OSDN Git Service

Fix race condition btw DelayReferenceRefernent vs Reference.clear().
authorHiroshi Yamauchi <yamauchi@google.com>
Mon, 19 Dec 2016 19:44:47 +0000 (11:44 -0800)
committerHiroshi Yamauchi <yamauchi@google.com>
Mon, 19 Dec 2016 19:44:47 +0000 (11:44 -0800)
commit65f5f247a367af9d6b9ac63767b69ecf3ab079bc
treebff631b0efd7e8fe77be9c445ea9224e2b67433b
parent5b32b91d731d6187ada4c6fc804041b7b3b6903c
Fix race condition btw DelayReferenceRefernent vs Reference.clear().

Rename IsMarkedHeapReference to IsNullOrMarkedHeapReference.

Move the null check from the caller of IsMarkedHeapReference into
IsNullOrMarkedHeapReference.

Make sure that the referent is only loaded once between the null
check and the IsMarked call.

Use a CAS in ConcurrentCopying::IsNullOrMarkedHeapReference when
called from DelayReferenceRefernent.

Bug: 33389022
Test: test-art-host without and with CC.

Change-Id: I20edab4dac2a4bb02dbb72af0f09de77b55ac08e
13 files changed:
runtime/gc/collector/concurrent_copying.cc
runtime/gc/collector/concurrent_copying.h
runtime/gc/collector/garbage_collector.h
runtime/gc/collector/mark_compact.cc
runtime/gc/collector/mark_compact.h
runtime/gc/collector/mark_sweep.cc
runtime/gc/collector/mark_sweep.h
runtime/gc/collector/semi_space.cc
runtime/gc/collector/semi_space.h
runtime/gc/reference_processor.cc
runtime/gc/reference_queue.cc
runtime/mirror/object_reference-inl.h
runtime/mirror/object_reference.h