From f7ab8348b88b7ce63c5fa112f5a71756da541763 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 7 Jun 2017 08:14:13 +0000 Subject: Revert "Fixed Literal String intern mismatch." bug: 62337922 This reverts commit 762ef842d78b6f8a76f2b119504f075728540077. Change-Id: Idfa3a9271e3dfb92dc849f68b97c8eeeb2732abc --- compiler/driver/compiler_driver.cc | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 0097f55e53..d008060309 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -2426,9 +2426,33 @@ class InitializeClassVisitor : public CompilationVisitor { } } + bool NoPotentialInternStrings(Handle klass, + Handle* class_loader) + REQUIRES_SHARED(Locks::mutator_lock_) { + StackHandleScope<1> hs(Thread::Current()); + Handle 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); + auto rtn_type = m->GetReturnType(true); // return value is discarded because resolve will be done internally. if (rtn_type == nullptr) { self->ClearException(); return false; @@ -2553,7 +2577,7 @@ class InitializeClassVisitor : public CompilationVisitor { return false; } - return true; + return NoPotentialInternStrings(klass, class_loader); } const ParallelCompilationManager* const manager_; -- cgit v1.2.3-59-g8ed1b