RFR: 8282883: Use JVM_LEAF to avoid ThreadStateTransition for some simple JVM entries

David Holmes dholmes at openjdk.java.net
Thu Mar 10 13:21:43 UTC 2022


On Thu, 10 Mar 2022 09:18:49 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Some existing JVM_ENTRY routines are behavioral simple, they do not lock, GC or throw exceptions, we could use JVM_LEAF instead of JVM_ENTRY, to avoid ThreadStateTransition and safepoint checks.
>
> I am a bit concerned about `JVM_Yield`, though. AFAICS, `JVM_LEAF` should not run for too long, because that would interfere with safepointing, and yielding the thread does look like an invitation to de-schedule the thread for unknown amount of time. @dholmes-ora -- you looked at it, have you figured this is okay?

@shipilev JVM_LEAF keeps the thread `_thread_in_native` and so has no impact on safepoints etc (in contrast JRT_LEAF can be called while `_thread_in_java` which does impact safepointing). So your concern about yield is actually the wrong way round: the current JVM_ENTRY means we yield while `_thread_in_vm` which means that a safepoint cannot be reached until that thread gets rescheduled.

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

PR: https://git.openjdk.java.net/jdk/pull/7760


More information about the hotspot-runtime-dev mailing list