RFR: 8226228: Make Threads_lock an always safepoint checked lock.

Robbin Ehn robbin.ehn at oracle.com
Mon Jun 17 11:21:10 UTC 2019


Hi all, please review.

A safepoint checked lock always check for safepoint if the locker is an
JavaThread. If it's not a JavaThread, the thread are not participating in the
safepoint protocol thus safepoints are not checked.

A JavaThread that is not on _the_ ThreadsList is not participating in the 
safepoint protocol and for most purposes should be treat as NonJavaThread.
This applies to whether we should check for a safepoint.

This changeset suggest adding a method for checking this.
We can use that method in the mutex code to determine if we should treat locker
as JavaThread or a NonJavaThread.

The only problematic scenario is when we are an active JavaThread in vmError.cpp 
but don't want to safepoint, but want the ThreadsList to be stable.
I choose a best effort approach.
Alternatives could be stop freeing the backing array if there is an an error or
letting the thread running the error code become an inactive JavaThread thus
avoiding safepointing.

This fix also helps converting Heap_lock to an always lock (Heap_lock needed
changes not included).

Issue:
https://bugs.openjdk.java.net/browse/JDK-8226228
Code:
http://cr.openjdk.java.net/~rehn/8226228/webrev/index.html

Passes t1-3.

Thanks, Robbin


More information about the hotspot-runtime-dev mailing list