diff options
author | 2022-10-10 12:07:46 +0100 | |
---|---|---|
committer | 2022-10-13 11:36:34 +0000 | |
commit | 5111cb6b246c62a40806940076f9e10761f5f41c (patch) | |
tree | ef27b3465eef3c219e75d13276cecaf9441d6c4e /test/497-inlining-and-class-loader | |
parent | d828fc10982300728d02c97dfac1a0e3684551c8 (diff) |
Refactor and cleanup DexCache.
- Introduce macros to avoid duplicating code for each dex cache kind.
- Remove preResolvedStrings, this was unused.
- Remove dex cache length fields, we can easily infer them.
Test: test.py
Change-Id: I1e0bc8cf078ce8e09c4d756c63be32cb344fcce1
Diffstat (limited to 'test/497-inlining-and-class-loader')
-rw-r--r-- | test/497-inlining-and-class-loader/clear_dex_cache.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/497-inlining-and-class-loader/clear_dex_cache.cc b/test/497-inlining-and-class-loader/clear_dex_cache.cc index 36ec4eb65c..ddbcef59c8 100644 --- a/test/497-inlining-and-class-loader/clear_dex_cache.cc +++ b/test/497-inlining-and-class-loader/clear_dex_cache.cc @@ -34,7 +34,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_Main_cloneResolvedMethods(JNIEnv* env, ScopedObjectAccess soa(Thread::Current()); ObjPtr<mirror::DexCache> dex_cache = soa.Decode<mirror::Class>(cls)->GetDexCache(); size_t num_methods = dex_cache->NumResolvedMethods(); - mirror::MethodDexCacheType* methods = dex_cache->GetResolvedMethods(); + auto* methods = dex_cache->GetResolvedMethods(); CHECK_EQ(num_methods != 0u, methods != nullptr); if (num_methods == 0u) { return nullptr; @@ -48,7 +48,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_Main_cloneResolvedMethods(JNIEnv* env, CHECK(array != nullptr); ObjPtr<mirror::Array> decoded_array = soa.Decode<mirror::Array>(array); for (size_t i = 0; i != num_methods; ++i) { - auto pair = mirror::DexCache::GetNativePair(methods, i); + auto pair = methods->GetNativePair(i); uint32_t index = pair.index; ArtMethod* method = pair.object; if (sizeof(void*) == 4) { @@ -69,7 +69,7 @@ extern "C" JNIEXPORT void JNICALL Java_Main_restoreResolvedMethods( ScopedObjectAccess soa(Thread::Current()); ObjPtr<mirror::DexCache> dex_cache = soa.Decode<mirror::Class>(cls)->GetDexCache(); size_t num_methods = dex_cache->NumResolvedMethods(); - mirror::MethodDexCacheType* methods = dex_cache->GetResolvedMethods(); + auto* methods = dex_cache->GetResolvedMethods(); CHECK_EQ(num_methods != 0u, methods != nullptr); ObjPtr<mirror::Array> old = soa.Decode<mirror::Array>(old_cache); CHECK_EQ(methods != nullptr, old != nullptr); @@ -86,8 +86,8 @@ extern "C" JNIEXPORT void JNICALL Java_Main_restoreResolvedMethods( index = dchecked_integral_cast<uint32_t>(long_array->Get(2u * i)); method = reinterpret_cast64<ArtMethod*>(long_array->Get(2u * i + 1u)); } - mirror::MethodDexCachePair pair(method, index); - mirror::DexCache::SetNativePair(methods, i, pair); + mirror::NativeDexCachePair<ArtMethod> pair(method, index); + methods->SetNativePair(i, pair); } } |