On Fri, 19 Jun 2026 15:03:48 GMT, Jorn Vernee <[email protected]> wrote:

>> Per Minborg has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Improve performance for VTs
>
> src/java.base/share/classes/java/lang/Thread.java line 302:
> 
>> 300:          *
>> 301:          * PTRDIFF_MAX (usually 2<sup>63</sup>-1) allows us to use the 
>> sign bit
>> 302:          * as a flag for acquire state without conflicting with 
>> malloc() return values.
> 
> Why does `PTRDIFF_MAX` allow us to do this? I believe in the past we had 
> reasons to believe that addresses might use the sign bit on some systems 
> (e.g. for pointer tagging). `PTRDIFF_MAX` is also system dependent AFAICT.
> 
> I see we will never get false positives because you've added a check when 
> allocating the pool, but I'm not sure we can rely on this as an invariant.

Another alternative would be to rely on bit 0 and make sure we are always at 
least `short` aligned. I will investigate `PTRDIFF_MAX` a bit more.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31365#discussion_r3450799330

Reply via email to