RFR: 8293207: Add assert to JVM_ReferenceRefersTo to clarify its API

Axel Boldt-Christmas aboldtch at openjdk.org
Thu Sep 1 10:57:06 UTC 2022


JVM_ReferenceRefersTo should only be used for soft/weak references and not phantom references, which has its own implementation. This is not clear from the name. `java_lang_ref_Reference::weak_referent_no_keepalive(ref_oop)` is only a valid call if `!java_lang_ref_Reference::is_phantom(ref_oop)`.

Adds an assert and comment to make this clear.

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

Commit messages:
 - 8293207: Add assert to JVM_ReferenceRefersTo to clarify its API

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

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


More information about the hotspot-dev mailing list