Skip to content

Commit

Permalink
8286302: Port JEP 425 to PPC64
Browse files Browse the repository at this point in the history
Reviewed-by: tsteele, mdoerr
  • Loading branch information
reinrich committed Nov 28, 2022
1 parent d610211 commit 43d1173
Show file tree
Hide file tree
Showing 66 changed files with 3,455 additions and 408 deletions.
32 changes: 32 additions & 0 deletions src/hotspot/cpu/aarch64/continuationEntry_aarch64.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2022 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/

#ifndef CPU_AARCH64_CONTINUATIONENTRY_AARCH64_HPP
#define CPU_AARCH64_CONTINUATIONENTRY_AARCH64_HPP

class ContinuationEntryPD {
// empty
};

#endif // CPU_AARCH64_CONTINUATIONENTRY_AARCH64_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ void ThawBase::patch_chunk_pd(intptr_t* sp) {
*(intptr_t**)(sp - frame::sender_sp_offset) = fp;
}

template <typename ConfigT>
inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
// Fast path depends on !PreserveFramePointer. See can_thaw_fast().
assert(!PreserveFramePointer, "Frame pointers need to be fixed");
}

// Slow path

inline frame ThawBase::new_entry_frame() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ inline address* ContinuationHelper::InterpretedFrame::return_pc_address(const fr
return (address*)(f.fp() + frame::return_addr_offset);
}

inline void ContinuationHelper::InterpretedFrame::patch_sender_sp(frame& f, intptr_t* sp) {
inline void ContinuationHelper::InterpretedFrame::patch_sender_sp(frame& f, const frame& caller) {
intptr_t* sp = caller.unextended_sp();
assert(f.is_interpreted_frame(), "");
intptr_t* la = f.addr_at(frame::interpreter_frame_sender_sp_offset);
*la = f.is_heap_frame() ? (intptr_t)(sp - f.fp()) : (intptr_t)sp;
Expand Down Expand Up @@ -137,4 +138,8 @@ inline intptr_t* ContinuationHelper::InterpretedFrame::frame_top(const frame& f,
return f.unextended_sp() + (callee_interpreted ? callee_argsize : 0);
}

inline intptr_t* ContinuationHelper::InterpretedFrame::callers_sp(const frame& f) {
return f.fp() + frame::metadata_words;
}

#endif // CPU_AARCH64_CONTINUATIONHELPER_AARCH64_INLINE_HPP
7 changes: 7 additions & 0 deletions src/hotspot/cpu/aarch64/frame_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@

// size, in words, of frame metadata (e.g. pc and link)
metadata_words = sender_sp_offset,
// size, in words, of metadata at frame bottom, i.e. it is not part of the
// caller/callee overlap
metadata_words_at_bottom = metadata_words,
// size, in words, of frame metadata at the frame top, i.e. it is located
// between a callee frame and its stack arguments, where it is part
// of the caller/callee overlap
metadata_words_at_top = 0,
// in bytes
frame_alignment = 16,
// size, in words, of maximum shift in frame position due to alignment
Expand Down
32 changes: 32 additions & 0 deletions src/hotspot/cpu/arm/continuationEntry_arm.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2022 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/

#ifndef CPU_ARM_CONTINUATIONENTRY_ARM_HPP
#define CPU_ARM_CONTINUATIONENTRY_ARM_HPP

class ContinuationEntryPD {
// empty
};

#endif // CPU_ARM_CONTINUATIONENTRY_ARM_HPP
5 changes: 5 additions & 0 deletions src/hotspot/cpu/arm/continuationFreezeThaw_arm.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ void ThawBase::patch_chunk_pd(intptr_t* sp) {
Unimplemented();
}

template <typename ConfigT>
inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
Unimplemented();
}

inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
Unimplemented();
}
Expand Down
7 changes: 6 additions & 1 deletion src/hotspot/cpu/arm/continuationHelper_arm.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ inline address* ContinuationHelper::InterpretedFrame::return_pc_address(const fr
return NULL;
}

