< prev index next >

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

Print this page
@@ -701,11 +701,11 @@
      }
  
      if (LockingMode == LM_LIGHTWEIGHT) {
        ldr(tmp, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
        lightweight_lock(obj_reg, tmp, tmp2, tmp3, slow_case);
-       b(count);
+       b(done);
      } else if (LockingMode == LM_LEGACY) {
        // Load (object->mark() | 1) into swap_reg
        ldr(rscratch1, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
        orr(swap_reg, rscratch1, 1);
  

@@ -751,29 +751,32 @@
        sub(swap_reg, swap_reg, rscratch1);
        ands(swap_reg, swap_reg, (uint64_t)(7 - (int)os::vm_page_size()));
  
        // Save the test result, for recursive case, the result is zero
        str(swap_reg, Address(lock_reg, mark_offset));
-       br(Assembler::EQ, count);
+       br(Assembler::NE, slow_case);
+       b(done);
      }
+ 
+     bind(count);
+     inc_held_monitor_count();
+     b(done);
+ 
      bind(slow_case);
  
+     //    push_cont_fastpath();
      // Call the runtime routine for slow case
      if (LockingMode == LM_LIGHTWEIGHT) {
        call_VM(noreg,
                CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter_obj),
                obj_reg);
      } else {
        call_VM(noreg,
                CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
                lock_reg);
      }
-     b(done);
- 
-     bind(count);
-     increment(Address(rthread, JavaThread::held_monitor_count_offset()));
- 
+     //    pop_cont_fastpath();
      bind(done);
    }
  }
  
  

@@ -814,13 +817,13 @@
      ldr(obj_reg, Address(lock_reg, BasicObjectLock::obj_offset()));
  
      // Free entry
      str(zr, Address(lock_reg, BasicObjectLock::obj_offset()));
  
-     if (LockingMode == LM_LIGHTWEIGHT) {
-       Label slow_case;
+     Label slow_case;
  
+     if (LockingMode == LM_LIGHTWEIGHT) {
        // Check for non-symmetric locking. This is allowed by the spec and the interpreter
        // must handle it.
        Register tmp = rscratch1;
        // First check for lock-stack underflow.
        ldrw(tmp, Address(rthread, JavaThread::lock_stack_top_offset()));

@@ -833,31 +836,31 @@
        br(Assembler::NE, slow_case);
  
        ldr(header_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
        tbnz(header_reg, exact_log2(markWord::monitor_value), slow_case);
        lightweight_unlock(obj_reg, header_reg, swap_reg, tmp_reg, slow_case);
-       b(count);
-       bind(slow_case);
+       b(done);
      } else if (LockingMode == LM_LEGACY) {
        // Load the old header from BasicLock structure
        ldr(header_reg, Address(swap_reg,
                                BasicLock::displaced_header_offset_in_bytes()));
  
        // Test for recursion
-       cbz(header_reg, count);
+       cbz(header_reg, done);
  
        // Atomic swap back the old header
-       cmpxchg_obj_header(swap_reg, header_reg, obj_reg, rscratch1, count, /*fallthrough*/nullptr);
+       cmpxchg_obj_header(swap_reg, header_reg, obj_reg, rscratch1, count, &slow_case);
      }
-     // Call the runtime routine for slow case.
-     str(obj_reg, Address(lock_reg, BasicObjectLock::obj_offset())); // restore obj
-     call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg);
-     b(done);
  
      bind(count);
-     decrement(Address(rthread, JavaThread::held_monitor_count_offset()));
+     dec_held_monitor_count();
+     b(done);
  
+     bind(slow_case);
+     // Call the runtime routine for slow case.
+     str(obj_reg, Address(lock_reg, BasicObjectLock::obj_offset())); // restore obj
+     call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg);
      bind(done);
      restore_bcp();
    }
  }
  
< prev index next >