Implement BitMemory{Reader,Writer}
Two simple classes which replace the need to pass
the (BitMemoryRegion, bit_offset) tuple everywhere.
The slightly simplifies the code and it also makes
it possible to optimize those classes in the future.
Test: test-art-host-gtest-stack_map_test
Test: test-art-host-gtest-bit_table_test
Change-Id: I4806c805149a07e1a11b76405ca27960a0012c69
diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc
index e8b3330..57f47af 100644
--- a/compiler/optimizing/stack_map_stream.cc
+++ b/compiler/optimizing/stack_map_stream.cc
@@ -301,16 +301,16 @@
}
}
- size_t bit_offset = 0;
- stack_maps_.Encode(&out_, &bit_offset);
- register_masks_.Encode(&out_, &bit_offset);
- stack_masks_.Encode(&out_, &bit_offset);
- invoke_infos_.Encode(&out_, &bit_offset);
- inline_infos_.Encode(&out_, &bit_offset);
- dex_register_masks_.Encode(&out_, &bit_offset);
- dex_register_maps_.Encode(&out_, &bit_offset);
- dex_register_catalog_.Encode(&out_, &bit_offset);
- EncodeVarintBits(&out_, &bit_offset, num_dex_registers_);
+ BitMemoryWriter<ScopedArenaVector<uint8_t>> out(&out_);
+ stack_maps_.Encode(out);
+ register_masks_.Encode(out);
+ stack_masks_.Encode(out);
+ invoke_infos_.Encode(out);
+ inline_infos_.Encode(out);
+ dex_register_masks_.Encode(out);
+ dex_register_maps_.Encode(out);
+ dex_register_catalog_.Encode(out);
+ EncodeVarintBits(out, num_dex_registers_);
return UnsignedLeb128Size(out_.size()) + out_.size();
}