From 4d6fdd9fb379ac6e3575c3ec5406d808e0290636 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 31 Oct 2024 17:38:03 +0100 Subject: Use .data.img.rel.ro for app image methods. This should improve app startup as we can skip the target method resolution on the first call. For `invoke-direct` we should never go to the resolution trampoline for app image methods and for `invoke-static` we go to the trampoline only if the class is not yet visibly initialized and in that case we still save time as the target method is already known. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --speed-profile Test: run-gtests.sh Test: testrunner.py --target --optimizing --speed-profile Bug: 38313278 Change-Id: I1fea5485264b433fe642c9d0092a5411813eb996 --- 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 b061e042f0..4eb0782d52 100644 --- a/compiler/linker/linker_patch.h +++ b/compiler/linker/linker_patch.h @@ -50,6 +50,7 @@ class LinkerPatch { kIntrinsicReference, // Boot image reference for an intrinsic, see IntrinsicObjects. kBootImageRelRo, kMethodRelative, + kMethodAppImageRelRo, kMethodBssEntry, kJniEntrypointRelative, kCallRelative, @@ -93,6 +94,16 @@ class LinkerPatch { return patch; } + static LinkerPatch MethodAppImageRelRoPatch(size_t literal_offset, + const DexFile* target_dex_file, + uint32_t pc_insn_offset, + uint32_t target_method_idx) { + LinkerPatch patch(literal_offset, Type::kMethodAppImageRelRo, target_dex_file); + patch.method_idx_ = target_method_idx; + patch.pc_insn_offset_ = pc_insn_offset; + return patch; + } + static LinkerPatch MethodBssEntryPatch(size_t literal_offset, const DexFile* target_dex_file, uint32_t pc_insn_offset, @@ -244,6 +255,7 @@ class LinkerPatch { MethodReference TargetMethod() const { DCHECK(patch_type_ == Type::kMethodRelative || + patch_type_ == Type::kMethodAppImageRelRo || patch_type_ == Type::kMethodBssEntry || patch_type_ == Type::kJniEntrypointRelative || patch_type_ == Type::kCallRelative); @@ -274,6 +286,7 @@ class LinkerPatch { DCHECK(patch_type_ == Type::kIntrinsicReference || patch_type_ == Type::kBootImageRelRo || patch_type_ == Type::kMethodRelative || + patch_type_ == Type::kMethodAppImageRelRo || patch_type_ == Type::kMethodBssEntry || patch_type_ == Type::kJniEntrypointRelative || patch_type_ == Type::kTypeRelative || -- cgit v1.2.3-59-g8ed1b