diff options
| author | 2017-02-14 15:16:19 -0800 | |
|---|---|---|
| committer | 2017-02-14 15:36:39 -0800 | |
| commit | c420a805fbc0207888a2fa04b4e9a17490621cc3 (patch) | |
| tree | c2f2e1f7b574e3de0c5dc7d4d44bcffd0b96a4bb | |
| parent | aff5505d85612621bd112d9af1ba4cc31a4619d1 (diff) | |
Address some comments for aog/333864
Mostly comment changes.
Bug: 34621054
Test: test-art-host
Change-Id: I95f77651d47a8d0c71d580778d1126ab4aa1d751
| -rw-r--r-- | runtime/stack_map.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/runtime/stack_map.h b/runtime/stack_map.h index 61d6a5847c..f7a64026b7 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -747,6 +747,7 @@ class StackMapEncoding { return total_bit_size_; } + // Encode the encoding into the vector. template<typename Vector> void Encode(Vector* dest) const { static_assert(alignof(StackMapEncoding) == 1, "Should not require alignment"); @@ -754,6 +755,7 @@ class StackMapEncoding { dest->insert(dest->end(), ptr, ptr + sizeof(*this)); } + // Decode the encoding from a pointer, updates the pointer. void Decode(const uint8_t** ptr) { *this = *reinterpret_cast<const StackMapEncoding*>(*ptr); *ptr += sizeof(*this); @@ -924,6 +926,7 @@ class InlineInfoEncoding { void Dump(VariableIndentationOutputStream* vios) const; + // Encode the encoding into the vector. template<typename Vector> void Encode(Vector* dest) const { static_assert(alignof(InlineInfoEncoding) == 1, "Should not require alignment"); @@ -931,6 +934,7 @@ class InlineInfoEncoding { dest->insert(dest->end(), ptr, ptr + sizeof(*this)); } + // Decode the encoding from a pointer, updates the pointer. void Decode(const uint8_t** ptr) { *this = *reinterpret_cast<const InlineInfoEncoding*>(*ptr); *ptr += sizeof(*this); @@ -1171,6 +1175,7 @@ struct CodeInfoEncoding { ComputeTableOffsets(); } + // Compress is not const since it calculates cache_header_size. This is used by PrepareForFillIn. template<typename Vector> void Compress(Vector* dest) { dex_register_map.Encode(dest); @@ -1210,9 +1215,9 @@ struct CodeInfoEncoding { private: // Computed fields (not serialized). - // Header size in bytes. + // Header size in bytes, cached to avoid needing to re-decoding the encoding in HeaderSize. uint32_t cache_header_size = kInvalidSize; - // Non header size in bytes. + // Non header size in bytes, cached to avoid needing to re-decoding the encoding in NonHeaderSize. uint32_t cache_non_header_size = kInvalidSize; }; @@ -1221,7 +1226,13 @@ struct CodeInfoEncoding { * The information is of the form: * * [CodeInfoEncoding, DexRegisterMap+, DexLocationCatalog+, StackMap+, RegisterMask+, StackMask+, - * DexRegisterMap+, InlineInfo*] + * InlineInfo*] + * + * where CodeInfoEncoding is of the form: + * + * [ByteSizedTable(dex_register_map), ByteSizedTable(location_catalog), + * BitEncodingTable<StackMapEncoding>, BitEncodingTable<BitRegionEncoding>, + * BitEncodingTable<BitRegionEncoding>, BitEncodingTable<InlineInfoEncoding>] */ class CodeInfo { public: @@ -1331,7 +1342,9 @@ class CodeInfo { } InlineInfo GetInlineInfo(size_t index, const CodeInfoEncoding& encoding) const { - // Since we do not know the depth, we just return the whole remaining map. + // Since we do not know the depth, we just return the whole remaining map. The caller may + // access the inline info for arbitrary depths. To return the precise inline info we would need + // to count the depth before returning. // TODO: Clean this up. const size_t bit_offset = encoding.inline_info.bit_offset + index * encoding.inline_info.encoding.BitSize(); |