[aarch64-port-dev ] Fix JCK failure in JVMTI popframe support
Andrew Haley
aph at redhat.com
Wed Mar 5 09:45:17 PST 2014
Our JVMTI popframe support wasn't quite right. The wrong register was
used for the bytecode pointer and
InterpreterRuntime::popframe_move_outgoing_args(), which is needed by
x86 but breaks things for us, was called.
Also, I nioticed that when restarting a returned-to method we weren't
setting the machine SP.
Fixed thusly.
Andrew.
# HG changeset patch
# User aph
# Date 1394038301 0
# Wed Mar 05 16:51:41 2014 +0000
# Node ID cc094e1af98de679e81d17d3fc2653158c7b26c6
# Parent 623e2e5f003a4a17e897aa251f8d49e4234193c0
Fix JCK failure in JVMTI popframe support
diff -r 623e2e5f003a -r cc094e1af98d src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp Mon Mar 03 15:38:07 2014 +0000
+++ b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp Wed Mar 05 16:51:41 2014 +0000
@@ -1579,10 +1579,6 @@
// empty. Thus, for any VM calls at this point, GC will find a legal
// oop map (with empty expression stack).
- // In current activation
- // tos: exception
- // esi: exception bcp
-
//
// JVMTI PopFrame support
//
@@ -1614,8 +1610,6 @@
InterpreterRuntime::interpreter_contains), c_rarg1);
__ cbnz(r0, caller_not_deoptimized);
- __ call_Unimplemented();
-
// Compute size of arguments for saving when returning to
// deoptimized caller
__ get_method(r0);
@@ -1653,30 +1647,12 @@
/* install_monitor_exception */ false,
/* notify_jvmdi */ false);
- // Finish with popframe handling
- // A previous I2C followed by a deoptimization might have moved the
- // outgoing arguments further up the stack. PopFrame expects the
- // mutations to those outgoing arguments to be preserved and other
- // constraints basically require this frame to look exactly as
- // though it had previously invoked an interpreted activation with
- // no space between the top of the expression stack (current
- // last_sp) and the top of stack. Rather than force deopt to
- // maintain this kind of invariant all the time we call a small
- // fixup routine to move the mutated arguments onto the top of our
- // expression stack if necessary.
- __ mov(c_rarg1, sp);
- __ ldr(c_rarg2, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
- // PC must point into interpreter here
- __ set_last_Java_frame(noreg, rfp, (address)NULL, rscratch1);
- __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::popframe_move_outgoing_args), rthread, c_rarg1, c_rarg2);
- __ reset_last_Java_frame(true, true);
// Restore the last_sp and null it out
- __ ldr(rscratch1, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
- __ mov(esp, rscratch1);
+ __ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
__ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
- __ restore_bcp(); // XXX do we need this?
- __ restore_locals(); // XXX do we need this?
+ __ restore_bcp();
+ __ restore_locals();
__ restore_constant_pool_cache();
__ get_method(rmethod);
@@ -1694,7 +1670,7 @@
if (EnableInvokeDynamic) {
Label L_done;
- __ ldrb(rscratch1, Address(r13, 0));
+ __ ldrb(rscratch1, Address(rbcp, 0));
__ cmpw(r1, Bytecodes::_invokestatic);
__ br(Assembler::EQ, L_done);
@@ -1702,7 +1678,7 @@
// Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL.
__ ldr(c_rarg0, Address(rlocals, 0));
- __ call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), c_rarg0, rmethod, rscratch1);
+ __ call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), c_rarg0, rmethod, rbcp);
__ cbz(r0, L_done);
@@ -1711,6 +1687,16 @@
}
#endif // INCLUDE_JVMTI
+ // Restore machine SP
+ __ ldr(rscratch1, Address(rmethod, Method::const_offset()));
+ __ ldrh(rscratch1, Address(rscratch1, ConstMethod::max_stack_offset()));
+ __ add(rscratch1, rscratch1, frame::interpreter_frame_monitor_size()
+ + (EnableInvokeDynamic ? 2 : 0));
+ __ ldr(rscratch2,
+ Address(rfp, frame::interpreter_frame_initial_sp_offset * wordSize));
+ __ sub(rscratch1, rscratch2, rscratch1, ext::uxtw, 3);
+ __ andr(sp, rscratch1, -16);
+
__ dispatch_next(vtos);
// end of PopFrame support
More information about the aarch64-port-dev
mailing list