diff options
author | Christopher Ferris <cferris@google.com> | 2014-07-11 06:44:39 +0000 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2014-07-11 06:44:39 +0000 |
commit | d4415e8bd04c4a9367744ff0149597b4f37a0e0a (patch) | |
tree | 97c42c08fd04034cf6cecadb39644bf9531be0f1 /runtime/gc/reference_processor.cc | |
parent | a9b870b73a155ce70c867d5b3f9758fab0b45f07 (diff) | |
download | android_art-d4415e8bd04c4a9367744ff0149597b4f37a0e0a.tar.gz android_art-d4415e8bd04c4a9367744ff0149597b4f37a0e0a.tar.bz2 android_art-d4415e8bd04c4a9367744ff0149597b4f37a0e0a.zip |
Revert "Revert "Add intrinsic for Reference.get()""
This reverts commit a9b870b73a155ce70c867d5b3f9758fab0b45f07.
Change-Id: Ic2a9b47f2b911bef4b764d10bc33cf000e4b4211
Diffstat (limited to 'runtime/gc/reference_processor.cc')
-rw-r--r-- | runtime/gc/reference_processor.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc index e52bc1fd1e..62d9e68273 100644 --- a/runtime/gc/reference_processor.cc +++ b/runtime/gc/reference_processor.cc @@ -17,7 +17,9 @@ #include "reference_processor.h" #include "mirror/object-inl.h" +#include "mirror/reference.h" #include "mirror/reference-inl.h" +#include "reference_processor-inl.h" #include "reflection.h" #include "ScopedLocalRef.h" #include "scoped_thread_state_change.h" @@ -27,18 +29,17 @@ namespace art { namespace gc { ReferenceProcessor::ReferenceProcessor() - : process_references_args_(nullptr, nullptr, nullptr), slow_path_enabled_(false), + : process_references_args_(nullptr, nullptr, nullptr), preserving_references_(false), lock_("reference processor lock", kReferenceProcessorLock), condition_("reference processor condition", lock_) { } void ReferenceProcessor::EnableSlowPath() { - Locks::mutator_lock_->AssertExclusiveHeld(Thread::Current()); - slow_path_enabled_ = true; + mirror::Reference::GetJavaLangRefReference()->SetSlowPathEnabled(true); } void ReferenceProcessor::DisableSlowPath(Thread* self) { - slow_path_enabled_ = false; + mirror::Reference::GetJavaLangRefReference()->SetSlowPathEnabled(false); condition_.Broadcast(self); } @@ -46,11 +47,11 @@ mirror::Object* ReferenceProcessor::GetReferent(Thread* self, mirror::Reference* mirror::Object* const referent = reference->GetReferent(); // If the referent is null then it is already cleared, we can just return null since there is no // scenario where it becomes non-null during the reference processing phase. - if (LIKELY(!slow_path_enabled_) || referent == nullptr) { + if (UNLIKELY(!SlowPathEnabled()) || referent == nullptr) { return referent; } MutexLock mu(self, lock_); - while (slow_path_enabled_) { + while (SlowPathEnabled()) { mirror::HeapReference<mirror::Object>* const referent_addr = reference->GetReferentReferenceAddr(); // If the referent became cleared, return it. Don't need barrier since thread roots can't get @@ -117,7 +118,7 @@ void ReferenceProcessor::ProcessReferences(bool concurrent, TimingLogger* timing process_references_args_.is_marked_callback_ = is_marked_callback; process_references_args_.mark_callback_ = mark_object_callback; process_references_args_.arg_ = arg; - CHECK_EQ(slow_path_enabled_, concurrent) << "Slow path must be enabled iff concurrent"; + CHECK_EQ(SlowPathEnabled(), concurrent) << "Slow path must be enabled iff concurrent"; } // Unless required to clear soft references with white references, preserve some white referents. if (!clear_soft_references) { |