From a4a0ef2832d31a8b37a53438121fc5a65dcecd53 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Thu, 12 Dec 2024 10:26:41 +0100 Subject: [PATCH] * update post barrier cost estimate --- src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp b/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp index cb77b5bddd6c3..696a9632a4bc2 100644 --- a/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp +++ b/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp @@ -299,9 +299,13 @@ uint G1BarrierSetC2::estimated_barrier_size(const Node* node) const { nodes += 50; } if ((barrier_data & G1C2BarrierPost) != 0) { - // Approximate the number of nodes needed with the number of Assembly instructions - // since we do not have real nodes. - nodes += 12; + // Approximate the number of nodes needed; an if costs 4 nodes (Cmp, Bool, + // If, If projection), any other (Assembly) instruction is approximated with + // a cost of 1. + nodes += 4 // base cost for the card write containing getting base offset, address calculation and the card write; + + 6 // same region check: Uncompress (new_val) oop, xor, shr, (cmp), jmp + + 4 // new_val is null check + + 4; // card not clean check. } return nodes; }