RFR: 8254842: [JVMCI] copy thread name when attaching libgraal thread to HotSpot

Doug Simon dnsimon at openjdk.java.net
Thu Oct 15 19:26:12 UTC 2020


On Thu, 15 Oct 2020 19:15:44 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> This PR modifies `HotSpotJVMCIRuntime.attachCurrentThread` when it is called from within libgraal so that the name of
>> the thread in the libgraal heap is used as the name of the peer thread created in HotSpot.
>> This useful when viewing output such as `-XX:JVMCITraceLevel=1`. For example, here's sample output without this PR:
>> JVMCITrace-1[Thread-0]: initializing JVMCI runtime -1
>> JVMCITrace-1[Thread-0]: initialized JVMCI runtime -1
>> and then with:
>> JVMCITrace-1[LibGraalHotSpotGraalManagementInitialization]: initializing JVMCI runtime -1
>> JVMCITrace-1[LibGraalHotSpotGraalManagementInitialization]: initialized JVMCI runtime -1
>
> src/hotspot/share/jvmci/jvmciCompilerToVM.cpp line 2358:
> 
>> 2356:     JNIEnv* hotspotEnv;
>> 2357:
>> 2358:     int name_len = env->GetArrayLength(name);
> 
> `name` could be NULL based on code in attachCurrentThread. Should we check for NULL here?

It's not obvious, but the test against `IS_IN_NATIVE_IMAGE` in `HotSpotJVMCIRuntime.attachCurrentThread` is equivalent
to the `thread == NULL` test here. I'll add a comment (and maybe a `guarantee`) to clarify this.

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

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


More information about the hotspot-compiler-dev mailing list