RFR: 8346470: Improve WriteBarrier JMH to have old-to-young refs

Eric Caspole ecaspole at openjdk.org
Wed Mar 12 15:54:28 UTC 2025


Adds new cases based on the existing ones using an extra iteration setup to allocate into young gen, allowing to test old-to-young stores etc, where the existing code is all old-to-old.

Here is a run on a standard OCI A1.160 with JDK 25:

Benchmark                                                                         Mode  Cnt     Score    Error  Units
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathNullLarge          avgt   12  3448.826 ±  1.620  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathNullSmall          avgt   12    63.740 ±  0.151  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathNullYoungLarge     avgt   12  3448.353 ±  0.860  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathNullYoungSmall     avgt   12    63.565 ±  0.132  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathOldToYoungLarge    avgt   12  4476.390 ±  0.930  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathOldToYoungSmall    avgt   12    73.517 ±  0.082  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathRealLarge          avgt   12  3103.911 ±  2.079  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathRealSmall          avgt   12    57.549 ±  0.512  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathYoungToOldLarge    avgt   12  9587.762 ±  2.044  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathYoungToOldSmall    avgt   12   157.244 ±  0.169  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathYoungToYoungLarge  avgt   12  3103.191 ±  1.100  ns/op
WriteBarrier.WithDefaultUnrolling.testArrayWriteBarrierFastPathYoungToYoungSmall  avgt   12    57.392 ±  0.624  ns/op
WriteBarrier.WithDefaultUnrolling.testFieldWriteBarrierFastPath                   avgt   12     2.668 ±  0.001  ns/op
WriteBarrier.WithDefaultUnrolling.testFieldWriteBarrierFastPathYoungRef           avgt   12     9.337 ±  0.001  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathNullLarge              avgt   12  3449.234 ±  1.840  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathNullSmall              avgt   12    63.720 ±  0.079  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathNullYoungLarge         avgt   12  3448.055 ±  0.665  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathNullYoungSmall         avgt   12    63.555 ±  0.116  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathOldToYoungLarge        avgt   12  4476.646 ±  1.560  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathOldToYoungSmall        avgt   12    73.525 ±  0.070  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathRealLarge              avgt   12  3104.395 ±  1.537  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathRealSmall              avgt   12    57.766 ±  0.136  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathYoungToOldLarge        avgt   12  9586.585 ±  1.086  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathYoungToOldSmall        avgt   12   157.147 ±  0.128  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathYoungToYoungLarge      avgt   12  3103.531 ±  0.883  ns/op
WriteBarrier.WithoutUnrolling.testArrayWriteBarrierFastPathYoungToYoungSmall      avgt   12    57.669 ±  0.620  ns/op
WriteBarrier.WithoutUnrolling.testFieldWriteBarrierFastPath                       avgt   12     2.668 ±  0.001  ns/op
WriteBarrier.WithoutUnrolling.testFieldWriteBarrierFastPathYoungRef               avgt   12     9.337 ±  0.001  ns/op

-------------

Commit messages:
 - cleanup and copyright year
 - 8346470: Improve WriteBarrier JMH to have old-to-young refs

Changes: https://git.openjdk.org/jdk/pull/24010/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24010&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8346470
  Stats: 94 lines in 1 file changed: 92 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/24010.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24010/head:pull/24010

PR: https://git.openjdk.org/jdk/pull/24010


More information about the hotspot-gc-dev mailing list