summaryrefslogtreecommitdiff
path: root/compiler/optimizing/stack_map_stream.cc
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2018-06-26 18:13:49 +0100
committer David Srbecky <dsrbecky@google.com> 2018-06-27 10:15:32 +0100
commita38e6cf2aaf4fd3d92b05c0a7a146fb5525ea72d (patch)
tree377c74c834776b9942bb7c2853e44447dac27f83 /compiler/optimizing/stack_map_stream.cc
parentf6ba5b316b51d0fb9f91cb51a42e51dfeee62ee4 (diff)
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
Diffstat (limited to 'compiler/optimizing/stack_map_stream.cc')
-rw-r--r--compiler/optimizing/stack_map_stream.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc
index cb988050ff..5d361953ba 100644
--- a/compiler/optimizing/stack_map_stream.cc
+++ b/compiler/optimizing/stack_map_stream.cc
@@ -339,22 +339,24 @@ size_t StackMapStream::PrepareForFillIn() {
dex_register_maps_.Encode(out);
dex_register_catalog_.Encode(out);
- return UnsignedLeb128Size(out_.size()) + out_.size();
+ return out_.size();
}
void StackMapStream::FillInCodeInfo(MemoryRegion region) {
DCHECK(in_stack_map_ == false) << "Mismatched Begin/End calls";
DCHECK(in_inline_info_ == false) << "Mismatched Begin/End calls";
DCHECK_NE(0u, out_.size()) << "PrepareForFillIn not called before FillIn";
- DCHECK_EQ(region.size(), UnsignedLeb128Size(out_.size()) + out_.size());
+ DCHECK_EQ(region.size(), out_.size());
- uint8_t* ptr = EncodeUnsignedLeb128(region.begin(), out_.size());
- region.CopyFromVector(ptr - region.begin(), out_);
+ region.CopyFromVector(0, out_);
+
+ // Verify that we can load the CodeInfo and check some essentials.
+ CodeInfo code_info(region);
+ CHECK_EQ(code_info.Size(), out_.size());
+ CHECK_EQ(code_info.GetNumberOfStackMaps(), stack_maps_.size());
// Verify all written data (usually only in debug builds).
if (kVerifyStackMaps) {
- CodeInfo code_info(region);
- CHECK_EQ(code_info.GetNumberOfStackMaps(), stack_maps_.size());
for (const auto& dcheck : dchecks_) {
dcheck(code_info);
}