diff options
author | 2023-10-19 19:44:46 +0000 | |
---|---|---|
committer | 2023-10-23 18:36:14 +0000 | |
commit | ea6525ab31ca14d5a919a244824cc8e63ba8c767 (patch) | |
tree | 59f7572f2152a0f643ed19c66e21261c3f94fd3b /runtime/gc/reference_queue.h | |
parent | 23bdf0606a4d97050de96dfb5a87c32587721579 (diff) |
Use release memory-order when going from gray to non-gray state
At certain places we were using `relaxed` order which allows
reordering the preceding stores of to-space references in the object
after the state change.
Bug: 302845084
Test: art/test/testrunner/testrunner.py
Change-Id: Ibbf27c8fa9eda2bf9635c69668b3750139178a30
Diffstat (limited to 'runtime/gc/reference_queue.h')
-rw-r--r-- | runtime/gc/reference_queue.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/gc/reference_queue.h b/runtime/gc/reference_queue.h index 3fda7167d4..69f04d783a 100644 --- a/runtime/gc/reference_queue.h +++ b/runtime/gc/reference_queue.h @@ -80,8 +80,10 @@ class ReferenceQueue { // If applicable, disable the read barrier for the reference after its referent is handled (see // ConcurrentCopying::ProcessMarkStackRef.) This must be called for a reference that's dequeued - // from pending queue (DequeuePendingReference). - void DisableReadBarrierForReference(ObjPtr<mirror::Reference> ref) + // from pending queue (DequeuePendingReference). 'order' is expected to be + // 'release' if called outside 'weak-ref access disabled' critical section. + // Otherwise 'relaxed' order will suffice. + void DisableReadBarrierForReference(ObjPtr<mirror::Reference> ref, std::memory_order order) REQUIRES_SHARED(Locks::mutator_lock_); // Enqueues finalizer references with white referents. White referents are blackened, moved to |