On Mon, 27 Nov 2023 20:38:03 GMT, Bernd <d...@openjdk.org> wrote:

>> src/java.management/share/classes/java/lang/management/ThreadInfo.java line 
>> 552:
>> 
>>> 550:      * java.lang.invoke.MethodHandle method handle} obtained from the
>>> 551:      * {@linkplain java.lang.foreign.Linker native linker}.
>>> 552:      *
>> 
>> This area is new to me, but I happened to be in this code few days back. I'm 
>> mostly curious on what the actual definition of a thread being in native 
>> means.
>> When a thread is executing any of the following,  does it end up being 
>> considered as being in a "native method":
>> 
>> - A syscall (for example, `write()`)
>> - A C function exposed by a platform specific library
>> - A JNI method (either part of the JDK or the application) which then may or 
>> may not do any syscall or C function call on a platform specific library
>
> I would agree, it should state if runtime functions (including those doing a 
> syscall) will be counted here. (For JNi i would not need it to be spelled 
> out, on the other hand it would help, since it makes clear we don’t mean c2 
> code)

This `isInNative` method intends to provide a way to tell if the thread has 
transitioned from executing Java method to a native method.  JVM interpreter 
and compiler provide the support for Java language which is why I think such 
clarification might not be highly necessary.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16791#discussion_r1406737205

Reply via email to