summaryrefslogtreecommitdiff
path: root/compiler/linker/linker_patch.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-04-12 11:00:19 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2024-05-07 18:06:47 +0000
commit488413f47e7552d067edf9cfd5ceda321fc12f88 (patch)
tree7bc33df1846aa6838babe2f1f5b6c60137a7eb71 /compiler/linker/linker_patch.h
parenta463b165408222e3ef6a2052ef31b1560b3afea6 (diff)
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
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 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 ||