diff options
author | 2018-06-20 17:45:41 -0700 | |
---|---|---|
committer | 2018-06-20 17:48:08 -0700 | |
commit | 88ea61ef73d4c670ae6188f60e1d07bb8befc895 (patch) | |
tree | 4be800ea6e2e6ea7b985649c62a3a88841eb1720 /runtime/mirror/dex_cache-inl.h | |
parent | 15bdbf1e189d998cb0f63772a456190cf85bc777 (diff) |
Refactor WriteBarrier logic into its own file
Refactor write barrier logic to have the null check logic in the
barrier if possible.
Moved the logic into its own file.
Test: test-art-host
Change-Id: I8292cd7f01dbdddea7aeab6e01da4d309ab452fe
Diffstat (limited to 'runtime/mirror/dex_cache-inl.h')
-rw-r--r-- | runtime/mirror/dex_cache-inl.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h index e64a325024..faec6e6bf8 100644 --- a/runtime/mirror/dex_cache-inl.h +++ b/runtime/mirror/dex_cache-inl.h @@ -34,6 +34,7 @@ #include "mirror/method_type.h" #include "obj_ptr.h" #include "runtime.h" +#include "write_barrier-inl.h" #include <atomic> @@ -76,7 +77,7 @@ inline void DexCache::SetResolvedString(dex::StringIndex string_idx, ObjPtr<Stri runtime->RecordResolveString(this, string_idx); } // TODO: Fine-grained marking, so that we don't need to go through all arrays in full. - runtime->GetHeap()->WriteBarrierEveryFieldOf(this); + WriteBarrier::ForEveryFieldWrite(this); } inline void DexCache::ClearString(dex::StringIndex string_idx) { @@ -113,7 +114,7 @@ inline void DexCache::SetResolvedType(dex::TypeIndex type_idx, ObjPtr<Class> res GetResolvedTypes()[TypeSlotIndex(type_idx)].store( TypeDexCachePair(resolved, type_idx.index_), std::memory_order_release); // TODO: Fine-grained marking, so that we don't need to go through all arrays in full. - Runtime::Current()->GetHeap()->WriteBarrierEveryFieldOf(this); + WriteBarrier::ForEveryFieldWrite(this); } inline void DexCache::ClearResolvedType(dex::TypeIndex type_idx) { @@ -145,7 +146,7 @@ inline void DexCache::SetResolvedMethodType(dex::ProtoIndex proto_idx, MethodTyp GetResolvedMethodTypes()[MethodTypeSlotIndex(proto_idx)].store( MethodTypeDexCachePair(resolved, proto_idx.index_), std::memory_order_relaxed); // TODO: Fine-grained marking, so that we don't need to go through all arrays in full. - Runtime::Current()->GetHeap()->WriteBarrierEveryFieldOf(this); + WriteBarrier::ForEveryFieldWrite(this); } inline CallSite* DexCache::GetResolvedCallSite(uint32_t call_site_idx) { @@ -171,7 +172,7 @@ inline ObjPtr<CallSite> DexCache::SetResolvedCallSite(uint32_t call_site_idx, reinterpret_cast<Atomic<GcRoot<mirror::CallSite>>&>(target); if (ref.CompareAndSetStrongSequentiallyConsistent(null_call_site, candidate)) { // TODO: Fine-grained marking, so that we don't need to go through all arrays in full. - Runtime::Current()->GetHeap()->WriteBarrierEveryFieldOf(this); + WriteBarrier::ForEveryFieldWrite(this); return call_site; } else { return target.Read(); |