summaryrefslogtreecommitdiff
path: root/libdexfile/dex/method_reference.h
diff options
context:
space:
mode:
author Almaz Mingaleev <mingaleev@google.com> 2023-12-15 15:47:22 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-01-03 15:29:48 +0000
commit3f0981b56a1b9a415383c552c063b890c840b13e (patch)
tree4f5aae6900d024630a90401761905b5ce4847f08 /libdexfile/dex/method_reference.h
parent41c5dde40d1c75d36a7f984c8d72ec65fbff3111 (diff)
Revert^2 "x86_64: Store resolved MethodType-s in .bss."
This reverts commit d014fd019e84471665ac02f2de285541009892cd. Reason for revert: fix codegen to do runtime call in JIT for now. Bug: 297147201 Test: ./art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: ./art/test/testrunner/testrunner.py --jvm -b Test: ./art/test.py --host -b Test: ./art/test/testrunner/testrunner.py --host --64 --jit -b Change-Id: I0f01c8391b09659bb6195955ecd8f88159141872
Diffstat (limited to 'libdexfile/dex/method_reference.h')
-rw-r--r--libdexfile/dex/method_reference.h27
1 files changed, 6 insertions, 21 deletions
diff --git a/libdexfile/dex/method_reference.h b/libdexfile/dex/method_reference.h
index f66ac30c53..9d4eabef2a 100644
--- a/libdexfile/dex/method_reference.h
+++ b/libdexfile/dex/method_reference.h
@@ -21,6 +21,7 @@
#include <string>
#include "dex/dex_file.h"
#include "dex/dex_file_reference.h"
+#include "dex/proto_reference.h"
namespace art {
@@ -34,6 +35,9 @@ class MethodReference : public DexFileReference {
const dex::MethodId& GetMethodId() const {
return dex_file->GetMethodId(index);
}
+ const art::ProtoReference GetProtoReference() const {
+ return ProtoReference(dex_file, GetMethodId().proto_idx_);
+ }
};
// Compare the actual referenced method signatures. Used for method reference deduplication.
@@ -62,27 +66,8 @@ struct MethodReferenceValueComparator {
if (name_diff != 0) {
return name_diff < 0;
}
- // And then compare proto ids, starting with return type comparison.
- const dex::ProtoId& prid1 = mr1.dex_file->GetProtoId(mid1.proto_idx_);
- const dex::ProtoId& prid2 = mr2.dex_file->GetProtoId(mid2.proto_idx_);
- int return_type_diff = strcmp(mr1.dex_file->StringByTypeIdx(prid1.return_type_idx_),
- mr2.dex_file->StringByTypeIdx(prid2.return_type_idx_));
- if (return_type_diff != 0) {
- return return_type_diff < 0;
- }
- // And finishing with lexicographical parameter comparison.
- const dex::TypeList* params1 = mr1.dex_file->GetProtoParameters(prid1);
- size_t param1_size = (params1 != nullptr) ? params1->Size() : 0u;
- const dex::TypeList* params2 = mr2.dex_file->GetProtoParameters(prid2);
- size_t param2_size = (params2 != nullptr) ? params2->Size() : 0u;
- for (size_t i = 0, num = std::min(param1_size, param2_size); i != num; ++i) {
- int param_diff = strcmp(mr1.dex_file->StringByTypeIdx(params1->GetTypeItem(i).type_idx_),
- mr2.dex_file->StringByTypeIdx(params2->GetTypeItem(i).type_idx_));
- if (param_diff != 0) {
- return param_diff < 0;
- }
- }
- return param1_size < param2_size;
+ // Then compare protos.
+ return ProtoReferenceValueComparator()(mr1.GetProtoReference(), mr2.GetProtoReference());
}
};