Remove explicit size from CodeInfo.
It was mostly there since it was necessary to create the
bound-checked MemoryRegion for loading.
The new BitMemoryReader interface is much easier to
tweak to avoid needing to know the size ahead of time.
Keep the CHECK that the loader reads the expected number
of bytes, but move it to FillInCodeInfo.
This saves 0.2% of .oat file size.
Test: test-art-host-gtest-stack_map_test
Test: test-art-host-gtest-bit_table_test
Change-Id: I92ee936e9fd004da61b90841aff9c9f2029fcfbf
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index cb43ced..ad52f37 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -289,13 +289,13 @@
}
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 @@
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 @@
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 @@
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