Skip to content

Commit 9f8d833

Browse files
Thomas Schatzlrobcasloz
Thomas Schatzl
andcommittedMar 17, 2025
8346194: Improve G1 pre-barrier C2 cost estimate
Co-authored-by: Roberto Castañeda Lozano <rcastanedalo@openjdk.org> Reviewed-by: rcastanedalo, ayang
1 parent 2672c40 commit 9f8d833

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,15 @@ bool G1BarrierSetC2::expand_barriers(Compile* C, PhaseIterGVN& igvn) const {
287287
}
288288

289289
uint G1BarrierSetC2::estimated_barrier_size(const Node* node) const {
290-
// These Ideal node counts are extracted from the pre-matching Ideal graph
291-
// generated when compiling the following method with early barrier expansion:
292-
// static void write(MyObject obj1, Object o) {
293-
// obj1.o1 = o;
294-
// }
295290
uint8_t barrier_data = MemNode::barrier_data(node);
296291
uint nodes = 0;
297292
if ((barrier_data & G1C2BarrierPre) != 0) {
298-
nodes += 50;
293+
// Only consider the fast path for the barrier that is
294+
// actually inlined into the main code stream.
295+
// The slow path is laid out separately and does not
296+
// directly affect performance.
297+
// It has a cost of 6 (AddP, LoadB, Cmp, Bool, If, IfProj).
298+
nodes += 6;
299299
}
300300
if ((barrier_data & G1C2BarrierPost) != 0) {
301301
nodes += 60;

0 commit comments

Comments
 (0)
Please sign in to comment.