diff options
author | Sam Clegg <sbc@chromium.org> | 2024-05-10 16:33:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 23:33:38 +0000 |
commit | abc430b617385f3e989f85e7bd1c2a9d838fd217 (patch) | |
tree | 5a7869083ae64cc59a04cb5512b3f175fade02d5 /src/parser/contexts.h | |
parent | 9975b56614d4a5560b35f009be20d51e360b69dc (diff) | |
download | binaryen-abc430b617385f3e989f85e7bd1c2a9d838fd217.tar.gz binaryen-abc430b617385f3e989f85e7bd1c2a9d838fd217.tar.bz2 binaryen-abc430b617385f3e989f85e7bd1c2a9d838fd217.zip |
[memory64] Add table64 to existing memory64 support (#6577)
Tests is still very limited. Hopefully we can use the upstream spec
tests soon and avoid having to write our own tests for
`.set/.set/.fill/etc`.
See https://github.com/WebAssembly/memory64/issues/51
Diffstat (limited to 'src/parser/contexts.h')
-rw-r--r-- | src/parser/contexts.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/parser/contexts.h b/src/parser/contexts.h index cead35f60..8f0c6cdff 100644 --- a/src/parser/contexts.h +++ b/src/parser/contexts.h @@ -46,7 +46,7 @@ struct Limits { }; struct MemType { - Type type; + Type indexType; Limits limits; bool shared; }; @@ -56,6 +56,11 @@ struct Memarg { uint32_t align; }; +struct TableType { + Type indexType; + Limits limits; +}; + // The location, possible name, and index in the respective module index space // of a module-level definition in the input. struct DefPos { @@ -853,7 +858,7 @@ struct ParseDeclsCtx : NullTypeParserCtx, NullInstrParserCtx { using LimitsT = Limits; using ElemListT = Index; using DataStringT = std::vector<char>; - using TableTypeT = Limits; + using TableTypeT = TableType; using MemTypeT = MemType; Lexer in; @@ -942,7 +947,9 @@ struct ParseDeclsCtx : NullTypeParserCtx, NullInstrParserCtx { Limits getLimitsFromElems(Index elems) { return {elems, elems}; } - Limits makeTableType(Limits limits, TypeT) { return limits; } + TableType makeTableType(Type indexType, Limits limits, TypeT) { + return {indexType, limits}; + } std::vector<char> makeDataString() { return {}; } void appendDataString(std::vector<char>& data, std::string_view str) { @@ -954,8 +961,8 @@ struct ParseDeclsCtx : NullTypeParserCtx, NullInstrParserCtx { return {size, size}; } - MemType makeMemType(Type type, Limits limits, bool shared) { - return {type, limits, shared}; + MemType makeMemType(Type indexType, Limits limits, bool shared) { + return {indexType, limits, shared}; } Result<TypeUseT> @@ -975,10 +982,12 @@ struct ParseDeclsCtx : NullTypeParserCtx, NullInstrParserCtx { std::vector<Annotation>&&, Index pos); - Result<Table*> - addTableDecl(Index pos, Name name, ImportNames* importNames, Limits limits); + Result<Table*> addTableDecl(Index pos, + Name name, + ImportNames* importNames, + TableType limits); Result<> - addTable(Name, const std::vector<Name>&, ImportNames*, Limits, Index); + addTable(Name, const std::vector<Name>&, ImportNames*, TableType, Index); // TODO: Record index of implicit elem for use when parsing types and instrs. Result<> addImplicitElems(TypeT, ElemListT&& elems); @@ -1252,7 +1261,7 @@ struct ParseModuleTypesCtx : TypeParserCtx<ParseModuleTypesCtx>, LimitsT getLimitsFromElems(ElemListT) { return Ok{}; } - Type makeTableType(LimitsT, Type type) { return type; } + Type makeTableType(Type indexType, LimitsT, Type type) { return type; } LimitsT getLimitsFromData(DataStringT) { return Ok{}; } MemTypeT makeMemType(Type, LimitsT, bool) { return Ok{}; } @@ -1441,7 +1450,7 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> { LimitsT getLimitsFromElems(std::vector<Expression*>& elems) { return Ok{}; } - TableTypeT makeTableType(LimitsT, Type) { return Ok{}; } + TableTypeT makeTableType(Type, LimitsT, Type) { return Ok{}; } struct CatchInfo { Name tag; |