Lines Matching refs:Ctx
83 static uint8_t readUint8(WasmObjectFile::ReadContext &Ctx) { in readUint8() argument
84 if (Ctx.Ptr == Ctx.End) in readUint8()
86 return *Ctx.Ptr++; in readUint8()
89 static uint32_t readUint32(WasmObjectFile::ReadContext &Ctx) { in readUint32() argument
90 if (Ctx.Ptr + 4 > Ctx.End) in readUint32()
92 uint32_t Result = support::endian::read32le(Ctx.Ptr); in readUint32()
93 Ctx.Ptr += 4; in readUint32()
97 static int32_t readFloat32(WasmObjectFile::ReadContext &Ctx) { in readFloat32() argument
98 if (Ctx.Ptr + 4 > Ctx.End) in readFloat32()
101 memcpy(&Result, Ctx.Ptr, sizeof(Result)); in readFloat32()
102 Ctx.Ptr += sizeof(Result); in readFloat32()
106 static int64_t readFloat64(WasmObjectFile::ReadContext &Ctx) { in readFloat64() argument
107 if (Ctx.Ptr + 8 > Ctx.End) in readFloat64()
110 memcpy(&Result, Ctx.Ptr, sizeof(Result)); in readFloat64()
111 Ctx.Ptr += sizeof(Result); in readFloat64()
115 static uint64_t readULEB128(WasmObjectFile::ReadContext &Ctx) { in readULEB128() argument
118 uint64_t Result = decodeULEB128(Ctx.Ptr, &Count, Ctx.End, &Error); in readULEB128()
121 Ctx.Ptr += Count; in readULEB128()
125 static StringRef readString(WasmObjectFile::ReadContext &Ctx) { in readString() argument
126 uint32_t StringLen = readULEB128(Ctx); in readString()
127 if (Ctx.Ptr + StringLen > Ctx.End) in readString()
130 StringRef(reinterpret_cast<const char *>(Ctx.Ptr), StringLen); in readString()
131 Ctx.Ptr += StringLen; in readString()
135 static int64_t readLEB128(WasmObjectFile::ReadContext &Ctx) { in readLEB128() argument
138 uint64_t Result = decodeSLEB128(Ctx.Ptr, &Count, Ctx.End, &Error); in readLEB128()
141 Ctx.Ptr += Count; in readLEB128()
145 static uint8_t readVaruint1(WasmObjectFile::ReadContext &Ctx) { in readVaruint1() argument
146 int64_t Result = readLEB128(Ctx); in readVaruint1()
152 static int32_t readVarint32(WasmObjectFile::ReadContext &Ctx) { in readVarint32() argument
153 int64_t Result = readLEB128(Ctx); in readVarint32()
159 static uint32_t readVaruint32(WasmObjectFile::ReadContext &Ctx) { in readVaruint32() argument
160 uint64_t Result = readULEB128(Ctx); in readVaruint32()
166 static int64_t readVarint64(WasmObjectFile::ReadContext &Ctx) { in readVarint64() argument
167 return readLEB128(Ctx); in readVarint64()
170 static uint64_t readVaruint64(WasmObjectFile::ReadContext &Ctx) { in readVaruint64() argument
171 return readULEB128(Ctx); in readVaruint64()
174 static uint8_t readOpcode(WasmObjectFile::ReadContext &Ctx) { in readOpcode() argument
175 return readUint8(Ctx); in readOpcode()
178 static wasm::ValType parseValType(WasmObjectFile::ReadContext &Ctx, in parseValType() argument
194 /* Discard HeapType */ readVarint64(Ctx); in parseValType()
200 WasmObjectFile::ReadContext &Ctx) { in readInitExpr() argument
201 auto Start = Ctx.Ptr; in readInitExpr()
204 Expr.Inst.Opcode = readOpcode(Ctx); in readInitExpr()
207 Expr.Inst.Value.Int32 = readVarint32(Ctx); in readInitExpr()
210 Expr.Inst.Value.Int64 = readVarint64(Ctx); in readInitExpr()
213 Expr.Inst.Value.Float32 = readFloat32(Ctx); in readInitExpr()
216 Expr.Inst.Value.Float64 = readFloat64(Ctx); in readInitExpr()
219 Expr.Inst.Value.Global = readULEB128(Ctx); in readInitExpr()
222 /* Discard type */ parseValType(Ctx, readVaruint32(Ctx)); in readInitExpr()
230 uint8_t EndOpcode = readOpcode(Ctx); in readInitExpr()
236 Ctx.Ptr = Start; in readInitExpr()
238 uint8_t Opcode = readOpcode(Ctx); in readInitExpr()
245 readULEB128(Ctx); in readInitExpr()
248 readFloat32(Ctx); in readInitExpr()
251 readFloat64(Ctx); in readInitExpr()
269 readULEB128(Ctx); // heap type index in readInitExpr()
272 readULEB128(Ctx); // heap type index in readInitExpr()
273 readULEB128(Ctx); // array size in readInitExpr()
278 Expr.Body = ArrayRef<uint8_t>(Start, Ctx.Ptr - Start); in readInitExpr()
291 static wasm::WasmLimits readLimits(WasmObjectFile::ReadContext &Ctx) { in readLimits() argument
293 Result.Flags = readVaruint32(Ctx); in readLimits()
294 Result.Minimum = readVaruint64(Ctx); in readLimits()
296 Result.Maximum = readVaruint64(Ctx); in readLimits()
300 static wasm::WasmTableType readTableType(WasmObjectFile::ReadContext &Ctx) { in readTableType() argument
302 auto ElemType = parseValType(Ctx, readVaruint32(Ctx)); in readTableType()
304 TableType.Limits = readLimits(Ctx); in readTableType()
308 static Error readSection(WasmSection &Section, WasmObjectFile::ReadContext &Ctx, in readSection() argument
310 Section.Type = readUint8(Ctx); in readSection()
314 const uint8_t *PreSizePtr = Ctx.Ptr; in readSection()
315 uint32_t Size = readVaruint32(Ctx); in readSection()
316 Section.HeaderSecSizeEncodingLen = Ctx.Ptr - PreSizePtr; in readSection()
317 Section.Offset = Ctx.Ptr - Ctx.Start; in readSection()
321 if (Ctx.Ptr + Size > Ctx.End) in readSection()
326 SectionCtx.Start = Ctx.Ptr; in readSection()
327 SectionCtx.Ptr = Ctx.Ptr; in readSection()
328 SectionCtx.End = Ctx.Ptr + Size; in readSection()
333 Ctx.Ptr += SectionNameSize; in readSection()
343 Section.Content = ArrayRef<uint8_t>(Ctx.Ptr, Size); in readSection()
344 Ctx.Ptr += Size; in readSection()
358 ReadContext Ctx; in WasmObjectFile() local
359 Ctx.Start = getData().bytes_begin(); in WasmObjectFile()
360 Ctx.Ptr = Ctx.Start + 4; in WasmObjectFile()
361 Ctx.End = Ctx.Start + getData().size(); in WasmObjectFile()
363 if (Ctx.Ptr + 4 > Ctx.End) { in WasmObjectFile()
369 Header.Version = readUint32(Ctx); in WasmObjectFile()
378 while (Ctx.Ptr < Ctx.End) { in WasmObjectFile()
380 if ((Err = readSection(Sec, Ctx, Checker))) in WasmObjectFile()
390 ReadContext Ctx; in parseSection() local
391 Ctx.Start = Sec.Content.data(); in parseSection()
392 Ctx.End = Ctx.Start + Sec.Content.size(); in parseSection()
393 Ctx.Ptr = Ctx.Start; in parseSection()
396 return parseCustomSection(Sec, Ctx); in parseSection()
398 return parseTypeSection(Ctx); in parseSection()
400 return parseImportSection(Ctx); in parseSection()
402 return parseFunctionSection(Ctx); in parseSection()
404 return parseTableSection(Ctx); in parseSection()
406 return parseMemorySection(Ctx); in parseSection()
408 return parseTagSection(Ctx); in parseSection()
410 return parseGlobalSection(Ctx); in parseSection()
412 return parseExportSection(Ctx); in parseSection()
414 return parseStartSection(Ctx); in parseSection()
416 return parseElemSection(Ctx); in parseSection()
418 return parseCodeSection(Ctx); in parseSection()
420 return parseDataSection(Ctx); in parseSection()
422 return parseDataCountSection(Ctx); in parseSection()
429 Error WasmObjectFile::parseDylinkSection(ReadContext &Ctx) { in parseDylinkSection() argument
433 DylinkInfo.MemorySize = readVaruint32(Ctx); in parseDylinkSection()
434 DylinkInfo.MemoryAlignment = readVaruint32(Ctx); in parseDylinkSection()
435 DylinkInfo.TableSize = readVaruint32(Ctx); in parseDylinkSection()
436 DylinkInfo.TableAlignment = readVaruint32(Ctx); in parseDylinkSection()
437 uint32_t Count = readVaruint32(Ctx); in parseDylinkSection()
439 DylinkInfo.Needed.push_back(readString(Ctx)); in parseDylinkSection()
442 if (Ctx.Ptr != Ctx.End) in parseDylinkSection()
448 Error WasmObjectFile::parseDylink0Section(ReadContext &Ctx) { in parseDylink0Section() argument
453 const uint8_t *OrigEnd = Ctx.End; in parseDylink0Section()
454 while (Ctx.Ptr < OrigEnd) { in parseDylink0Section()
455 Ctx.End = OrigEnd; in parseDylink0Section()
456 uint8_t Type = readUint8(Ctx); in parseDylink0Section()
457 uint32_t Size = readVaruint32(Ctx); in parseDylink0Section()
460 Ctx.End = Ctx.Ptr + Size; in parseDylink0Section()
464 DylinkInfo.MemorySize = readVaruint32(Ctx); in parseDylink0Section()
465 DylinkInfo.MemoryAlignment = readVaruint32(Ctx); in parseDylink0Section()
466 DylinkInfo.TableSize = readVaruint32(Ctx); in parseDylink0Section()
467 DylinkInfo.TableAlignment = readVaruint32(Ctx); in parseDylink0Section()
470 Count = readVaruint32(Ctx); in parseDylink0Section()
472 DylinkInfo.Needed.push_back(readString(Ctx)); in parseDylink0Section()
476 uint32_t Count = readVaruint32(Ctx); in parseDylink0Section()
478 DylinkInfo.ExportInfo.push_back({readString(Ctx), readVaruint32(Ctx)}); in parseDylink0Section()
483 uint32_t Count = readVaruint32(Ctx); in parseDylink0Section()
486 {readString(Ctx), readString(Ctx), readVaruint32(Ctx)}); in parseDylink0Section()
492 Ctx.Ptr += Size; in parseDylink0Section()
495 if (Ctx.Ptr != Ctx.End) { in parseDylink0Section()
501 if (Ctx.Ptr != Ctx.End) in parseDylink0Section()
507 Error WasmObjectFile::parseNameSection(ReadContext &Ctx) { in parseNameSection() argument
521 while (Ctx.Ptr < Ctx.End) { in parseNameSection()
522 uint8_t Type = readUint8(Ctx); in parseNameSection()
523 uint32_t Size = readVaruint32(Ctx); in parseNameSection()
524 const uint8_t *SubSectionEnd = Ctx.Ptr + Size; in parseNameSection()
530 uint32_t Count = readVaruint32(Ctx); in parseNameSection()
532 uint32_t Index = readVaruint32(Ctx); in parseNameSection()
533 StringRef Name = readString(Ctx); in parseNameSection()
603 Ctx.Ptr += Size; in parseNameSection()
606 if (Ctx.Ptr != SubSectionEnd) in parseNameSection()
611 if (Ctx.Ptr != Ctx.End) in parseNameSection()
617 Error WasmObjectFile::parseLinkingSection(ReadContext &Ctx) { in parseLinkingSection() argument
620 LinkingData.Version = readVaruint32(Ctx); in parseLinkingSection()
628 const uint8_t *OrigEnd = Ctx.End; in parseLinkingSection()
629 while (Ctx.Ptr < OrigEnd) { in parseLinkingSection()
630 Ctx.End = OrigEnd; in parseLinkingSection()
631 uint8_t Type = readUint8(Ctx); in parseLinkingSection()
632 uint32_t Size = readVaruint32(Ctx); in parseLinkingSection()
635 Ctx.End = Ctx.Ptr + Size; in parseLinkingSection()
638 if (Error Err = parseLinkingSectionSymtab(Ctx)) in parseLinkingSection()
642 uint32_t Count = readVaruint32(Ctx); in parseLinkingSection()
647 DataSegments[I].Data.Name = readString(Ctx); in parseLinkingSection()
648 DataSegments[I].Data.Alignment = readVaruint32(Ctx); in parseLinkingSection()
649 DataSegments[I].Data.LinkingFlags = readVaruint32(Ctx); in parseLinkingSection()
654 uint32_t Count = readVaruint32(Ctx); in parseLinkingSection()
658 Init.Priority = readVaruint32(Ctx); in parseLinkingSection()
659 Init.Symbol = readVaruint32(Ctx); in parseLinkingSection()
669 if (Error Err = parseLinkingSectionComdat(Ctx)) in parseLinkingSection()
673 Ctx.Ptr += Size; in parseLinkingSection()
676 if (Ctx.Ptr != Ctx.End) in parseLinkingSection()
680 if (Ctx.Ptr != OrigEnd) in parseLinkingSection()
686 Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { in parseLinkingSectionSymtab() argument
687 uint32_t Count = readVaruint32(Ctx); in parseLinkingSectionSymtab()
719 Info.Kind = readUint8(Ctx); in parseLinkingSectionSymtab()
720 Info.Flags = readVaruint32(Ctx); in parseLinkingSectionSymtab()
725 Info.ElementIndex = readVaruint32(Ctx); in parseLinkingSectionSymtab()
731 Info.Name = readString(Ctx); in parseLinkingSectionSymtab()
740 Info.Name = readString(Ctx); in parseLinkingSectionSymtab()
751 Info.ElementIndex = readVaruint32(Ctx); in parseLinkingSectionSymtab()
761 Info.Name = readString(Ctx); in parseLinkingSectionSymtab()
770 Info.Name = readString(Ctx); in parseLinkingSectionSymtab()
781 Info.ElementIndex = readVaruint32(Ctx); in parseLinkingSectionSymtab()
791 Info.Name = readString(Ctx); in parseLinkingSectionSymtab()
800 Info.Name = readString(Ctx); in parseLinkingSectionSymtab()
811 Info.Name = readString(Ctx); in parseLinkingSectionSymtab()
813 auto Index = readVaruint32(Ctx); in parseLinkingSectionSymtab()
814 auto Offset = readVaruint64(Ctx); in parseLinkingSectionSymtab()
815 auto Size = readVaruint64(Ctx); in parseLinkingSectionSymtab()
839 Info.ElementIndex = readVaruint32(Ctx); in parseLinkingSectionSymtab()
847 Info.ElementIndex = readVaruint32(Ctx); in parseLinkingSectionSymtab()
857 Info.Name = readString(Ctx); in parseLinkingSectionSymtab()
867 Info.Name = readString(Ctx); in parseLinkingSectionSymtab()
897 Error WasmObjectFile::parseLinkingSectionComdat(ReadContext &Ctx) { in parseLinkingSectionComdat() argument
898 uint32_t ComdatCount = readVaruint32(Ctx); in parseLinkingSectionComdat()
901 StringRef Name = readString(Ctx); in parseLinkingSectionComdat()
907 uint32_t Flags = readVaruint32(Ctx); in parseLinkingSectionComdat()
912 uint32_t EntryCount = readVaruint32(Ctx); in parseLinkingSectionComdat()
914 unsigned Kind = readVaruint32(Ctx); in parseLinkingSectionComdat()
915 unsigned Index = readVaruint32(Ctx); in parseLinkingSectionComdat()
953 Error WasmObjectFile::parseProducersSection(ReadContext &Ctx) { in parseProducersSection() argument
955 uint32_t Fields = readVaruint32(Ctx); in parseProducersSection()
957 StringRef FieldName = readString(Ctx); in parseProducersSection()
975 uint32_t ValueCount = readVaruint32(Ctx); in parseProducersSection()
978 StringRef Name = readString(Ctx); in parseProducersSection()
979 StringRef Version = readString(Ctx); in parseProducersSection()
988 if (Ctx.Ptr != Ctx.End) in parseProducersSection()
994 Error WasmObjectFile::parseTargetFeaturesSection(ReadContext &Ctx) { in parseTargetFeaturesSection() argument
996 uint32_t FeatureCount = readVaruint32(Ctx); in parseTargetFeaturesSection()
999 Feature.Prefix = readUint8(Ctx); in parseTargetFeaturesSection()
1009 Feature.Name = std::string(readString(Ctx)); in parseTargetFeaturesSection()
1017 if (Ctx.Ptr != Ctx.End) in parseTargetFeaturesSection()
1024 Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { in parseRelocSection() argument
1025 uint32_t SectionIndex = readVaruint32(Ctx); in parseRelocSection()
1030 uint32_t RelocCount = readVaruint32(Ctx); in parseRelocSection()
1035 uint32_t type = readVaruint32(Ctx); in parseRelocSection()
1037 Reloc.Offset = readVaruint32(Ctx); in parseRelocSection()
1049 Reloc.Index = readVaruint32(Ctx); in parseRelocSection()
1094 Reloc.Addend = readVarint32(Ctx); in parseRelocSection()
1103 Reloc.Addend = readVarint64(Ctx); in parseRelocSection()
1108 Reloc.Addend = readVarint32(Ctx); in parseRelocSection()
1113 Reloc.Addend = readVarint64(Ctx); in parseRelocSection()
1118 Reloc.Addend = readVarint32(Ctx); in parseRelocSection()
1152 if (Ctx.Ptr != Ctx.End) in parseRelocSection()
1158 Error WasmObjectFile::parseCustomSection(WasmSection &Sec, ReadContext &Ctx) { in parseCustomSection() argument
1160 if (Error Err = parseDylinkSection(Ctx)) in parseCustomSection()
1163 if (Error Err = parseDylink0Section(Ctx)) in parseCustomSection()
1166 if (Error Err = parseNameSection(Ctx)) in parseCustomSection()
1169 if (Error Err = parseLinkingSection(Ctx)) in parseCustomSection()
1172 if (Error Err = parseProducersSection(Ctx)) in parseCustomSection()
1175 if (Error Err = parseTargetFeaturesSection(Ctx)) in parseCustomSection()
1178 if (Error Err = parseRelocSection(Sec.Name, Ctx)) in parseCustomSection()
1184 Error WasmObjectFile::parseTypeSection(ReadContext &Ctx) { in parseTypeSection() argument
1186 uint32_t TypeCode = readVaruint32((Ctx)); in parseTypeSection()
1187 /* Discard StorageType */ parseValType(Ctx, TypeCode); in parseTypeSection()
1188 /* Discard Mutability */ readVaruint32(Ctx); in parseTypeSection()
1191 uint32_t Count = readVaruint32(Ctx); in parseTypeSection()
1195 uint8_t Form = readUint8(Ctx); in parseTypeSection()
1199 uint32_t RecSize = readVaruint32(Ctx); in parseTypeSection()
1215 uint32_t Supers = readVaruint32(Ctx); in parseTypeSection()
1220 /* Discard SuperIndex */ readVaruint32(Ctx); in parseTypeSection()
1222 Form = readVaruint32(Ctx); in parseTypeSection()
1225 uint32_t FieldCount = readVaruint32(Ctx); in parseTypeSection()
1241 uint32_t ParamCount = readVaruint32(Ctx); in parseTypeSection()
1244 uint32_t ParamType = readUint8(Ctx); in parseTypeSection()
1245 Sig.Params.push_back(parseValType(Ctx, ParamType)); in parseTypeSection()
1248 uint32_t ReturnCount = readVaruint32(Ctx); in parseTypeSection()
1250 uint32_t ReturnType = readUint8(Ctx); in parseTypeSection()
1251 Sig.Returns.push_back(parseValType(Ctx, ReturnType)); in parseTypeSection()
1256 if (Ctx.Ptr != Ctx.End) in parseTypeSection()
1262 Error WasmObjectFile::parseImportSection(ReadContext &Ctx) { in parseImportSection() argument
1263 uint32_t Count = readVaruint32(Ctx); in parseImportSection()
1268 Im.Module = readString(Ctx); in parseImportSection()
1269 Im.Field = readString(Ctx); in parseImportSection()
1270 Im.Kind = readUint8(Ctx); in parseImportSection()
1274 Im.SigIndex = readVaruint32(Ctx); in parseImportSection()
1281 Im.Global.Type = readUint8(Ctx); in parseImportSection()
1282 Im.Global.Mutable = readVaruint1(Ctx); in parseImportSection()
1285 Im.Memory = readLimits(Ctx); in parseImportSection()
1290 Im.Table = readTableType(Ctx); in parseImportSection()
1303 if (readUint8(Ctx) != 0) // Reserved 'attribute' field in parseImportSection()
1306 Im.SigIndex = readVaruint32(Ctx); in parseImportSection()
1317 if (Ctx.Ptr != Ctx.End) in parseImportSection()
1323 Error WasmObjectFile::parseFunctionSection(ReadContext &Ctx) { in parseFunctionSection() argument
1324 uint32_t Count = readVaruint32(Ctx); in parseFunctionSection()
1328 uint32_t Type = readVaruint32(Ctx); in parseFunctionSection()
1336 if (Ctx.Ptr != Ctx.End) in parseFunctionSection()
1342 Error WasmObjectFile::parseTableSection(ReadContext &Ctx) { in parseTableSection() argument
1344 uint32_t Count = readVaruint32(Ctx); in parseTableSection()
1348 T.Type = readTableType(Ctx); in parseTableSection()
1360 if (Ctx.Ptr != Ctx.End) in parseTableSection()
1366 Error WasmObjectFile::parseMemorySection(ReadContext &Ctx) { in parseMemorySection() argument
1367 uint32_t Count = readVaruint32(Ctx); in parseMemorySection()
1370 auto Limits = readLimits(Ctx); in parseMemorySection()
1375 if (Ctx.Ptr != Ctx.End) in parseMemorySection()
1381 Error WasmObjectFile::parseTagSection(ReadContext &Ctx) { in parseTagSection() argument
1383 uint32_t Count = readVaruint32(Ctx); in parseTagSection()
1387 if (readUint8(Ctx) != 0) // Reserved 'attribute' field in parseTagSection()
1390 uint32_t Type = readVaruint32(Ctx); in parseTagSection()
1401 if (Ctx.Ptr != Ctx.End) in parseTagSection()
1407 Error WasmObjectFile::parseGlobalSection(ReadContext &Ctx) { in parseGlobalSection() argument
1409 const uint8_t *SectionStart = Ctx.Ptr; in parseGlobalSection()
1410 uint32_t Count = readVaruint32(Ctx); in parseGlobalSection()
1415 const uint8_t *GlobalStart = Ctx.Ptr; in parseGlobalSection()
1417 auto GlobalOpcode = readVaruint32(Ctx); in parseGlobalSection()
1418 Global.Type.Type = (uint8_t)parseValType(Ctx, GlobalOpcode); in parseGlobalSection()
1419 Global.Type.Mutable = readVaruint1(Ctx); in parseGlobalSection()
1420 if (Error Err = readInitExpr(Global.InitExpr, Ctx)) in parseGlobalSection()
1422 Global.Size = static_cast<uint32_t>(Ctx.Ptr - GlobalStart); in parseGlobalSection()
1425 if (Ctx.Ptr != Ctx.End) in parseGlobalSection()
1431 Error WasmObjectFile::parseExportSection(ReadContext &Ctx) { in parseExportSection() argument
1432 uint32_t Count = readVaruint32(Ctx); in parseExportSection()
1437 Ex.Name = readString(Ctx); in parseExportSection()
1438 Ex.Kind = readUint8(Ctx); in parseExportSection()
1439 Ex.Index = readVaruint32(Ctx); in parseExportSection()
1502 if (Ctx.Ptr != Ctx.End) in parseExportSection()
1585 Error WasmObjectFile::parseStartSection(ReadContext &Ctx) { in parseStartSection() argument
1586 StartFunction = readVaruint32(Ctx); in parseStartSection()
1593 Error WasmObjectFile::parseCodeSection(ReadContext &Ctx) { in parseCodeSection() argument
1595 uint32_t FunctionCount = readVaruint32(Ctx); in parseCodeSection()
1603 const uint8_t *FunctionStart = Ctx.Ptr; in parseCodeSection()
1604 uint32_t Size = readVaruint32(Ctx); in parseCodeSection()
1605 const uint8_t *FunctionEnd = Ctx.Ptr + Size; in parseCodeSection()
1607 Function.CodeOffset = Ctx.Ptr - FunctionStart; in parseCodeSection()
1609 Function.CodeSectionOffset = FunctionStart - Ctx.Start; in parseCodeSection()
1612 uint32_t NumLocalDecls = readVaruint32(Ctx); in parseCodeSection()
1616 Decl.Count = readVaruint32(Ctx); in parseCodeSection()
1617 Decl.Type = readUint8(Ctx); in parseCodeSection()
1621 uint32_t BodySize = FunctionEnd - Ctx.Ptr; in parseCodeSection()
1623 if (Ctx.Ptr + BodySize > Ctx.End) { in parseCodeSection()
1627 Function.Body = ArrayRef<uint8_t>(Ctx.Ptr, BodySize); in parseCodeSection()
1630 Ctx.Ptr += BodySize; in parseCodeSection()
1631 assert(Ctx.Ptr == FunctionEnd); in parseCodeSection()
1633 if (Ctx.Ptr != Ctx.End) in parseCodeSection()
1639 Error WasmObjectFile::parseElemSection(ReadContext &Ctx) { in parseElemSection() argument
1640 uint32_t Count = readVaruint32(Ctx); in parseElemSection()
1644 Segment.Flags = readVaruint32(Ctx); in parseElemSection()
1666 Segment.TableNumber = readVaruint32(Ctx); in parseElemSection()
1679 if (Error Err = readInitExpr(Segment.Offset, Ctx)) in parseElemSection()
1684 auto ElemKind = readVaruint32(Ctx); in parseElemSection()
1686 Segment.ElemKind = parseValType(Ctx, ElemKind); in parseElemSection()
1701 auto ElemType = parseValType(Ctx, readVaruint32(Ctx)); in parseElemSection()
1707 uint32_t NumElems = readVaruint32(Ctx); in parseElemSection()
1712 if (Error Err = readInitExpr(Expr, Ctx)) in parseElemSection()
1717 Segment.Functions.push_back(readVaruint32(Ctx)); in parseElemSection()
1722 if (Ctx.Ptr != Ctx.End) in parseElemSection()
1728 Error WasmObjectFile::parseDataSection(ReadContext &Ctx) { in parseDataSection() argument
1730 uint32_t Count = readVaruint32(Ctx); in parseDataSection()
1737 Segment.Data.InitFlags = readVaruint32(Ctx); in parseDataSection()
1740 ? readVaruint32(Ctx) in parseDataSection()
1743 if (Error Err = readInitExpr(Segment.Data.Offset, Ctx)) in parseDataSection()
1750 uint32_t Size = readVaruint32(Ctx); in parseDataSection()
1751 if (Size > (size_t)(Ctx.End - Ctx.Ptr)) in parseDataSection()
1754 Segment.Data.Content = ArrayRef<uint8_t>(Ctx.Ptr, Size); in parseDataSection()
1760 Segment.SectionOffset = Ctx.Ptr - Ctx.Start; in parseDataSection()
1761 Ctx.Ptr += Size; in parseDataSection()
1764 if (Ctx.Ptr != Ctx.End) in parseDataSection()
1770 Error WasmObjectFile::parseDataCountSection(ReadContext &Ctx) { in parseDataCountSection() argument
1771 DataCount = readVaruint32(Ctx); in parseDataCountSection()