< prev index next >

src/hotspot/cpu/x86/sharedRuntime_x86.cpp

Print this page
@@ -23,10 +23,11 @@
   */
  
  #include "precompiled.hpp"
  #include "asm/macroAssembler.hpp"
  #include "runtime/sharedRuntime.hpp"
+ #include "utilities/globalDefinitions.hpp"
  #include "vmreg_x86.inline.hpp"
  #ifdef COMPILER1
  #include "c1/c1_Runtime1.hpp"
  #endif //COMPILER1
  

@@ -56,13 +57,20 @@
      __ bind(Continue);
    }
  
    __ movptr(result, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
  
-   // check if locked
-   __ testptr(result, markWord::unlocked_value);
-   __ jcc(Assembler::zero, slowCase);
+ 
+   if (LockingMode == LM_LIGHTWEIGHT) {
+     // check if monitor
+     __ testptr(result, markWord::monitor_value);
+     __ jcc(Assembler::notZero, slowCase);
+   } else {
+     // check if locked
+     __ testptr(result, markWord::unlocked_value);
+     __ jcc(Assembler::zero, slowCase);
+   }
  
    if (UseBiasedLocking) {
      // Check if biased and fall through to runtime if so
      __ testptr(result, markWord::biased_lock_bit_in_place);
      __ jcc(Assembler::notZero, slowCase);

@@ -71,12 +79,17 @@
    // get hash
  #ifdef _LP64
    // Read the header and build a mask to get its hash field.
    // Depend on hash_mask being at most 32 bits and avoid the use of hash_mask_in_place
    // because it could be larger than 32 bits in a 64-bit vm. See markWord.hpp.
-   __ shrptr(result, markWord::hash_shift);
-   __ andptr(result, markWord::hash_mask);
+   if (UseCompactObjectHeaders) {
+     __ shrptr(result, markWord::hash_shift_compact);
+     __ andptr(result, markWord::hash_mask_compact);
+   } else {
+     __ shrptr(result, markWord::hash_shift);
+     __ andptr(result, markWord::hash_mask);
+   }
  #else
    __ andptr(result, markWord::hash_mask_in_place);
  #endif //_LP64
  
    // test if hashCode exists
< prev index next >