RFR: 8325303: Replace markWord.is_neutral() with markWord.is_unlocked()

Stefan Karlsson stefank at openjdk.org
Fri Apr 5 06:14:11 UTC 2024


On Thu, 4 Apr 2024 08:26:44 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> This is a small tidy up to try and remove confusion between checking `is_neutral` (a general state normally associated with a displaced markword in a "pristine" state) and `is_unlocked` (a specific state within the locking protocol). The underlying bit-pattern is the same and so these have been used somewhat synonymously/interchangeably.
>> 
>> A few comment tweaks too.
>> 
>> Testing: tiers 1-3 (sanity)
>> 
>> Thanks.
>
> This seems reasonable to me. Are there any use-cases of `is_neutral()` left? Could you explain why we use `is_neutral()` there and not `is_locked()`?

> Thanks for the reviews @stefank and @dcubed-ojdk .
> 
> > Are there any use-cases of is_neutral() left? Could you explain why we use is_neutral() there and not is_locked()?
> 
> As Dan indicated (thanks Dan) yes there remain uses of `is_neutral` associated with inspection of the displaced markword. The displaced markword is (mostly) used when the associated object is locked, but the displaced markword itself contains the unlocked bit pattern. So I decided to keep the `is_neutral` terminology in those cases to avoid potential avoid confusion.
> 
> As this doesn't seem to be a sticking point I will proceed with integration.
> 
> Thanks again.
> 
> /integrate

In BasicLock::move_to you renamed `is_neutral` to `is_locked` should that have stayed as `is_neutral`?

-   if (displaced_header().is_neutral()) {
+   if (displaced_header().is_unlocked()) {

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

PR Comment: https://git.openjdk.org/jdk/pull/17741#issuecomment-2039021509


More information about the hotspot-dev mailing list