inline void ContinuationHelper::InterpretedFrame::patch_sender_sp(frame& f, intptr_t* sp) {
inline void ContinuationHelper::InterpretedFrame::patch_sender_sp(frame& f, const frame& caller) {
Unimplemented();
}

Expand Down Expand Up @@ -122,4 +122,9 @@ inline intptr_t* ContinuationHelper::InterpretedFrame::frame_top(const frame& f,
return NULL;
}

inline intptr_t* ContinuationHelper::InterpretedFrame::callers_sp(const frame& f) {
Unimplemented();
return NULL;
}

#endif // CPU_ARM_CONTINUATIONHELPER_ARM_INLINE_HPP
7 changes: 7 additions & 0 deletions src/hotspot/cpu/arm/frame_arm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
// Entry frames
entry_frame_call_wrapper_offset = 0,
metadata_words = sender_sp_offset,
// size, in words, of metadata at frame bottom, i.e. it is not part of the
// caller/callee overlap
metadata_words_at_bottom = metadata_words,
// size, in words, of frame metadata at the frame top, i.e. it is located
// between a callee frame and its stack arguments, where it is part
// of the caller/callee overlap
metadata_words_at_top = 0,
frame_alignment = 16,
// size, in words, of maximum shift in frame position due to alignment
align_wiggle = 1
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/ppc/assembler_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ class Argument {
// in a register. This is not documented, but we follow this convention, too.
n_regs_not_on_stack_c = 8,

n_int_register_parameters_j = 8,
n_float_register_parameters_j = 13
n_int_register_parameters_j = 8, // duplicates num_java_iarg_registers
n_float_register_parameters_j = 13, // num_java_farg_registers
};
// creation
Argument(int number) : _number(number) {}
Expand Down Expand Up @@ -1372,7 +1372,7 @@ class Assembler : public AbstractAssembler {

// Issue an illegal instruction.
inline void illtrap();
static inline bool is_illtrap(int x);
static inline bool is_illtrap(address instr_addr);

// PPC 1, section 3.3.8, Fixed-Point Arithmetic Instructions
inline void addi( Register d, Register a, int si16);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/assembler_ppc.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ inline address Assembler::emit_fd(address entry, address toc, address env) {

// Issue an illegal instruction. 0 is guaranteed to be an illegal instruction.
inline void Assembler::illtrap() { Assembler::emit_int32(0); }
inline bool Assembler::is_illtrap(int x) { return x == 0; }
inline bool Assembler::is_illtrap(address instr_addr) { return *(uint32_t*)instr_addr == 0u; }

// PPC 1, section 3.3.8, Fixed-Point Arithmetic Instructions
inline void Assembler::addi( Register d, Register a, int si16) { assert(a != R0, "r0 not allowed"); addi_r0ok( d, a, si16); }
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ void LIR_Assembler::call(LIR_OpJavaCall* op, relocInfo::relocType rtype) {
__ code()->set_insts_mark();
__ bl(__ pc());
add_call_info(code_offset(), op->info());
__ post_call_nop();
}


Expand Down Expand Up @@ -692,6 +693,7 @@ void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
// serves as dummy and the bl will be patched later.
__ bl(__ pc());
add_call_info(code_offset(), op->info());
__ post_call_nop();
}

void LIR_Assembler::explicit_null_check(Register addr, CodeEmitInfo* info) {
Expand Down Expand Up @@ -2876,13 +2878,15 @@ void LIR_Assembler::rt_call(LIR_Opr result, address dest,
__ bctrl();
assert(info != NULL, "sanity");
add_call_info_here(info);
__ post_call_nop();
return;
}

__ call_c_with_frame_resize(dest, /*no resizing*/ 0);
if (info != NULL) {
add_call_info_here(info);
}
__ post_call_nop();
}


Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
bne(CCR0, slow_int);

bind(done);

inc_held_monitor_count(Rmark /*tmp*/);
}


Expand All @@ -160,7 +162,7 @@ void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rb
Address mark_addr(Roop, oopDesc::mark_offset_in_bytes());
assert(mark_addr.disp() == 0, "cas must take a zero displacement");

// Test first it it is a fast recursive unlock.
// Test first if it is a fast recursive unlock.
ld(Rmark, BasicLock::displaced_header_offset_in_bytes(), Rbox);
cmpdi(CCR0, Rmark, 0);
beq(CCR0, done);
Expand All @@ -186,6 +188,8 @@ void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rb

// Done
bind(done);

dec_held_monitor_count(Rmark /*tmp*/);
}


Expand Down
35 changes: 35 additions & 0 deletions src/hotspot/cpu/ppc/continuationEntry_ppc.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2022 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/

#ifndef CPU_PPC_CONTINUATIONENTRY_PPC_HPP
#define CPU_PPC_CONTINUATIONENTRY_PPC_HPP

#include "runtime/frame.hpp"

class ContinuationEntryPD {
// This is needed to position the ContinuationEntry at the unextended sp of the entry frame
frame::abi_reg_args _abi;
};

#endif // CPU_PPC_CONTINUATIONENTRY_PPC_HPP
16 changes: 10 additions & 6 deletions src/hotspot/cpu/ppc/continuationEntry_ppc.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,24 @@

#include "runtime/continuationEntry.hpp"

// TODO: Implement
#include "oops/method.inline.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/registerMap.hpp"
#include "utilities/macros.hpp"

inline frame ContinuationEntry::to_frame() const {
Unimplemented();
return frame();
static CodeBlob* cb = CodeCache::find_blob_fast(entry_pc());
assert(cb != nullptr, "");
assert(cb->as_compiled_method()->method()->is_continuation_enter_intrinsic(), "");
return frame(entry_sp(), entry_pc(), entry_sp(), entry_fp(), cb);
}

inline intptr_t* ContinuationEntry::entry_fp() const {
Unimplemented();
return nullptr;
return (intptr_t*)((address)this + size());
}

inline void ContinuationEntry::update_register_map(RegisterMap* map) const {
Unimplemented();
// Nothing to do (no non-volatile registers in java calling convention)
}

#endif // CPU_PPC_CONTINUATIONENTRY_PPC_INLINE_HPP
Loading

1 comment on commit 43d1173

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.