Add method frame info to CodeInfo.
The stored information will be used in follow-up CLs.
This temporarily increases .oat file size by 0.7%.
Test: test-art-host-gtest
Change-Id: Ie7d898b06398ae44287bb1e8153861ab112a216c
diff --git a/runtime/stack_map.cc b/runtime/stack_map.cc
index 7f7f6fc..42d2478 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 @@
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 {