Skip to content

Commit 1c7641d

Browse files
committed
8347563: C2: clean up ModRefBarrierSetC2
Reviewed-by: ayang, tschatzl, kvn
1 parent 86a8b48 commit 1c7641d

File tree

4 files changed

+6
-60
lines changed

4 files changed

+6
-60
lines changed

src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,9 @@ Node* CardTableBarrierSetC2::byte_map_base_node(GraphKit* kit) const {
4949
// Insert a write-barrier store. This is to let generational GC work; we have
5050
// to flag all oop-stores before the next GC point.
5151
void CardTableBarrierSetC2::post_barrier(GraphKit* kit,
52-
Node* ctl,
53-
Node* oop_store,
5452
Node* obj,
5553
Node* adr,
56-
uint adr_idx,
5754
Node* val,
58-
BasicType bt,
5955
bool use_precise) const {
6056
// No store check needed if we're storing a null.
6157
if (val != nullptr && val->is_Con()) {

src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,13 +30,9 @@
3030
class CardTableBarrierSetC2: public ModRefBarrierSetC2 {
3131
protected:
3232
virtual void post_barrier(GraphKit* kit,
33-
Node* ctl,
34-
Node* store,
3533
Node* obj,
3634
Node* adr,
37-
uint adr_idx,
3835
Node* val,
39-
BasicType bt,
4036
bool use_precise) const;
4137

4238
Node* byte_map_base_node(GraphKit* kit) const;

src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.cpp

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@
2525
#include "opto/arraycopynode.hpp"
2626
#include "opto/graphKit.hpp"
2727
#include "opto/idealKit.hpp"
28-
#include "opto/narrowptrnode.hpp"
2928
#include "gc/shared/c2/modRefBarrierSetC2.hpp"
30-
#include "utilities/macros.hpp"
3129

3230
Node* ModRefBarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val) const {
3331
DecoratorSet decorators = access.decorators();
3432

35-
const TypePtr* adr_type = access.addr().type();
3633
Node* adr = access.addr().node();
3734

3835
bool is_array = (decorators & IS_ARRAY) != 0;
@@ -47,36 +44,22 @@ Node* ModRefBarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val
4744

4845
assert(access.is_parse_access(), "entry not supported at optimization time");
4946
C2ParseAccess& parse_access = static_cast<C2ParseAccess&>(access);
50-
GraphKit* kit = parse_access.kit();
5147

52-
uint adr_idx = kit->C->get_alias_index(adr_type);
53-
assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" );
54-
55-
pre_barrier(kit, true /* do_load */, kit->control(), access.base(), adr, adr_idx, val.node(),
56-
static_cast<const TypeOopPtr*>(val.type()), nullptr /* pre_val */, access.type());
5748
Node* store = BarrierSetC2::store_at_resolved(access, val);
58-
post_barrier(kit, kit->control(), access.raw_access(), access.base(), adr, adr_idx, val.node(),
59-
access.type(), use_precise);
49+
post_barrier(parse_access.kit(), access.base(), adr, val.node(), use_precise);
6050

6151
return store;
6252
}
6353

6454
Node* ModRefBarrierSetC2::atomic_cmpxchg_val_at_resolved(C2AtomicParseAccess& access, Node* expected_val,
6555
Node* new_val, const Type* value_type) const {
66-
GraphKit* kit = access.kit();
67-
6856
if (!access.is_oop()) {
6957
return BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type);
7058
}
7159

72-
pre_barrier(kit, false /* do_load */,
73-
kit->control(), nullptr, nullptr, max_juint, nullptr, nullptr,
74-
expected_val /* pre_val */, T_OBJECT);
75-
7660
Node* result = BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type);
7761

78-
post_barrier(kit, kit->control(), access.raw_access(), access.base(),
79-
access.addr().node(), access.alias_idx(), new_val, T_OBJECT, true);
62+
post_barrier(access.kit(), access.base(), access.addr().node(), new_val, true);
8063

8164
return result;
8265
}
@@ -89,10 +72,6 @@ Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& a
8972
return BarrierSetC2::atomic_cmpxchg_bool_at_resolved(access, expected_val, new_val, value_type);
9073
}
9174

92-
pre_barrier(kit, false /* do_load */,
93-
kit->control(), nullptr, nullptr, max_juint, nullptr, nullptr,
94-
expected_val /* pre_val */, T_OBJECT);
95-
9675
Node* load_store = BarrierSetC2::atomic_cmpxchg_bool_at_resolved(access, expected_val, new_val, value_type);
9776

9877
// 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
10887
IdealKit ideal(kit);
10988
ideal.if_then(load_store, BoolTest::ne, ideal.ConI(0), PROB_STATIC_FREQUENT); {
11089
kit->sync_kit(ideal);
111-
post_barrier(kit, ideal.ctrl(), access.raw_access(), access.base(),
112-
access.addr().node(), access.alias_idx(), new_val, T_OBJECT, true);
90+
post_barrier(kit, access.base(), access.addr().node(), new_val, true);
11391
ideal.sync_kit(kit);
11492
} ideal.end_if();
11593
kit->final_sync(ideal);
@@ -118,21 +96,12 @@ Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& a
11896
}
11997

12098
Node* ModRefBarrierSetC2::atomic_xchg_at_resolved(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const {
121-
GraphKit* kit = access.kit();
122-
12399
Node* result = BarrierSetC2::atomic_xchg_at_resolved(access, new_val, value_type);
124100
if (!access.is_oop()) {
125101
return result;
126102
}
127103

128-
// Don't need to load pre_val. The old value is returned by load_store.
129-
// The pre_barrier can execute after the xchg as long as no safepoint
130-
// gets inserted between them.
131-
pre_barrier(kit, false /* do_load */,
132-
kit->control(), nullptr, nullptr, max_juint, nullptr, nullptr,
133-
result /* pre_val */, T_OBJECT);
134-
post_barrier(kit, kit->control(), access.raw_access(), access.base(), access.addr().node(),
135-
access.alias_idx(), new_val, T_OBJECT, true);
104+
post_barrier(access.kit(), access.base(), access.addr().node(), new_val, true);
136105

137106
return result;
138107
}

src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.hpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -31,25 +31,10 @@ class TypeOopPtr;
3131

3232
class ModRefBarrierSetC2: public BarrierSetC2 {
3333
protected:
34-
virtual void pre_barrier(GraphKit* kit,
35-
bool do_load,
36-
Node* ctl,
37-
Node* obj,
38-
Node* adr,
39-
uint adr_idx,
40-
Node* val,
41-
const TypeOopPtr* val_type,
42-
Node* pre_val,
43-
BasicType bt) const {}
44-
4534
virtual void post_barrier(GraphKit* kit,
46-
Node* ctl,
47-
Node* store,
4835
Node* obj,
4936
Node* adr,
50-
uint adr_idx,
5137
Node* val,
52-
BasicType bt,
5338
bool use_precise) const {}
5439

5540
virtual Node* store_at_resolved(C2Access& access, C2AccessValue& val) const;

0 commit comments

Comments
 (0)