From 60bc39c8eb0e5d7328bf59a96e9eedfc6f0a4aeb Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 27 Jan 2016 18:37:48 -0800 Subject: [PATCH] Remove some more read barriers in image relocation Bug: 26786304 Bug: 22858531 Change-Id: I70dacae7657ebf6dac2b3dad7726eebe5a2b2649 --- runtime/gc/space/image_space.cc | 6 +++--- runtime/mirror/dex_cache-inl.h | 10 ++++------ runtime/mirror/dex_cache.h | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc index 891e280ab..f6079232b 100644 --- a/runtime/gc/space/image_space.cc +++ b/runtime/gc/space/image_space.cc @@ -1041,7 +1041,7 @@ static bool RelocateInPlace(ImageHeader& image_header, auto* dex_caches = image_header.GetImageRoot(ImageHeader::kDexCaches)-> AsObjectArray(); for (int32_t i = 0, count = dex_caches->GetLength(); i < count; ++i) { - mirror::DexCache* dex_cache = dex_caches->Get(i); + mirror::DexCache* dex_cache = dex_caches->Get(i); // Fix up dex cache pointers. GcRoot* strings = dex_cache->GetStrings(); if (strings != nullptr) { @@ -1049,7 +1049,7 @@ static bool RelocateInPlace(ImageHeader& image_header, if (strings != new_strings) { dex_cache->SetFieldPtr64(mirror::DexCache::StringsOffset(), new_strings); } - dex_cache->FixupStrings(new_strings, fixup_adapter); + dex_cache->FixupStrings(new_strings, fixup_adapter); } GcRoot* types = dex_cache->GetResolvedTypes(); if (types != nullptr) { @@ -1057,7 +1057,7 @@ static bool RelocateInPlace(ImageHeader& image_header, if (types != new_types) { dex_cache->SetFieldPtr64(mirror::DexCache::ResolvedTypesOffset(), new_types); } - dex_cache->FixupResolvedTypes(new_types, fixup_adapter); + dex_cache->FixupResolvedTypes(new_types, fixup_adapter); } ArtMethod** methods = dex_cache->GetResolvedMethods(); if (methods != nullptr) { diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h index 2ecc9fb1a..2da3d8479 100644 --- a/runtime/mirror/dex_cache-inl.h +++ b/runtime/mirror/dex_cache-inl.h @@ -142,12 +142,11 @@ inline void DexCache::VisitReferences(mirror::Class* klass, const Visitor& visit } } -template +template inline void DexCache::FixupStrings(GcRoot* dest, const Visitor& visitor) { GcRoot* src = GetStrings(); for (size_t i = 0, count = NumStrings(); i < count; ++i) { - // TODO: Probably don't need read barrier for most callers. - mirror::String* source = src[i].Read(); + mirror::String* source = src[i].Read(); mirror::String* new_source = visitor(source); if (source != new_source) { dest[i] = GcRoot(new_source); @@ -155,12 +154,11 @@ inline void DexCache::FixupStrings(GcRoot* dest, const Visitor& } } -template +template inline void DexCache::FixupResolvedTypes(GcRoot* dest, const Visitor& visitor) { GcRoot* src = GetResolvedTypes(); for (size_t i = 0, count = NumResolvedTypes(); i < count; ++i) { - // TODO: Probably don't need read barrier for most callers. - mirror::Class* source = src[i].Read(); + mirror::Class* source = src[i].Read(); mirror::Class* new_source = visitor(source); if (source != new_source) { dest[i] = GcRoot(new_source); diff --git a/runtime/mirror/dex_cache.h b/runtime/mirror/dex_cache.h index 0002076ce..7912510f9 100644 --- a/runtime/mirror/dex_cache.h +++ b/runtime/mirror/dex_cache.h @@ -61,11 +61,11 @@ class MANAGED DexCache FINAL : public Object { void Fixup(ArtMethod* trampoline, size_t pointer_size) SHARED_REQUIRES(Locks::mutator_lock_); - template + template void FixupStrings(GcRoot* dest, const Visitor& visitor) SHARED_REQUIRES(Locks::mutator_lock_); - template + template void FixupResolvedTypes(GcRoot* dest, const Visitor& visitor) SHARED_REQUIRES(Locks::mutator_lock_); -- 2.11.0