RFR: 7902944: JMH: Avoid weak references in Blackhole.consume(Object)

Aleksey Shipilev shade at openjdk.org
Thu Jan 9 12:52:31 UTC 2025


See the bug for rationale. This avoids `WeakReference`-s completely through the aliased box trick. Not only this solves the original problem with inline types, it also allows for prompt reclamation of the objects, without relying on the specifics of VM reference processing.

I looked at `jmh-core-benchmarks` results, and they suggest this still works reliably without compiler blackholes. Compiler blackholes make all of this irrelevant.

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

Commit messages:
 - Fixing with aliased boxes
 - Boxed weak ref

Changes: https://git.openjdk.org/jmh/pull/153/files
  Webrev: https://webrevs.openjdk.org/?repo=jmh&pr=153&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7902944
  Stats: 30 lines in 2 files changed: 19 ins; 1 del; 10 mod
  Patch: https://git.openjdk.org/jmh/pull/153.diff
  Fetch: git fetch https://git.openjdk.org/jmh.git pull/153/head:pull/153

PR: https://git.openjdk.org/jmh/pull/153


More information about the jmh-dev mailing list