8258746: illegal access to global field _jvmci_old_thread_counters by terminated thread causes crash

Reviewed-by: dholmes, kvn
(cherry picked from commit d9cb068f4b)
This commit is contained in:
Dean Long
2021-06-26 20:07:04 +00:00
committed by Vitaly Provodin
parent 6c41e2ee42
commit d81ce2f65c

View File

@@ -1239,11 +1239,6 @@ JavaThread::~JavaThread() {
#if INCLUDE_JVMCI
if (JVMCICounterSize > 0) {
if (jvmci_counters_include(this)) {
for (int i = 0; i < JVMCICounterSize; i++) {
_jvmci_old_thread_counters[i] += _jvmci_counters[i];
}
}
FREE_C_HEAP_ARRAY(jlong, _jvmci_counters);
}
#endif // INCLUDE_JVMCI
@@ -1499,6 +1494,17 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
_timer_exit_phase3.stop();
_timer_exit_phase4.start();
}
#if INCLUDE_JVMCI
if (JVMCICounterSize > 0) {
if (jvmci_counters_include(this)) {
for (int i = 0; i < JVMCICounterSize; i++) {
_jvmci_old_thread_counters[i] += _jvmci_counters[i];
}
}
}
#endif // INCLUDE_JVMCI
// Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
Threads::remove(this, daemon);