ART: Move DexFileStringEquals to DexFile
Avoid a static function in an inline header being shared.
Bug: 119869270
Test: mmma art
Change-Id: If10189f92bca71c8bd3ef679bdc48a0dbc113fa3
diff --git a/libdexfile/dex/dex_file-inl.h b/libdexfile/dex/dex_file-inl.h
index cacd7dd..58fc893 100644
--- a/libdexfile/dex/dex_file-inl.h
+++ b/libdexfile/dex/dex_file-inl.h
@@ -154,8 +154,8 @@
offset;
}
-static inline bool DexFileStringEquals(const DexFile* df1, dex::StringIndex sidx1,
- const DexFile* df2, dex::StringIndex sidx2) {
+inline bool DexFile::StringEquals(const DexFile* df1, dex::StringIndex sidx1,
+ const DexFile* df2, dex::StringIndex sidx2) {
uint32_t s1_len; // Note: utf16 length != mutf8 length.
const char* s1_data = df1->StringDataAndUtf16LengthByIdx(sidx1, &s1_len);
uint32_t s2_len;
@@ -191,8 +191,8 @@
const dex::TypeId& return_type_id = dex_file_->GetTypeId(proto_id_->return_type_idx_);
const dex::TypeId& rhs_return_type_id =
rhs.dex_file_->GetTypeId(rhs.proto_id_->return_type_idx_);
- if (!DexFileStringEquals(dex_file_, return_type_id.descriptor_idx_,
- rhs.dex_file_, rhs_return_type_id.descriptor_idx_)) {
+ if (!DexFile::StringEquals(dex_file_, return_type_id.descriptor_idx_,
+ rhs.dex_file_, rhs_return_type_id.descriptor_idx_)) {
return false; // Return type mismatch.
}
}
@@ -208,8 +208,8 @@
const dex::TypeId& param_id = dex_file_->GetTypeId(params->GetTypeItem(i).type_idx_);
const dex::TypeId& rhs_param_id =
rhs.dex_file_->GetTypeId(rhs_params->GetTypeItem(i).type_idx_);
- if (!DexFileStringEquals(dex_file_, param_id.descriptor_idx_,
- rhs.dex_file_, rhs_param_id.descriptor_idx_)) {
+ if (!DexFile::StringEquals(dex_file_, param_id.descriptor_idx_,
+ rhs.dex_file_, rhs_param_id.descriptor_idx_)) {
return false; // Parameter type mismatch.
}
}
diff --git a/libdexfile/dex/dex_file.h b/libdexfile/dex/dex_file.h
index 104c38d..05e4b61 100644
--- a/libdexfile/dex/dex_file.h
+++ b/libdexfile/dex/dex_file.h
@@ -780,6 +780,9 @@
static uint32_t DecodeDebugInfoParameterNames(const uint8_t** debug_info,
const Visitor& visitor);
+ static inline bool StringEquals(const DexFile* df1, dex::StringIndex sidx1,
+ const DexFile* df2, dex::StringIndex sidx2);
+
protected:
// First Dex format version supporting default methods.
static const uint32_t kDefaultMethodsVersion = 37;
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index dd5b0d5..dd62853 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -189,7 +189,7 @@
}
const DexFile* dex_file2 = other->GetDexFile();
const dex::MethodId& mid2 = dex_file2->GetMethodId(other->GetDexMethodIndex());
- if (!DexFileStringEquals(dex_file, mid.name_idx_, dex_file2, mid2.name_idx_)) {
+ if (!DexFile::StringEquals(dex_file, mid.name_idx_, dex_file2, mid2.name_idx_)) {
return false; // Name mismatch.
}
return dex_file->GetMethodSignature(mid) == dex_file2->GetMethodSignature(mid2);