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).
760 // Encode the encoding into the vector.
768 // Decode the encoding from a pointer, updates the pointer.
806 ALWAYS_INLINE uint32_t GetDexPc(const StackMapEncoding& encoding) const {
807 return encoding.GetDexPcEncoding().Load(region_);
810 ALWAYS_INLINE void SetDexPc(const StackMapEncoding& encoding, uint32_t dex_pc) {
811 encoding.GetDexPcEncoding().Store(region_, dex_pc);
814 ALWAYS_INLINE uint32_t GetNativePcOffset(const StackMapEncoding& encoding,
817 encoding.GetNativePcEncoding().Load(region_)));
821 ALWAYS_INLINE void SetNativePcCodeOffset(const StackMapEncoding& encoding,
823 encoding.GetNativePcEncoding().Store(region_, native_pc_offset.CompressedValue());
826 ALWAYS_INLINE uint32_t GetDexRegisterMapOffset(const StackMapEncoding& encoding) const {
827 return encoding.GetDexRegisterMapEncoding().Load(region_);
830 ALWAYS_INLINE void SetDexRegisterMapOffset(const StackMapEncoding& encoding, uint32_t offset) {
831 encoding.GetDexRegisterMapEncoding().Store(region_, offset);
834 ALWAYS_INLINE uint32_t GetInlineInfoIndex(const StackMapEncoding& encoding) const {
835 return encoding.GetInlineInfoEncoding().Load(region_);
838 ALWAYS_INLINE void SetInlineInfoIndex(const StackMapEncoding& encoding, uint32_t index) {
839 encoding.GetInlineInfoEncoding().Store(region_, index);
842 ALWAYS_INLINE uint32_t GetRegisterMaskIndex(const StackMapEncoding& encoding) const {
843 return encoding.GetRegisterMaskIndexEncoding().Load(region_);
846 ALWAYS_INLINE void SetRegisterMaskIndex(const StackMapEncoding& encoding, uint32_t mask) {
847 encoding.GetRegisterMaskIndexEncoding().Store(region_, mask);
850 ALWAYS_INLINE uint32_t GetStackMaskIndex(const StackMapEncoding& encoding) const {
851 return encoding.GetStackMaskIndexEncoding().Load(region_);
854 ALWAYS_INLINE void SetStackMaskIndex(const StackMapEncoding& encoding, uint32_t mask) {
855 encoding.GetStackMaskIndexEncoding().Store(region_, mask);
858 ALWAYS_INLINE bool HasDexRegisterMap(const StackMapEncoding& encoding) const {
859 return GetDexRegisterMapOffset(encoding) != kNoDexRegisterMap;
862 ALWAYS_INLINE bool HasInlineInfo(const StackMapEncoding& encoding) const {
863 return GetInlineInfoIndex(encoding) != kNoInlineInfo;
874 const CodeInfoEncoding& encoding,
907 // Note: We're not encoding the dex pc if there is none. That's the case
940 // Encode the encoding into the vector.
948 // Decode the encoding from a pointer, updates the pointer.
976 ALWAYS_INLINE uint32_t GetDepth(const InlineInfoEncoding& encoding) const {
978 while (!GetRegionAtDepth(encoding, depth++).LoadBit(0)) { } // Check is_last bit.
982 ALWAYS_INLINE void SetDepth(const InlineInfoEncoding& encoding, uint32_t depth) {
985 GetRegionAtDepth(encoding, d).StoreBit(0, d == depth - 1); // Set is_last bit.
989 ALWAYS_INLINE uint32_t GetMethodIndexIdxAtDepth(const InlineInfoEncoding& encoding,
991 DCHECK(!EncodesArtMethodAtDepth(encoding, depth));
992 return encoding.GetMethodIndexIdxEncoding().Load(GetRegionAtDepth(encoding, depth));
995 ALWAYS_INLINE void SetMethodIndexIdxAtDepth(const InlineInfoEncoding& encoding,
998 encoding.GetMethodIndexIdxEncoding().Store(GetRegionAtDepth(encoding, depth), index);
1002 ALWAYS_INLINE uint32_t GetMethodIndexAtDepth(const InlineInfoEncoding& encoding,
1005 return method_info.GetMethodIndex(GetMethodIndexIdxAtDepth(encoding, depth));
1008 ALWAYS_INLINE uint32_t GetDexPcAtDepth(const InlineInfoEncoding& encoding,
1010 return encoding.GetDexPcEncoding().Load(GetRegionAtDepth(encoding, depth));
1013 ALWAYS_INLINE void SetDexPcAtDepth(const InlineInfoEncoding& encoding,
1016 encoding.GetDexPcEncoding().Store(GetRegionAtDepth(encoding, depth), dex_pc);
1019 ALWAYS_INLINE bool EncodesArtMethodAtDepth(const InlineInfoEncoding& encoding,
1021 return (encoding.GetExtraDataEncoding().Load(GetRegionAtDepth(encoding, depth)) & 1) == 0;
1024 ALWAYS_INLINE void SetExtraDataAtDepth(const InlineInfoEncoding& encoding,
1027 encoding.GetExtraDataEncoding().Store(GetRegionAtDepth(encoding, depth), extra_data);
1030 ALWAYS_INLINE ArtMethod* GetArtMethodAtDepth(const InlineInfoEncoding& encoding,
1032 uint32_t low_bits = encoding.GetExtraDataEncoding().Load(GetRegionAtDepth(encoding, depth));
1033 uint32_t high_bits = encoding.GetMethodIndexIdxEncoding().Load(
1034 GetRegionAtDepth(encoding, depth));
1044 ALWAYS_INLINE uint32_t GetDexRegisterMapOffsetAtDepth(const InlineInfoEncoding& encoding,
1046 return encoding.GetDexRegisterMapEncoding().Load(GetRegionAtDepth(encoding, depth));
1049 ALWAYS_INLINE void SetDexRegisterMapOffsetAtDepth(const InlineInfoEncoding& encoding,
1052 encoding.GetDexRegisterMapEncoding().Store(GetRegionAtDepth(encoding, depth), offset);
1055 ALWAYS_INLINE bool HasDexRegisterMapAtDepth(const InlineInfoEncoding& encoding,
1057 return GetDexRegisterMapOffsetAtDepth(encoding, depth) != StackMap::kNoDexRegisterMap;
1066 ALWAYS_INLINE BitMemoryRegion GetRegionAtDepth(const InlineInfoEncoding& encoding,
1068 size_t entry_size = encoding.BitSize();
1076 // Bit sized region encoding, may be more than 255 bits.
1096 template <typename Encoding>
1099 // How the encoding is laid out (serialized).
1100 Encoding encoding;
1111 encoding.Encode(dest);
1116 encoding.Decode(ptr);
1123 *offset += encoding.BitSize() * num_entries;
1130 const size_t map_size = encoding.BitSize();
1222 ALWAYS_INLINE uint32_t GetNativePcOffset(const InvokeInfoEncoding& encoding,
1225 CodeOffset::FromCompressedOffset(encoding.GetNativePcEncoding().Load(region_)));
1229 ALWAYS_INLINE void SetNativePcCodeOffset(const InvokeInfoEncoding& encoding,
1231 encoding.GetNativePcEncoding().Store(region_, native_pc_offset.CompressedValue());
1234 ALWAYS_INLINE uint32_t GetInvokeType(const InvokeInfoEncoding& encoding) const {
1235 return encoding.GetInvokeTypeEncoding().Load(region_);
1238 ALWAYS_INLINE void SetInvokeType(const InvokeInfoEncoding& encoding, uint32_t invoke_type) {
1239 encoding.GetInvokeTypeEncoding().Store(region_, invoke_type);
1242 ALWAYS_INLINE uint32_t GetMethodIndexIdx(const InvokeInfoEncoding& encoding) const {
1243 return encoding.GetMethodIndexEncoding().Load(region_);
1246 ALWAYS_INLINE void SetMethodIndexIdx(const InvokeInfoEncoding& encoding,
1248 encoding.GetMethodIndexEncoding().Store(region_, method_index_idx);
1251 ALWAYS_INLINE uint32_t GetMethodIndex(const InvokeInfoEncoding& encoding,
1253 return method_info.GetMethodIndex(GetMethodIndexIdx(encoding));
1287 if (stack_map.encoding.GetInlineInfoEncoding().BitSize() > 0) {
1306 if (stack_map.encoding.GetInlineInfoEncoding().BitSize() > 0) {
1339 // Header size in bytes, cached to avoid needing to re-decoding the encoding in HeaderSize.
1341 // Non header size in bytes, cached to avoid needing to re-decoding the encoding in NonHeaderSize.
1364 CodeInfoEncoding encoding = CodeInfoEncoding(data);
1366 encoding.HeaderSize() + encoding.NonHeaderSize());
1370 CodeInfoEncoding encoding(region_.begin());
1371 AssertValidStackMap(encoding);
1372 return encoding;
1375 bool HasInlineInfo(const CodeInfoEncoding& encoding) const {
1376 return encoding.stack_map.encoding.GetInlineInfoEncoding().BitSize() > 0;
1379 DexRegisterLocationCatalog GetDexRegisterLocationCatalog(const CodeInfoEncoding& encoding) const {
1380 return DexRegisterLocationCatalog(region_.Subregion(encoding.location_catalog.byte_offset,
1381 encoding.location_catalog.num_bytes));
1384 ALWAYS_INLINE size_t GetNumberOfStackMaskBits(const CodeInfoEncoding& encoding) const {
1385 return encoding.stack_mask.encoding.BitSize();
1388 ALWAYS_INLINE StackMap GetStackMapAt(size_t index, const CodeInfoEncoding& encoding) const {
1389 return StackMap(encoding.stack_map.BitRegion(region_, index));
1392 BitMemoryRegion GetStackMask(size_t index, const CodeInfoEncoding& encoding) const {
1393 return encoding.stack_mask.BitRegion(region_, index);
1396 BitMemoryRegion GetStackMaskOf(const CodeInfoEncoding& encoding,
1398 return GetStackMask(stack_map.GetStackMaskIndex(encoding.stack_map.encoding), encoding);
1401 BitMemoryRegion GetRegisterMask(size_t index, const CodeInfoEncoding& encoding) const {
1402 return encoding.register_mask.BitRegion(region_, index);
1405 uint32_t GetRegisterMaskOf(const CodeInfoEncoding& encoding, const StackMap& stack_map) const {
1406 size_t index = stack_map.GetRegisterMaskIndex(encoding.stack_map.encoding);
1407 return GetRegisterMask(index, encoding).LoadBits(0u, encoding.register_mask.encoding.BitSize());
1410 uint32_t GetNumberOfLocationCatalogEntries(const CodeInfoEncoding& encoding) const {
1411 return encoding.location_catalog.num_entries;
1414 uint32_t GetDexRegisterLocationCatalogSize(const CodeInfoEncoding& encoding) const {
1415 return encoding.location_catalog.num_bytes;
1418 uint32_t GetNumberOfStackMaps(const CodeInfoEncoding& encoding) const {
1419 return encoding.stack_map.num_entries;
1423 ALWAYS_INLINE size_t GetStackMapsSizeInBits(const CodeInfoEncoding& encoding) const {
1424 return encoding.stack_map.encoding.BitSize() * GetNumberOfStackMaps(encoding);
1427 InvokeInfo GetInvokeInfo(const CodeInfoEncoding& encoding, size_t index) const {
1428 return InvokeInfo(encoding.invoke_info.BitRegion(region_, index));
1432 const CodeInfoEncoding& encoding,
1434 if (!stack_map.HasDexRegisterMap(encoding.stack_map.encoding)) {
1437 const uint32_t offset = encoding.dex_register_map.byte_offset +
1438 stack_map.GetDexRegisterMapOffset(encoding.stack_map.encoding);
1439 size_t size = ComputeDexRegisterMapSizeOf(encoding, offset, number_of_dex_registers);
1443 size_t GetDexRegisterMapsSize(const CodeInfoEncoding& encoding,
1446 for (size_t i = 0, e = GetNumberOfStackMaps(encoding); i < e; ++i) {
1447 StackMap stack_map = GetStackMapAt(i, encoding);
1448 DexRegisterMap map(GetDexRegisterMapOf(stack_map, encoding, number_of_dex_registers));
1457 const CodeInfoEncoding& encoding,
1459 if (!inline_info.HasDexRegisterMapAtDepth(encoding.inline_info.encoding, depth)) {
1462 uint32_t offset = encoding.dex_register_map.byte_offset +
1463 inline_info.GetDexRegisterMapOffsetAtDepth(encoding.inline_info.encoding, depth);
1464 size_t size = ComputeDexRegisterMapSizeOf(encoding, offset, number_of_dex_registers);
1469 InlineInfo GetInlineInfo(size_t index, const CodeInfoEncoding& encoding) const {
1474 const size_t bit_offset = encoding.inline_info.bit_offset +
1475 index * encoding.inline_info.encoding.BitSize();
1479 InlineInfo GetInlineInfoOf(StackMap stack_map, const CodeInfoEncoding& encoding) const {
1480 DCHECK(stack_map.HasInlineInfo(encoding.stack_map.encoding));
1481 uint32_t index = stack_map.GetInlineInfoIndex(encoding.stack_map.encoding);
1482 return GetInlineInfo(index, encoding);
1485 StackMap GetStackMapForDexPc(uint32_t dex_pc, const CodeInfoEncoding& encoding) const {
1486 for (size_t i = 0, e = GetNumberOfStackMaps(encoding); i < e; ++i) {
1487 StackMap stack_map = GetStackMapAt(i, encoding);
1488 if (stack_map.GetDexPc(encoding.stack_map.encoding) == dex_pc) {
1497 StackMap GetCatchStackMapForDexPc(uint32_t dex_pc, const CodeInfoEncoding& encoding) const {
1498 for (size_t i = GetNumberOfStackMaps(encoding); i > 0; --i) {
1499 StackMap stack_map = GetStackMapAt(i - 1, encoding);
1500 if (stack_map.GetDexPc(encoding.stack_map.encoding) == dex_pc) {
1507 StackMap GetOsrStackMapForDexPc(uint32_t dex_pc, const CodeInfoEncoding& encoding) const {
1508 size_t e = GetNumberOfStackMaps(encoding);
1515 const StackMapEncoding& stack_map_encoding = encoding.stack_map.encoding;
1517 StackMap stack_map = GetStackMapAt(i, encoding);
1519 StackMap other = GetStackMapAt(i + 1, encoding);
1530 GetStackMapAt(i + 2, encoding).GetNativePcOffset(stack_map_encoding, kRuntimeISA));
1540 const CodeInfoEncoding& encoding) const {
1544 for (size_t i = 0, e = GetNumberOfStackMaps(encoding); i < e; ++i) {
1545 StackMap stack_map = GetStackMapAt(i, encoding);
1546 if (stack_map.GetNativePcOffset(encoding.stack_map.encoding, kRuntimeISA) ==
1555 const CodeInfoEncoding& encoding) {
1556 for (size_t index = 0; index < encoding.invoke_info.num_entries; index++) {
1557 InvokeInfo item = GetInvokeInfo(encoding, index);
1558 if (item.GetNativePcOffset(encoding.invoke_info.encoding, kRuntimeISA) == native_pc_offset) {
1578 void AssertValidStackMap(const CodeInfoEncoding& encoding) const {
1579 if (region_.size() != 0 && region_.size_in_bits() < GetStackMapsSizeInBits(encoding)) {
1581 << encoding.HeaderSize() << "\n"
1582 << encoding.NonHeaderSize() << "\n"
1583 << encoding.location_catalog.num_entries << "\n"
1584 << encoding.stack_map.num_entries << "\n"
1585 << encoding.stack_map.encoding.BitSize();
1592 size_t ComputeDexRegisterMapSizeOf(const CodeInfoEncoding& encoding,
1606 DexRegisterMap::SingleEntrySizeInBits(GetNumberOfLocationCatalogEntries(encoding))