summaryrefslogtreecommitdiff
path: root/runtime/native/java_lang_DexCache.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-12-20 16:24:13 +0000
committer Vladimir Marko <vmarko@google.com> 2017-01-30 10:21:16 +0000
commitec7862283dd49f5a58d0ac45960ce27c2f7671b8 (patch)
tree26d6dcc1d5ed4f0ba5ac15f17ef7377215684bf6 /runtime/native/java_lang_DexCache.cc
parentc01d49091f4588777db5bf45345f388058caa99f (diff)
Hash-based dex cache type array.
Test: m test-art-host (Interpreter, Optimizing, JIT) Test: m test-art-target on Nexus 6P (Interpreter, Optimizing, JIT) Test: Nexus 6P boots Test: m valgrind-test-art-host Bug: 30627598 Bug: 34659969 Bug: 30419309 Change-Id: Ic00eda89e58088a3573fc9ec0ad04c0e69e161d1
Diffstat (limited to 'runtime/native/java_lang_DexCache.cc')
-rw-r--r--runtime/native/java_lang_DexCache.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/runtime/native/java_lang_DexCache.cc b/runtime/native/java_lang_DexCache.cc
index f1c350f23c..0b667fec45 100644
--- a/runtime/native/java_lang_DexCache.cc
+++ b/runtime/native/java_lang_DexCache.cc
@@ -53,7 +53,7 @@ static jobject DexCache_getDexNative(JNIEnv* env, jobject javaDexCache) {
static jobject DexCache_getResolvedType(JNIEnv* env, jobject javaDexCache, jint type_index) {
ScopedFastNativeObjectAccess soa(env);
ObjPtr<mirror::DexCache> dex_cache = soa.Decode<mirror::DexCache>(javaDexCache);
- CHECK_LT(static_cast<size_t>(type_index), dex_cache->NumResolvedTypes());
+ CHECK_LT(static_cast<size_t>(type_index), dex_cache->GetDexFile()->NumTypeIds());
return soa.AddLocalReference<jobject>(dex_cache->GetResolvedType(dex::TypeIndex(type_index)));
}
@@ -69,8 +69,11 @@ static void DexCache_setResolvedType(JNIEnv* env, jobject javaDexCache, jint typ
jobject type) {
ScopedFastNativeObjectAccess soa(env);
ObjPtr<mirror::DexCache> dex_cache = soa.Decode<mirror::DexCache>(javaDexCache);
- CHECK_LT(static_cast<size_t>(type_index), dex_cache->NumResolvedTypes());
- dex_cache->SetResolvedType(dex::TypeIndex(type_index), soa.Decode<mirror::Class>(type));
+ CHECK_LT(static_cast<size_t>(type_index), dex_cache->GetDexFile()->NumTypeIds());
+ ObjPtr<mirror::Class> t = soa.Decode<mirror::Class>(type);
+ if (t != nullptr) {
+ dex_cache->SetResolvedType(dex::TypeIndex(type_index), t);
+ }
}
static void DexCache_setResolvedString(JNIEnv* env, jobject javaDexCache, jint string_index,
@@ -78,7 +81,10 @@ static void DexCache_setResolvedString(JNIEnv* env, jobject javaDexCache, jint s
ScopedFastNativeObjectAccess soa(env);
ObjPtr<mirror::DexCache> dex_cache = soa.Decode<mirror::DexCache>(javaDexCache);
CHECK_LT(static_cast<size_t>(string_index), dex_cache->GetDexFile()->NumStringIds());
- dex_cache->SetResolvedString(dex::StringIndex(string_index), soa.Decode<mirror::String>(string));
+ ObjPtr<mirror::String> s = soa.Decode<mirror::String>(string);
+ if (s != nullptr) {
+ dex_cache->SetResolvedString(dex::StringIndex(string_index), s);
+ }
}
static JNINativeMethod gMethods[] = {