RFR: 8319797: Recursive lightweight locking: Runtime implementation [v3]
David Holmes
dholmes at openjdk.org
Tue Nov 14 07:52:32 UTC 2023
On Mon, 13 Nov 2023 09:07:59 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> 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.
To be clear I was querying the use of `std::is_standard_layout` here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16606#discussion_r1392124042
More information about the hotspot-dev
mailing list