mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 02:24:40 +02:00
8209667: Explicit barriers for C1/LIR
Reviewed-by: eosterlund, roland
This commit is contained in:
parent
b1ce2c0fe8
commit
83d1dd7d9a
6 changed files with 34 additions and 4 deletions
|
@ -941,6 +941,10 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) {
|
||||||
index = tmp;
|
index = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_updateBytes) {
|
||||||
|
base_op = access_resolve(ACCESS_READ, base_op);
|
||||||
|
}
|
||||||
|
|
||||||
if (offset) {
|
if (offset) {
|
||||||
LIR_Opr tmp = new_pointer_register();
|
LIR_Opr tmp = new_pointer_register();
|
||||||
__ add(base_op, LIR_OprFact::intConst(offset), tmp);
|
__ add(base_op, LIR_OprFact::intConst(offset), tmp);
|
||||||
|
@ -1019,6 +1023,10 @@ void LIRGenerator::do_update_CRC32C(Intrinsic* x) {
|
||||||
index = tmp;
|
index = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_updateBytes) {
|
||||||
|
base_op = access_resolve(ACCESS_READ, base_op);
|
||||||
|
}
|
||||||
|
|
||||||
if (offset) {
|
if (offset) {
|
||||||
LIR_Opr tmp = new_pointer_register();
|
LIR_Opr tmp = new_pointer_register();
|
||||||
__ add(base_op, LIR_OprFact::intConst(offset), tmp);
|
__ add(base_op, LIR_OprFact::intConst(offset), tmp);
|
||||||
|
|
|
@ -997,6 +997,10 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (is_updateBytes) {
|
||||||
|
base_op = access_resolve(IS_NOT_NULL | ACCESS_READ, base_op);
|
||||||
|
}
|
||||||
|
|
||||||
LIR_Address* a = new LIR_Address(base_op,
|
LIR_Address* a = new LIR_Address(base_op,
|
||||||
index,
|
index,
|
||||||
offset,
|
offset,
|
||||||
|
@ -1054,7 +1058,7 @@ void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {
|
||||||
constant_aOffset = result_aOffset->as_jlong();
|
constant_aOffset = result_aOffset->as_jlong();
|
||||||
result_aOffset = LIR_OprFact::illegalOpr;
|
result_aOffset = LIR_OprFact::illegalOpr;
|
||||||
}
|
}
|
||||||
LIR_Opr result_a = a.result();
|
LIR_Opr result_a = access_resolve(ACCESS_READ, a.result());
|
||||||
|
|
||||||
long constant_bOffset = 0;
|
long constant_bOffset = 0;
|
||||||
LIR_Opr result_bOffset = bOffset.result();
|
LIR_Opr result_bOffset = bOffset.result();
|
||||||
|
@ -1062,7 +1066,7 @@ void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {
|
||||||
constant_bOffset = result_bOffset->as_jlong();
|
constant_bOffset = result_bOffset->as_jlong();
|
||||||
result_bOffset = LIR_OprFact::illegalOpr;
|
result_bOffset = LIR_OprFact::illegalOpr;
|
||||||
}
|
}
|
||||||
LIR_Opr result_b = b.result();
|
LIR_Opr result_b = access_resolve(ACCESS_READ, b.result());
|
||||||
|
|
||||||
#ifndef _LP64
|
#ifndef _LP64
|
||||||
result_a = new_register(T_INT);
|
result_a = new_register(T_INT);
|
||||||
|
|
|
@ -1690,6 +1690,15 @@ LIR_Opr LIRGenerator::access_atomic_add_at(DecoratorSet decorators, BasicType ty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LIR_Opr LIRGenerator::access_resolve(DecoratorSet decorators, LIR_Opr obj) {
|
||||||
|
// Use stronger ACCESS_WRITE|ACCESS_READ by default.
|
||||||
|
if ((decorators & (ACCESS_READ | ACCESS_WRITE)) == 0) {
|
||||||
|
decorators |= ACCESS_READ | ACCESS_WRITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _barrier_set->resolve(this, decorators, obj);
|
||||||
|
}
|
||||||
|
|
||||||
void LIRGenerator::do_LoadField(LoadField* x) {
|
void LIRGenerator::do_LoadField(LoadField* x) {
|
||||||
bool needs_patching = x->needs_patching();
|
bool needs_patching = x->needs_patching();
|
||||||
bool is_volatile = x->field()->is_volatile();
|
bool is_volatile = x->field()->is_volatile();
|
||||||
|
@ -1767,11 +1776,12 @@ void LIRGenerator::do_NIOCheckIndex(Intrinsic* x) {
|
||||||
if (GenerateRangeChecks) {
|
if (GenerateRangeChecks) {
|
||||||
CodeEmitInfo* info = state_for(x);
|
CodeEmitInfo* info = state_for(x);
|
||||||
CodeStub* stub = new RangeCheckStub(info, index.result());
|
CodeStub* stub = new RangeCheckStub(info, index.result());
|
||||||
|
LIR_Opr buf_obj = access_resolve(IS_NOT_NULL | ACCESS_READ, buf.result());
|
||||||
if (index.result()->is_constant()) {
|
if (index.result()->is_constant()) {
|
||||||
cmp_mem_int(lir_cond_belowEqual, buf.result(), java_nio_Buffer::limit_offset(), index.result()->as_jint(), info);
|
cmp_mem_int(lir_cond_belowEqual, buf_obj, java_nio_Buffer::limit_offset(), index.result()->as_jint(), info);
|
||||||
__ branch(lir_cond_belowEqual, T_INT, stub);
|
__ branch(lir_cond_belowEqual, T_INT, stub);
|
||||||
} else {
|
} else {
|
||||||
cmp_reg_mem(lir_cond_aboveEqual, index.result(), buf.result(),
|
cmp_reg_mem(lir_cond_aboveEqual, index.result(), buf_obj,
|
||||||
java_nio_Buffer::limit_offset(), T_INT, info);
|
java_nio_Buffer::limit_offset(), T_INT, info);
|
||||||
__ branch(lir_cond_aboveEqual, T_INT, stub);
|
__ branch(lir_cond_aboveEqual, T_INT, stub);
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,6 +300,8 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
|
||||||
LIR_Opr access_atomic_add_at(DecoratorSet decorators, BasicType type,
|
LIR_Opr access_atomic_add_at(DecoratorSet decorators, BasicType type,
|
||||||
LIRItem& base, LIRItem& offset, LIRItem& value);
|
LIRItem& base, LIRItem& offset, LIRItem& value);
|
||||||
|
|
||||||
|
LIR_Opr access_resolve(DecoratorSet decorators, LIR_Opr obj);
|
||||||
|
|
||||||
// These need to guarantee JMM volatile semantics are preserved on each platform
|
// These need to guarantee JMM volatile semantics are preserved on each platform
|
||||||
// and requires one implementation per architecture.
|
// and requires one implementation per architecture.
|
||||||
LIR_Opr atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value);
|
LIR_Opr atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value);
|
||||||
|
|
|
@ -334,3 +334,7 @@ void BarrierSetC1::generate_referent_check(LIRAccess& access, LabelObj* cont) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LIR_Opr BarrierSetC1::resolve(LIRGenerator* gen, DecoratorSet decorators, LIR_Opr obj) {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
|
@ -134,6 +134,8 @@ public:
|
||||||
virtual LIR_Opr atomic_xchg_at(LIRAccess& access, LIRItem& value);
|
virtual LIR_Opr atomic_xchg_at(LIRAccess& access, LIRItem& value);
|
||||||
virtual LIR_Opr atomic_add_at(LIRAccess& access, LIRItem& value);
|
virtual LIR_Opr atomic_add_at(LIRAccess& access, LIRItem& value);
|
||||||
|
|
||||||
|
virtual LIR_Opr resolve(LIRGenerator* gen, DecoratorSet decorators, LIR_Opr obj);
|
||||||
|
|
||||||
virtual void generate_c1_runtime_stubs(BufferBlob* buffer_blob) {}
|
virtual void generate_c1_runtime_stubs(BufferBlob* buffer_blob) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue