Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit d9cb068

Browse files
committed
8258746: illegal access to global field _jvmci_old_thread_counters by terminated thread causes crash
Reviewed-by: dholmes, kvn
1 parent 6eb734a commit d9cb068

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/hotspot/share/runtime/thread.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,11 +1239,6 @@ JavaThread::~JavaThread() {
12391239

12401240
#if INCLUDE_JVMCI
12411241
if (JVMCICounterSize > 0) {
1242-
if (jvmci_counters_include(this)) {
1243-
for (int i = 0; i < JVMCICounterSize; i++) {
1244-
_jvmci_old_thread_counters[i] += _jvmci_counters[i];
1245-
}
1246-
}
12471242
FREE_C_HEAP_ARRAY(jlong, _jvmci_counters);
12481243
}
12491244
#endif // INCLUDE_JVMCI
@@ -1499,6 +1494,17 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
14991494
_timer_exit_phase3.stop();
15001495
_timer_exit_phase4.start();
15011496
}
1497+
1498+
#if INCLUDE_JVMCI
1499+
if (JVMCICounterSize > 0) {
1500+
if (jvmci_counters_include(this)) {
1501+
for (int i = 0; i < JVMCICounterSize; i++) {
1502+
_jvmci_old_thread_counters[i] += _jvmci_counters[i];
1503+
}
1504+
}
1505+
}
1506+
#endif // INCLUDE_JVMCI
1507+
15021508
// Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
15031509
Threads::remove(this, daemon);
15041510

0 commit comments

Comments
 (0)