mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
8210752: Remaining explicit barriers for C2
Reviewed-by: roland, shade
This commit is contained in:
parent
ba0203b2d5
commit
0055586b61
2 changed files with 29 additions and 11 deletions
|
@ -244,7 +244,7 @@ class LibraryCallKit : public GraphKit {
|
|||
Node* generate_min_max(vmIntrinsics::ID id, Node* x, Node* y);
|
||||
// This returns Type::AnyPtr, RawPtr, or OopPtr.
|
||||
int classify_unsafe_addr(Node* &base, Node* &offset, BasicType type);
|
||||
Node* make_unsafe_address(Node*& base, Node* offset, BasicType type = T_ILLEGAL, bool can_cast = false);
|
||||
Node* make_unsafe_address(Node*& base, Node* offset, DecoratorSet decorators, BasicType type = T_ILLEGAL, bool can_cast = false);
|
||||
|
||||
typedef enum { Relaxed, Opaque, Volatile, Acquire, Release } AccessKind;
|
||||
DecoratorSet mo_decorator_for_access_kind(AccessKind kind);
|
||||
|
@ -1684,7 +1684,7 @@ bool LibraryCallKit::inline_string_getCharsU() {
|
|||
|
||||
if (!stopped()) {
|
||||
src = access_resolve(src, ACCESS_READ);
|
||||
dst = access_resolve(dst, ACCESS_READ);
|
||||
dst = access_resolve(dst, ACCESS_WRITE);
|
||||
|
||||
// Calculate starting addresses.
|
||||
Node* src_start = array_element_address(src, src_begin, T_BYTE);
|
||||
|
@ -2193,7 +2193,7 @@ LibraryCallKit::classify_unsafe_addr(Node* &base, Node* &offset, BasicType type)
|
|||
}
|
||||
}
|
||||
|
||||
inline Node* LibraryCallKit::make_unsafe_address(Node*& base, Node* offset, BasicType type, bool can_cast) {
|
||||
inline Node* LibraryCallKit::make_unsafe_address(Node*& base, Node* offset, DecoratorSet decorators, BasicType type, bool can_cast) {
|
||||
Node* uncasted_base = base;
|
||||
int kind = classify_unsafe_addr(uncasted_base, offset, type);
|
||||
if (kind == Type::RawPtr) {
|
||||
|
@ -2222,6 +2222,7 @@ inline Node* LibraryCallKit::make_unsafe_address(Node*& base, Node* offset, Basi
|
|||
}
|
||||
// We don't know if it's an on heap or off heap access. Fall back
|
||||
// to raw memory access.
|
||||
base = access_resolve(base, decorators);
|
||||
Node* raw = _gvn.transform(new CheckCastPPNode(control(), base, TypeRawPtr::BOTTOM));
|
||||
return basic_plus_adr(top(), raw, offset);
|
||||
} else {
|
||||
|
@ -2388,7 +2389,7 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
|
|||
"fieldOffset must be byte-scaled");
|
||||
// 32-bit machines ignore the high half!
|
||||
offset = ConvL2X(offset);
|
||||
adr = make_unsafe_address(base, offset, type, kind == Relaxed);
|
||||
adr = make_unsafe_address(base, offset, is_store ? ACCESS_WRITE : ACCESS_READ, type, kind == Relaxed);
|
||||
|
||||
if (_gvn.type(base)->isa_ptr() != TypePtr::NULL_PTR) {
|
||||
heap_base_oop = base;
|
||||
|
@ -2672,7 +2673,7 @@ bool LibraryCallKit::inline_unsafe_load_store(const BasicType type, const LoadSt
|
|||
assert(Unsafe_field_offset_to_byte_offset(11) == 11, "fieldOffset must be byte-scaled");
|
||||
// 32-bit machines ignore the high half of long offsets
|
||||
offset = ConvL2X(offset);
|
||||
Node* adr = make_unsafe_address(base, offset, type, false);
|
||||
Node* adr = make_unsafe_address(base, offset, ACCESS_WRITE | ACCESS_READ, type, false);
|
||||
const TypePtr *adr_type = _gvn.type(adr)->isa_ptr();
|
||||
|
||||
Compile::AliasType* alias_type = C->alias_type(adr_type);
|
||||
|
@ -2967,6 +2968,11 @@ bool LibraryCallKit::inline_native_isInterrupted() {
|
|||
Node* rec_thr = argument(0);
|
||||
Node* tls_ptr = NULL;
|
||||
Node* cur_thr = generate_current_thread(tls_ptr);
|
||||
|
||||
// Resolve oops to stable for CmpP below.
|
||||
cur_thr = access_resolve(cur_thr, 0);
|
||||
rec_thr = access_resolve(rec_thr, 0);
|
||||
|
||||
Node* cmp_thr = _gvn.transform(new CmpPNode(cur_thr, rec_thr));
|
||||
Node* bol_thr = _gvn.transform(new BoolNode(cmp_thr, BoolTest::ne));
|
||||
|
||||
|
@ -3401,6 +3407,10 @@ bool LibraryCallKit::inline_native_subtype_check() {
|
|||
klasses[which_arg] = _gvn.transform(kls);
|
||||
}
|
||||
|
||||
// Resolve oops to stable for CmpP below.
|
||||
args[0] = access_resolve(args[0], 0);
|
||||
args[1] = access_resolve(args[1], 0);
|
||||
|
||||
// Having loaded both klasses, test each for null.
|
||||
bool never_see_null = !too_many_traps(Deoptimization::Reason_null_check);
|
||||
for (which_arg = 0; which_arg <= 1; which_arg++) {
|
||||
|
@ -4178,8 +4188,10 @@ bool LibraryCallKit::inline_unsafe_copyMemory() {
|
|||
assert(Unsafe_field_offset_to_byte_offset(11) == 11,
|
||||
"fieldOffset must be byte-scaled");
|
||||
|
||||
Node* src = make_unsafe_address(src_ptr, src_off);
|
||||
Node* dst = make_unsafe_address(dst_ptr, dst_off);
|
||||
src_ptr = access_resolve(src_ptr, ACCESS_READ);
|
||||
dst_ptr = access_resolve(dst_ptr, ACCESS_WRITE);
|
||||
Node* src = make_unsafe_address(src_ptr, src_off, ACCESS_READ);
|
||||
Node* dst = make_unsafe_address(dst_ptr, dst_off, ACCESS_WRITE);
|
||||
|
||||
// Conservatively insert a memory barrier on all memory slices.
|
||||
// Do not let writes of the copy source or destination float below the copy.
|
||||
|
@ -5334,8 +5346,10 @@ bool LibraryCallKit::inline_vectorizedMismatch() {
|
|||
Node* call;
|
||||
jvms()->set_should_reexecute(true);
|
||||
|
||||
Node* obja_adr = make_unsafe_address(obja, aoffset);
|
||||
Node* objb_adr = make_unsafe_address(objb, boffset);
|
||||
obja = access_resolve(obja, ACCESS_READ);
|
||||
objb = access_resolve(objb, ACCESS_READ);
|
||||
Node* obja_adr = make_unsafe_address(obja, aoffset, ACCESS_READ);
|
||||
Node* objb_adr = make_unsafe_address(objb, boffset, ACCESS_READ);
|
||||
|
||||
call = make_runtime_call(RC_LEAF,
|
||||
OptoRuntime::vectorizedMismatch_Type(),
|
||||
|
@ -6117,6 +6131,10 @@ Node* LibraryCallKit::inline_cipherBlockChaining_AESCrypt_predicate(bool decrypt
|
|||
src = must_be_not_null(src, true);
|
||||
dest = must_be_not_null(dest, true);
|
||||
|
||||
// Resolve oops to stable for CmpP below.
|
||||
src = access_resolve(src, 0);
|
||||
dest = access_resolve(dest, 0);
|
||||
|
||||
ciInstanceKlass* instklass_AESCrypt = klass_AESCrypt->as_instance_klass();
|
||||
|
||||
Node* instof = gen_instanceof(embeddedCipherObj, makecon(TypeKlassPtr::make(instklass_AESCrypt)));
|
||||
|
|
|
@ -2747,8 +2747,8 @@ void Parse::do_one_bytecode() {
|
|||
handle_if_acmp:
|
||||
// If this is a backwards branch in the bytecodes, add Safepoint
|
||||
maybe_add_safepoint(iter().get_dest());
|
||||
a = pop();
|
||||
b = pop();
|
||||
a = access_resolve(pop(), 0);
|
||||
b = access_resolve(pop(), 0);
|
||||
c = _gvn.transform( new CmpPNode(b, a) );
|
||||
c = optimize_cmp_with_klass(c);
|
||||
do_if(btest, c);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue