8347563: C2: clean up ModRefBarrierSetC2
Reviewed-by: ayang, tschatzl, kvn
This commit is contained in:
parent
86a8b48b6c
commit
1c7641d44f
@ -49,13 +49,9 @@ Node* CardTableBarrierSetC2::byte_map_base_node(GraphKit* kit) const {
|
||||
// Insert a write-barrier store. This is to let generational GC work; we have
|
||||
// to flag all oop-stores before the next GC point.
|
||||
void CardTableBarrierSetC2::post_barrier(GraphKit* kit,
|
||||
Node* ctl,
|
||||
Node* oop_store,
|
||||
Node* obj,
|
||||
Node* adr,
|
||||
uint adr_idx,
|
||||
Node* val,
|
||||
BasicType bt,
|
||||
bool use_precise) const {
|
||||
// No store check needed if we're storing a null.
|
||||
if (val != nullptr && val->is_Con()) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,13 +30,9 @@
|
||||
class CardTableBarrierSetC2: public ModRefBarrierSetC2 {
|
||||
protected:
|
||||
virtual void post_barrier(GraphKit* kit,
|
||||
Node* ctl,
|
||||
Node* store,
|
||||
Node* obj,
|
||||
Node* adr,
|
||||
uint adr_idx,
|
||||
Node* val,
|
||||
BasicType bt,
|
||||
bool use_precise) const;
|
||||
|
||||
Node* byte_map_base_node(GraphKit* kit) const;
|
||||
|
@ -25,14 +25,11 @@
|
||||
#include "opto/arraycopynode.hpp"
|
||||
#include "opto/graphKit.hpp"
|
||||
#include "opto/idealKit.hpp"
|
||||
#include "opto/narrowptrnode.hpp"
|
||||
#include "gc/shared/c2/modRefBarrierSetC2.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
Node* ModRefBarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val) const {
|
||||
DecoratorSet decorators = access.decorators();
|
||||
|
||||
const TypePtr* adr_type = access.addr().type();
|
||||
Node* adr = access.addr().node();
|
||||
|
||||
bool is_array = (decorators & IS_ARRAY) != 0;
|
||||
@ -47,36 +44,22 @@ Node* ModRefBarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val
|
||||
|
||||
assert(access.is_parse_access(), "entry not supported at optimization time");
|
||||
C2ParseAccess& parse_access = static_cast<C2ParseAccess&>(access);
|
||||
GraphKit* kit = parse_access.kit();
|
||||
|
||||
uint adr_idx = kit->C->get_alias_index(adr_type);
|
||||
assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" );
|
||||
|
||||
pre_barrier(kit, true /* do_load */, kit->control(), access.base(), adr, adr_idx, val.node(),
|
||||
static_cast<const TypeOopPtr*>(val.type()), nullptr /* pre_val */, access.type());
|
||||
Node* store = BarrierSetC2::store_at_resolved(access, val);
|
||||
post_barrier(kit, kit->control(), access.raw_access(), access.base(), adr, adr_idx, val.node(),
|
||||
access.type(), use_precise);
|
||||
post_barrier(parse_access.kit(), access.base(), adr, val.node(), use_precise);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
Node* ModRefBarrierSetC2::atomic_cmpxchg_val_at_resolved(C2AtomicParseAccess& access, Node* expected_val,
|
||||
Node* new_val, const Type* value_type) const {
|
||||
GraphKit* kit = access.kit();
|
||||
|
||||
if (!access.is_oop()) {
|
||||
return BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type);
|
||||
}
|
||||
|
||||
pre_barrier(kit, false /* do_load */,
|
||||
kit->control(), nullptr, nullptr, max_juint, nullptr, nullptr,
|
||||
expected_val /* pre_val */, T_OBJECT);
|
||||
|
||||
Node* result = BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type);
|
||||
|
||||
post_barrier(kit, kit->control(), access.raw_access(), access.base(),
|
||||
access.addr().node(), access.alias_idx(), new_val, T_OBJECT, true);
|
||||
post_barrier(access.kit(), access.base(), access.addr().node(), new_val, true);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -89,10 +72,6 @@ Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& a
|
||||
return BarrierSetC2::atomic_cmpxchg_bool_at_resolved(access, expected_val, new_val, value_type);
|
||||
}
|
||||
|
||||
pre_barrier(kit, false /* do_load */,
|
||||
kit->control(), nullptr, nullptr, max_juint, nullptr, nullptr,
|
||||
expected_val /* pre_val */, T_OBJECT);
|
||||
|
||||
Node* load_store = BarrierSetC2::atomic_cmpxchg_bool_at_resolved(access, expected_val, new_val, value_type);
|
||||
|
||||
// Emit the post barrier only when the actual store happened. This makes sense
|
||||
@ -108,8 +87,7 @@ Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& a
|
||||
IdealKit ideal(kit);
|
||||
ideal.if_then(load_store, BoolTest::ne, ideal.ConI(0), PROB_STATIC_FREQUENT); {
|
||||
kit->sync_kit(ideal);
|
||||
post_barrier(kit, ideal.ctrl(), access.raw_access(), access.base(),
|
||||
access.addr().node(), access.alias_idx(), new_val, T_OBJECT, true);
|
||||
post_barrier(kit, access.base(), access.addr().node(), new_val, true);
|
||||
ideal.sync_kit(kit);
|
||||
} ideal.end_if();
|
||||
kit->final_sync(ideal);
|
||||
@ -118,21 +96,12 @@ Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& a
|
||||
}
|
||||
|
||||
Node* ModRefBarrierSetC2::atomic_xchg_at_resolved(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const {
|
||||
GraphKit* kit = access.kit();
|
||||
|
||||
Node* result = BarrierSetC2::atomic_xchg_at_resolved(access, new_val, value_type);
|
||||
if (!access.is_oop()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Don't need to load pre_val. The old value is returned by load_store.
|
||||
// The pre_barrier can execute after the xchg as long as no safepoint
|
||||
// gets inserted between them.
|
||||
pre_barrier(kit, false /* do_load */,
|
||||
kit->control(), nullptr, nullptr, max_juint, nullptr, nullptr,
|
||||
result /* pre_val */, T_OBJECT);
|
||||
post_barrier(kit, kit->control(), access.raw_access(), access.base(), access.addr().node(),
|
||||
access.alias_idx(), new_val, T_OBJECT, true);
|
||||
post_barrier(access.kit(), access.base(), access.addr().node(), new_val, true);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,25 +31,10 @@ class TypeOopPtr;
|
||||
|
||||
class ModRefBarrierSetC2: public BarrierSetC2 {
|
||||
protected:
|
||||
virtual void pre_barrier(GraphKit* kit,
|
||||
bool do_load,
|
||||
Node* ctl,
|
||||
Node* obj,
|
||||
Node* adr,
|
||||
uint adr_idx,
|
||||
Node* val,
|
||||
const TypeOopPtr* val_type,
|
||||
Node* pre_val,
|
||||
BasicType bt) const {}
|
||||
|
||||
virtual void post_barrier(GraphKit* kit,
|
||||
Node* ctl,
|
||||
Node* store,
|
||||
Node* obj,
|
||||
Node* adr,
|
||||
uint adr_idx,
|
||||
Node* val,
|
||||
BasicType bt,
|
||||
bool use_precise) const {}
|
||||
|
||||
virtual Node* store_at_resolved(C2Access& access, C2AccessValue& val) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user