Home | History | Annotate | Download | only in runtime

Lines Matching refs:Encoding

86     // Large location kinds, requiring a 5-byte encoding (1 byte for the
658 // We reuse the idea from ULEB128p1 to support encoding of -1 (aka 0xFFFFFFFF).
758 // Encode the encoding into the vector.
766 // Decode the encoding from a pointer, updates the pointer.
804 ALWAYS_INLINE uint32_t GetDexPc(const StackMapEncoding& encoding) const {
805 return encoding.GetDexPcEncoding().Load(region_);
808 ALWAYS_INLINE void SetDexPc(const StackMapEncoding& encoding, uint32_t dex_pc) {
809 encoding.GetDexPcEncoding().Store(region_, dex_pc);
812 ALWAYS_INLINE uint32_t GetNativePcOffset(const StackMapEncoding& encoding,
815 CodeOffset::FromCompressedOffset(encoding
819 ALWAYS_INLINE void SetNativePcCodeOffset(const StackMapEncoding& encoding,
821 encoding.GetNativePcEncoding().Store(region_, native_pc_offset.CompressedValue());
824 ALWAYS_INLINE uint32_t GetDexRegisterMapOffset(const StackMapEncoding& encoding) const {
825 return encoding.GetDexRegisterMapEncoding().Load(region_);
828 ALWAYS_INLINE void SetDexRegisterMapOffset(const StackMapEncoding& encoding, uint32_t offset) {
829 encoding.GetDexRegisterMapEncoding().Store(region_, offset);
832 ALWAYS_INLINE uint32_t GetInlineInfoIndex(const StackMapEncoding& encoding) const {
833 return encoding.GetInlineInfoEncoding().Load(region_);
836 ALWAYS_INLINE void SetInlineInfoIndex(const StackMapEncoding& encoding, uint32_t index) {
837 encoding.GetInlineInfoEncoding().Store(region_, index);
840 ALWAYS_INLINE uint32_t GetRegisterMaskIndex(const StackMapEncoding& encoding) const {
841 return encoding.GetRegisterMaskIndexEncoding().Load(region_);
844 ALWAYS_INLINE void SetRegisterMaskIndex(const StackMapEncoding& encoding, uint32_t mask) {
845 encoding.GetRegisterMaskIndexEncoding().Store(region_, mask);
848 ALWAYS_INLINE uint32_t GetStackMaskIndex(const StackMapEncoding& encoding) const {
849 return encoding.GetStackMaskIndexEncoding().Load(region_);
852 ALWAYS_INLINE void SetStackMaskIndex(const StackMapEncoding& encoding, uint32_t mask) {
853 encoding.GetStackMaskIndexEncoding().Store(region_, mask);
856 ALWAYS_INLINE bool HasDexRegisterMap(const StackMapEncoding& encoding) const {
857 return GetDexRegisterMapOffset(encoding) != kNoDexRegisterMap;
860 ALWAYS_INLINE bool HasInlineInfo(const StackMapEncoding& encoding) const {
861 return GetInlineInfoIndex(encoding) != kNoInlineInfo;
872 const CodeInfoEncoding& encoding,
905 // Note: We're not encoding the dex pc if there is none. That's the case
938 // Encode the encoding into the vector.
946 // Decode the encoding from a pointer, updates the pointer.
974 ALWAYS_INLINE uint32_t GetDepth(const InlineInfoEncoding& encoding) const {
976 while (!GetRegionAtDepth(encoding, depth++).LoadBit(0)) { } // Check is_last bit.
980 ALWAYS_INLINE void SetDepth(const InlineInfoEncoding& encoding, uint32_t depth) {
983 GetRegionAtDepth(encoding, d).StoreBit(0, d == depth - 1); // Set is_last bit.
987 ALWAYS_INLINE uint32_t GetMethodIndexIdxAtDepth(const InlineInfoEncoding& encoding,
989 DCHECK(!EncodesArtMethodAtDepth(encoding, depth));
990 return encoding.GetMethodIndexIdxEncoding().Load(GetRegionAtDepth(encoding, depth));
993 ALWAYS_INLINE void SetMethodIndexIdxAtDepth(const InlineInfoEncoding& encoding,
996 encoding.GetMethodIndexIdxEncoding().Store(GetRegionAtDepth(encoding, depth), index);
1000 ALWAYS_INLINE uint32_t GetMethodIndexAtDepth(const InlineInfoEncoding& encoding,
1003 return method_info.GetMethodIndex(GetMethodIndexIdxAtDepth(encoding, depth));
1006 ALWAYS_INLINE uint32_t GetDexPcAtDepth(const InlineInfoEncoding& encoding,
1008 return encoding.GetDexPcEncoding().Load(GetRegionAtDepth(encoding, depth));
1011 ALWAYS_INLINE void SetDexPcAtDepth(const InlineInfoEncoding& encoding,
1014 encoding.GetDexPcEncoding().Store(GetRegionAtDepth(encoding, depth), dex_pc);
1017 ALWAYS_INLINE bool EncodesArtMethodAtDepth(const InlineInfoEncoding& encoding,
1019 return (encoding.GetExtraDataEncoding().Load(GetRegionAtDepth(encoding, depth)) & 1) == 0;
1022 ALWAYS_INLINE void SetExtraDataAtDepth(const InlineInfoEncoding& encoding,
1025 encoding.GetExtraDataEncoding().Store(GetRegionAtDepth(encoding, depth), extra_data);
1028 ALWAYS_INLINE ArtMethod* GetArtMethodAtDepth(const InlineInfoEncoding& encoding,
1030 uint32_t low_bits = encoding.GetExtraDataEncoding().Load(GetRegionAtDepth(encoding, depth));
1031 uint32_t high_bits = encoding.GetMethodIndexIdxEncoding().Load(
1032 GetRegionAtDepth(encoding, depth));
1042 ALWAYS_INLINE uint32_t GetDexRegisterMapOffsetAtDepth(const InlineInfoEncoding& encoding,
1044 return encoding.GetDexRegisterMapEncoding().Load(GetRegionAtDepth(encoding, depth));
1047 ALWAYS_INLINE void SetDexRegisterMapOffsetAtDepth(const InlineInfoEncoding& encoding,
1050 encoding.GetDexRegisterMapEncoding().Store(GetRegionAtDepth(encoding, depth), offset);
1053 ALWAYS_INLINE bool HasDexRegisterMapAtDepth(const InlineInfoEncoding& encoding,
1055 return GetDexRegisterMapOffsetAtDepth(encoding, depth) != StackMap::kNoDexRegisterMap;
1064 ALWAYS_INLINE BitMemoryRegion GetRegionAtDepth(const InlineInfoEncoding& encoding,
1066 size_t entry_size = encoding.BitSize();
1074 // Bit sized region encoding, may be more than 255 bits.
1094 template <typename Encoding>
1097 // How the encoding is laid out (serialized).
1098 Encoding encoding;
1109 encoding.Encode(dest);
1114 encoding.Decode(ptr);
1121 *offset += encoding.BitSize() * num_entries;
1128 const size_t map_size = encoding.BitSize();
1220 ALWAYS_INLINE uint32_t GetNativePcOffset(const InvokeInfoEncoding& encoding,
1223 CodeOffset::FromCompressedOffset(encoding.GetNativePcEncoding().Load(region_)));
1227 ALWAYS_INLINE void SetNativePcCodeOffset(const InvokeInfoEncoding& encoding,
1229 encoding.GetNativePcEncoding().Store(region_, native_pc_offset.CompressedValue());
1232 ALWAYS_INLINE uint32_t GetInvokeType(const InvokeInfoEncoding& encoding) const {
1233 return encoding.GetInvokeTypeEncoding().Load(region_);
1236 ALWAYS_INLINE void SetInvokeType(const InvokeInfoEncoding& encoding, uint32_t invoke_type) {
1237 encoding.GetInvokeTypeEncoding().Store(region_, invoke_type);
1240 ALWAYS_INLINE uint32_t GetMethodIndexIdx(const InvokeInfoEncoding& encoding) const {
1241 return encoding.GetMethodIndexEncoding().Load(region_);
1244 ALWAYS_INLINE void SetMethodIndexIdx(const InvokeInfoEncoding& encoding,
1246 encoding.GetMethodIndexEncoding().Store(region_, method_index_idx);
1249 ALWAYS_INLINE uint32_t GetMethodIndex(const InvokeInfoEncoding& encoding,
1251 return method_info.GetMethodIndex(GetMethodIndexIdx(encoding));
1282 if (stack_map.encoding.GetInlineInfoEncoding().BitSize() > 0) {
1301 if (stack_map.encoding.GetInlineInfoEncoding().BitSize() > 0) {
1334 // Header size in bytes, cached to avoid needing to re-decoding the encoding in HeaderSize.
1336 // Non header size in bytes, cached to avoid needing to re-decoding the encoding in NonHeaderSize.
1359 CodeInfoEncoding encoding = CodeInfoEncoding(data);
1361 encoding.HeaderSize() + encoding.NonHeaderSize());
1365 CodeInfoEncoding encoding(region_.begin());
1366 AssertValidStackMap(encoding);
1367 return encoding;
1370 bool HasInlineInfo(const CodeInfoEncoding& encoding) const {
1371 return encoding.stack_map.encoding.GetInlineInfoEncoding().BitSize() > 0;
1374 DexRegisterLocationCatalog GetDexRegisterLocationCatalog(const CodeInfoEncoding& encoding) const {
1375 return DexRegisterLocationCatalog(region_.Subregion(encoding.location_catalog.byte_offset,
1376 encoding.location_catalog.num_bytes));
1379 ALWAYS_INLINE size_t GetNumberOfStackMaskBits(const CodeInfoEncoding& encoding) const {
1380 return encoding.stack_mask.encoding.BitSize();
1383 ALWAYS_INLINE StackMap GetStackMapAt(size_t index, const CodeInfoEncoding& encoding) const {
1384 return StackMap(encoding.stack_map.BitRegion(region_, index));
1387 BitMemoryRegion GetStackMask(size_t index, const CodeInfoEncoding& encoding) const {
1388 return encoding.stack_mask.BitRegion(region_, index);
1391 BitMemoryRegion GetStackMaskOf(const CodeInfoEncoding& encoding,
1393 return GetStackMask(stack_map.GetStackMaskIndex(encoding.stack_map.encoding), encoding);
1396 BitMemoryRegion GetRegisterMask(size_t index, const CodeInfoEncoding& encoding) const {
1397 return encoding.register_mask.BitRegion(region_, index);
1400 uint32_t GetRegisterMaskOf(const CodeInfoEncoding& encoding, const StackMap& stack_map) const {
1401 size_t index = stack_map.GetRegisterMaskIndex(encoding.stack_map.encoding);
1402 return GetRegisterMask(index, encoding).LoadBits(0u, encoding.register_mask.encoding.BitSize());
1405 uint32_t GetNumberOfLocationCatalogEntries(const CodeInfoEncoding& encoding) const {
1406 return encoding.location_catalog.num_entries;
1409 uint32_t GetDexRegisterLocationCatalogSize(const CodeInfoEncoding& encoding) const {
1410 return encoding.location_catalog.num_bytes;
1413 uint32_t GetNumberOfStackMaps(const CodeInfoEncoding& encoding) const {
1414 return encoding.stack_map.num_entries;
1418 ALWAYS_INLINE size_t GetStackMapsSizeInBits(const CodeInfoEncoding& encoding) const {
1419 return encoding.stack_map.encoding.BitSize() * GetNumberOfStackMaps(encoding);
1422 InvokeInfo GetInvokeInfo(const CodeInfoEncoding& encoding, size_t index) const {
1423 return InvokeInfo(encoding.invoke_info.BitRegion(region_, index));
1427 const CodeInfoEncoding& encoding,
1429 if (!stack_map.HasDexRegisterMap(encoding.stack_map.encoding)) {
1432 const uint32_t offset = encoding.dex_register_map.byte_offset +
1433 stack_map.GetDexRegisterMapOffset(encoding.stack_map.encoding);
1434 size_t size = ComputeDexRegisterMapSizeOf(encoding, offset, number_of_dex_registers);
1438 size_t GetDexRegisterMapsSize(const CodeInfoEncoding& encoding,
1441 for (size_t i = 0, e = GetNumberOfStackMaps(encoding); i < e; ++i) {
1442 StackMap stack_map = GetStackMapAt(i, encoding);
1443 DexRegisterMap map(GetDexRegisterMapOf(stack_map, encoding, number_of_dex_registers));
1452 const CodeInfoEncoding& encoding,
1454 if (!inline_info.HasDexRegisterMapAtDepth(encoding.inline_info.encoding, depth)) {
1457 uint32_t offset = encoding.dex_register_map.byte_offset +
1458 inline_info.GetDexRegisterMapOffsetAtDepth(encoding.inline_info.encoding, depth);
1459 size_t size = ComputeDexRegisterMapSizeOf(encoding, offset, number_of_dex_registers);
1464 InlineInfo GetInlineInfo(size_t index, const CodeInfoEncoding& encoding) const {
1469 const size_t bit_offset = encoding.inline_info.bit_offset +
1470 index * encoding.inline_info.encoding.BitSize();
1474 InlineInfo GetInlineInfoOf(StackMap stack_map, const CodeInfoEncoding& encoding) const {
1475 DCHECK(stack_map.HasInlineInfo(encoding.stack_map.encoding));
1476 uint32_t index = stack_map.GetInlineInfoIndex(encoding.stack_map.encoding);
1477 return GetInlineInfo(index, encoding);
1480 StackMap GetStackMapForDexPc(uint32_t dex_pc, const CodeInfoEncoding& encoding) const {
1481 for (size_t i = 0, e = GetNumberOfStackMaps(encoding); i < e; ++i) {
1482 StackMap stack_map = GetStackMapAt(i, encoding);
1483 if (stack_map.GetDexPc(encoding.stack_map.encoding) == dex_pc) {
1492 StackMap GetCatchStackMapForDexPc(uint32_t dex_pc, const CodeInfoEncoding& encoding) const {
1493 for (size_t i = GetNumberOfStackMaps(encoding); i > 0; --i) {
1494 StackMap stack_map = GetStackMapAt(i - 1, encoding);
1495 if (stack_map.GetDexPc(encoding.stack_map.encoding) == dex_pc) {
1502 StackMap GetOsrStackMapForDexPc(uint32_t dex_pc, const CodeInfoEncoding& encoding) const {
1503 size_t e = GetNumberOfStackMaps(encoding);
1510 const StackMapEncoding& stack_map_encoding = encoding.stack_map.encoding;
1512 StackMap stack_map = GetStackMapAt(i, encoding);
1514 StackMap other = GetStackMapAt(i + 1, encoding);
1525 GetStackMapAt(i + 2, encoding).GetNativePcOffset(stack_map_encoding, kRuntimeISA));
1535 const CodeInfoEncoding& encoding) const {
1539 for (size_t i = 0, e = GetNumberOfStackMaps(encoding); i < e; ++i) {
1540 StackMap stack_map = GetStackMapAt(i, encoding);
1541 if (stack_map.GetNativePcOffset(encoding.stack_map.encoding, kRuntimeISA) ==
1550 const CodeInfoEncoding& encoding) {
1551 for (size_t index = 0; index < encoding.invoke_info.num_entries; index++) {
1552 InvokeInfo item = GetInvokeInfo(encoding, index);
1553 if (item.GetNativePcOffset(encoding.invoke_info.encoding, kRuntimeISA) == native_pc_offset) {
1573 void AssertValidStackMap(const CodeInfoEncoding& encoding) const {
1574 if (region_.size() != 0 && region_.size_in_bits() < GetStackMapsSizeInBits(encoding)) {
1576 << encoding.HeaderSize() << "\n"
1577 << encoding.NonHeaderSize() << "\n"
1578 << encoding.location_catalog.num_entries << "\n"
1579 << encoding.stack_map.num_entries << "\n"
1580 << encoding.stack_map.encoding.BitSize();
1587 size_t ComputeDexRegisterMapSizeOf(const CodeInfoEncoding& encoding,
1601 DexRegisterMap::SingleEntrySizeInBits(GetNumberOfLocationCatalogEntries(encoding))