RFR: 8319797: Recursive lightweight locking: Runtime implementation [v2]

Axel Boldt-Christmas aboldtch at openjdk.org
Mon Nov 13 09:11:05 UTC 2023


On Mon, 13 Nov 2023 01:08:20 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Axel Boldt-Christmas has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix comment typos
>
> src/hotspot/share/runtime/lockStack.cpp line 50:
> 
>> 48:   STATIC_ASSERT(sizeof(_bad_oop_sentinel) == oopSize);
>> 49:   STATIC_ASSERT(sizeof(_base[0]) == oopSize);
>> 50:   STATIC_ASSERT(std::is_standard_layout<LockStack>::value);
> 
> What is this? Are we allowed to use it?

There is probably more nuance here w.r.t. `offsetof` than I know. 
My belief was that reason we did not use `offsetof` is because we use it on non standard layout types, for which is invalid. But the lock stack is a standard layout. 

However,  reading some of issues surrounding `offsetof` (mainly poor compiler support and becoming conditionally supported in C++17) there might be more reasons to avoid it. If that is the case this property would have to be asserted at runtime instead. 

Maybe @kimbarrett has some more insight.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16606#discussion_r1390797991


More information about the hotspot-dev mailing list