Delta-encoding of mapping tables.
Both PC offsets and dalvik offsets are delta-encoded. Since
PC offsets are increasing, the deltas are then compressed as
unsigned LEB128. Dalvik offsets are not monotonic, so their
deltas are compressed as signed LEB128.
This reduces the size of the mapping tables by about 30%
on average, 25% from the PC offset and 5% from the dalvik
offset delta encoding.
Bug: 9437697
Change-Id: I600ab9c22dec178088d4947a811cca3bc8bd4cf4
diff --git a/runtime/exception_test.cc b/runtime/exception_test.cc
index e9a6e4f..8f542d8 100644
--- a/runtime/exception_test.cc
+++ b/runtime/exception_test.cc
@@ -54,17 +54,17 @@
fake_code_.push_back(0x70 | i);
}
- fake_mapping_data_.PushBack(4); // first element is count
- fake_mapping_data_.PushBack(4); // total (non-length) elements
- fake_mapping_data_.PushBack(2); // count of pc to dex elements
+ fake_mapping_data_.PushBackUnsigned(4); // first element is count
+ fake_mapping_data_.PushBackUnsigned(4); // total (non-length) elements
+ fake_mapping_data_.PushBackUnsigned(2); // count of pc to dex elements
// --- pc to dex table
- fake_mapping_data_.PushBack(3); // offset 3
- fake_mapping_data_.PushBack(3); // maps to dex offset 3
+ fake_mapping_data_.PushBackUnsigned(3 - 0); // offset 3
+ fake_mapping_data_.PushBackSigned(3 - 0); // maps to dex offset 3
// --- dex to pc table
- fake_mapping_data_.PushBack(3); // offset 3
- fake_mapping_data_.PushBack(3); // maps to dex offset 3
+ fake_mapping_data_.PushBackUnsigned(3 - 0); // offset 3
+ fake_mapping_data_.PushBackSigned(3 - 0); // maps to dex offset 3
- fake_vmap_table_data_.PushBack(0);
+ fake_vmap_table_data_.PushBackUnsigned(0);
fake_gc_map_.push_back(0); // 0 bytes to encode references and native pc offsets.
fake_gc_map_.push_back(0);
@@ -91,8 +91,8 @@
const DexFile* dex_;
std::vector<uint8_t> fake_code_;
- UnsignedLeb128EncodingVector fake_mapping_data_;
- UnsignedLeb128EncodingVector fake_vmap_table_data_;
+ Leb128EncodingVector fake_mapping_data_;
+ Leb128EncodingVector fake_vmap_table_data_;
std::vector<uint8_t> fake_gc_map_;
mirror::ArtMethod* method_f_;