Fixed Literal String intern mismatch.
Literal Strings in app images are interned into local intern tables
which causes mismatch with the runtime intern table, especially when
a string is loaded from app images twice. Now when .art is loaded, a
visitor go through all classes and their fields to intern every string
literal found again.
Test case 596 is updated to test the string intern functioanlity.
Test on devices Nexus 5X, fixing strings takes 5.4 ms on GoogleMap
during startup.
Bug: 62224799
Test: test-art-host -j64
Change-Id: I2e1d44a79db1ae5f9aec80f228128201d1d838d8
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 70c3f60..3fdfb31 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -2424,33 +2424,9 @@
}
}
- bool NoPotentialInternStrings(Handle<mirror::Class> klass,
- Handle<mirror::ClassLoader>* class_loader)
- REQUIRES_SHARED(Locks::mutator_lock_) {
- StackHandleScope<1> hs(Thread::Current());
- Handle<mirror::DexCache> h_dex_cache = hs.NewHandle(klass->GetDexCache());
- const DexFile* dex_file = h_dex_cache->GetDexFile();
- const DexFile::ClassDef* class_def = klass->GetClassDef();
- annotations::RuntimeEncodedStaticFieldValueIterator value_it(*dex_file,
- &h_dex_cache,
- class_loader,
- manager_->GetClassLinker(),
- *class_def);
-
- const auto jString = annotations::RuntimeEncodedStaticFieldValueIterator::kString;
- for ( ; value_it.HasNext(); value_it.Next()) {
- if (value_it.GetValueType() == jString) {
- // We don't want cache the static encoded strings which is a potential intern.
- return false;
- }
- }
-
- return true;
- }
-
bool ResolveTypesOfMethods(Thread* self, ArtMethod* m)
REQUIRES_SHARED(Locks::mutator_lock_) {
- auto rtn_type = m->GetReturnType(true); // return value is discarded because resolve will be done internally.
+ auto rtn_type = m->GetReturnType(true);
if (rtn_type == nullptr) {
self->ClearException();
return false;
@@ -2575,7 +2551,7 @@
return false;
}
- return NoPotentialInternStrings(klass, class_loader);
+ return true;
}
const ParallelCompilationManager* const manager_;