summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-03-15 08:38:54 -0700
committerGitHub <noreply@github.com>2023-03-15 08:38:54 -0700
commitecd13fa043bc9b54cfce6026ee72498d13d0cc87 (patch)
treeedce5c22a2e8e8a486917eb23392f8c1ee8f2d17
parentb1f0e98ce3899e803e829df8a57df879695113ee (diff)
downloadbinaryen-ecd13fa043bc9b54cfce6026ee72498d13d0cc87.tar.gz
binaryen-ecd13fa043bc9b54cfce6026ee72498d13d0cc87.tar.bz2
binaryen-ecd13fa043bc9b54cfce6026ee72498d13d0cc87.zip
[Wasm GC] Remove RefIsFunc and RefIsI31 from the binary format (#5574)
We still support ref.is_func/i31 in the text format for now. After we verify that no users depend on that we can remove it as well.
-rw-r--r--src/wasm-binary.h3
-rw-r--r--src/wasm/wasm-binary.cpp22
-rw-r--r--src/wasm/wasm-stack.cpp14
3 files changed, 0 insertions, 39 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index f09094c9d..e6092fbc9 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1130,8 +1130,6 @@ enum ASTNodes {
BrOnCastNull = 0x4a,
BrOnCastFailNull = 0x4b,
RefCastNop = 0x4c,
- RefIsFunc = 0x50,
- RefIsI31 = 0x52,
RefAsFunc = 0x58,
RefAsI31 = 0x5a,
BrOnFunc = 0x60,
@@ -1745,7 +1743,6 @@ public:
void visitDrop(Drop* curr);
void visitRefNull(RefNull* curr);
void visitRefIsNull(RefIsNull* curr);
- void visitRefIs(RefTest* curr, uint8_t code);
void visitRefFunc(RefFunc* curr);
void visitRefEq(RefEq* curr);
void visitTableGet(TableGet* curr);
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 72f99c033..518a809fa 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -4041,12 +4041,6 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) {
if (maybeVisitStringSliceIter(curr, opcode)) {
break;
}
- if (opcode == BinaryConsts::RefIsFunc ||
- opcode == BinaryConsts::RefIsI31) {
- visitRefIs((curr = allocator.alloc<RefTest>())->cast<RefTest>(),
- opcode);
- break;
- }
if (opcode == BinaryConsts::RefAsFunc ||
opcode == BinaryConsts::RefAsI31) {
visitRefAsCast((curr = allocator.alloc<RefCast>())->cast<RefCast>(),
@@ -6618,22 +6612,6 @@ void WasmBinaryBuilder::visitRefIsNull(RefIsNull* curr) {
curr->finalize();
}
-void WasmBinaryBuilder::visitRefIs(RefTest* curr, uint8_t code) {
- BYN_TRACE("zz node: RefIs\n");
- switch (code) {
- case BinaryConsts::RefIsFunc:
- curr->castType = Type(HeapType::func, NonNullable);
- break;
- case BinaryConsts::RefIsI31:
- curr->castType = Type(HeapType::i31, NonNullable);
- break;
- default:
- WASM_UNREACHABLE("invalid code for ref.is_*");
- }
- curr->ref = popNonVoidExpression();
- curr->finalize();
-}
-
void WasmBinaryBuilder::visitRefFunc(RefFunc* curr) {
BYN_TRACE("zz node: RefFunc\n");
Index index = getU32LEB();
diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp
index b0e78c22e..d6420ed43 100644
--- a/src/wasm/wasm-stack.cpp
+++ b/src/wasm/wasm-stack.cpp
@@ -2010,20 +2010,6 @@ void BinaryInstWriter::visitCallRef(CallRef* curr) {
void BinaryInstWriter::visitRefTest(RefTest* curr) {
o << int8_t(BinaryConsts::GCPrefix);
- // TODO: These instructions are deprecated. Remove them.
- if (auto type = curr->castType.getHeapType();
- curr->castType.isNonNullable() && type.isBasic()) {
- switch (type.getBasic()) {
- case HeapType::func:
- o << U32LEB(BinaryConsts::RefIsFunc);
- return;
- case HeapType::i31:
- o << U32LEB(BinaryConsts::RefIsI31);
- return;
- default:
- break;
- }
- }
if (curr->castType.isNullable()) {
o << U32LEB(BinaryConsts::RefTestNull);
} else {