summaryrefslogtreecommitdiff
path: root/compiler/linker/linker_patch.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-10-31 17:38:03 +0100
committer VladimĂ­r Marko <vmarko@google.com> 2024-11-05 13:54:34 +0000
commit4d6fdd9fb379ac6e3575c3ec5406d808e0290636 (patch)
treecd7c157f6ca93745672901a3fafc33a9426c70fe /compiler/linker/linker_patch.h
parent389f84b5c45cb58255ebcc44758f04adc37dd5b6 (diff)
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
Diffstat (limited to 'compiler/linker/linker_patch.h')
-rw-r--r--compiler/linker/linker_patch.h13
1 files changed, 13 insertions, 0 deletions
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 ||