8288105: [PPC64] Problems with -XX:+VerifyStack

Reviewed-by: goetz, mbaesken
This commit is contained in:
Martin Doerr 2022-06-13 14:42:49 +00:00
parent f4b05a1168
commit 7aafc69a96
4 changed files with 28 additions and 57 deletions

View file

@ -219,14 +219,6 @@ frame frame::sender_for_interpreter_frame(RegisterMap *map) const {
return frame(sender_sp(), sender_pc(), (intptr_t*)get_ijava_state()->sender_sp); return frame(sender_sp(), sender_pc(), (intptr_t*)get_ijava_state()->sender_sp);
} }
intptr_t* frame::compiled_sender_sp(CodeBlob* cb) const {
return sender_sp();
}
address* frame::compiled_sender_pc_addr(CodeBlob* cb) const {
return sender_pc_addr();
}
void frame::patch_pc(Thread* thread, address pc) { void frame::patch_pc(Thread* thread, address pc) {
assert(_cb == CodeCache::find_blob(pc), "unexpected pc"); assert(_cb == CodeCache::find_blob(pc), "unexpected pc");
address* pc_addr = (address*)&(own_abi()->lr); address* pc_addr = (address*)&(own_abi()->lr);
@ -402,17 +394,8 @@ intptr_t *frame::initial_deoptimization_info() {
#ifndef PRODUCT #ifndef PRODUCT
// This is a generic constructor which is only used by pns() in debug.cpp. // This is a generic constructor which is only used by pns() in debug.cpp.
frame::frame(void* sp, void* fp, void* pc) : _sp((intptr_t*)sp), // fp is dropped and gets determined by backlink.
_pc((address)pc), frame::frame(void* sp, void* fp, void* pc) : frame((intptr_t*)sp, (address)pc) {}
_cb(NULL),
_oop_map(NULL),
_on_heap(false),
DEBUG_ONLY(_frame_index(-1) COMMA)
_unextended_sp((intptr_t*)sp),
_fp(NULL) {
setup(); // also sets _fp and adjusts _unextended_sp
}
#endif #endif
// Pointer beyond the "oldest/deepest" BasicObjectLock on stack. // Pointer beyond the "oldest/deepest" BasicObjectLock on stack.

View file

@ -382,13 +382,9 @@
const ImmutableOopMap* get_oop_map() const; const ImmutableOopMap* get_oop_map() const;
// Constructors // Constructors
inline frame(intptr_t* sp, address pc); inline frame(intptr_t* sp, address pc, intptr_t* unextended_sp = nullptr, intptr_t* fp = nullptr, CodeBlob* cb = nullptr);
inline frame(intptr_t* sp, address pc, intptr_t* unextended_sp, intptr_t* fp = nullptr, CodeBlob* cb = nullptr);
private: private:
intptr_t* compiled_sender_sp(CodeBlob* cb) const;
address* compiled_sender_pc_addr(CodeBlob* cb) const;
address* sender_pc_addr(void) const; address* sender_pc_addr(void) const;
public: public:

View file

@ -33,9 +33,12 @@
// Inline functions for ppc64 frames: // Inline functions for ppc64 frames:
// Initialize frame members (_pc and _sp must be given) // Initialize frame members (_sp must be given)
inline void frame::setup() { inline void frame::setup() {
assert(_pc != nullptr, "precondition: must have PC"); if (_pc == nullptr) {
_pc = (address)own_abi()->lr;
assert(_pc != nullptr, "must have PC");
}
if (_cb == nullptr) { if (_cb == nullptr) {
_cb = CodeCache::find_blob(_pc); _cb = CodeCache::find_blob(_pc);
@ -45,6 +48,10 @@ inline void frame::setup() {
_fp = (intptr_t*)own_abi()->callers_sp; _fp = (intptr_t*)own_abi()->callers_sp;
} }
if (_unextended_sp == nullptr) {
_unextended_sp = _sp;
}
// When thawing continuation frames the _unextended_sp passed to the constructor is not aligend // When thawing continuation frames the _unextended_sp passed to the constructor is not aligend
assert(_on_heap || (is_aligned(_sp, alignment_in_bytes) && is_aligned(_fp, alignment_in_bytes)), assert(_on_heap || (is_aligned(_sp, alignment_in_bytes) && is_aligned(_fp, alignment_in_bytes)),
"invalid alignment sp:" PTR_FORMAT " unextended_sp:" PTR_FORMAT " fp:" PTR_FORMAT, p2i(_sp), p2i(_unextended_sp), p2i(_fp)); "invalid alignment sp:" PTR_FORMAT " unextended_sp:" PTR_FORMAT " fp:" PTR_FORMAT, p2i(_sp), p2i(_unextended_sp), p2i(_fp));
@ -68,28 +75,18 @@ inline void frame::setup() {
// Constructors // Constructors
// Initialize all fields, _unextended_sp will be adjusted in find_codeblob_and_set_pc_and_deopt_state. // Initialize all fields
inline frame::frame() : _sp(nullptr), _pc(nullptr), _cb(nullptr), _oop_map(nullptr), _deopt_state(unknown), inline frame::frame() : _sp(nullptr), _pc(nullptr), _cb(nullptr), _oop_map(nullptr), _deopt_state(unknown),
_on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(nullptr), _fp(nullptr) {} _on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(nullptr), _fp(nullptr) {}
inline frame::frame(intptr_t* sp)
: _sp(sp), _pc((address)own_abi()->lr), _cb(nullptr), _oop_map(nullptr),
_on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(sp), _fp(nullptr) {
setup();
}
inline frame::frame(intptr_t* sp, address pc)
: _sp(sp), _pc(pc), _cb(nullptr), _oop_map(nullptr),
_on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(sp), _fp(nullptr) {
setup();
}
inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp, intptr_t* fp, CodeBlob* cb) inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp, intptr_t* fp, CodeBlob* cb)
: _sp(sp), _pc(pc), _cb(nullptr), _oop_map(nullptr), : _sp(sp), _pc(pc), _cb(cb), _oop_map(nullptr),
_on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(unextended_sp), _fp(fp) { _on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(unextended_sp), _fp(fp) {
setup(); setup();
} }
inline frame::frame(intptr_t* sp) : frame(sp, nullptr) {}
// Accessors // Accessors
// Return unique id for this frame. The id must have a value where we // Return unique id for this frame. The id must have a value where we
@ -305,7 +302,7 @@ inline frame frame::sender_raw(RegisterMap* map) const {
if (is_interpreted_frame()) return sender_for_interpreter_frame(map); if (is_interpreted_frame()) return sender_for_interpreter_frame(map);
assert(_cb == CodeCache::find_blob(pc()),"Must be the same"); assert(_cb == CodeCache::find_blob(pc()),"Must be the same");
if (_cb != NULL) return sender_for_compiled_frame(map); if (_cb != nullptr) return sender_for_compiled_frame(map);
// Must be native-compiled frame, i.e. the marshaling code for native // Must be native-compiled frame, i.e. the marshaling code for native
// methods that exists in the core system. // methods that exists in the core system.
@ -313,24 +310,21 @@ inline frame frame::sender_raw(RegisterMap* map) const {
} }
inline frame frame::sender_for_compiled_frame(RegisterMap *map) const { inline frame frame::sender_for_compiled_frame(RegisterMap *map) const {
assert(map != NULL, "map must be set"); assert(map != nullptr, "map must be set");
// Frame owned by compiler. intptr_t* sender_sp = this->sender_sp();
address pc = *compiled_sender_pc_addr(_cb); address sender_pc = this->sender_pc();
frame caller(compiled_sender_sp(_cb), pc);
// Now adjust the map. // Now adjust the map.
// Get the rest.
if (map->update_map()) { if (map->update_map()) {
// Tell GC to use argument oopmaps for some runtime stubs that need it. // Tell GC to use argument oopmaps for some runtime stubs that need it.
map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread())); map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
if (_cb->oop_maps() != NULL) { if (_cb->oop_maps() != nullptr) {
OopMapSet::update_register_map(this, map); OopMapSet::update_register_map(this, map);
} }
} }
return caller; return frame(sender_sp, sender_pc);
} }
template <typename RegisterMapT> template <typename RegisterMapT>

View file

@ -2591,7 +2591,6 @@ void SharedRuntime::generate_deopt_blob() {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
__ BIND(exec_mode_initialized); __ BIND(exec_mode_initialized);
{
const Register unroll_block_reg = R22_tmp2; const Register unroll_block_reg = R22_tmp2;
// We need to set `last_Java_frame' because `fetch_unroll_info' will // We need to set `last_Java_frame' because `fetch_unroll_info' will
@ -2648,7 +2647,6 @@ void SharedRuntime::generate_deopt_blob() {
// stack: (skeletal interpreter frame, ..., optional skeletal // stack: (skeletal interpreter frame, ..., optional skeletal
// interpreter frame, optional c2i, caller of deoptee, ...). // interpreter frame, optional c2i, caller of deoptee, ...).
}
// push an `unpack_frame' taking care of float / int return values. // push an `unpack_frame' taking care of float / int return values.
__ push_frame(frame_size_in_bytes, R0/*tmp*/); __ push_frame(frame_size_in_bytes, R0/*tmp*/);
@ -2663,7 +2661,7 @@ void SharedRuntime::generate_deopt_blob() {
// Let the unpacker layout information in the skeletal frames just // Let the unpacker layout information in the skeletal frames just
// allocated. // allocated.
__ get_PC_trash_LR(R3_RET); __ calculate_address_from_global_toc(R3_RET, calls_return_pc, true, true, true, true);
__ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R3_RET); __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R3_RET);
// This is a call to a LEAF method, so no oop map is required. // This is a call to a LEAF method, so no oop map is required.
__ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames), __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames),
@ -2715,6 +2713,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
Register unroll_block_reg = R21_tmp1; Register unroll_block_reg = R21_tmp1;
Register klass_index_reg = R22_tmp2; Register klass_index_reg = R22_tmp2;
Register unc_trap_reg = R23_tmp3; Register unc_trap_reg = R23_tmp3;
Register r_return_pc = R27_tmp7;
OopMapSet* oop_maps = new OopMapSet(); OopMapSet* oop_maps = new OopMapSet();
int frame_size_in_bytes = frame::abi_reg_args_size; int frame_size_in_bytes = frame::abi_reg_args_size;
@ -2739,9 +2738,9 @@ void SharedRuntime::generate_uncommon_trap_blob() {
// sender frame as the deoptee frame. // sender frame as the deoptee frame.
// Remember the offset of the instruction whose address will be // Remember the offset of the instruction whose address will be
// moved to R11_scratch1. // moved to R11_scratch1.
address gc_map_pc = __ get_PC_trash_LR(R11_scratch1); address gc_map_pc = __ pc();
__ calculate_address_from_global_toc(r_return_pc, gc_map_pc, true, true, true, true);
__ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1); __ set_last_Java_frame(/*sp*/R1_SP, r_return_pc);
__ mr(klass_index_reg, R3); __ mr(klass_index_reg, R3);
__ li(R5_ARG3, Deoptimization::Unpack_uncommon_trap); __ li(R5_ARG3, Deoptimization::Unpack_uncommon_trap);
@ -2797,8 +2796,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
// ...). // ...).
// Set the "unpack_frame" as last_Java_frame. // Set the "unpack_frame" as last_Java_frame.
__ get_PC_trash_LR(R11_scratch1); __ set_last_Java_frame(/*sp*/R1_SP, r_return_pc);
__ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1);
// Indicate it is the uncommon trap case. // Indicate it is the uncommon trap case.
__ li(unc_trap_reg, Deoptimization::Unpack_uncommon_trap); __ li(unc_trap_reg, Deoptimization::Unpack_uncommon_trap);