diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/oat.h | 4 | ||||
-rw-r--r-- | runtime/stack_map.cc | 15 | ||||
-rw-r--r-- | runtime/stack_map.h | 21 |
3 files changed, 30 insertions, 10 deletions
diff --git a/runtime/oat.h b/runtime/oat.h index 22c6a39e09..02fad46a0d 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 Kind column to stack maps. - static constexpr uint8_t kOatVersion[] = { '1', '4', '9', '\0' }; + // Last oat version changed reason: Add method frame info to CodeInfo. + static constexpr uint8_t kOatVersion[] = { '1', '5', '0', '\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 7f7f6fce0a..42d24784de 100644 --- a/runtime/stack_map.cc +++ b/runtime/stack_map.cc @@ -22,14 +22,24 @@ #include "art_method.h" #include "base/indenter.h" #include "base/stats.h" +#include "oat_quick_method_header.h" #include "scoped_thread_state_change-inl.h" namespace art { +CodeInfo::CodeInfo(const OatQuickMethodHeader* header) + : CodeInfo(header->GetOptimizedCodeInfoPtr()) { +} + void CodeInfo::Decode(const uint8_t* data) { size_t non_header_size = DecodeUnsignedLeb128(&data); size_ = UnsignedLeb128Size(non_header_size) + non_header_size; - MemoryRegion region(const_cast<uint8_t*>(data), non_header_size); + const uint8_t* end = data + non_header_size; + 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); stack_maps_.Decode(reader); register_masks_.Decode(reader); @@ -39,8 +49,7 @@ void CodeInfo::Decode(const uint8_t* data) { dex_register_masks_.Decode(reader); dex_register_maps_.Decode(reader); dex_register_catalog_.Decode(reader); - number_of_dex_registers_ = DecodeVarintBits(reader); - CHECK_EQ(non_header_size, BitsToBytesRoundUp(reader.GetBitOffset())) << "Invalid CodeInfo"; + CHECK_EQ(BitsToBytesRoundUp(reader.GetBitOffset()), region.size()) << "Invalid CodeInfo"; } BitTable<StackMap>::const_iterator CodeInfo::BinarySearchNativePc(uint32_t packed_pc) const { diff --git a/runtime/stack_map.h b/runtime/stack_map.h index 83f0c05501..cb43ced2a5 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -19,6 +19,7 @@ #include <limits> +#include "arch/instruction_set.h" #include "base/bit_memory_region.h" #include "base/bit_table.h" #include "base/bit_utils.h" @@ -28,10 +29,11 @@ #include "dex/dex_file_types.h" #include "dex_register_location.h" #include "method_info.h" -#include "oat_quick_method_header.h" +#include "quick/quick_method_frame_info.h" namespace art { +class OatQuickMethodHeader; class VariableIndentationOutputStream; // Size of a frame slot, in bytes. This constant is a signed value, @@ -290,9 +292,7 @@ class CodeInfo { DCHECK_EQ(size_, region.size()); } - explicit CodeInfo(const OatQuickMethodHeader* header) - : CodeInfo(header->GetOptimizedCodeInfoPtr()) { - } + explicit CodeInfo(const OatQuickMethodHeader* header); size_t Size() const { return size_; @@ -435,6 +435,14 @@ class CodeInfo { // Accumulate code info size statistics into the given Stats tree. void AddSizeStats(/*out*/ Stats* parent) const; + ALWAYS_INLINE static QuickMethodFrameInfo DecodeFrameInfo(const uint8_t* data) { + DecodeUnsignedLeb128(&data); + return QuickMethodFrameInfo( + DecodeUnsignedLeb128(&data), + DecodeUnsignedLeb128(&data), + DecodeUnsignedLeb128(&data)); + } + private: // Returns lower bound (fist stack map which has pc greater or equal than the desired one). // It ignores catch stack maps at the end (it is the same as if they had maximum pc value). @@ -448,6 +456,10 @@ 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_; + uint32_t number_of_dex_registers_; BitTable<StackMap> stack_maps_; BitTable<RegisterMask> register_masks_; BitTable<MaskInfo> stack_masks_; @@ -456,7 +468,6 @@ class CodeInfo { BitTable<MaskInfo> dex_register_masks_; BitTable<DexRegisterMapInfo> dex_register_maps_; BitTable<DexRegisterInfo> dex_register_catalog_; - uint32_t number_of_dex_registers_; // Excludes any inlined methods. }; #undef ELEMENT_BYTE_OFFSET_AFTER |