--- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Tue Oct 18 18:59:01 2016 +0000
+++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Tue Oct 18 19:31:21 2016 +0000
@@ -454,8 +454,9 @@
__ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
#if INCLUDE_JVMCI
- // Check if we need to take lock at entry of synchronized method.
- if (UseJVMCICompiler) {
+ // Check if we need to take lock at entry of synchronized method. This can
+ // only occur on method entry so emit it only for vtos with step 0.
+ if (UseJVMCICompiler && state == vtos && step == 0) {
Label L;
__ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
__ cbz(rscratch1, L);
@@ -464,8 +465,17 @@
// Take lock.
lock_method();
__ bind(L);
+ } else {
+#ifdef ASSERT
+ if (UseJVMCICompiler) {
+ Label L;
+ __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
+ __ cbz(rscratch1, L);
+ __ stop("unexpected pending monitor in deopt entry");
+ __ bind(L);
+ }
+#endif
}
-#endif
// handle exceptions
{
Label L;
--- a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp Tue Oct 18 18:59:01 2016 +0000
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp Tue Oct 18 19:31:21 2016 +0000
@@ -384,8 +384,9 @@
address entry = __ pc();
__ get_constant_pool_cache(LcpoolCache); // load LcpoolCache
#if INCLUDE_JVMCI
- // Check if we need to take lock at entry of synchronized method.
- if (UseJVMCICompiler) {
+ // Check if we need to take lock at entry of synchronized method. This can
+ // only occur on method entry so emit it only for vtos with step 0.
+ if (UseJVMCICompiler && state == vtos && step == 0) {
Label L;
Address pending_monitor_enter_addr(G2_thread, JavaThread::pending_monitorenter_offset());
__ ldbool(pending_monitor_enter_addr, Gtemp); // Load if pending monitor enter
@@ -395,6 +396,17 @@
// Take lock.
lock_method();
__ bind(L);
+ } else {
+#ifdef ASSERT
+ if (UseJVMCICompiler) {
+ Label L;
+ Address pending_monitor_enter_addr(G2_thread, JavaThread::pending_monitorenter_offset());
+ __ ldbool(pending_monitor_enter_addr, Gtemp); // Load if pending monitor enter
+ __ cmp_and_br_short(Gtemp, G0, Assembler::equal, Assembler::pn, L);
+ __ stop("unexpected pending monitor in deopt entry");
+ __ bind(L);
+ }
+#endif
}
#endif
{ Label L;
--- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp Tue Oct 18 18:59:01 2016 +0000
+++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp Tue Oct 18 19:31:21 2016 +0000
@@ -254,8 +254,9 @@
const Register thread = NOT_LP64(rcx) LP64_ONLY(r15_thread);
NOT_LP64(__ get_thread(thread));
#if INCLUDE_JVMCI
- // Check if we need to take lock at entry of synchronized method.
- if (UseJVMCICompiler) {
+ // Check if we need to take lock at entry of synchronized method. This can
+ // only occur on method entry so emit it only for vtos with step 0.
+ if (UseJVMCICompiler && state == vtos && step == 0) {
Label L;
__ cmpb(Address(thread, JavaThread::pending_monitorenter_offset()), 0);
__ jcc(Assembler::zero, L);
@@ -266,6 +267,16 @@
// Take lock.
lock_method();
__ bind(L);
+ } else {
+#ifdef ASSERT
+ if (UseJVMCICompiler) {
+ Label L;
+ __ cmpb(Address(r15_thread, JavaThread::pending_monitorenter_offset()), 0);
+ __ jccb(Assembler::zero, L);
+ __ stop("unexpected pending monitor in deopt entry");
+ __ bind(L);
+ }
+#endif
}
#endif
// handle exceptions