From d014fd019e84471665ac02f2de285541009892cd Mon Sep 17 00:00:00 2001 From: Almaz Mingaleev Date: Fri, 15 Dec 2023 11:48:05 +0000 Subject: Revert "x86_64: Store resolved MethodType-s in .bss." This reverts commit a627c7e71a59135daab7f2fb8505d4873f61e4ac. Reason for revert: 979-const-method-handle fails. Can repro with ITERATIONS_FOR_JIT set to 120_000 and ./art/test/testrunner/testrunner.py --host --64 --jit --no-jvmti --debug --prebuild --checkjni --cms --no-relocate --ntrace --cdex-fast -b -t 979-const Change-Id: I653a83aa12f2c28b163e0d43dbc95b8e8a190436 --- libdexfile/dex/method_reference.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'libdexfile/dex/method_reference.h') diff --git a/libdexfile/dex/method_reference.h b/libdexfile/dex/method_reference.h index 9d4eabef2a..f66ac30c53 100644 --- a/libdexfile/dex/method_reference.h +++ b/libdexfile/dex/method_reference.h @@ -21,7 +21,6 @@ #include #include "dex/dex_file.h" #include "dex/dex_file_reference.h" -#include "dex/proto_reference.h" namespace art { @@ -35,9 +34,6 @@ 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. @@ -66,8 +62,27 @@ struct MethodReferenceValueComparator { if (name_diff != 0) { return name_diff < 0; } - // Then compare protos. - return ProtoReferenceValueComparator()(mr1.GetProtoReference(), mr2.GetProtoReference()); + // 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; } }; -- cgit v1.2.3-59-g8ed1b