mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 01:24:33 +02:00
8288139: JavaThread touches oop after GC barrier is detached
Reviewed-by: pchilanomate, dholmes, rehn, eosterlund
This commit is contained in:
parent
e26d3b3c01
commit
a144988600
4 changed files with 16 additions and 13 deletions
|
@ -123,6 +123,7 @@
|
|||
#include "services/attachListener.hpp"
|
||||
#include "services/management.hpp"
|
||||
#include "services/memTracker.hpp"
|
||||
#include "services/threadIdTable.hpp"
|
||||
#include "services/threadService.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
#include "utilities/copy.hpp"
|
||||
|
@ -3594,6 +3595,13 @@ void Threads::remove(JavaThread* p, bool is_daemon) {
|
|||
// that we do not remove thread without safepoint code notice
|
||||
{ MonitorLocker ml(Threads_lock);
|
||||
|
||||
if (ThreadIdTable::is_initialized()) {
|
||||
// This cleanup must be done before the current thread's GC barrier
|
||||
// is detached since we need to touch the threadObj oop.
|
||||
jlong tid = SharedRuntime::get_java_tid(p);
|
||||
ThreadIdTable::remove_thread(tid);
|
||||
}
|
||||
|
||||
// BarrierSet state must be destroyed after the last thread transition
|
||||
// before the thread terminates. Thread transitions result in calls to
|
||||
// StackWatermarkSet::on_safepoint(), which performs GC processing,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue