< prev index next >

src/hotspot/cpu/x86/sharedRuntime_x86.cpp

Print this page




  42                                  const methodHandle& method,
  43                                  Register obj_reg,
  44                                  Register result) {
  45   Label slowCase;
  46 
  47   // Unlike for Object.hashCode, System.identityHashCode is static method and
  48   // gets object as argument instead of the receiver.
  49   if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) {
  50     Label Continue;
  51     // return 0 for null reference input
  52     __ cmpptr(obj_reg, (int32_t)NULL_WORD);
  53     __ jcc(Assembler::notEqual, Continue);
  54     __ xorptr(result, result);
  55     __ ret(0);
  56     __ bind(Continue);
  57   }
  58 
  59   __ movptr(result, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
  60 
  61   // check if locked
  62   __ testptr(result, markWord::unlocked_value);
  63   __ jcc(Assembler::zero, slowCase);
  64 
  65   if (UseBiasedLocking) {
  66     // Check if biased and fall through to runtime if so
  67     __ testptr(result, markWord::biased_lock_bit_in_place);
  68     __ jcc(Assembler::notZero, slowCase);
  69   }
  70 
  71   // get hash
  72 #ifdef _LP64
  73   // Read the header and build a mask to get its hash field.
  74   // Depend on hash_mask being at most 32 bits and avoid the use of hash_mask_in_place
  75   // because it could be larger than 32 bits in a 64-bit vm. See markWord.hpp.
  76   __ shrptr(result, markWord::hash_shift);
  77   __ andptr(result, markWord::hash_mask);
  78 #else
  79   __ andptr(result, markWord::hash_mask_in_place);
  80 #endif //_LP64
  81 
  82   // test if hashCode exists
  83   __ jcc(Assembler::zero, slowCase);
  84 #ifndef _LP64
  85   __ shrptr(result, markWord::hash_shift);
  86 #endif
  87   __ ret(0);
  88   __ bind(slowCase);
  89 }
  90 #endif //COMPILER1
  91 


  42                                  const methodHandle& method,
  43                                  Register obj_reg,
  44                                  Register result) {
  45   Label slowCase;
  46 
  47   // Unlike for Object.hashCode, System.identityHashCode is static method and
  48   // gets object as argument instead of the receiver.
  49   if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) {
  50     Label Continue;
  51     // return 0 for null reference input
  52     __ cmpptr(obj_reg, (int32_t)NULL_WORD);
  53     __ jcc(Assembler::notEqual, Continue);
  54     __ xorptr(result, result);
  55     __ ret(0);
  56     __ bind(Continue);
  57   }
  58 
  59   __ movptr(result, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
  60 
  61   // check if locked
  62   __ testptr(result, markOopDesc::unlocked_value);
  63   __ jcc(Assembler::zero, slowCase);
  64 
  65   if (UseBiasedLocking) {
  66     // Check if biased and fall through to runtime if so
  67     __ testptr(result, markOopDesc::biased_lock_bit_in_place);
  68     __ jcc(Assembler::notZero, slowCase);
  69   }
  70 
  71   // get hash
  72 #ifdef _LP64
  73   // Read the header and build a mask to get its hash field.
  74   // Depend on hash_mask being at most 32 bits and avoid the use of hash_mask_in_place
  75   // because it could be larger than 32 bits in a 64-bit vm. See markOop.hpp.
  76   __ shrptr(result, markOopDesc::hash_shift);
  77   __ andptr(result, markOopDesc::hash_mask);
  78 #else
  79   __ andptr(result, markOopDesc::hash_mask_in_place);
  80 #endif //_LP64
  81 
  82   // test if hashCode exists
  83   __ jcc(Assembler::zero, slowCase);
  84 #ifndef _LP64
  85   __ shrptr(result, markOopDesc::hash_shift);
  86 #endif
  87   __ ret(0);
  88   __ bind(slowCase);
  89 }
  90 #endif //COMPILER1
  91 
< prev index next >