From c79548b93a81ccf7609413da1345a7570c51b9ba Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 7 Dec 2022 16:06:53 -0600 Subject: 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. --- src/wasm/wat-parser.cpp | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) (limited to 'src/wasm/wat-parser.cpp') 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 Result makeI31New(Ctx&, Index); template Result makeI31Get(Ctx&, Index, bool signed_); template Result makeRefTest(Ctx&, Index); -template -Result makeRefTestStatic(Ctx&, Index); +template Result makeRefTest(Ctx&, Index); template Result makeRefCast(Ctx&, Index); -template -Result makeRefCastStatic(Ctx&, Index); -template -Result makeRefCastNopStatic(Ctx&, Index); +template Result makeRefCastNop(Ctx&, Index); template Result makeBrOn(Ctx&, Index, BrOnOp op); template -Result makeBrOnStatic(Ctx&, Index, BrOnOp op); +Result makeBrOn(Ctx&, Index, BrOnOp op); template -Result makeStructNewStatic(Ctx&, Index, bool default_); +Result makeStructNew(Ctx&, Index, bool default_); template Result makeStructGet(Ctx&, Index, bool signed_ = false); template Result makeStructSet(Ctx&, Index); template -Result makeArrayNewStatic(Ctx&, Index, bool default_); +Result makeArrayNew(Ctx&, Index, bool default_); template Result makeArrayNewSeg(Ctx&, Index, ArrayNewSegOp op); template @@ -2971,23 +2967,13 @@ Result makeRefTest(Ctx& ctx, Index pos) { return ctx.in.err("unimplemented instruction"); } -template -Result makeRefTestStatic(Ctx& ctx, Index pos) { - return ctx.in.err("unimplemented instruction"); -} - template Result makeRefCast(Ctx& ctx, Index pos) { return ctx.in.err("unimplemented instruction"); } template -Result makeRefCastStatic(Ctx& ctx, Index pos) { - return ctx.in.err("unimplemented instruction"); -} - -template -Result makeRefCastNopStatic(Ctx& ctx, Index pos) { +Result makeRefCastNop(Ctx& ctx, Index pos) { return ctx.in.err("unimplemented instruction"); } @@ -2997,13 +2983,7 @@ Result makeBrOn(Ctx& ctx, Index pos, BrOnOp op) { } template -Result makeBrOnStatic(Ctx& ctx, Index pos, BrOnOp op) { - return ctx.in.err("unimplemented instruction"); -} - -template -Result -makeStructNewStatic(Ctx& ctx, Index pos, bool default_) { +Result makeStructNew(Ctx& ctx, Index pos, bool default_) { auto type = typeidx(ctx); CHECK_ERR(type); if (default_) { @@ -3031,8 +3011,7 @@ Result makeStructSet(Ctx& ctx, Index pos) { } template -Result -makeArrayNewStatic(Ctx& ctx, Index pos, bool default_) { +Result makeArrayNew(Ctx& ctx, Index pos, bool default_) { return ctx.in.err("unimplemented instruction"); } -- cgit v1.2.3