diff options
Diffstat (limited to 'runtime/mirror/dex_cache.cc')
-rw-r--r-- | runtime/mirror/dex_cache.cc | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/runtime/mirror/dex_cache.cc b/runtime/mirror/dex_cache.cc index b7f8ee7a07..1d9fecdd11 100644 --- a/runtime/mirror/dex_cache.cc +++ b/runtime/mirror/dex_cache.cc @@ -52,45 +52,47 @@ void DexCache::Initialize(const DexFile* dex_file, ObjPtr<ClassLoader> class_loa void DexCache::VisitReflectiveTargets(ReflectiveValueVisitor* visitor) { bool wrote = false; - FieldDexCacheType* fields = GetResolvedFields(); + auto* fields = GetResolvedFields(); size_t num_fields = NumResolvedFields(); // Check both the data pointer and count since the array might be initialized // concurrently on other thread, and we might observe just one of the values. for (size_t i = 0; fields != nullptr && i < num_fields; i++) { - auto pair(GetNativePair(fields, i)); - if (pair.index == FieldDexCachePair::InvalidIndexForSlot(i)) { + auto pair(fields->GetNativePair(i)); + if (pair.index == NativeDexCachePair<ArtField>::InvalidIndexForSlot(i)) { continue; } ArtField* new_val = visitor->VisitField( pair.object, DexCacheSourceInfo(kSourceDexCacheResolvedField, pair.index, this)); if (UNLIKELY(new_val != pair.object)) { if (new_val == nullptr) { - pair = FieldDexCachePair(nullptr, FieldDexCachePair::InvalidIndexForSlot(i)); + pair = NativeDexCachePair<ArtField>( + nullptr, NativeDexCachePair<ArtField>::InvalidIndexForSlot(i)); } else { pair.object = new_val; } - SetNativePair(fields, i, pair); + fields->SetNativePair(i, pair); wrote = true; } } - MethodDexCacheType* methods = GetResolvedMethods(); + auto* methods = GetResolvedMethods(); size_t num_methods = NumResolvedMethods(); // Check both the data pointer and count since the array might be initialized // concurrently on other thread, and we might observe just one of the values. for (size_t i = 0; methods != nullptr && i < num_methods; i++) { - auto pair(GetNativePair(methods, i)); - if (pair.index == MethodDexCachePair::InvalidIndexForSlot(i)) { + auto pair(methods->GetNativePair(i)); + if (pair.index == NativeDexCachePair<ArtMethod>::InvalidIndexForSlot(i)) { continue; } ArtMethod* new_val = visitor->VisitMethod( pair.object, DexCacheSourceInfo(kSourceDexCacheResolvedMethod, pair.index, this)); if (UNLIKELY(new_val != pair.object)) { if (new_val == nullptr) { - pair = MethodDexCachePair(nullptr, MethodDexCachePair::InvalidIndexForSlot(i)); + pair = NativeDexCachePair<ArtMethod>( + nullptr, NativeDexCachePair<ArtMethod>::InvalidIndexForSlot(i)); } else { pair.object = new_val; } - SetNativePair(methods, i, pair); + methods->SetNativePair(i, pair); wrote = true; } } @@ -106,12 +108,6 @@ void DexCache::ResetNativeArrays() { SetResolvedFields(nullptr); SetResolvedMethodTypes(nullptr); SetResolvedCallSites(nullptr); - SetField32<false>(NumStringsOffset(), 0); - SetField32<false>(NumResolvedTypesOffset(), 0); - SetField32<false>(NumResolvedMethodsOffset(), 0); - SetField32<false>(NumResolvedFieldsOffset(), 0); - SetField32<false>(NumResolvedMethodTypesOffset(), 0); - SetField32<false>(NumResolvedCallSitesOffset(), 0); } void DexCache::SetLocation(ObjPtr<mirror::String> location) { |