< prev index next >

src/hotspot/cpu/x86/sharedRuntime_x86.cpp

Print this page

 40 // Since hashCode is usually polymorphic at call sites we can't do this
 41 // optimization at the call site without a lot of work.
 42 void SharedRuntime::inline_check_hashcode_from_object_header(MacroAssembler* masm,
 43                                  const methodHandle& method,
 44                                  Register obj_reg,
 45                                  Register result) {
 46   Label slowCase;
 47 
 48   // Unlike for Object.hashCode, System.identityHashCode is static method and
 49   // gets object as argument instead of the receiver.
 50   if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) {
 51     Label Continue;
 52     // return 0 for null reference input
 53     __ cmpptr(obj_reg, NULL_WORD);
 54     __ jcc(Assembler::notEqual, Continue);
 55     __ xorptr(result, result);
 56     __ ret(0);
 57     __ bind(Continue);
 58   }
 59 





 60   __ movptr(result, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
 61 
 62   if (!UseObjectMonitorTable) {
 63     // check if monitor
 64     __ testptr(result, markWord::monitor_value);
 65     __ jcc(Assembler::notZero, slowCase);
 66   }
 67 
 68   // get hash
 69   // Read the header and build a mask to get its hash field.
 70   // Depend on hash_mask being at most 32 bits and avoid the use of hash_mask_in_place
 71   // because it could be larger than 32 bits in a 64-bit vm. See markWord.hpp.
 72   __ shrptr(result, markWord::hash_shift);
 73   __ andptr(result, markWord::hash_mask);
 74 
 75   // test if hashCode exists
 76   __ jccb(Assembler::zero, slowCase);
 77   __ ret(0);
 78   __ bind(slowCase);
 79 }

 40 // Since hashCode is usually polymorphic at call sites we can't do this
 41 // optimization at the call site without a lot of work.
 42 void SharedRuntime::inline_check_hashcode_from_object_header(MacroAssembler* masm,
 43                                  const methodHandle& method,
 44                                  Register obj_reg,
 45                                  Register result) {
 46   Label slowCase;
 47 
 48   // Unlike for Object.hashCode, System.identityHashCode is static method and
 49   // gets object as argument instead of the receiver.
 50   if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) {
 51     Label Continue;
 52     // return 0 for null reference input
 53     __ cmpptr(obj_reg, NULL_WORD);
 54     __ jcc(Assembler::notEqual, Continue);
 55     __ xorptr(result, result);
 56     __ ret(0);
 57     __ bind(Continue);
 58   }
 59 
 60   if (UseCompactObjectHeaders) {
 61     // Don't generate anything else and always take the slow-path for now.
 62     return;
 63   }
 64 
 65   __ movptr(result, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
 66 
 67   if (!UseObjectMonitorTable) {
 68     // check if monitor
 69     __ testptr(result, markWord::monitor_value);
 70     __ jcc(Assembler::notZero, slowCase);
 71   }
 72 
 73   // get hash
 74   // Read the header and build a mask to get its hash field.
 75   // Depend on hash_mask being at most 32 bits and avoid the use of hash_mask_in_place
 76   // because it could be larger than 32 bits in a 64-bit vm. See markWord.hpp.
 77   __ shrptr(result, markWord::hash_shift);
 78   __ andptr(result, markWord::hash_mask);
 79 
 80   // test if hashCode exists
 81   __ jccb(Assembler::zero, slowCase);
 82   __ ret(0);
 83   __ bind(slowCase);
 84 }
< prev index next >