From c66a8e55574d3d83f20ba7d0705f52ce34eb3dca Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 16 Apr 2024 16:17:24 +0000 Subject: Clean up target retrieval from `LinkerPatch`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 38313278 Change-Id: I637680589ba6f483b746bce567870f6d896d9fde --- compiler/linker/linker_patch.h | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'compiler/linker') diff --git a/compiler/linker/linker_patch.h b/compiler/linker/linker_patch.h index 6e09ea8954..19ee0e640c 100644 --- a/compiler/linker/linker_patch.h +++ b/compiler/linker/linker_patch.h @@ -25,6 +25,9 @@ #include "base/bit_utils.h" #include "base/macros.h" #include "dex/method_reference.h" +#include "dex/proto_reference.h" +#include "dex/string_reference.h" +#include "dex/type_reference.h" namespace art HIDDEN { @@ -236,42 +239,23 @@ class LinkerPatch { return MethodReference(target_dex_file_, method_idx_); } - const DexFile* TargetTypeDexFile() const { + TypeReference TargetType() const { DCHECK(patch_type_ == Type::kTypeRelative || patch_type_ == Type::kTypeBssEntry || patch_type_ == Type::kPublicTypeBssEntry || patch_type_ == Type::kPackageTypeBssEntry); - return target_dex_file_; + return TypeReference(target_dex_file_, dex::TypeIndex(type_idx_)); } - dex::TypeIndex TargetTypeIndex() const { - DCHECK(patch_type_ == Type::kTypeRelative || - patch_type_ == Type::kTypeBssEntry || - patch_type_ == Type::kPublicTypeBssEntry || - patch_type_ == Type::kPackageTypeBssEntry); - return dex::TypeIndex(type_idx_); - } - - const DexFile* TargetStringDexFile() const { + StringReference TargetString() const { DCHECK(patch_type_ == Type::kStringRelative || patch_type_ == Type::kStringBssEntry); - return target_dex_file_; - } - - dex::StringIndex TargetStringIndex() const { - DCHECK(patch_type_ == Type::kStringRelative || - patch_type_ == Type::kStringBssEntry); - return dex::StringIndex(string_idx_); - } - - const DexFile* TargetProtoDexFile() const { - DCHECK(patch_type_ == Type::kMethodTypeBssEntry); - return target_dex_file_; + return StringReference(target_dex_file_, dex::StringIndex(string_idx_)); } - dex::ProtoIndex TargetProtoIndex() const { + ProtoReference TargetProto() const { DCHECK(patch_type_ == Type::kMethodTypeBssEntry); - return dex::ProtoIndex(proto_idx_); + return ProtoReference(target_dex_file_, dex::ProtoIndex(proto_idx_)); } uint32_t PcInsnOffset() const { -- cgit v1.2.3-59-g8ed1b