diff options
author | 2017-01-19 14:48:48 -0800 | |
---|---|---|
committer | 2017-01-20 15:47:06 -0800 | |
commit | a2f526f889be06f96ea59624c9dfb1223b3839f3 (patch) | |
tree | 769f517e6664de0e89abeadf07a39d5410fcee42 /runtime/arch/instruction_set.h | |
parent | 64e50021845b1ad9d8851596e8aaddf18be217c2 (diff) |
Compressed native PC for stack maps
Compress native PC based on instruction alignment. This reduces the
size of stack maps, boot.oat is 0.4% smaller for arm64.
Test: test-art-host, test-art-target, N6P booting
Change-Id: I2b70eecabda88b06fa80a85688fd992070d54278
Diffstat (limited to 'runtime/arch/instruction_set.h')
-rw-r--r-- | runtime/arch/instruction_set.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/runtime/arch/instruction_set.h b/runtime/arch/instruction_set.h index 4a8bea45e5..99aea62468 100644 --- a/runtime/arch/instruction_set.h +++ b/runtime/arch/instruction_set.h @@ -75,6 +75,14 @@ static constexpr size_t kMipsAlignment = 8; // X86 instruction alignment. This is the recommended alignment for maximum performance. static constexpr size_t kX86Alignment = 16; +// Different than code alignment since code alignment is only first instruction of method. +static constexpr size_t kThumb2InstructionAlignment = 2; +static constexpr size_t kArm64InstructionAlignment = 4; +static constexpr size_t kX86InstructionAlignment = 1; +static constexpr size_t kX86_64InstructionAlignment = 1; +static constexpr size_t kMipsInstructionAlignment = 2; +static constexpr size_t kMips64InstructionAlignment = 2; + const char* GetInstructionSetString(InstructionSet isa); // Note: Returns kNone when the string cannot be parsed to a known value. @@ -106,6 +114,17 @@ static inline PointerSize GetInstructionSetPointerSize(InstructionSet isa) { } } +ALWAYS_INLINE static inline constexpr size_t GetInstructionSetInstructionAlignment( + InstructionSet isa) { + return (isa == kThumb2 || isa == kArm) ? kThumb2InstructionAlignment : + (isa == kArm64) ? kArm64InstructionAlignment : + (isa == kX86) ? kX86InstructionAlignment : + (isa == kX86_64) ? kX86_64InstructionAlignment : + (isa == kMips) ? kMipsInstructionAlignment : + (isa == kMips64) ? kMips64InstructionAlignment : + 0; // Invalid case, but constexpr doesn't support asserts. +} + static inline bool IsValidInstructionSet(InstructionSet isa) { switch (isa) { case kArm: |