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

Roman Kennke rkennke at openjdk.java.net
Thu Apr 14 09:37:15 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

This pull request has now been integrated.

Changeset: 339005db
Author:    Roman Kennke <rkennke at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/339005dbc99e94ed094612c7b34eb0c93ca1f8c1
Stats:     1 line in 1 file changed: 0 ins; 0 del; 1 mod

8284816: Make markWord::has_monitor() more robust

Reviewed-by: stuefe, zgu, dcubed

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

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


More information about the hotspot-dev mailing list