diff options
author | Thomas Lively <tlively@google.com> | 2022-12-07 16:06:53 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-07 14:06:53 -0800 |
commit | c79548b93a81ccf7609413da1345a7570c51b9ba (patch) | |
tree | 7783fbf6610383fb76fe312fe3c125860428b779 /src/wasm/wat-parser.cpp | |
parent | 5a8d09bfe725f321b022187e294991db3ffaa417 (diff) | |
download | binaryen-c79548b93a81ccf7609413da1345a7570c51b9ba.tar.gz binaryen-c79548b93a81ccf7609413da1345a7570c51b9ba.tar.bz2 binaryen-c79548b93a81ccf7609413da1345a7570c51b9ba.zip |
Add standard versions of WasmGC casts (#5331)
We previously supported only the non-standard cast instructions introduced when
we were experimenting with nominal types. Parse the names and opcodes of their
standard counterparts and switch to emitting the standard names and opcodes.
Port all of the tests to use the standard instructions, but add additional tests
showing that the non-standard versions are still parsed correctly.
Diffstat (limited to 'src/wasm/wat-parser.cpp')
-rw-r--r-- | src/wasm/wat-parser.cpp | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/src/wasm/wat-parser.cpp b/src/wasm/wat-parser.cpp index 3f52e6fe6..c3fd2bc4b 100644 --- a/src/wasm/wat-parser.cpp +++ b/src/wasm/wat-parser.cpp @@ -2016,24 +2016,20 @@ template<typename Ctx> Result<typename Ctx::InstrT> makeI31New(Ctx&, Index); template<typename Ctx> Result<typename Ctx::InstrT> makeI31Get(Ctx&, Index, bool signed_); template<typename Ctx> Result<typename Ctx::InstrT> makeRefTest(Ctx&, Index); -template<typename Ctx> -Result<typename Ctx::InstrT> makeRefTestStatic(Ctx&, Index); +template<typename Ctx> Result<typename Ctx::InstrT> makeRefTest(Ctx&, Index); template<typename Ctx> Result<typename Ctx::InstrT> makeRefCast(Ctx&, Index); -template<typename Ctx> -Result<typename Ctx::InstrT> makeRefCastStatic(Ctx&, Index); -template<typename Ctx> -Result<typename Ctx::InstrT> makeRefCastNopStatic(Ctx&, Index); +template<typename Ctx> Result<typename Ctx::InstrT> makeRefCastNop(Ctx&, Index); template<typename Ctx> Result<typename Ctx::InstrT> makeBrOn(Ctx&, Index, BrOnOp op); template<typename Ctx> -Result<typename Ctx::InstrT> makeBrOnStatic(Ctx&, Index, BrOnOp op); +Result<typename Ctx::InstrT> makeBrOn(Ctx&, Index, BrOnOp op); template<typename Ctx> -Result<typename Ctx::InstrT> makeStructNewStatic(Ctx&, Index, bool default_); +Result<typename Ctx::InstrT> makeStructNew(Ctx&, Index, bool default_); template<typename Ctx> Result<typename Ctx::InstrT> makeStructGet(Ctx&, Index, bool signed_ = false); template<typename Ctx> Result<typename Ctx::InstrT> makeStructSet(Ctx&, Index); template<typename Ctx> -Result<typename Ctx::InstrT> makeArrayNewStatic(Ctx&, Index, bool default_); +Result<typename Ctx::InstrT> makeArrayNew(Ctx&, Index, bool default_); template<typename Ctx> Result<typename Ctx::InstrT> makeArrayNewSeg(Ctx&, Index, ArrayNewSegOp op); template<typename Ctx> @@ -2972,22 +2968,12 @@ Result<typename Ctx::InstrT> makeRefTest(Ctx& ctx, Index pos) { } template<typename Ctx> -Result<typename Ctx::InstrT> makeRefTestStatic(Ctx& ctx, Index pos) { - return ctx.in.err("unimplemented instruction"); -} - -template<typename Ctx> Result<typename Ctx::InstrT> makeRefCast(Ctx& ctx, Index pos) { return ctx.in.err("unimplemented instruction"); } template<typename Ctx> -Result<typename Ctx::InstrT> makeRefCastStatic(Ctx& ctx, Index pos) { - return ctx.in.err("unimplemented instruction"); -} - -template<typename Ctx> -Result<typename Ctx::InstrT> makeRefCastNopStatic(Ctx& ctx, Index pos) { +Result<typename Ctx::InstrT> makeRefCastNop(Ctx& ctx, Index pos) { return ctx.in.err("unimplemented instruction"); } @@ -2997,13 +2983,7 @@ Result<typename Ctx::InstrT> makeBrOn(Ctx& ctx, Index pos, BrOnOp op) { } template<typename Ctx> -Result<typename Ctx::InstrT> makeBrOnStatic(Ctx& ctx, Index pos, BrOnOp op) { - return ctx.in.err("unimplemented instruction"); -} - -template<typename Ctx> -Result<typename Ctx::InstrT> -makeStructNewStatic(Ctx& ctx, Index pos, bool default_) { +Result<typename Ctx::InstrT> makeStructNew(Ctx& ctx, Index pos, bool default_) { auto type = typeidx(ctx); CHECK_ERR(type); if (default_) { @@ -3031,8 +3011,7 @@ Result<typename Ctx::InstrT> makeStructSet(Ctx& ctx, Index pos) { } template<typename Ctx> -Result<typename Ctx::InstrT> -makeArrayNewStatic(Ctx& ctx, Index pos, bool default_) { +Result<typename Ctx::InstrT> makeArrayNew(Ctx& ctx, Index pos, bool default_) { return ctx.in.err("unimplemented instruction"); } |