From eace45873190a27302b3644c32ec82854b59d299 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 24 Nov 2014 18:29:54 -0800 Subject: Move dexCacheStrings from ArtMethod to Class Adds one load for const strings which are not direct. Saves >= 60KB of memory avg per app. Image size: -350KB. Bug: 17643507 Change-Id: I2d1a3253d9de09682be9bc6b420a29513d592cc8 (cherry picked from commit f521f423b66e952f746885dd9f6cf8ef2788955d) --- runtime/class_linker.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/class_linker.cc') diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 677fdc9462..f092772239 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2780,6 +2780,7 @@ void ClassLinker::LoadClass(Thread* self, const DexFile& dex_file, klass->SetDexClassDefIndex(dex_file.GetIndexForClassDef(dex_class_def)); klass->SetDexTypeIndex(dex_class_def.class_idx_); + klass->SetDexCacheStrings(klass->GetDexCache()->GetStrings()); const uint8_t* class_data = dex_file.GetClassData(dex_class_def); if (class_data == nullptr) { @@ -2935,7 +2936,6 @@ mirror::ArtMethod* ClassLinker::LoadMethod(Thread* self, const DexFile& dex_file dst->SetDeclaringClass(klass.Get()); dst->SetCodeItemOffset(it.GetMethodCodeItemOffset()); - dst->SetDexCacheStrings(klass->GetDexCache()->GetStrings()); dst->SetDexCacheResolvedMethods(klass->GetDexCache()->GetResolvedMethods()); dst->SetDexCacheResolvedTypes(klass->GetDexCache()->GetResolvedTypes()); @@ -4063,7 +4063,6 @@ static void CheckProxyMethod(Handle method, // The proxy method doesn't have its own dex cache or dex file and so it steals those of its // interface prototype. The exception to this are Constructors and the Class of the Proxy itself. - CHECK_EQ(prototype->GetDexCacheStrings(), method->GetDexCacheStrings()); CHECK(prototype->HasSameDexCacheResolvedMethods(method.Get())); CHECK(prototype->HasSameDexCacheResolvedTypes(method.Get())); CHECK_EQ(prototype->GetDexMethodIndex(), method->GetDexMethodIndex()); -- cgit v1.2.3-59-g8ed1b