8315069: Relativize extended_sp in interpreter frames
Reviewed-by: haosun, aph, fyang
This commit is contained in:
parent
c2e01eba5a
commit
033f311abc
@ -153,11 +153,14 @@ inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, co
|
||||
assert((intptr_t*)hf.at_relative(frame::interpreter_frame_last_sp_offset) == hf.unextended_sp(), "");
|
||||
|
||||
relativize_one(vfp, hfp, frame::interpreter_frame_initial_sp_offset); // == block_top == block_bottom
|
||||
relativize_one(vfp, hfp, frame::interpreter_frame_extended_sp_offset);
|
||||
|
||||
// extended_sp is already relativized by TemplateInterpreterGenerator::generate_normal_entry or
|
||||
// AbstractInterpreter::layout_activation
|
||||
|
||||
assert((hf.fp() - hf.unextended_sp()) == (f.fp() - f.unextended_sp()), "");
|
||||
assert(hf.unextended_sp() == (intptr_t*)hf.at(frame::interpreter_frame_last_sp_offset), "");
|
||||
assert(hf.unextended_sp() <= (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
|
||||
assert(hf.unextended_sp() > (intptr_t*)hf.at(frame::interpreter_frame_extended_sp_offset), "");
|
||||
assert(hf.fp() > (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
|
||||
assert(hf.fp() <= (intptr_t*)hf.at(frame::interpreter_frame_locals_offset), "");
|
||||
}
|
||||
@ -294,7 +297,9 @@ inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, c
|
||||
assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
|
||||
|
||||
derelativize_one(vfp, frame::interpreter_frame_initial_sp_offset);
|
||||
derelativize_one(vfp, frame::interpreter_frame_extended_sp_offset);
|
||||
|
||||
// Make sure that extended_sp is kept relativized.
|
||||
assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp(), "");
|
||||
}
|
||||
|
||||
#endif // CPU_AARCH64_CONTINUATIONFREEZETHAW_AARCH64_INLINE_HPP
|
||||
|
@ -362,7 +362,9 @@ void frame::interpreter_frame_set_last_sp(intptr_t* sp) {
|
||||
|
||||
// Used by template based interpreter deoptimization
|
||||
void frame::interpreter_frame_set_extended_sp(intptr_t* sp) {
|
||||
*((intptr_t**)addr_at(interpreter_frame_extended_sp_offset)) = sp;
|
||||
assert(is_interpreted_frame(), "interpreted frame expected");
|
||||
// set relativized extended_sp
|
||||
ptr_at_put(interpreter_frame_extended_sp_offset, (sp - fp()));
|
||||
}
|
||||
|
||||
frame frame::sender_for_entry_frame(RegisterMap* map) const {
|
||||
|
@ -86,6 +86,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
||||
void restore_sp_after_call() {
|
||||
Label L;
|
||||
ldr(rscratch1, Address(rfp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
lea(rscratch1, Address(rfp, rscratch1, Address::lsl(LogBytesPerWord)));
|
||||
#ifdef ASSERT
|
||||
cbnz(rscratch1, L);
|
||||
stop("SP is null");
|
||||
@ -98,6 +99,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
||||
#ifdef ASSERT
|
||||
Label L;
|
||||
ldr(rscratch1, Address(rfp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
lea(rscratch1, Address(rfp, rscratch1, Address::lsl(LogBytesPerWord)));
|
||||
cmp(sp, rscratch1);
|
||||
br(EQ, L);
|
||||
stop(msg);
|
||||
|
@ -812,7 +812,8 @@ void TemplateInterpreterGenerator::lock_method() {
|
||||
__ check_extended_sp();
|
||||
__ sub(sp, sp, entry_size); // add space for a monitor entry
|
||||
__ sub(esp, esp, entry_size);
|
||||
__ mov(rscratch1, sp);
|
||||
__ sub(rscratch1, sp, rfp);
|
||||
__ asr(rscratch1, rscratch1, Interpreter::logStackElementSize);
|
||||
__ str(rscratch1, Address(rfp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
__ str(esp, monitor_block_top); // set new monitor block top
|
||||
// store object
|
||||
@ -880,15 +881,19 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
|
||||
__ add(rscratch1, rscratch1, MAX2(3, Method::extra_stack_entries()));
|
||||
__ sub(rscratch1, sp, rscratch1, ext::uxtw, 3);
|
||||
__ andr(rscratch1, rscratch1, -16);
|
||||
__ sub(rscratch2, rscratch1, rfp);
|
||||
__ asr(rscratch2, rscratch2, Interpreter::logStackElementSize);
|
||||
// Store extended SP and mirror
|
||||
__ stp(r10, rscratch1, Address(sp, 4 * wordSize));
|
||||
__ stp(r10, rscratch2, Address(sp, 4 * wordSize));
|
||||
// Move SP out of the way
|
||||
__ mov(sp, rscratch1);
|
||||
} else {
|
||||
// Make sure there is room for the exception oop pushed in case method throws
|
||||
// an exception (see TemplateInterpreterGenerator::generate_throw_exception())
|
||||
__ sub(rscratch1, sp, 2 * wordSize);
|
||||
__ stp(r10, rscratch1, Address(sp, 4 * wordSize));
|
||||
__ sub(rscratch2, rscratch1, rfp);
|
||||
__ asr(rscratch2, rscratch2, Interpreter::logStackElementSize);
|
||||
__ stp(r10, rscratch2, Address(sp, 4 * wordSize));
|
||||
__ mov(sp, rscratch1);
|
||||
}
|
||||
}
|
||||
|
@ -3910,7 +3910,8 @@ void TemplateTable::monitorenter()
|
||||
|
||||
__ check_extended_sp();
|
||||
__ sub(sp, sp, entry_size); // make room for the monitor
|
||||
__ mov(rscratch1, sp);
|
||||
__ sub(rscratch1, sp, rfp);
|
||||
__ asr(rscratch1, rscratch1, Interpreter::logStackElementSize);
|
||||
__ str(rscratch1, Address(rfp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
|
||||
__ ldr(c_rarg1, monitor_block_bot); // c_rarg1: old expression stack bottom
|
||||
|
@ -151,11 +151,14 @@ inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, co
|
||||
assert((intptr_t*)hf.at_relative(frame::interpreter_frame_last_sp_offset) == hf.unextended_sp(), "");
|
||||
|
||||
relativize_one(vfp, hfp, frame::interpreter_frame_initial_sp_offset); // == block_top == block_bottom
|
||||
relativize_one(vfp, hfp, frame::interpreter_frame_extended_sp_offset);
|
||||
|
||||
// extended_sp is already relativized by TemplateInterpreterGenerator::generate_normal_entry or
|
||||
// AbstractInterpreter::layout_activation
|
||||
|
||||
assert((hf.fp() - hf.unextended_sp()) == (f.fp() - f.unextended_sp()), "");
|
||||
assert(hf.unextended_sp() == (intptr_t*)hf.at(frame::interpreter_frame_last_sp_offset), "");
|
||||
assert(hf.unextended_sp() <= (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
|
||||
assert(hf.unextended_sp() > (intptr_t*)hf.at(frame::interpreter_frame_extended_sp_offset), "");
|
||||
assert(hf.fp() > (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
|
||||
#ifdef ASSERT
|
||||
if (f.interpreter_frame_method()->max_locals() > 0) {
|
||||
@ -296,7 +299,9 @@ inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, c
|
||||
assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
|
||||
|
||||
derelativize_one(vfp, frame::interpreter_frame_initial_sp_offset);
|
||||
derelativize_one(vfp, frame::interpreter_frame_extended_sp_offset);
|
||||
|
||||
// Make sure that extended_sp is kept relativized.
|
||||
assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp(), "");
|
||||
}
|
||||
|
||||
#endif // CPU_RISCV_CONTINUATIONFREEZETHAW_RISCV_INLINE_HPP
|
||||
|
@ -337,7 +337,9 @@ void frame::interpreter_frame_set_last_sp(intptr_t* last_sp) {
|
||||
}
|
||||
|
||||
void frame::interpreter_frame_set_extended_sp(intptr_t* sp) {
|
||||
*((intptr_t**)addr_at(interpreter_frame_extended_sp_offset)) = sp;
|
||||
assert(is_interpreted_frame(), "interpreted frame expected");
|
||||
// set relativized extended_sp
|
||||
ptr_at_put(interpreter_frame_extended_sp_offset, (sp - fp()));
|
||||
}
|
||||
|
||||
frame frame::sender_for_entry_frame(RegisterMap* map) const {
|
||||
|
@ -85,6 +85,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
||||
void restore_sp_after_call() {
|
||||
Label L;
|
||||
ld(t0, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
shadd(t0, t0, fp, t0, LogBytesPerWord);
|
||||
#ifdef ASSERT
|
||||
bnez(t0, L);
|
||||
stop("SP is null");
|
||||
@ -97,6 +98,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
||||
#ifdef ASSERT
|
||||
Label L;
|
||||
ld(t0, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
shadd(t0, t0, fp, t0, LogBytesPerWord);
|
||||
beq(sp, t0, L);
|
||||
stop(msg);
|
||||
bind(L);
|
||||
|
@ -710,7 +710,9 @@ void TemplateInterpreterGenerator::lock_method() {
|
||||
__ check_extended_sp();
|
||||
__ add(sp, sp, - entry_size); // add space for a monitor entry
|
||||
__ add(esp, esp, - entry_size);
|
||||
__ sd(sp, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
__ sub(t0, sp, fp);
|
||||
__ srai(t0, t0, Interpreter::logStackElementSize);
|
||||
__ sd(t0, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
__ sd(esp, monitor_block_top); // set new monitor block top
|
||||
// store object
|
||||
__ sd(x10, Address(esp, BasicObjectLock::obj_offset()));
|
||||
@ -785,15 +787,19 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
|
||||
__ slli(t0, t0, 3);
|
||||
__ sub(t0, sp, t0);
|
||||
__ andi(t0, t0, -16);
|
||||
__ sub(t1, t0, fp);
|
||||
__ srai(t1, t1, Interpreter::logStackElementSize);
|
||||
// Store extended SP
|
||||
__ sd(t0, Address(sp, 5 * wordSize));
|
||||
__ sd(t1, Address(sp, 5 * wordSize));
|
||||
// Move SP out of the way
|
||||
__ mv(sp, t0);
|
||||
} else {
|
||||
// Make sure there is room for the exception oop pushed in case method throws
|
||||
// an exception (see TemplateInterpreterGenerator::generate_throw_exception())
|
||||
__ sub(t0, sp, 2 * wordSize);
|
||||
__ sd(t0, Address(sp, 5 * wordSize));
|
||||
__ sub(t1, t0, fp);
|
||||
__ srai(t1, t1, Interpreter::logStackElementSize);
|
||||
__ sd(t1, Address(sp, 5 * wordSize));
|
||||
__ mv(sp, t0);
|
||||
}
|
||||
}
|
||||
|
@ -3844,7 +3844,9 @@ void TemplateTable::monitorenter() {
|
||||
|
||||
__ check_extended_sp();
|
||||
__ sub(sp, sp, entry_size); // make room for the monitor
|
||||
__ sd(sp, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
__ sub(t0, sp, fp);
|
||||
__ srai(t0, t0, Interpreter::logStackElementSize);
|
||||
__ sd(t0, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize));
|
||||
|
||||
__ ld(c_rarg1, monitor_block_bot); // c_rarg1: old expression stack bottom
|
||||
__ sub(esp, esp, entry_size); // move expression stack top
|
||||
|
Loading…
Reference in New Issue
Block a user