< prev index next >

src/hotspot/cpu/s390/macroAssembler_s390.cpp

Print this page
@@ -3490,11 +3490,11 @@
  
  // "The box" is the space on the stack where we copy the object mark.
  void MacroAssembler::compiler_fast_lock_object(Register oop, Register box, Register temp1, Register temp2) {
  
    assert(LockingMode != LM_LIGHTWEIGHT, "uses fast_lock_lightweight");
-   assert_different_registers(oop, box, temp1, temp2);
+   assert_different_registers(oop, box, temp1, temp2, Z_R0_scratch);
  
    Register displacedHeader = temp1;
    Register currentHeader   = temp1;
    Register temp            = temp2;
  

@@ -3559,27 +3559,26 @@
  
    bind(object_has_monitor);
  
    Register zero = temp;
    Register monitor_tagged = displacedHeader; // Tagged with markWord::monitor_value.
-   // The object's monitor m is unlocked iff m->owner is null,
-   // otherwise m->owner may contain a thread or a stack address.
  
-   // Try to CAS m->owner from null to current thread.
-   // If m->owner is null, then csg succeeds and sets m->owner=THREAD and CR=EQ.
-   // Otherwise, register zero is filled with the current owner.
+   // Try to CAS owner (no owner => current thread's _lock_id).
+   // If csg succeeds then CR=EQ, otherwise, register zero is filled
+   // with the current owner.
    z_lghi(zero, 0);
-   z_csg(zero, Z_thread, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), monitor_tagged);
+   z_lg(Z_R0_scratch, Address(Z_thread, JavaThread::lock_id_offset()));
+   z_csg(zero, Z_R0_scratch, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), monitor_tagged);
  
    // Store a non-null value into the box.
    z_stg(box, BasicLock::displaced_header_offset_in_bytes(), box);
  
    z_bre(done); // acquired the lock for the first time.
  
    BLOCK_COMMENT("fast_path_recursive_lock {");
    // Check if we are already the owner (recursive lock)
-   z_cgr(Z_thread, zero); // owner is stored in zero by "z_csg" above
+   z_cgr(Z_R0_scratch, zero); // owner is stored in zero by "z_csg" above
    z_brne(done); // not a recursive lock
  
    // Current thread already owns the lock. Just increment recursion count.
    z_agsi(Address(monitor_tagged, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)), 1ll);
    z_cgr(zero, zero); // set the CC to EQUAL

@@ -3593,11 +3592,11 @@
  }
  
  void MacroAssembler::compiler_fast_unlock_object(Register oop, Register box, Register temp1, Register temp2) {
  
    assert(LockingMode != LM_LIGHTWEIGHT, "uses fast_unlock_lightweight");
-   assert_different_registers(oop, box, temp1, temp2);
+   assert_different_registers(oop, box, temp1, temp2, Z_R0_scratch);
  
    Register displacedHeader = temp1;
    Register currentHeader   = temp2;
    Register temp            = temp1;
  

@@ -3640,11 +3639,12 @@
    // This is handled like owner thread mismatches: We take the slow path.
  
    // Handle existing monitor.
    bind(object_has_monitor);
  
-   z_cg(Z_thread, Address(currentHeader, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+   z_lg(Z_R0_scratch, Address(Z_thread, JavaThread::lock_id_offset()));
+   z_cg(Z_R0_scratch, Address(currentHeader, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
    z_brne(done);
  
    BLOCK_COMMENT("fast_path_recursive_unlock {");
    load_and_test_long(temp, Address(currentHeader, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
    z_bre(not_recursive); // if 0 then jump, it's not recursive locking

@@ -6162,11 +6162,11 @@
  
    bind(unlocked);
  }
  
  void MacroAssembler::compiler_fast_lock_lightweight_object(Register obj, Register box, Register tmp1, Register tmp2) {
-   assert_different_registers(obj, box, tmp1, tmp2);
+   assert_different_registers(obj, box, tmp1, tmp2, Z_R0_scratch);
  
    // Handle inflated monitor.
    NearLabel inflated;
    // Finish fast lock successfully. MUST reach to with flag == NE
    NearLabel locked;

@@ -6290,19 +6290,20 @@
      const ByteSize monitor_tag = in_ByteSize(UseObjectMonitorTable ? 0 : checked_cast<int>(markWord::monitor_value));
      const Address owner_address(tmp1_monitor, ObjectMonitor::owner_offset() - monitor_tag);
      const Address recursions_address(tmp1_monitor, ObjectMonitor::recursions_offset() - monitor_tag);
  
  
-     // Try to CAS m->owner from null to current thread.
-     // If m->owner is null, then csg succeeds and sets m->owner=THREAD and CR=EQ.
-     // Otherwise, register zero is filled with the current owner.
+     // Try to CAS owner (no owner => current thread's _lock_id).
+     // If csg succeeds then CR=EQ, otherwise, register zero is filled
+     // with the current owner.
      z_lghi(zero, 0);
-     z_csg(zero, Z_thread, owner_address);
+     z_lg(Z_R0_scratch, Address(Z_thread, JavaThread::lock_id_offset()));
+     z_csg(zero, Z_R0_scratch, owner_address);
      z_bre(monitor_locked);
  
      // Check if recursive.
-     z_cgr(Z_thread, zero); // zero contains the owner from z_csg instruction
+     z_cgr(Z_R0_scratch, zero); // zero contains the owner from z_csg instruction
      z_brne(slow_path);
  
      // Recursive
      z_agsi(recursions_address, 1ll);
  
< prev index next >