Remove Method's dex_cache_resolved_fields_
We no longer generate code to access dex_cache_resolved_fields_ and the
slow paths can access the dex cache with extra indirections. Removing
the field saves image space.
This change also requires Change I2e16e99d
Change-Id: Ic64df15f3982a2655942d7cd5157eb497f70af7d
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 17e4f4e..bc8e333 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1516,7 +1516,6 @@
dst->SetDexCacheStrings(klass->GetDexCache()->GetStrings());
dst->SetDexCacheResolvedTypes(klass->GetDexCache()->GetResolvedTypes());
dst->SetDexCacheResolvedMethods(klass->GetDexCache()->GetResolvedMethods());
- dst->SetDexCacheResolvedFields(klass->GetDexCache()->GetResolvedFields());
dst->SetDexCacheCodeAndDirectMethods(klass->GetDexCache()->GetCodeAndDirectMethods());
dst->SetDexCacheInitializedStaticStorage(klass->GetDexCache()->GetInitializedStaticStorage());
}
diff --git a/src/class_linker.h b/src/class_linker.h
index c49c03f..0b16533 100644
--- a/src/class_linker.h
+++ b/src/class_linker.h
@@ -170,7 +170,8 @@
}
Field* ResolveField(uint32_t field_idx, const Method* referrer, bool is_static) {
- Field* resolved_field = referrer->GetDexCacheResolvedFields()->Get(field_idx);
+ Field* resolved_field =
+ referrer->GetDeclaringClass()->GetDexCache()->GetResolvedField(field_idx);
if (UNLIKELY(resolved_field == NULL)) {
Class* declaring_class = referrer->GetDeclaringClass();
DexCache* dex_cache = declaring_class->GetDexCache();
@@ -193,7 +194,8 @@
bool is_static);
Field* ResolveFieldJLS(uint32_t field_idx, const Method* referrer) {
- Field* resolved_field = referrer->GetDexCacheResolvedFields()->Get(field_idx);
+ Field* resolved_field =
+ referrer->GetDeclaringClass()->GetDexCache()->GetResolvedField(field_idx);
if (UNLIKELY(resolved_field == NULL)) {
Class* declaring_class = referrer->GetDeclaringClass();
DexCache* dex_cache = declaring_class->GetDexCache();
diff --git a/src/class_linker_test.cc b/src/class_linker_test.cc
index 6ddbac0..bc13cb2 100644
--- a/src/class_linker_test.cc
+++ b/src/class_linker_test.cc
@@ -140,7 +140,6 @@
EXPECT_TRUE(method->GetDexCacheStrings() != NULL);
EXPECT_TRUE(method->GetDexCacheResolvedTypes() != NULL);
EXPECT_TRUE(method->GetDexCacheResolvedMethods() != NULL);
- EXPECT_TRUE(method->GetDexCacheResolvedFields() != NULL);
EXPECT_TRUE(method->GetDexCacheCodeAndDirectMethods() != NULL);
EXPECT_TRUE(method->GetDexCacheInitializedStaticStorage() != NULL);
EXPECT_EQ(method->GetDeclaringClass()->GetDexCache()->GetStrings(),
@@ -149,8 +148,6 @@
method->GetDexCacheResolvedTypes());
EXPECT_EQ(method->GetDeclaringClass()->GetDexCache()->GetResolvedMethods(),
method->GetDexCacheResolvedMethods());
- EXPECT_EQ(method->GetDeclaringClass()->GetDexCache()->GetResolvedFields(),
- method->GetDexCacheResolvedFields());
EXPECT_EQ(method->GetDeclaringClass()->GetDexCache()->GetCodeAndDirectMethods(),
method->GetDexCacheCodeAndDirectMethods());
EXPECT_EQ(method->GetDeclaringClass()->GetDexCache()->GetInitializedStaticStorage(),
@@ -449,7 +446,6 @@
offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Method, declaring_class_), "declaringClass"));
offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Method, dex_cache_code_and_direct_methods_), "dexCacheCodeAndDirectMethods"));
offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Method, dex_cache_initialized_static_storage_), "dexCacheInitializedStaticStorage"));
- offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Method, dex_cache_resolved_fields_), "dexCacheResolvedFields"));
offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Method, dex_cache_resolved_methods_), "dexCacheResolvedMethods"));
offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Method, dex_cache_resolved_types_), "dexCacheResolvedTypes"));
offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Method, dex_cache_strings_), "dexCacheStrings"));
diff --git a/src/object.cc b/src/object.cc
index 9e3e9d3..6be1136 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -365,16 +365,6 @@
new_dex_cache_methods, false);
}
-ObjectArray<Field>* Method::GetDexCacheResolvedFields() const {
- return GetFieldObject<ObjectArray<Field>*>(
- OFFSET_OF_OBJECT_MEMBER(Method, dex_cache_resolved_fields_), false);
-}
-
-void Method::SetDexCacheResolvedFields(ObjectArray<Field>* new_dex_cache_fields) {
- SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Method, dex_cache_resolved_fields_),
- new_dex_cache_fields, false);
-}
-
CodeAndDirectMethods* Method::GetDexCacheCodeAndDirectMethods() const {
return GetFieldPtr<CodeAndDirectMethods*>(
OFFSET_OF_OBJECT_MEMBER(Method, dex_cache_code_and_direct_methods_),
diff --git a/src/object.h b/src/object.h
index c2f8cc1..19ca325 100644
--- a/src/object.h
+++ b/src/object.h
@@ -596,10 +596,6 @@
return OFFSET_OF_OBJECT_MEMBER(Method, dex_cache_resolved_types_);
}
- static MemberOffset DexCacheResolvedFieldsOffset() {
- return OFFSET_OF_OBJECT_MEMBER(Method, dex_cache_resolved_fields_);
- }
-
static MemberOffset DexCacheInitializedStaticStorageOffset() {
return OFFSET_OF_OBJECT_MEMBER(Method,
dex_cache_initialized_static_storage_);
@@ -611,9 +607,6 @@
ObjectArray<Method>* GetDexCacheResolvedMethods() const;
void SetDexCacheResolvedMethods(ObjectArray<Method>* new_dex_cache_methods);
- ObjectArray<Field>* GetDexCacheResolvedFields() const;
- void SetDexCacheResolvedFields(ObjectArray<Field>* new_dex_cache_fields);
-
CodeAndDirectMethods* GetDexCacheCodeAndDirectMethods() const;
void SetDexCacheCodeAndDirectMethods(CodeAndDirectMethods* new_value);
@@ -875,9 +868,6 @@
ObjectArray<StaticStorageBase>* dex_cache_initialized_static_storage_;
// short cuts to declaring_class_->dex_cache_ member for fast compiled code access
- ObjectArray<Field>* dex_cache_resolved_fields_;
-
- // short cuts to declaring_class_->dex_cache_ member for fast compiled code access
ObjectArray<Method>* dex_cache_resolved_methods_;
// short cuts to declaring_class_->dex_cache_ member for fast compiled code access
diff --git a/src/runtime_support.cc b/src/runtime_support.cc
index 668191b..f9f3d07 100644
--- a/src/runtime_support.cc
+++ b/src/runtime_support.cc
@@ -447,7 +447,7 @@
// Fast path field resolution that can't throw exceptions
static Field* FindFieldFast(uint32_t field_idx, const Method* referrer, bool is_primitive,
size_t expected_size) {
- Field* resolved_field = referrer->GetDexCacheResolvedFields()->Get(field_idx);
+ Field* resolved_field = referrer->GetDeclaringClass()->GetDexCache()->GetResolvedField(field_idx);
if (UNLIKELY(resolved_field == NULL)) {
return NULL;
}