Skip to content

Commit e39754b

Browse files
committed
[GR-74207] Guard JVMTI VTMS thread state fixup for attaching threads
PullRequest: labsjdk-ce/274
2 parents 52f04aa + a4fd587 commit e39754b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.ci/ci.jsonnet

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ local common = import 'common.libsonnet';
375375
targets: ['gate'],
376376
deploysArtifacts: true,
377377

378+
local skip_fastdebug = conf.name == '-windows-cygwin-amd64',
379+
378380
local build_labsjdk(jdk_debug_level, java_home_env_var) = [
379381
['set-export', java_home_env_var, conf.path('${PWD}/../%s-java-home' % jdk_debug_level)],
380382
['python3', '-u', conf.path('${LABSJDK_BUILDER_DIR}/build_labsjdk.py'),
@@ -403,7 +405,7 @@ local common = import 'common.libsonnet';
403405
['set-export', 'JIB_DATA_DIR', conf.path('${PWD}/../jib')],
404406
] +
405407
build_labsjdk('release', 'JAVA_HOME') +
406-
build_labsjdk('fastdebug', 'JAVA_HOME_FASTDEBUG'),
408+
(if skip_fastdebug then [] else build_labsjdk('fastdebug', 'JAVA_HOME_FASTDEBUG')),
407409
},
408410

409411
local build_confs(defs) = [

src/hotspot/share/prims/jvmtiEnvBase.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1671,9 +1671,13 @@ class VM_SetNotifyJvmtiEventsMode : public VM_Operation {
16711671

16721672
static void correct_jvmti_thread_state(JavaThread* jt) {
16731673
oop ct_oop = jt->threadObj();
1674+
// JNI-attaching threads may not have a java.lang.Thread yet.
1675+
if (ct_oop == nullptr) {
1676+
return;
1677+
}
16741678
oop vt_oop = jt->vthread();
16751679
JvmtiThreadState* jt_state = jt->jvmti_thread_state();
1676-
JvmtiThreadState* ct_state = java_lang_Thread::jvmti_thread_state(jt->threadObj());
1680+
JvmtiThreadState* ct_state = java_lang_Thread::jvmti_thread_state(ct_oop);
16771681
JvmtiThreadState* vt_state = vt_oop != nullptr ? java_lang_Thread::jvmti_thread_state(vt_oop) : nullptr;
16781682
bool virt = vt_oop != nullptr && java_lang_VirtualThread::is_instance(vt_oop);
16791683

0 commit comments

Comments
 (0)