diff options
author | Lokesh Gidra <lokeshgidra@google.com> | 2019-12-04 13:46:11 -0800 |
---|---|---|
committer | Treehugger Robot <treehugger-gerrit@google.com> | 2019-12-05 01:53:26 +0000 |
commit | 9317031cd016e02a26cdeea8045df9925b33ffe2 (patch) | |
tree | b1278f6d99c2e4c1375c1d9031d552c9875a4e3c | |
parent | a0b4631f73547b44bff5c0c01b605d867cd083cc (diff) |
Move thread-local mark-stack revocation outside SOA
Revoking mark-stack inside a ScopedObjectAccess scope could potentially
call checkpoints in its destructor, which may trigger read-barrier,
after the mark-stack is revoked.
Test: art/test/testrunner/testrunner.py --target
Bug: 140119552
Change-Id: I90d62cbf5edbaf953de73aeb2b3b59612b6897d3
-rw-r--r-- | runtime/gc/collector/concurrent_copying.h | 3 | ||||
-rw-r--r-- | runtime/thread.cc | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/runtime/gc/collector/concurrent_copying.h b/runtime/gc/collector/concurrent_copying.h index dd295d153f..0240460874 100644 --- a/runtime/gc/collector/concurrent_copying.h +++ b/runtime/gc/collector/concurrent_copying.h @@ -150,8 +150,7 @@ class ConcurrentCopying : public GarbageCollector { bool IsWeakRefAccessEnabled() REQUIRES(Locks::thread_list_lock_) { return weak_ref_access_enabled_; } - void RevokeThreadLocalMarkStack(Thread* thread) REQUIRES_SHARED(Locks::mutator_lock_) - REQUIRES(!mark_stack_lock_); + void RevokeThreadLocalMarkStack(Thread* thread) REQUIRES(!mark_stack_lock_); mirror::Object* IsMarked(mirror::Object* from_ref) override REQUIRES_SHARED(Locks::mutator_lock_); diff --git a/runtime/thread.cc b/runtime/thread.cc index 290b87f496..59a170517c 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -2439,9 +2439,11 @@ void Thread::Destroy() { { ScopedObjectAccess soa(self); Runtime::Current()->GetHeap()->RevokeThreadLocalBuffers(this); - if (kUseReadBarrier) { - Runtime::Current()->GetHeap()->ConcurrentCopyingCollector()->RevokeThreadLocalMarkStack(this); - } + } + // Mark-stack revocation must be performed at the very end. No + // checkpoint/flip-function or read-barrier should be called after this. + if (kUseReadBarrier) { + Runtime::Current()->GetHeap()->ConcurrentCopyingCollector()->RevokeThreadLocalMarkStack(this); } } |