From 488413f47e7552d067edf9cfd5ceda321fc12f88 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Fri, 12 Apr 2024 11:00:19 +0000 Subject: Faster `HLoadClass` for app image classes. Add app image relocations for classes in the app image, similar to the existing relocations for boot image. This new load kind lets the compiled code avoid the null check and slow path. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --speed-profile Test: run-test.sh Test: testrunner.py --target --optimizing --speed-profile Bug: 38313278 Change-Id: Iffd76fe9ac6b95c37c2781fd6257e1d5cd0790d0 --- compiler/linker/linker_patch.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'compiler/linker/linker_patch.h') diff --git a/compiler/linker/linker_patch.h b/compiler/linker/linker_patch.h index 19ee0e640c..b061e042f0 100644 --- a/compiler/linker/linker_patch.h +++ b/compiler/linker/linker_patch.h @@ -54,6 +54,7 @@ class LinkerPatch { kJniEntrypointRelative, kCallRelative, kTypeRelative, + kTypeAppImageRelRo, kTypeBssEntry, kPublicTypeBssEntry, kPackageTypeBssEntry, @@ -130,6 +131,16 @@ class LinkerPatch { return patch; } + static LinkerPatch TypeAppImageRelRoPatch(size_t literal_offset, + const DexFile* target_dex_file, + uint32_t pc_insn_offset, + uint32_t target_type_idx) { + LinkerPatch patch(literal_offset, Type::kTypeAppImageRelRo, target_dex_file); + patch.type_idx_ = target_type_idx; + patch.pc_insn_offset_ = pc_insn_offset; + return patch; + } + static LinkerPatch TypeBssEntryPatch(size_t literal_offset, const DexFile* target_dex_file, uint32_t pc_insn_offset, @@ -241,6 +252,7 @@ class LinkerPatch { TypeReference TargetType() const { DCHECK(patch_type_ == Type::kTypeRelative || + patch_type_ == Type::kTypeAppImageRelRo || patch_type_ == Type::kTypeBssEntry || patch_type_ == Type::kPublicTypeBssEntry || patch_type_ == Type::kPackageTypeBssEntry); @@ -265,6 +277,7 @@ class LinkerPatch { patch_type_ == Type::kMethodBssEntry || patch_type_ == Type::kJniEntrypointRelative || patch_type_ == Type::kTypeRelative || + patch_type_ == Type::kTypeAppImageRelRo || patch_type_ == Type::kTypeBssEntry || patch_type_ == Type::kPublicTypeBssEntry || patch_type_ == Type::kPackageTypeBssEntry || -- cgit v1.2.3-59-g8ed1b