Skip to content

Commit 7aafc69

Browse files
committedJun 13, 2022
8288105: [PPC64] Problems with -XX:+VerifyStack
Reviewed-by: goetz, mbaesken
1 parent f4b05a1 commit 7aafc69

File tree

4 files changed

+28
-57
lines changed

4 files changed

+28
-57
lines changed
 

‎src/hotspot/cpu/ppc/frame_ppc.cpp

+2-19
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,6 @@ frame frame::sender_for_interpreter_frame(RegisterMap *map) const {
219219
return frame(sender_sp(), sender_pc(), (intptr_t*)get_ijava_state()->sender_sp);
220220
}
221221

222-
intptr_t* frame::compiled_sender_sp(CodeBlob* cb) const {
223-
return sender_sp();
224-
}
225-
226-
address* frame::compiled_sender_pc_addr(CodeBlob* cb) const {
227-
return sender_pc_addr();
228-
}
229-
230222
void frame::patch_pc(Thread* thread, address pc) {
231223
assert(_cb == CodeCache::find_blob(pc), "unexpected pc");
232224
address* pc_addr = (address*)&(own_abi()->lr);
@@ -402,17 +394,8 @@ intptr_t *frame::initial_deoptimization_info() {
402394

403395
#ifndef PRODUCT
404396
// This is a generic constructor which is only used by pns() in debug.cpp.
405-
frame::frame(void* sp, void* fp, void* pc) : _sp((intptr_t*)sp),
406-
_pc((address)pc),
407-
_cb(NULL),
408-
_oop_map(NULL),
409-
_on_heap(false),
410-
DEBUG_ONLY(_frame_index(-1) COMMA)
411-
_unextended_sp((intptr_t*)sp),
412-
_fp(NULL) {
413-
setup(); // also sets _fp and adjusts _unextended_sp
414-
}
415-
397+
// fp is dropped and gets determined by backlink.
398+
frame::frame(void* sp, void* fp, void* pc) : frame((intptr_t*)sp, (address)pc) {}
416399
#endif
417400

418401
// Pointer beyond the "oldest/deepest" BasicObjectLock on stack.

‎src/hotspot/cpu/ppc/frame_ppc.hpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,9 @@
382382
const ImmutableOopMap* get_oop_map() const;
383383

384384
// Constructors
385-
inline frame(intptr_t* sp, address pc);
386-
inline frame(intptr_t* sp, address pc, intptr_t* unextended_sp, intptr_t* fp = nullptr, CodeBlob* cb = nullptr);
385+
inline frame(intptr_t* sp, address pc, intptr_t* unextended_sp = nullptr, intptr_t* fp = nullptr, CodeBlob* cb = nullptr);
387386

388387
private:
389-
390-
intptr_t* compiled_sender_sp(CodeBlob* cb) const;
391-
address* compiled_sender_pc_addr(CodeBlob* cb) const;
392388
address* sender_pc_addr(void) const;
393389

394390
public:

‎src/hotspot/cpu/ppc/frame_ppc.inline.hpp

+19-25
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@
3333

3434
// Inline functions for ppc64 frames:
3535

36-
// Initialize frame members (_pc and _sp must be given)
36+
// Initialize frame members (_sp must be given)
3737
inline void frame::setup() {
38-
assert(_pc != nullptr, "precondition: must have PC");
38+
if (_pc == nullptr) {
39+
_pc = (address)own_abi()->lr;
40+
assert(_pc != nullptr, "must have PC");
41+
}
3942

4043
if (_cb == nullptr) {
4144
_cb = CodeCache::find_blob(_pc);
@@ -45,6 +48,10 @@ inline void frame::setup() {
4548
_fp = (intptr_t*)own_abi()->callers_sp;
4649
}
4750

51+
if (_unextended_sp == nullptr) {
52+
_unextended_sp = _sp;
53+
}
54+
4855
// When thawing continuation frames the _unextended_sp passed to the constructor is not aligend
4956
assert(_on_heap || (is_aligned(_sp, alignment_in_bytes) && is_aligned(_fp, alignment_in_bytes)),
5057
"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() {
6875

6976
// Constructors
7077

71-
// Initialize all fields, _unextended_sp will be adjusted in find_codeblob_and_set_pc_and_deopt_state.
78+
// Initialize all fields
7279
inline frame::frame() : _sp(nullptr), _pc(nullptr), _cb(nullptr), _oop_map(nullptr), _deopt_state(unknown),
7380
_on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(nullptr), _fp(nullptr) {}
7481

75-
inline frame::frame(intptr_t* sp)
76-
: _sp(sp), _pc((address)own_abi()->lr), _cb(nullptr), _oop_map(nullptr),
77-
_on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(sp), _fp(nullptr) {
78-
setup();
79-
}
80-
81-
inline frame::frame(intptr_t* sp, address pc)
82-
: _sp(sp), _pc(pc), _cb(nullptr), _oop_map(nullptr),
83-
_on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(sp), _fp(nullptr) {
84-
setup();
85-
}
86-
8782
inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp, intptr_t* fp, CodeBlob* cb)
88-
: _sp(sp), _pc(pc), _cb(nullptr), _oop_map(nullptr),
83+
: _sp(sp), _pc(pc), _cb(cb), _oop_map(nullptr),
8984
_on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(unextended_sp), _fp(fp) {
9085
setup();
9186
}
9287

88+
inline frame::frame(intptr_t* sp) : frame(sp, nullptr) {}
89+
9390
// Accessors
9491

9592
// Return unique id for this frame. The id must have a value where we
@@ -305,32 +302,29 @@ inline frame frame::sender_raw(RegisterMap* map) const {
305302
if (is_interpreted_frame()) return sender_for_interpreter_frame(map);
306303
assert(_cb == CodeCache::find_blob(pc()),"Must be the same");
307304

308-
if (_cb != NULL) return sender_for_compiled_frame(map);
305+
if (_cb != nullptr) return sender_for_compiled_frame(map);
309306

310307
// Must be native-compiled frame, i.e. the marshaling code for native
311308
// methods that exists in the core system.
312309
return frame(sender_sp(), sender_pc());
313310
}
314311

315312
inline frame frame::sender_for_compiled_frame(RegisterMap *map) const {
316-
assert(map != NULL, "map must be set");
313+
assert(map != nullptr, "map must be set");
317314

318-
// Frame owned by compiler.
319-
address pc = *compiled_sender_pc_addr(_cb);
320-
frame caller(compiled_sender_sp(_cb), pc);
315+
intptr_t* sender_sp = this->sender_sp();
316+
address sender_pc = this->sender_pc();
321317

322318
// Now adjust the map.
323-
324-
// Get the rest.
325319
if (map->update_map()) {
326320
// Tell GC to use argument oopmaps for some runtime stubs that need it.
327321
map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
328-
if (_cb->oop_maps() != NULL) {
322+
if (_cb->oop_maps() != nullptr) {
329323
OopMapSet::update_register_map(this, map);
330324
}
331325
}
332326

333-
return caller;
327+
return frame(sender_sp, sender_pc);
334328
}
335329

336330
template <typename RegisterMapT>

‎src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -2591,7 +2591,6 @@ void SharedRuntime::generate_deopt_blob() {
25912591
// --------------------------------------------------------------------------
25922592
__ BIND(exec_mode_initialized);
25932593

2594-
{
25952594
const Register unroll_block_reg = R22_tmp2;
25962595

25972596
// We need to set `last_Java_frame' because `fetch_unroll_info' will
@@ -2648,7 +2647,6 @@ void SharedRuntime::generate_deopt_blob() {
26482647

26492648
// stack: (skeletal interpreter frame, ..., optional skeletal
26502649
// interpreter frame, optional c2i, caller of deoptee, ...).
2651-
}
26522650

26532651
// push an `unpack_frame' taking care of float / int return values.
26542652
__ push_frame(frame_size_in_bytes, R0/*tmp*/);
@@ -2663,7 +2661,7 @@ void SharedRuntime::generate_deopt_blob() {
26632661

26642662
// Let the unpacker layout information in the skeletal frames just
26652663
// allocated.
2666-
__ get_PC_trash_LR(R3_RET);
2664+
__ calculate_address_from_global_toc(R3_RET, calls_return_pc, true, true, true, true);
26672665
__ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R3_RET);
26682666
// This is a call to a LEAF method, so no oop map is required.
26692667
__ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames),
@@ -2715,6 +2713,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
27152713
Register unroll_block_reg = R21_tmp1;
27162714
Register klass_index_reg = R22_tmp2;
27172715
Register unc_trap_reg = R23_tmp3;
2716+
Register r_return_pc = R27_tmp7;
27182717

27192718
OopMapSet* oop_maps = new OopMapSet();
27202719
int frame_size_in_bytes = frame::abi_reg_args_size;
@@ -2739,9 +2738,9 @@ void SharedRuntime::generate_uncommon_trap_blob() {
27392738
// sender frame as the deoptee frame.
27402739
// Remember the offset of the instruction whose address will be
27412740
// moved to R11_scratch1.
2742-
address gc_map_pc = __ get_PC_trash_LR(R11_scratch1);
2743-
2744-
__ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1);
2741+
address gc_map_pc = __ pc();
2742+
__ calculate_address_from_global_toc(r_return_pc, gc_map_pc, true, true, true, true);
2743+
__ set_last_Java_frame(/*sp*/R1_SP, r_return_pc);
27452744

27462745
__ mr(klass_index_reg, R3);
27472746
__ li(R5_ARG3, Deoptimization::Unpack_uncommon_trap);
@@ -2797,8 +2796,7 @@ void SharedRuntime::generate_uncommon_trap_blob() {
27972796
// ...).
27982797

27992798
// Set the "unpack_frame" as last_Java_frame.
2800-
__ get_PC_trash_LR(R11_scratch1);
2801-
__ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1);
2799+
__ set_last_Java_frame(/*sp*/R1_SP, r_return_pc);
28022800

28032801
// Indicate it is the uncommon trap case.
28042802
__ li(unc_trap_reg, Deoptimization::Unpack_uncommon_trap);

0 commit comments

Comments
 (0)
Please sign in to comment.