diff src/cpu/sparc/vm/templateInterpreter_sparc.cpp @ 16941:4e3b63e7a9f6

Fixing relock on interpreter when entering synchronized methods.
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Mon, 25 Aug 2014 11:32:04 -0700
parents 4062efea018b
children 52b4284cb496
line wrap: on
line diff
--- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Mon Aug 25 10:41:56 2014 -0700
+++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Mon Aug 25 11:32:04 2014 -0700
@@ -199,6 +199,22 @@
 address InterpreterGenerator::generate_deopt_entry_for(TosState state, int step) {
   address entry = __ pc();
   __ get_constant_pool_cache(LcpoolCache); // load LcpoolCache
+#ifdef GRAAL
+  // Check if we need to take lock at entry of synchronized method.
+  {
+    Label L;
+
+    //__ cmp(, 0);
+    Address pending_monitor_enter_addr(G2_thread, Thread::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);
+    // Clear flag.
+    __ stbool(G0, pending_monitor_enter_addr);
+    // Take lock.
+    lock_method();
+    __ bind(L);
+  }
+#endif
   { Label L;
     Address exception_addr(G2_thread, Thread::pending_exception_offset());
     __ ld_ptr(exception_addr, Gtemp);  // Load pending exception.
@@ -1689,8 +1705,13 @@
         // make sure I5_savedSP and the entry frames notion of saved SP
         // agree.  This assertion duplicate a check in entry frame code
         // but catches the failure earlier.
-        assert(*caller->register_addr(Lscratch) == *interpreter_frame->register_addr(I5_savedSP),
+        /*
+         * Sanzinger: This does not make sense to me, since when we call stub_call -> i2c, the i2c may change the
+         * sp, which then is not in sync with Lscratch anymore.
+         */
+        /**assert(*caller->register_addr(Lscratch) == *interpreter_frame->register_addr(I5_savedSP),
                "would change callers SP");
+               */
       }
       if (caller->is_entry_frame()) {
         tty->print("entry ");