RFR: 8284816: Make markWord::has_monitor() more robust

Roman Kennke rkennke at openjdk.java.net
Wed Apr 13 10:06:46 UTC 2022


Currently, markWord::has_monitor() is implemented like this:

`    return ((value() & monitor_value) != 0);`

monitor value is `0b10`. This means that it also reports marked or forwarded objects (`0b11`) as having a monitor, which is wrong. As far as I can tell, it does not cause any problems because relevant code is either not affected by marked/forwarded objects, or by testing bits in an order that hides the problem.

I suggest to test the bits properly to make it more robust and avoid potenial future bugs.

Testing:
 - [x] tier1
 - [ ] tier2
 - [ ] tier3

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

Commit messages:
 - 8284816: Make markWord::has_monitor() more robust

Changes: https://git.openjdk.java.net/jdk/pull/8219/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8219&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8284816
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8219.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8219/head:pull/8219

PR: https://git.openjdk.java.net/jdk/pull/8219


More information about the hotspot-dev mailing list