Lines Matching refs:Encoding
88 // Large location kinds, requiring a 5-byte encoding (1 byte for the
660 // We reuse the idea from ULEB128p1 to support encoding of -1 (aka 0xFFFFFFFF).
714 // Note: We're not encoding the dex pc if there is none. That's the case
764 // Encode the encoding into the vector.
772 // Decode the encoding from a pointer, updates the pointer.
810 ALWAYS_INLINE uint32_t GetDexPc(const StackMapEncoding& encoding) const {
811 return encoding.GetDexPcEncoding().Load(region_);
814 ALWAYS_INLINE void SetDexPc(const StackMapEncoding& encoding, uint32_t dex_pc) {
815 encoding.GetDexPcEncoding().Store(region_, dex_pc);
818 encoding,
821 CodeOffset::FromCompressedOffset(encoding.GetNativePcEncoding().Load(region_)));
825 ALWAYS_INLINE void SetNativePcCodeOffset(const StackMapEncoding& encoding,
827 encoding.GetNativePcEncoding().Store(region_, native_pc_offset.CompressedValue());
830 ALWAYS_INLINE uint32_t GetDexRegisterMapOffset(const StackMapEncoding& encoding) const {
831 return encoding.GetDexRegisterMapEncoding().Load(region_);
834 ALWAYS_INLINE void SetDexRegisterMapOffset(const StackMapEncoding& encoding, uint32_t offset) {
835 encoding.GetDexRegisterMapEncoding().Store(region_, offset);
838 ALWAYS_INLINE uint32_t GetInlineInfoIndex(const StackMapEncoding& encoding) const {
839 return encoding.GetInlineInfoEncoding().Load(region_);
842 ALWAYS_INLINE void SetInlineInfoIndex(const StackMapEncoding& encoding, uint32_t index) {
843 encoding.GetInlineInfoEncoding().Store(region_, index);
846 ALWAYS_INLINE uint32_t GetRegisterMaskIndex(const StackMapEncoding& encoding) const {
847 return encoding.GetRegisterMaskIndexEncoding().Load(region_);
850 ALWAYS_INLINE void SetRegisterMaskIndex(const StackMapEncoding& encoding, uint32_t mask) {
851 encoding.GetRegisterMaskIndexEncoding().Store(region_, mask);
854 ALWAYS_INLINE uint32_t GetStackMaskIndex(const StackMapEncoding& encoding) const {
855 return encoding.GetStackMaskIndexEncoding().Load(region_);
858 ALWAYS_INLINE void SetStackMaskIndex(const StackMapEncoding& encoding, uint32_t mask) {
859 encoding.GetStackMaskIndexEncoding().Store(region_, mask);
862 ALWAYS_INLINE bool HasDexRegisterMap(const StackMapEncoding& encoding) const {
863 return GetDexRegisterMapOffset(encoding) != kNoDexRegisterMap;
866 ALWAYS_INLINE bool HasInlineInfo(const StackMapEncoding& encoding) const {
867 return GetInlineInfoIndex(encoding) != kNoInlineInfo;
878 const CodeInfoEncoding& encoding,
911 // Note: We're not encoding the dex pc if there is none. That's the case
944 // Encode the encoding into the vector.
952 // Decode the encoding from a pointer, updates the pointer.
980 ALWAYS_INLINE uint32_t GetDepth(const InlineInfoEncoding& encoding) const {
982 while (!GetRegionAtDepth(encoding, depth++).LoadBit(0)) { } // Check is_last bit.
986 ALWAYS_INLINE void SetDepth(const InlineInfoEncoding& encoding, uint32_t depth) {
989 GetRegionAtDepth(encoding, d).StoreBit(0, d == depth - 1); // Set is_last bit.
993 ALWAYS_INLINE uint32_t GetMethodIndexIdxAtDepth(const InlineInfoEncoding& encoding,
995 DCHECK(!EncodesArtMethodAtDepth(encoding, depth));
996 return encoding.GetMethodIndexIdxEncoding().Load(GetRegionAtDepth(encoding, depth));
999 ALWAYS_INLINE void SetMethodIndexIdxAtDepth(const InlineInfoEncoding& encoding,
1002 encoding.GetMethodIndexIdxEncoding().Store(GetRegionAtDepth(encoding, depth), index);
1006 ALWAYS_INLINE uint32_t GetMethodIndexAtDepth(const InlineInfoEncoding& encoding,
1009 return method_info.GetMethodIndex(GetMethodIndexIdxAtDepth(encoding, depth));
1012 ALWAYS_INLINE uint32_t GetDexPcAtDepth(const InlineInfoEncoding& encoding,
1014 return encoding.GetDexPcEncoding().Load(GetRegionAtDepth(encoding, depth));
1017 ALWAYS_INLINE void SetDexPcAtDepth(const InlineInfoEncoding& encoding,
1020 encoding.GetDexPcEncoding().Store(GetRegionAtDepth(encoding, depth), dex_pc);
1023 ALWAYS_INLINE bool EncodesArtMethodAtDepth(const InlineInfoEncoding& encoding,
1025 return (encoding.GetExtraDataEncoding().Load(GetRegionAtDepth(encoding, depth)) & 1) == 0;
1028 ALWAYS_INLINE void SetExtraDataAtDepth(const InlineInfoEncoding& encoding,
1031 encoding.GetExtraDataEncoding().Store(GetRegionAtDepth(encoding, depth), extra_data);
1034 ALWAYS_INLINE ArtMethod* GetArtMethodAtDepth(const InlineInfoEncoding& encoding,
1036 uint32_t low_bits = encoding.GetExtraDataEncoding().Load(GetRegionAtDepth(encoding, depth));
1037 uint32_t high_bits = encoding.GetMethodIndexIdxEncoding().Load(
1038 GetRegionAtDepth(encoding, depth));
1048 ALWAYS_INLINE uint32_t GetDexRegisterMapOffsetAtDepth(const InlineInfoEncoding& encoding,
1050 return encoding.GetDexRegisterMapEncoding().Load(GetRegionAtDepth(encoding, depth));
1053 ALWAYS_INLINE void SetDexRegisterMapOffsetAtDepth(const InlineInfoEncoding& encoding,
1056 encoding.GetDexRegisterMapEncoding().Store(GetRegionAtDepth(encoding, depth), offset);
1059 ALWAYS_INLINE bool HasDexRegisterMapAtDepth(const InlineInfoEncoding& encoding,
1061 return GetDexRegisterMapOffsetAtDepth(encoding, depth) != StackMap::kNoDexRegisterMap;
1070 ALWAYS_INLINE BitMemoryRegion GetRegionAtDepth(const InlineInfoEncoding& encoding,
1072 size_t entry_size = encoding.BitSize();
1080 // Bit sized region encoding, may be more than 255 bits.
1100 template <typename Encoding>
1103 // How the encoding is laid out (serialized).
1104 Encoding encoding;
1115 encoding.Encode(dest);
1120 encoding.Decode(ptr);
1127 *offset += encoding.BitSize() * num_entries;
1134 const size_t map_size = encoding.BitSize();
1226 ALWAYS_INLINE uint32_t GetNativePcOffset(const InvokeInfoEncoding& encoding,
1229 CodeOffset::FromCompressedOffset(encoding.GetNativePcEncoding().Load(region_)));
1233 ALWAYS_INLINE void SetNativePcCodeOffset(const InvokeInfoEncoding& encoding,
1235 encoding.GetNativePcEncoding().Store(region_, native_pc_offset.CompressedValue());
1238 ALWAYS_INLINE uint32_t GetInvokeType(const InvokeInfoEncoding& encoding) const {
1239 return encoding.GetInvokeTypeEncoding().Load(region_);
1242 ALWAYS_INLINE void SetInvokeType(const InvokeInfoEncoding& encoding, uint32_t invoke_type) {
1243 encoding.GetInvokeTypeEncoding().Store(region_, invoke_type);
1246 ALWAYS_INLINE uint32_t GetMethodIndexIdx(const InvokeInfoEncoding& encoding) const {
1247 return encoding.GetMethodIndexEncoding().Load(region_);
1250 ALWAYS_INLINE void SetMethodIndexIdx(const InvokeInfoEncoding& encoding,
1252 encoding.GetMethodIndexEncoding().Store(region_, method_index_idx);
1255 ALWAYS_INLINE uint32_t GetMethodIndex(const InvokeInfoEncoding& encoding,
1257 encoding));
1291 if (stack_map.encoding.GetInlineInfoEncoding().BitSize() > 0) {
1310 if (stack_map.encoding.GetInlineInfoEncoding().BitSize() > 0) {
1343 // Header size in bytes, cached to avoid needing to re-decoding the encoding in HeaderSize.
1345 // Non header size in bytes, cached to avoid needing to re-decoding the encoding in NonHeaderSize.
1368 CodeInfoEncoding encoding = CodeInfoEncoding(data);
1370 encoding.HeaderSize() + encoding.NonHeaderSize());
1374 CodeInfoEncoding encoding(region_.begin());
1375 AssertValidStackMap(encoding);
1376 return encoding;
1379 bool HasInlineInfo(const CodeInfoEncoding& encoding) const {
1380 return encoding.stack_map.encoding.GetInlineInfoEncoding().BitSize() > 0;
1383 DexRegisterLocationCatalog GetDexRegisterLocationCatalog(const CodeInfoEncoding& encoding) const {
1384 return DexRegisterLocationCatalog(region_.Subregion(encoding.location_catalog.byte_offset,
1385 encoding.location_catalog.num_bytes));
1388 ALWAYS_INLINE size_t GetNumberOfStackMaskBits(const CodeInfoEncoding& encoding) const {
1389 return encoding.stack_mask.encoding.BitSize();
1392 ALWAYS_INLINE StackMap GetStackMapAt(size_t index, const CodeInfoEncoding& encoding) const {
1393 return StackMap(encoding.stack_map.BitRegion(region_, index));
1396 BitMemoryRegion GetStackMask(size_t index, const CodeInfoEncoding& encoding) const {
1397 return encoding.stack_mask.BitRegion(region_, index);
1400 BitMemoryRegion GetStackMaskOf(const CodeInfoEncoding& encoding,
1402 return GetStackMask(stack_map.GetStackMaskIndex(encoding.stack_map.encoding), encoding);
1405 BitMemoryRegion GetRegisterMask(size_t index, const CodeInfoEncoding& encoding) const {
1406 return encoding.register_mask.BitRegion(region_, index);
1409 uint32_t GetRegisterMaskOf(const CodeInfoEncoding& encoding, const StackMap& stack_map) const {
1410 size_t index = stack_map.GetRegisterMaskIndex(encoding.stack_map.encoding);
1411 return GetRegisterMask(index, encoding).LoadBits(0u, encoding.register_mask.encoding.BitSize());
1414 uint32_t GetNumberOfLocationCatalogEntries(const CodeInfoEncoding& encoding) const {
1415 return encoding.location_catalog.num_entries;
1418 uint32_t GetDexRegisterLocationCatalogSize(const CodeInfoEncoding& encoding) const {
1419 return encoding.location_catalog.num_bytes;
1422 uint32_t GetNumberOfStackMaps(const CodeInfoEncoding& encoding) const {
1423 return encoding.stack_map.num_entries;
1427 ALWAYS_INLINE size_t GetStackMapsSizeInBits(const CodeInfoEncoding& encoding) const {
1428 return encoding.stack_map.encoding.BitSize() * GetNumberOfStackMaps(encoding);
1431 InvokeInfo GetInvokeInfo(const CodeInfoEncoding& encoding, size_t index) const {
1432 return InvokeInfo(encoding.invoke_info.BitRegion(region_, index));
1436 const CodeInfoEncoding& encoding,
1438 if (!stack_map.HasDexRegisterMap(encoding.stack_map.encoding)) {
1441 const uint32_t offset = encoding.dex_register_map.byte_offset +
1442 stack_map.GetDexRegisterMapOffset(encoding.stack_map.encoding);
1443 size_t size = ComputeDexRegisterMapSizeOf(encoding, offset, number_of_dex_registers);
1447 size_t GetDexRegisterMapsSize(const CodeInfoEncoding& encoding,
1450 for (size_t i = 0, e = GetNumberOfStackMaps(encoding); i < e; ++i) {
1451 StackMap stack_map = GetStackMapAt(i, encoding);
1452 DexRegisterMap map(GetDexRegisterMapOf(stack_map, encoding, number_of_dex_registers));
1461 const CodeInfoEncoding& encoding,
1463 if (!inline_info.HasDexRegisterMapAtDepth(encoding.inline_info.encoding, depth)) {
1466 uint32_t offset = encoding.dex_register_map.byte_offset +
1467 inline_info.GetDexRegisterMapOffsetAtDepth(encoding.inline_info.encoding, depth);
1468 size_t size = ComputeDexRegisterMapSizeOf(encoding, offset, number_of_dex_registers);
1473 InlineInfo GetInlineInfo(size_t index, const CodeInfoEncoding& encoding) const {
1478 const size_t bit_offset = encoding.inline_info.bit_offset +
1479 index * encoding.inline_info.encoding.BitSize();
1483 InlineInfo GetInlineInfoOf(StackMap stack_map, const CodeInfoEncoding& encoding) const {
1484 DCHECK(stack_map.HasInlineInfo(encoding.stack_map.encoding));
1485 uint32_t index = stack_map.GetInlineInfoIndex(encoding.stack_map.encoding);
1486 return GetInlineInfo(index, encoding);
1489 StackMap GetStackMapForDexPc(uint32_t dex_pc, const CodeInfoEncoding& encoding) const {
1490 for (size_t i = 0, e = GetNumberOfStackMaps(encoding); i < e; ++i) {
1491 StackMap stack_map = GetStackMapAt(i, encoding);
1492 if (stack_map.GetDexPc(encoding.stack_map.encoding) == dex_pc) {
1501 StackMap GetCatchStackMapForDexPc(uint32_t dex_pc, const CodeInfoEncoding& encoding) const {
1502 for (size_t i = GetNumberOfStackMaps(encoding); i > 0; --i) {
1503 StackMap stack_map = GetStackMapAt(i - 1, encoding);
1504 if (stack_map.GetDexPc(encoding.stack_map.encoding) == dex_pc) {
1511 StackMap GetOsrStackMapForDexPc(uint32_t dex_pc, const CodeInfoEncoding& encoding) const {
1512 size_t e = GetNumberOfStackMaps(encoding);
1519 const StackMapEncoding& stack_map_encoding = encoding.stack_map.encoding;
1521 StackMap stack_map = GetStackMapAt(i, encoding);
1523 StackMap other = GetStackMapAt(i + 1, encoding);
1534 GetStackMapAt(i + 2, encoding).GetNativePcOffset(stack_map_encoding, kRuntimeISA));
1544 const CodeInfoEncoding& encoding) const {
1548 for (size_t i = 0, e = GetNumberOfStackMaps(encoding); i < e; ++i) {
1549 StackMap stack_map = GetStackMapAt(i, encoding);
1550 if (stack_map.GetNativePcOffset(encoding.stack_map.encoding, kRuntimeISA) ==
1559 const CodeInfoEncoding& encoding) {
1560 for (size_t index = 0; index < encoding.invoke_info.num_entries; index++) {
1561 InvokeInfo item = GetInvokeInfo(encoding, index);
1562 if (item.GetNativePcOffset(encoding.invoke_info.encoding, kRuntimeISA) == native_pc_offset) {
1582 void AssertValidStackMap(const CodeInfoEncoding& encoding) const {
1583 if (region_.size() != 0 && region_.size_in_bits() < GetStackMapsSizeInBits(encoding)) {
1585 << encoding.HeaderSize() << "\n"
1586 << encoding.NonHeaderSize() << "\n"
1587 << encoding.location_catalog.num_entries << "\n"
1588 << encoding.stack_map.num_entries << "\n"
1589 << encoding.stack_map.encoding.BitSize();
1596 size_t ComputeDexRegisterMapSizeOf(const CodeInfoEncoding& encoding,
1610 DexRegisterMap::SingleEntrySizeInBits(GetNumberOfLocationCatalogEntries(encoding))