8208582: Introduce native oop barriers in C1 for OopHandle
Reviewed-by: coleenp, kvn
This commit is contained in:
parent
611c53c860
commit
b9052e9647
@ -1285,9 +1285,10 @@ void LIRGenerator::do_getClass(Intrinsic* x) {
|
|||||||
// FIXME T_ADDRESS should actually be T_METADATA but it can't because the
|
// FIXME T_ADDRESS should actually be T_METADATA but it can't because the
|
||||||
// meaning of these two is mixed up (see JDK-8026837).
|
// meaning of these two is mixed up (see JDK-8026837).
|
||||||
__ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), temp, info);
|
__ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), temp, info);
|
||||||
__ move_wide(new LIR_Address(temp, in_bytes(Klass::java_mirror_offset()), T_ADDRESS), result);
|
__ move_wide(new LIR_Address(temp, in_bytes(Klass::java_mirror_offset()), T_ADDRESS), temp);
|
||||||
// mirror = ((OopHandle)mirror)->resolve();
|
// mirror = ((OopHandle)mirror)->resolve();
|
||||||
__ move_wide(new LIR_Address(result, T_OBJECT), result);
|
access_load(IN_NATIVE, T_OBJECT,
|
||||||
|
LIR_OprFact::address(new LIR_Address(temp, T_OBJECT)), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// java.lang.Class::isPrimitive()
|
// java.lang.Class::isPrimitive()
|
||||||
@ -1623,6 +1624,18 @@ void LIRGenerator::access_load_at(DecoratorSet decorators, BasicType type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LIRGenerator::access_load(DecoratorSet decorators, BasicType type,
|
||||||
|
LIR_Opr addr, LIR_Opr result) {
|
||||||
|
decorators |= C1_READ_ACCESS;
|
||||||
|
LIRAccess access(this, decorators, LIR_OprFact::illegalOpr, LIR_OprFact::illegalOpr, type);
|
||||||
|
access.set_resolved_addr(addr);
|
||||||
|
if (access.is_raw()) {
|
||||||
|
_barrier_set->BarrierSetC1::load(access, result);
|
||||||
|
} else {
|
||||||
|
_barrier_set->load(access, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LIRGenerator::access_store_at(DecoratorSet decorators, BasicType type,
|
void LIRGenerator::access_store_at(DecoratorSet decorators, BasicType type,
|
||||||
LIRItem& base, LIR_Opr offset, LIR_Opr value,
|
LIRItem& base, LIR_Opr offset, LIR_Opr value,
|
||||||
CodeEmitInfo* patch_info, CodeEmitInfo* store_emit_info) {
|
CodeEmitInfo* patch_info, CodeEmitInfo* store_emit_info) {
|
||||||
|
@ -288,6 +288,9 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
|
|||||||
LIRItem& base, LIR_Opr offset, LIR_Opr result,
|
LIRItem& base, LIR_Opr offset, LIR_Opr result,
|
||||||
CodeEmitInfo* patch_info = NULL, CodeEmitInfo* load_emit_info = NULL);
|
CodeEmitInfo* patch_info = NULL, CodeEmitInfo* load_emit_info = NULL);
|
||||||
|
|
||||||
|
void access_load(DecoratorSet decorators, BasicType type,
|
||||||
|
LIR_Opr addr, LIR_Opr result);
|
||||||
|
|
||||||
LIR_Opr access_atomic_cmpxchg_at(DecoratorSet decorators, BasicType type,
|
LIR_Opr access_atomic_cmpxchg_at(DecoratorSet decorators, BasicType type,
|
||||||
LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value);
|
LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value);
|
||||||
|
|
||||||
|
@ -90,6 +90,13 @@ void BarrierSetC1::load_at(LIRAccess& access, LIR_Opr result) {
|
|||||||
load_at_resolved(access, result);
|
load_at_resolved(access, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BarrierSetC1::load(LIRAccess& access, LIR_Opr result) {
|
||||||
|
DecoratorSet decorators = access.decorators();
|
||||||
|
bool in_heap = (decorators & IN_HEAP) != 0;
|
||||||
|
assert(!in_heap, "consider using load_at");
|
||||||
|
load_at_resolved(access, result);
|
||||||
|
}
|
||||||
|
|
||||||
LIR_Opr BarrierSetC1::atomic_cmpxchg_at(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value) {
|
LIR_Opr BarrierSetC1::atomic_cmpxchg_at(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value) {
|
||||||
DecoratorSet decorators = access.decorators();
|
DecoratorSet decorators = access.decorators();
|
||||||
bool in_heap = (decorators & IN_HEAP) != 0;
|
bool in_heap = (decorators & IN_HEAP) != 0;
|
||||||
@ -159,13 +166,16 @@ void BarrierSetC1::load_at_resolved(LIRAccess& access, LIR_Opr result) {
|
|||||||
bool is_volatile = (((decorators & MO_SEQ_CST) != 0) || AlwaysAtomicAccesses) && os::is_MP();
|
bool is_volatile = (((decorators & MO_SEQ_CST) != 0) || AlwaysAtomicAccesses) && os::is_MP();
|
||||||
bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0;
|
bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0;
|
||||||
bool mask_boolean = (decorators & C1_MASK_BOOLEAN) != 0;
|
bool mask_boolean = (decorators & C1_MASK_BOOLEAN) != 0;
|
||||||
|
bool in_native = (decorators & IN_NATIVE) != 0;
|
||||||
|
|
||||||
if (support_IRIW_for_not_multiple_copy_atomic_cpu && is_volatile) {
|
if (support_IRIW_for_not_multiple_copy_atomic_cpu && is_volatile) {
|
||||||
__ membar();
|
__ membar();
|
||||||
}
|
}
|
||||||
|
|
||||||
LIR_PatchCode patch_code = needs_patching ? lir_patch_normal : lir_patch_none;
|
LIR_PatchCode patch_code = needs_patching ? lir_patch_normal : lir_patch_none;
|
||||||
if (is_volatile && !needs_patching) {
|
if (in_native) {
|
||||||
|
__ move_wide(access.resolved_addr()->as_address_ptr(), result);
|
||||||
|
} else if (is_volatile && !needs_patching) {
|
||||||
gen->volatile_field_load(access.resolved_addr()->as_address_ptr(), result, access.access_emit_info());
|
gen->volatile_field_load(access.resolved_addr()->as_address_ptr(), result, access.access_emit_info());
|
||||||
} else {
|
} else {
|
||||||
__ load(access.resolved_addr()->as_address_ptr(), result, access.access_emit_info(), patch_code);
|
__ load(access.resolved_addr()->as_address_ptr(), result, access.access_emit_info(), patch_code);
|
||||||
|
@ -127,6 +127,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
virtual void store_at(LIRAccess& access, LIR_Opr value);
|
virtual void store_at(LIRAccess& access, LIR_Opr value);
|
||||||
virtual void load_at(LIRAccess& access, LIR_Opr result);
|
virtual void load_at(LIRAccess& access, LIR_Opr result);
|
||||||
|
virtual void load(LIRAccess& access, LIR_Opr result);
|
||||||
|
|
||||||
virtual LIR_Opr atomic_cmpxchg_at(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value);
|
virtual LIR_Opr atomic_cmpxchg_at(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user