diff options
author | 2018-07-31 15:05:14 +0100 | |
---|---|---|
committer | 2018-08-10 09:43:45 +0100 | |
commit | d1606417eac35d4842f607b63eda48e868e8db1d (patch) | |
tree | 90220460ac22f888d93dd46596d67f1dbdceaffc /runtime/stack_map.h | |
parent | 2382eaec6a9d661b541eae3ce9dbcd9edb7ad251 (diff) |
Cleanup BitMemoryReader/Writer api.
Test: test-art-host-gtest-stack_map_test
Test: test-art-host-gtest-bit_table_test
Change-Id: I15c624d2a70736aeb8422ce5babcef8e8fa82136
Diffstat (limited to 'runtime/stack_map.h')
-rw-r--r-- | runtime/stack_map.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/runtime/stack_map.h b/runtime/stack_map.h index d6db05a3b8..cde08f312b 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -269,6 +269,26 @@ class MethodInfo : public BitTableAccessor<1> { */ class CodeInfo { public: + class Deduper { + public: + explicit Deduper(std::vector<uint8_t>* output) : writer_(output) { + DCHECK_EQ(output->size(), 0u); + } + + // Copy CodeInfo into output while de-duplicating the internal bit tables. + // It returns the byte offset of the copied CodeInfo within the output. + size_t Dedupe(const uint8_t* code_info); + + private: + template<typename Accessor> + void DedupeTable(BitMemoryReader& reader); + + BitMemoryWriter<std::vector<uint8_t>> writer_; + + // Deduplicate at BitTable level. The value is bit offset within the output. + std::map<BitMemoryRegion, uint32_t, BitMemoryRegion::Less> dedupe_map_; + }; + enum DecodeFlags { Default = 0, // Limits the decoding only to the data needed by GC. @@ -421,16 +441,6 @@ class CodeInfo { DecodeVarintBits(reader)); // fp_spill_mask_. } - typedef std::map<BitMemoryRegion, uint32_t, BitMemoryRegion::Less> DedupeMap; - - // Copy CodeInfo data while de-duplicating the internal bit tables. - // The 'out' vector must be reused between Dedupe calls (it does not have to be empty). - // The 'dedupe_map' stores the bit offsets of bit tables within the 'out' vector. - // It returns the byte offset of the copied CodeInfo within the 'out' vector. - static size_t Dedupe(std::vector<uint8_t>* out, - const uint8_t* in, - /*inout*/ DedupeMap* dedupe_map); - private: // Returns lower bound (fist stack map which has pc greater or equal than the desired one). // It ignores catch stack maps at the end (it is the same as if they had maximum pc value). |