RFR: 8252794: Creation of JNIMethodBlock should be done with a leaf lock
David Holmes
dholmes at openjdk.java.net
Wed Sep 9 01:32:54 UTC 2020
On Mon, 7 Sep 2020 12:16:17 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
> JVM TI uses handshakes and sometimes need jmethod ids.
> The CLD have an area where these ids are saved, which is created on first request for an id.
>
> The creation of this area should be done with a leaf lock.
> In W.I.P. asynchronous handshake change-set we use a mutex instead of a semaphore for serializing the handshakes,
> we thus get into lock ranks asserts.
>
> The CLD metaspace lock cannot be pushed down but we can use the same lock as for creating jmethod ids:
> JmethodIdCreation_lock. And push that down. (special-2 is picked to be compatible with W.I.P. asynchronous handshake
> change-set)
> The reason for CLD metaspace lock being used now is that we have one per CLD instead of one global one.
>
> Testing passes: t1-3
The locking strategy in this code is somewhat unclear.
src/hotspot/share/oops/method.cpp line 2190:
> 2188: // Also have to add the method to the list safely, which the cld lock
> 2189: // protects as well.
> 2190: MutexLocker ml(JmethodIdCreation_lock, Mutex::_no_safepoint_check_flag);
The comment above this states:
// Also have to add the method to the list safely, which the cld lock
// protects as well.
I don't know what list is being referred to here but either the comment is incorrect or else the change of lock is
incorrect!
src/hotspot/share/oops/method.cpp line 2214:
> 2212: // Also have to add the method to the list safely, which the cld lock
> 2213: // protects as well.
> 2214: MutexLocker ml(JmethodIdCreation_lock, Mutex::_no_safepoint_check_flag);
Ditto
-------------
Changes requested by dholmes (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/53
More information about the hotspot-dev
mailing list