#ifdef COMPILER1 // --------------------------------------------------------------------------- // Object.hashCode, System.identityHashCode can pull the hashCode from the // header word instead of doing a full VM transition once it's been computed. // Since hashCode is usually polymorphic at call sites we can't do this // optimization at the call site without a lot of work. void SharedRuntime::inline_check_hashcode_from_object_header(MacroAssembler* masm, const methodHandle& method, Register obj_reg, Register result) {
Label slowCase;
// Unlike for Object.hashCode, System.identityHashCode is static method and // gets object as argument instead of the receiver. if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) {
Label Continue; // return 0 for null reference input
__ cmpptr(obj_reg, NULL_WORD);
__ jcc(Assembler::notEqual, Continue);
__ xorptr(result, result);
__ ret(0);
__ bind(Continue);
}
// check if locked
__ testptr(result, markWord::unlocked_value);
__ jcc(Assembler::zero, slowCase);
// 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); #else
__ andptr(result, markWord::hash_mask_in_place); #endif//_LP64
// test if hashCode exists
__ jcc(Assembler::zero, slowCase); #ifndef _LP64
__ shrptr(result, markWord::hash_shift); #endif
__ ret(0);
__ bind(slowCase);
} #endif//COMPILER1
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.