[lworld] RFR: 8376566: [lworld] Runtime cleanups of markWord hashCode for inline types after JDK-8376171 [v2]
Paul Hübner
phubner at openjdk.org
Fri Feb 13 10:10:10 UTC 2026
> Hi all,
>
> The main ideas of this patch are to highlight and enforce the invariant we enforce when it comes to value objects' identity hash code.
>
> The original JBS issues addresses the following points, which have been addressed to various extents:
>
> 1. Adding assertions to the CAS-setting of the hash in the markWord. This is vital to enforce the invariant and was added.
> 2. Breaking the loop if the CAS results in a conflict. Putting the identity hash in the markWord is an optimization, so one could break out of the loop whenever. With the assertion, there's a good confidence that CAS will eventually succeed, namely once other threads stop poking at the markWord bits. **If there is demand, I can add a fixed upper bound.**
> 3. SSA-ing the hash variable. Done.
> 4. Possibly introducing a markWord::has_hash to improve legibility. I did not do this as it would yield multiple `obj->mark()` calls in the fast path and the current form is (in my opinion) sufficiently legible.
>
> Testing: tiers 1-3 on Linux (x64, AArch64), macOS (x64, AArch64), Windows (x64).
Paul Hübner has updated the pull request incrementally with one additional commit since the last revision:
Reviewer comments.
-------------
Changes:
- all: https://git.openjdk.org/valhalla/pull/2029/files
- new: https://git.openjdk.org/valhalla/pull/2029/files/17251974..0e251976
Webrevs:
- full: https://webrevs.openjdk.org/?repo=valhalla&pr=2029&range=01
- incr: https://webrevs.openjdk.org/?repo=valhalla&pr=2029&range=00-01
Stats: 25 lines in 2 files changed: 16 ins; 7 del; 2 mod
Patch: https://git.openjdk.org/valhalla/pull/2029.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2029/head:pull/2029
PR: https://git.openjdk.org/valhalla/pull/2029
More information about the valhalla-dev
mailing list