// ElemSegmentFlags provides methods for decoding and encoding the flags field // of an element segment. This is needed as the flags field has a non-trivial // encoding that is effectively split into independent `kind` and `payload` // enums. class ElemSegmentFlags { enumclass Flags : uint32_t { // 0 means active. 1 means (passive or declared), disambiguated by the next // bit.
Passive = 0x1, // For active segments, 1 means a table index is present. Otherwise, 0 means // passive and 1 means declared.
TableIndexOrDeclared = 0x2, // 0 means element kind / index (currently only func indexes). 1 means // element ref type and initializer expressions.
ElemExpressions = 0x4,
// Below this line are convenient combinations of flags
KindMask = Passive | TableIndexOrDeclared,
PayloadMask = ElemExpressions,
AllFlags = Passive | TableIndexOrDeclared | ElemExpressions,
};
uint32_t encoded_;
// The local entries are part of function bodies and thus serialized by both // wasm and asm.js and decoded as part of both validation and compilation.
[[nodiscard]] bool EncodeLocalEntries(Encoder& e, const ValTypeVector& locals);
// This performs no validation; the local entries must already have been // validated by an earlier pass.
// Returns whether the given [begin, end) prefix of a module's bytecode starts a // code section and, if so, returns the BytecodeRange of that code section. // Note that, even if this function returns 'false', [begin, end) may actually // be a valid module in the special case when there are no function defs and the // code section is not present. Such modules can be valid so the caller must // handle this special case.
// Calling DecodeModuleEnvironment decodes all sections up to the code section // and performs full validation of all those sections. The client must then // decode the code section itself, reusing ValidateFunctionBody if necessary, // and finally call DecodeModuleTail to decode all remaining sections after the // code section (again, performing full validation).
// Validate an entire module, returning true if the module was validated // successfully. If Validate returns false: // - if *error is null, the caller should report out-of-memory // - otherwise, there was a legitimate error described by *error
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.