diff options
author | 2017-09-06 17:21:03 +0100 | |
---|---|---|
committer | 2017-09-11 15:12:51 +0100 | |
commit | 94ec2db21332ee1dcdbbf254b99a9a999a304fe0 (patch) | |
tree | 6ced7e596731b61f95a3693f336527f55ea3cf3a /compiler/compiled_method.h | |
parent | 6cfbdbc359ec5414d3e49f70d28f8c0e65b98d63 (diff) |
Use mmapped boot image class table for PIC app HLoadClass.
Implement new HLoadClass load kind for boot image classes
referenced by PIC-compiled apps (i.e. prebuilts) that uses
PC-relative load from a boot image ClassTable mmapped into
the apps .bss. This reduces the size of the PIC prebuilts
that reference boot image classes compared to the kBssEntry
as we can completely avoid the slow path and stack map
unless we need to do the class initialization check.
Prebuilt services.odex for aosp_angler-userdebug (arm64):
- before: 20312800
- after: 19775352 (-525KiB)
Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --pictest
Test: testrunner.py --target on Nexus 6P.
Test: testrunner.py --target --pictest on Nexus 6P.
Test: Nexus 6P boots.
Bug: 31951624
Change-Id: I13adb19a1fa7d095a72a41f09daa6101876e77a8
Diffstat (limited to 'compiler/compiled_method.h')
-rw-r--r-- | compiler/compiled_method.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/compiled_method.h b/compiler/compiled_method.h index c67c523eb3..5ef6cbff78 100644 --- a/compiler/compiled_method.h +++ b/compiler/compiled_method.h @@ -124,6 +124,7 @@ class LinkerPatch { kCall, kCallRelative, // NOTE: Actual patching is instruction_set-dependent. kTypeRelative, // NOTE: Actual patching is instruction_set-dependent. + kTypeClassTable, // NOTE: Actual patching is instruction_set-dependent. kTypeBssEntry, // NOTE: Actual patching is instruction_set-dependent. kStringRelative, // NOTE: Actual patching is instruction_set-dependent. kStringInternTable, // NOTE: Actual patching is instruction_set-dependent. @@ -177,6 +178,16 @@ class LinkerPatch { return patch; } + static LinkerPatch TypeClassTablePatch(size_t literal_offset, + const DexFile* target_dex_file, + uint32_t pc_insn_offset, + uint32_t target_type_idx) { + LinkerPatch patch(literal_offset, Type::kTypeClassTable, 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, @@ -243,6 +254,7 @@ class LinkerPatch { case Type::kMethodBssEntry: case Type::kCallRelative: case Type::kTypeRelative: + case Type::kTypeClassTable: case Type::kTypeBssEntry: case Type::kStringRelative: case Type::kStringInternTable: @@ -264,12 +276,14 @@ class LinkerPatch { const DexFile* TargetTypeDexFile() const { DCHECK(patch_type_ == Type::kTypeRelative || + patch_type_ == Type::kTypeClassTable || patch_type_ == Type::kTypeBssEntry); return target_dex_file_; } dex::TypeIndex TargetTypeIndex() const { DCHECK(patch_type_ == Type::kTypeRelative || + patch_type_ == Type::kTypeClassTable || patch_type_ == Type::kTypeBssEntry); return dex::TypeIndex(type_idx_); } @@ -292,6 +306,7 @@ class LinkerPatch { DCHECK(patch_type_ == Type::kMethodRelative || patch_type_ == Type::kMethodBssEntry || patch_type_ == Type::kTypeRelative || + patch_type_ == Type::kTypeClassTable || patch_type_ == Type::kTypeBssEntry || patch_type_ == Type::kStringRelative || patch_type_ == Type::kStringInternTable || |