diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/oat.h | 4 | ||||
-rw-r--r-- | runtime/stack_map.cc | 14 | ||||
-rw-r--r-- | runtime/stack_map.h | 7 |
3 files changed, 10 insertions, 15 deletions
diff --git a/runtime/oat.h b/runtime/oat.h index 02fad46a0d..6c3cc20032 100644 --- a/runtime/oat.h +++ b/runtime/oat.h @@ -32,8 +32,8 @@ class InstructionSetFeatures; class PACKED(4) OatHeader { public: static constexpr uint8_t kOatMagic[] = { 'o', 'a', 't', '\n' }; - // Last oat version changed reason: Add method frame info to CodeInfo. - static constexpr uint8_t kOatVersion[] = { '1', '5', '0', '\0' }; + // Last oat version changed reason: Remove explicit size from CodeInfo. + static constexpr uint8_t kOatVersion[] = { '1', '5', '1', '\0' }; static constexpr const char* kImageLocationKey = "image-location"; static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline"; diff --git a/runtime/stack_map.cc b/runtime/stack_map.cc index 42d24784de..a3c6e05045 100644 --- a/runtime/stack_map.cc +++ b/runtime/stack_map.cc @@ -32,15 +32,12 @@ CodeInfo::CodeInfo(const OatQuickMethodHeader* header) } void CodeInfo::Decode(const uint8_t* data) { - size_t non_header_size = DecodeUnsignedLeb128(&data); - size_ = UnsignedLeb128Size(non_header_size) + non_header_size; - const uint8_t* end = data + non_header_size; + const uint8_t* begin = data; frame_size_in_bytes_ = DecodeUnsignedLeb128(&data); core_spill_mask_ = DecodeUnsignedLeb128(&data); fp_spill_mask_ = DecodeUnsignedLeb128(&data); number_of_dex_registers_ = DecodeUnsignedLeb128(&data); - MemoryRegion region(const_cast<uint8_t*>(data), end - data); - BitMemoryReader reader(BitMemoryRegion(region), /* bit_offset */ 0); + BitMemoryReader reader(data, /* bit_offset */ 0); stack_maps_.Decode(reader); register_masks_.Decode(reader); stack_masks_.Decode(reader); @@ -49,7 +46,7 @@ void CodeInfo::Decode(const uint8_t* data) { dex_register_masks_.Decode(reader); dex_register_maps_.Decode(reader); dex_register_catalog_.Decode(reader); - CHECK_EQ(BitsToBytesRoundUp(reader.GetBitOffset()), region.size()) << "Invalid CodeInfo"; + size_in_bits_ = (data - begin) * kBitsPerByte + reader.GetBitOffset(); } BitTable<StackMap>::const_iterator CodeInfo::BinarySearchNativePc(uint32_t packed_pc) const { @@ -154,8 +151,7 @@ static void AddTableSizeStats(const char* table_name, void CodeInfo::AddSizeStats(/*out*/ Stats* parent) const { Stats* stats = parent->Child("CodeInfo"); - stats->AddBytes(size_); - stats->Child("Header")->AddBytes(UnsignedLeb128Size(size_)); + stats->AddBytes(Size()); AddTableSizeStats<StackMap>("StackMaps", stack_maps_, stats); AddTableSizeStats<RegisterMask>("RegisterMasks", register_masks_, stats); AddTableSizeStats<MaskInfo>("StackMasks", stack_masks_, stats); @@ -222,7 +218,7 @@ void CodeInfo::Dump(VariableIndentationOutputStream* vios, const MethodInfo& method_info) const { vios->Stream() << "CodeInfo" - << " BitSize=" << size_ * kBitsPerByte + << " BitSize=" << size_in_bits_ << "\n"; ScopedIndentation indent1(vios); DumpTable<StackMap>(vios, "StackMaps", stack_maps_, verbose); diff --git a/runtime/stack_map.h b/runtime/stack_map.h index cb43ced2a5..ad52f377cf 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -289,13 +289,13 @@ class CodeInfo { } explicit CodeInfo(MemoryRegion region) : CodeInfo(region.begin()) { - DCHECK_EQ(size_, region.size()); + DCHECK_EQ(Size(), region.size()); } explicit CodeInfo(const OatQuickMethodHeader* header); size_t Size() const { - return size_; + return BitsToBytesRoundUp(size_in_bits_); } bool HasInlineInfo() const { @@ -436,7 +436,6 @@ class CodeInfo { void AddSizeStats(/*out*/ Stats* parent) const; ALWAYS_INLINE static QuickMethodFrameInfo DecodeFrameInfo(const uint8_t* data) { - DecodeUnsignedLeb128(&data); return QuickMethodFrameInfo( DecodeUnsignedLeb128(&data), DecodeUnsignedLeb128(&data), @@ -455,7 +454,6 @@ class CodeInfo { void Decode(const uint8_t* data); - size_t size_; uint32_t frame_size_in_bytes_; uint32_t core_spill_mask_; uint32_t fp_spill_mask_; @@ -468,6 +466,7 @@ class CodeInfo { BitTable<MaskInfo> dex_register_masks_; BitTable<DexRegisterMapInfo> dex_register_maps_; BitTable<DexRegisterInfo> dex_register_catalog_; + uint32_t size_in_bits_; }; #undef ELEMENT_BYTE_OFFSET_AFTER |