RFR: 8293337: Store method handle intrinsics in AOT cache [v9]

Ioi Lam iklam at openjdk.org
Wed Oct 16 23:34:50 UTC 2024


On Wed, 16 Oct 2024 15:32:55 GMT, Dan Heidinga <heidinga at openjdk.org> wrote:

>> The lock cannot be held while calling `AdapterHandlerLibrary::create_native_wrapper()` -- a few lines above. Otherwise  you'd see an error like
>> 
>>> assert(false) failed: Attempting to acquire lock AdapterHandlerLibrary_lock/safepoint out of order with lock InvokeMethodIntrinsicTable_lock/safepoint -- possible deadlock
>> 
>> You can see the same pattern with the existing code
>> 
>> https://github.com/openjdk/jdk/blob/b9cabbecdac27ae8b93df88660a4a0f3f60e6828/src/hotspot/share/classfile/systemDictionary.cpp#L2008-L2022
>> 
>> Most of the work is done inside `AdapterHandlerLibrary::create_native_wrapper()`, which generates native code. Also, this loop happens while the JVM is still in single-threaded mode, so there's no contention on the lock. The cost of taking this lock is negligible.
>
> Thanks for confirming.

After offline discussion with @coleep, we decided to not take this lock at all, as we will never have contention. I added a comment to explain why.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20959#discussion_r1803909285


More information about the hotspot-dev mailing list