diff options
author | 2018-05-29 23:27:22 +0100 | |
---|---|---|
committer | 2018-05-30 17:59:24 +0100 | |
commit | d02b23f7ee9664213216a82bfdcb0ee83824de04 (patch) | |
tree | 254b794533a6821c2ed2df31fab807abf7d508a4 /runtime/stack_map.h | |
parent | 08231f6cb3095a7dbde29299a7da5413a5f992e4 (diff) |
Remove the CodeOffset helper class.
I need to reduce the StackMapEntry to a POD type so that it
can be used in BitTableBuilder.
Test: test-art-host-gtest-stack_map_test
Change-Id: I5f9ad7fdc9c9405f22669a11aea14f925ef06ef7
Diffstat (limited to 'runtime/stack_map.h')
-rw-r--r-- | runtime/stack_map.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/runtime/stack_map.h b/runtime/stack_map.h index 1cb9a399f8..363884a21b 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -19,7 +19,6 @@ #include <limits> -#include "arch/code_offset.h" #include "base/bit_memory_region.h" #include "base/bit_table.h" #include "base/bit_utils.h" @@ -658,7 +657,7 @@ class DexRegisterMap { class StackMap : public BitTable<6>::Accessor { public: enum Field { - kNativePcOffset, + kPackedNativePc, kDexPc, kDexRegisterMapOffset, kInlineInfoIndex, @@ -672,8 +671,7 @@ class StackMap : public BitTable<6>::Accessor { : BitTable<kCount>::Accessor(table, row) {} ALWAYS_INLINE uint32_t GetNativePcOffset(InstructionSet instruction_set) const { - CodeOffset offset(CodeOffset::FromCompressedOffset(Get<kNativePcOffset>())); - return offset.Uint32Value(instruction_set); + return UnpackNativePc(Get<kPackedNativePc>(), instruction_set); } uint32_t GetDexPc() const { return Get<kDexPc>(); } @@ -688,6 +686,17 @@ class StackMap : public BitTable<6>::Accessor { uint32_t GetStackMaskIndex() const { return Get<kStackMaskIndex>(); } + static uint32_t PackNativePc(uint32_t native_pc, InstructionSet isa) { + // TODO: DCHECK_ALIGNED_PARAM(native_pc, GetInstructionSetInstructionAlignment(isa)); + return native_pc / GetInstructionSetInstructionAlignment(isa); + } + + static uint32_t UnpackNativePc(uint32_t packed_native_pc, InstructionSet isa) { + uint32_t native_pc = packed_native_pc * GetInstructionSetInstructionAlignment(isa); + DCHECK_EQ(native_pc / GetInstructionSetInstructionAlignment(isa), packed_native_pc); + return native_pc; + } + static void DumpEncoding(const BitTable<6>& table, VariableIndentationOutputStream* vios); void Dump(VariableIndentationOutputStream* vios, const CodeInfo& code_info, @@ -776,7 +785,7 @@ class InlineInfo : public BitTable<5>::Accessor { class InvokeInfo : public BitTable<3>::Accessor { public: enum Field { - kNativePcOffset, + kPackedNativePc, kInvokeType, kMethodIndexIdx, kCount, @@ -786,8 +795,7 @@ class InvokeInfo : public BitTable<3>::Accessor { : BitTable<kCount>::Accessor(table, row) {} ALWAYS_INLINE uint32_t GetNativePcOffset(InstructionSet instruction_set) const { - CodeOffset offset(CodeOffset::FromCompressedOffset(Get<kNativePcOffset>())); - return offset.Uint32Value(instruction_set); + return StackMap::UnpackNativePc(Get<kPackedNativePc>(), instruction_set); } uint32_t GetInvokeType() const { return Get<kInvokeType>(); } |