RFR: 8284816: Make markWord::has_monitor() more robust
Daniel D.Daugherty
dcubed at openjdk.java.net
Wed Apr 13 15:19:16 UTC 2022
On Wed, 13 Apr 2022 09:59:49 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
> 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
I agree that the new code is more precise.
Thumbs up.
-------------
Marked as reviewed by dcubed (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/8219
More information about the hotspot-dev
mailing list