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