RFR: 8356631: OopHandle replacement methods should not be called on empty handles

Aleksey Shipilev shade at openjdk.org
Fri May 9 11:14:07 UTC 2025


I noticed that in OopHandle/WeakHandle we have {replace,xchg,cmpxchg} methods that overwrite the handle. This is only safe to do when the handle is not empty -- i.e. when there is a storage allocated for it in relevant OopStorage. Otherwise we attempt the store to nullptr, and get a SEGV.

Only OopHandle::replace does the assertion for this. We need to add these asserts everywhere else.

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

Commit messages:
 - Fix
 - Basic fix

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

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


More information about the hotspot-dev mailing list