diff options
author | 2018-08-10 10:24:01 +0000 | |
---|---|---|
committer | 2018-08-10 10:24:01 +0000 | |
commit | 971a80e5aa36955d9fee6b479a5cbd554f50ca08 (patch) | |
tree | a30f7befba047b9dc4e73b46a7d469798f6c3037 /runtime/stack_map.h | |
parent | c5a319ca5f4c136770fa5c8931d9ee7f48bc6a0f (diff) | |
parent | d1606417eac35d4842f607b63eda48e868e8db1d (diff) |
Merge "Cleanup BitMemoryReader/Writer api."
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). |