RFR: 8319799: Recursive lightweight locking: x86 implementation [v13]

Roman Kennke rkennke at openjdk.org
Thu Jan 25 13:21:41 UTC 2024


On Thu, 25 Jan 2024 08:22:21 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

>> src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp line 144:
>> 
>>> 142:     lightweight_unlock(obj, disp_hdr, r15_thread, hdr, slow_case);
>>> 143: #else
>>> 144:     // This relies on the implementation of lightweight_unlock knowing that it
>> 
>> I wonder if is would be less brittle (fewer dependencies), if we didn't pass thread as register into lightweight_unlock() and keep the thread-loading and register-shuffling in that method? Same (perhaps) for lightweight_loc().
>
> The only annoying thing is that the generate native wrapper x86_32 path has a dedicated thread register. Have to either signal this to lightweight_{unlock,lock} or just reload the thread in this path.
> 
> I will see if I can find a cleaner solution.

Uh I see. This whole loading of the thread in x86_32 made me think (a while back) to not have any asm 'fast'-paths for x86_64 to begin with. IIRC, get_thread() calls into the runtime anyway, and if we do that anyway (sometimes repeatedly), we might just as well handle the whole locking there. It's annoying.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16607#discussion_r1466369287


More information about the hotspot-dev mailing list