summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/gen-s-parser.py1
-rw-r--r--scripts/wasm2js.js8
-rw-r--r--src/asmjs/asm_v_wasm.cpp3
-rw-r--r--src/binaryen-c.cpp48
-rw-r--r--src/binaryen-c.h26
-rw-r--r--src/cfg/cfg-traversal.h12
-rw-r--r--src/dataflow/graph.h3
-rw-r--r--src/gen-s-parser.inc14
-rw-r--r--src/ir/ReFinalize.cpp8
-rw-r--r--src/ir/abstract.h2
-rw-r--r--src/ir/branch-utils.h2
-rw-r--r--src/ir/cost.h3
-rw-r--r--src/ir/effects.h5
-rw-r--r--src/js/binaryen.js-post.js40
-rw-r--r--src/literal.h34
-rw-r--r--src/parsing.h4
-rw-r--r--src/passes/CodeFolding.cpp2
-rw-r--r--src/passes/CodePushing.cpp2
-rw-r--r--src/passes/ConstHoisting.cpp1
-rw-r--r--src/passes/Flatten.cpp4
-rw-r--r--src/passes/FuncCastEmulation.cpp2
-rw-r--r--src/passes/InstrumentLocals.cpp14
-rw-r--r--src/passes/MergeBlocks.cpp7
-rw-r--r--src/passes/Print.cpp13
-rw-r--r--src/passes/ReReloop.cpp3
-rw-r--r--src/passes/RemoveUnusedModuleElements.cpp6
-rw-r--r--src/passes/SimplifyLocals.cpp4
-rw-r--r--src/shell-interface.h1
-rw-r--r--src/tools/fuzzing.h23
-rw-r--r--src/tools/spec-wrapper.h3
-rw-r--r--src/tools/wasm-reduce.cpp5
-rw-r--r--src/wasm-binary.h7
-rw-r--r--src/wasm-builder.h16
-rw-r--r--src/wasm-delegations-fields.h9
-rw-r--r--src/wasm-delegations.h1
-rw-r--r--src/wasm-interpreter.h21
-rw-r--r--src/wasm-s-parser.h1
-rw-r--r--src/wasm-traversal.h6
-rw-r--r--src/wasm-type.h5
-rw-r--r--src/wasm.h16
-rw-r--r--src/wasm/literal.cpp50
-rw-r--r--src/wasm/wasm-binary.cpp33
-rw-r--r--src/wasm/wasm-s-parser.cpp33
-rw-r--r--src/wasm/wasm-stack.cpp8
-rw-r--r--src/wasm/wasm-type.cpp20
-rw-r--r--src/wasm/wasm-validator.cpp37
-rw-r--r--src/wasm/wasm.cpp10
-rw-r--r--src/wasm2js.h4
-rw-r--r--test/binaryen.js/expressions.js37
-rw-r--r--test/binaryen.js/expressions.js.txt5
-rw-r--r--test/binaryen.js/kitchen-sink.js7
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt53
-rw-r--r--test/ctor-eval/bad-indirect-call3.wast2
-rw-r--r--test/ctor-eval/bad-indirect-call3.wast.out4
-rw-r--r--test/example/c-api-kitchen-sink.c11
-rw-r--r--test/example/c-api-kitchen-sink.txt17
-rw-r--r--test/example/typeinfo.cpp13
-rw-r--r--test/example/typeinfo.txt5
-rw-r--r--test/exception-handling.wast4
-rw-r--r--test/exception-handling.wast.from-wast4
-rw-r--r--test/exception-handling.wast.fromBinary4
-rw-r--r--test/exception-handling.wast.fromBinary.noDebugInfo14
-rw-r--r--test/passes/code-pushing_all-features.txt17
-rw-r--r--test/passes/code-pushing_all-features.wast14
-rw-r--r--test/passes/inlining_all-features.txt33
-rw-r--r--test/passes/inlining_all-features.wast28
-rw-r--r--test/passes/instrument-locals_all-features_disable-typed-function-references.txt82
-rw-r--r--test/passes/instrument-locals_all-features_disable-typed-function-references.wast5
-rw-r--r--test/passes/precompute_all-features.txt10
-rw-r--r--test/passes/precompute_all-features.wast15
-rw-r--r--test/passes/remove-unused-names_code-folding_all-features.txt42
-rw-r--r--test/passes/remove-unused-names_code-folding_all-features.wast27
-rw-r--r--test/passes/remove-unused-names_merge-blocks_all-features.txt26
-rw-r--r--test/passes/remove-unused-names_merge-blocks_all-features.wast32
-rw-r--r--test/passes/simplify-locals_all-features.txt25
-rw-r--r--test/passes/simplify-locals_all-features.wast26
-rw-r--r--test/passes/translate-to-fuzz_all-features_metrics_noprint.txt62
-rw-r--r--test/reference-types.wast246
-rw-r--r--test/reference-types.wast.from-wast404
-rw-r--r--test/reference-types.wast.fromBinary391
-rw-r--r--test/reference-types.wast.fromBinary.noDebugInfo533
-rw-r--r--test/spec/call_indirect_sig_mismatch.wast2
-rw-r--r--test/spec/exception-handling.wast44
-rw-r--r--test/unit/test_features.py10
-rw-r--r--third_party/llvm-project/include/llvm/BinaryFormat/Wasm.h2
85 files changed, 259 insertions, 2577 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py
index ae19596d5..6dadb8ba1 100755
--- a/scripts/gen-s-parser.py
+++ b/scripts/gen-s-parser.py
@@ -535,7 +535,6 @@ instructions = [
("try", "makeTry(s)"),
("throw", "makeThrow(s)"),
("rethrow", "makeRethrow(s)"),
- ("br_on_exn", "makeBrOnExn(s)"),
# Multivalue pseudoinstructions
("tuple.make", "makeTupleMake(s)"),
("tuple.extract", "makeTupleExtract(s)"),
diff --git a/scripts/wasm2js.js b/scripts/wasm2js.js
index babf31267..869734c6f 100644
--- a/scripts/wasm2js.js
+++ b/scripts/wasm2js.js
@@ -128,10 +128,6 @@ var asmLibraryArg = {
console.log('get_externref ' + [loc, index, value]);
return value;
},
- get_exnref: function(loc, index, value) {
- console.log('get_exnref ' + [loc, index, value]);
- return value;
- },
set_i32: function(loc, index, value) {
console.log('set_i32 ' + [loc, index, value]);
return value;
@@ -153,10 +149,6 @@ var asmLibraryArg = {
console.log('set_externref ' + [loc, index, value]);
return value;
},
- set_exnref: function(loc, index, value) {
- console.log('set_exnref ' + [loc, index, value]);
- return value;
- },
load_ptr: function(loc, bytes, offset, ptr) {
console.log('load_ptr ' + [loc, bytes, offset, ptr]);
return ptr;
diff --git a/src/asmjs/asm_v_wasm.cpp b/src/asmjs/asm_v_wasm.cpp
index b07ef8534..f5e4b7815 100644
--- a/src/asmjs/asm_v_wasm.cpp
+++ b/src/asmjs/asm_v_wasm.cpp
@@ -34,7 +34,6 @@ AsmType wasmToAsmType(Type type) {
assert(false && "v128 not implemented yet");
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -65,8 +64,6 @@ char getSig(Type type) {
return 'F';
case Type::externref:
return 'X';
- case Type::exnref:
- return 'E';
case Type::anyref:
return 'A';
case Type::eqref:
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index 64813436e..93c8693c6 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -71,7 +71,6 @@ BinaryenLiteral toBinaryenLiteral(Literal x) {
ret.func = x.isNull() ? nullptr : x.getFunc().c_str();
break;
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
assert(x.isNull() && "unexpected non-null reference type literal");
@@ -102,7 +101,6 @@ Literal fromBinaryenLiteral(BinaryenLiteral x) {
case Type::funcref:
return Literal::makeFunc(x.func);
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
return Literal::makeNull(Type(x.type));
@@ -143,7 +141,6 @@ BinaryenType BinaryenTypeFloat64(void) { return Type::f64; }
BinaryenType BinaryenTypeVec128(void) { return Type::v128; }
BinaryenType BinaryenTypeFuncref(void) { return Type::funcref; }
BinaryenType BinaryenTypeExternref(void) { return Type::externref; }
-BinaryenType BinaryenTypeExnref(void) { return Type::exnref; }
BinaryenType BinaryenTypeAnyref(void) { return Type::anyref; }
BinaryenType BinaryenTypeEqref(void) { return Type::eqref; }
BinaryenType BinaryenTypeI31ref(void) { return Type::i31ref; }
@@ -1237,17 +1234,6 @@ BinaryenExpressionRef BinaryenRethrow(BinaryenModuleRef module,
return static_cast<Expression*>(Builder(*(Module*)module).makeRethrow(depth));
}
-BinaryenExpressionRef BinaryenBrOnExn(BinaryenModuleRef module,
- const char* name,
- const char* eventName,
- BinaryenExpressionRef exnref) {
- auto* wasm = (Module*)module;
- auto* event = wasm->getEventOrNull(eventName);
- assert(event && "br_on_exn's event must exist");
- return static_cast<Expression*>(
- Builder(*wasm).makeBrOnExn(name, event, (Expression*)exnref));
-}
-
BinaryenExpressionRef BinaryenI31New(BinaryenModuleRef module,
BinaryenExpressionRef value) {
return static_cast<Expression*>(
@@ -2932,40 +2918,6 @@ void BinaryenRethrowSetDepth(BinaryenExpressionRef expr, BinaryenIndex depth) {
assert(expression->is<Rethrow>());
static_cast<Rethrow*>(expression)->depth = depth;
}
-// BrOnExn
-const char* BinaryenBrOnExnGetEvent(BinaryenExpressionRef expr) {
- auto* expression = (Expression*)expr;
- assert(expression->is<BrOnExn>());
- return static_cast<BrOnExn*>(expression)->event.c_str();
-}
-void BinaryenBrOnExnSetEvent(BinaryenExpressionRef expr,
- const char* eventName) {
- auto* expression = (Expression*)expr;
- assert(expression->is<BrOnExn>());
- static_cast<BrOnExn*>(expression)->event = eventName;
-}
-const char* BinaryenBrOnExnGetName(BinaryenExpressionRef expr) {
- auto* expression = (Expression*)expr;
- assert(expression->is<BrOnExn>());
- return static_cast<BrOnExn*>(expression)->name.c_str();
-}
-void BinaryenBrOnExnSetName(BinaryenExpressionRef expr, const char* name) {
- auto* expression = (Expression*)expr;
- assert(expression->is<BrOnExn>());
- static_cast<BrOnExn*>(expression)->name = name;
-}
-BinaryenExpressionRef BinaryenBrOnExnGetExnref(BinaryenExpressionRef expr) {
- auto* expression = (Expression*)expr;
- assert(expression->is<BrOnExn>());
- return static_cast<BrOnExn*>(expression)->exnref;
-}
-void BinaryenBrOnExnSetExnref(BinaryenExpressionRef expr,
- BinaryenExpressionRef exnrefExpr) {
- auto* expression = (Expression*)expr;
- assert(expression->is<BrOnExn>());
- assert(exnrefExpr);
- static_cast<BrOnExn*>(expression)->exnref = (Expression*)exnrefExpr;
-}
// TupleMake
BinaryenIndex BinaryenTupleMakeGetNumOperands(BinaryenExpressionRef expr) {
auto* expression = (Expression*)expr;
diff --git a/src/binaryen-c.h b/src/binaryen-c.h
index 8d991343d..6337fadd8 100644
--- a/src/binaryen-c.h
+++ b/src/binaryen-c.h
@@ -100,7 +100,6 @@ BINARYEN_API BinaryenType BinaryenTypeFloat64(void);
BINARYEN_API BinaryenType BinaryenTypeVec128(void);
BINARYEN_API BinaryenType BinaryenTypeFuncref(void);
BINARYEN_API BinaryenType BinaryenTypeExternref(void);
-BINARYEN_API BinaryenType BinaryenTypeExnref(void);
BINARYEN_API BinaryenType BinaryenTypeAnyref(void);
BINARYEN_API BinaryenType BinaryenTypeEqref(void);
BINARYEN_API BinaryenType BinaryenTypeI31ref(void);
@@ -192,7 +191,6 @@ struct BinaryenLiteral {
double f64;
uint8_t v128[16];
const char* func;
- // TODO: exn
};
};
@@ -811,11 +809,6 @@ BinaryenThrow(BinaryenModuleRef module,
BINARYEN_API BinaryenExpressionRef BinaryenRethrow(BinaryenModuleRef module,
BinaryenIndex depth);
BINARYEN_API BinaryenExpressionRef
-BinaryenBrOnExn(BinaryenModuleRef module,
- const char* name,
- const char* eventName,
- BinaryenExpressionRef exnref);
-BINARYEN_API BinaryenExpressionRef
BinaryenTupleMake(BinaryenModuleRef module,
BinaryenExpressionRef* operands,
BinaryenIndex numOperands);
@@ -1812,25 +1805,6 @@ BINARYEN_API BinaryenIndex BinaryenRethrowGetDepth(BinaryenExpressionRef expr);
BINARYEN_API void BinaryenRethrowSetDepth(BinaryenExpressionRef expr,
BinaryenIndex depth);
-// BrOnExn
-
-// Gets the name of the event triggering a `br_on_exn` expression.
-BINARYEN_API const char* BinaryenBrOnExnGetEvent(BinaryenExpressionRef expr);
-// Sets the name of the event triggering a `br_on_exn` expression.
-BINARYEN_API void BinaryenBrOnExnSetEvent(BinaryenExpressionRef expr,
- const char* eventName);
-// Gets the name (target label) of a `br_on_exn` expression.
-BINARYEN_API const char* BinaryenBrOnExnGetName(BinaryenExpressionRef expr);
-// Sets the name (target label) of a `br_on_exn` expression.
-BINARYEN_API void BinaryenBrOnExnSetName(BinaryenExpressionRef expr,
- const char* name);
-// Gets the expression reference expression of a `br_on_exn` expression.
-BINARYEN_API BinaryenExpressionRef
-BinaryenBrOnExnGetExnref(BinaryenExpressionRef expr);
-// Sets the expression reference expression of a `br_on_exn` expression.
-BINARYEN_API void BinaryenBrOnExnSetExnref(BinaryenExpressionRef expr,
- BinaryenExpressionRef exnrefExpr);
-
// TupleMake
// Gets the number of operands of a `tuple.make` expression.
diff --git a/src/cfg/cfg-traversal.h b/src/cfg/cfg-traversal.h
index 267fb9589..fe85f0b9f 100644
--- a/src/cfg/cfg-traversal.h
+++ b/src/cfg/cfg-traversal.h
@@ -317,14 +317,6 @@ struct CFGWalker : public ControlFlowWalker<SubType, VisitorType> {
self->startUnreachableBlock();
}
- static void doEndBrOnExn(SubType* self, Expression** currp) {
- auto* curr = (*currp)->cast<BrOnExn>();
- self->branches[self->findBreakTarget(curr->name)].push_back(
- self->currBasicBlock); // branch to the target
- auto* last = self->currBasicBlock;
- self->link(last, self->startBasicBlock()); // we might fall through
- }
-
static void scan(SubType* self, Expression** currp) {
Expression* curr = *currp;
@@ -395,10 +387,6 @@ struct CFGWalker : public ControlFlowWalker<SubType, VisitorType> {
self->pushTask(SubType::doEndThrow, currp);
break;
}
- case Expression::Id::BrOnExnId: {
- self->pushTask(SubType::doEndBrOnExn, currp);
- break;
- }
default: {}
}
diff --git a/src/dataflow/graph.h b/src/dataflow/graph.h
index 4cf5022e3..6256c4c1e 100644
--- a/src/dataflow/graph.h
+++ b/src/dataflow/graph.h
@@ -228,8 +228,7 @@ struct Graph : public UnifiedExpressionVisitor<Graph, Node*> {
return doVisitUnreachable(unreachable);
} else if (auto* drop = curr->dynCast<Drop>()) {
return doVisitDrop(drop);
- } else if (curr->is<Try>() || curr->is<Throw>() || curr->is<Rethrow>() ||
- curr->is<BrOnExn>()) {
+ } else if (curr->is<Try>() || curr->is<Throw>() || curr->is<Rethrow>()) {
Fatal() << "DataFlow does not support EH instructions yet";
} else {
return doVisitGeneric(curr);
diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc
index 1b48eca24..93f064c89 100644
--- a/src/gen-s-parser.inc
+++ b/src/gen-s-parser.inc
@@ -71,17 +71,9 @@ switch (op[0]) {
case 'i':
if (strcmp(op, "br_if") == 0) { return makeBreak(s); }
goto parse_error;
- case 'o': {
- switch (op[6]) {
- case 'c':
- if (strcmp(op, "br_on_cast") == 0) { return makeBrOnCast(s); }
- goto parse_error;
- case 'e':
- if (strcmp(op, "br_on_exn") == 0) { return makeBrOnExn(s); }
- goto parse_error;
- default: goto parse_error;
- }
- }
+ case 'o':
+ if (strcmp(op, "br_on_cast") == 0) { return makeBrOnCast(s); }
+ goto parse_error;
case 't':
if (strcmp(op, "br_table") == 0) { return makeBreakTable(s); }
goto parse_error;
diff --git a/src/ir/ReFinalize.cpp b/src/ir/ReFinalize.cpp
index 32b38325d..014ee184e 100644
--- a/src/ir/ReFinalize.cpp
+++ b/src/ir/ReFinalize.cpp
@@ -136,14 +136,6 @@ void ReFinalize::visitRefEq(RefEq* curr) { curr->finalize(); }
void ReFinalize::visitTry(Try* curr) { curr->finalize(); }
void ReFinalize::visitThrow(Throw* curr) { curr->finalize(); }
void ReFinalize::visitRethrow(Rethrow* curr) { curr->finalize(); }
-void ReFinalize::visitBrOnExn(BrOnExn* curr) {
- curr->finalize();
- if (curr->exnref->type == Type::unreachable) {
- replaceUntaken(curr->exnref, nullptr);
- } else {
- updateBreakValueType(curr->name, curr->sent);
- }
-}
void ReFinalize::visitNop(Nop* curr) { curr->finalize(); }
void ReFinalize::visitUnreachable(Unreachable* curr) { curr->finalize(); }
void ReFinalize::visitPop(Pop* curr) { curr->finalize(); }
diff --git a/src/ir/abstract.h b/src/ir/abstract.h
index d4a93b011..4c8d556cb 100644
--- a/src/ir/abstract.h
+++ b/src/ir/abstract.h
@@ -115,7 +115,6 @@ inline UnaryOp getUnary(Type type, Op op) {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -289,7 +288,6 @@ inline BinaryOp getBinary(Type type, Op op) {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
diff --git a/src/ir/branch-utils.h b/src/ir/branch-utils.h
index 2e7ef470d..5e2cc5184 100644
--- a/src/ir/branch-utils.h
+++ b/src/ir/branch-utils.h
@@ -80,8 +80,6 @@ void operateOnScopeNameUsesAndSentTypes(Expression* expr, T func) {
func(name, br->value ? br->value->type : Type::none);
} else if (auto* sw = expr->dynCast<Switch>()) {
func(name, sw->value ? sw->value->type : Type::none);
- } else if (auto* br = expr->dynCast<BrOnExn>()) {
- func(name, br->sent);
} else if (auto* br = expr->dynCast<BrOnCast>()) {
func(name, br->getCastType());
} else {
diff --git a/src/ir/cost.h b/src/ir/cost.h
index 7f8e39e1b..46213880b 100644
--- a/src/ir/cost.h
+++ b/src/ir/cost.h
@@ -562,9 +562,6 @@ struct CostAnalyzer : public OverriddenVisitor<CostAnalyzer, Index> {
return ret;
}
Index visitRethrow(Rethrow* curr) { return 100; }
- Index visitBrOnExn(BrOnExn* curr) {
- return 1 + visit(curr->exnref) + curr->sent.size();
- }
Index visitTupleMake(TupleMake* curr) {
Index ret = 0;
for (auto* child : curr->operands) {
diff --git a/src/ir/effects.h b/src/ir/effects.h
index 22fab593d..e9e8d0f6c 100644
--- a/src/ir/effects.h
+++ b/src/ir/effects.h
@@ -538,11 +538,6 @@ private:
// traps when the arg is null
parent.implicitTrap = true;
}
- void visitBrOnExn(BrOnExn* curr) {
- parent.breakTargets.insert(curr->name);
- // traps when the arg is null
- parent.implicitTrap = true;
- }
void visitNop(Nop* curr) {}
void visitUnreachable(Unreachable* curr) { parent.trap = true; }
void visitPop(Pop* curr) {
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 6055ba5c6..1ae7b11b2 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -35,7 +35,6 @@ function initializeConstants() {
['v128', 'Vec128'],
['funcref', 'Funcref'],
['externref', 'Externref'],
- ['exnref', 'Exnref'],
['anyref', 'Anyref'],
['eqref', 'Eqref'],
['i31ref', 'I31ref'],
@@ -93,7 +92,6 @@ function initializeConstants() {
'Try',
'Throw',
'Rethrow',
- 'BrOnExn',
'TupleMake',
'TupleExtract',
'Pop',
@@ -2074,12 +2072,6 @@ function wrapModule(module, self = {}) {
}
};
- self['exnref'] = {
- 'pop'() {
- return Module['_BinaryenPop'](module, Module['exnref']);
- }
- };
-
self['anyref'] = {
'pop'() {
return Module['_BinaryenPop'](module, Module['anyref']);
@@ -2145,9 +2137,6 @@ function wrapModule(module, self = {}) {
self['rethrow'] = function(depth) {
return Module['_BinaryenRethrow'](module, depth);
};
- self['br_on_exn'] = function(label, event_, exnref) {
- return preserveStack(() => Module['_BinaryenBrOnExn'](module, strToStack(label), strToStack(event_), exnref));
- };
self['tuple'] = {
'make'(elements) {
@@ -2885,14 +2874,6 @@ Module['getExpressionInfo'] = function(expr) {
'type': type,
'depth': Module['_BinaryenRethrowGetDepth'](expr)
};
- case Module['BrOnExnId']:
- return {
- 'id': id,
- 'type': type,
- 'name': UTF8ToString(Module['_BinaryenBrOnExnGetName'](expr)),
- 'event': UTF8ToString(Module['_BinaryenBrOnExnGetEvent'](expr)),
- 'exnref': Module['_BinaryenBrOnExnGetExnref'](expr)
- };
case Module['TupleMakeId']:
return {
'id': id,
@@ -4230,27 +4211,6 @@ Module['Rethrow'] = makeExpressionWrapper({
}
});
-Module['BrOnExn'] = makeExpressionWrapper({
- 'getEvent'(expr) {
- return UTF8ToString(Module['_BinaryenBrOnExnGetEvent'](expr));
- },
- 'setEvent'(expr, eventName) {
- preserveStack(() => { Module['_BinaryenBrOnExnSetEvent'](expr, strToStack(eventName)) });
- },
- 'getName'(expr) {
- return UTF8ToString(Module['_BinaryenBrOnExnGetName'](expr));
- },
- 'setName'(expr, name) {
- preserveStack(() => { Module['_BinaryenBrOnExnSetName'](expr, strToStack(name)) });
- },
- 'getExnref'(expr) {
- return Module['_BinaryenBrOnExnGetExnref'](expr);
- },
- 'setExnref'(expr, exnrefExpr) {
- Module['_BinaryenBrOnExnSetExnref'](expr, exnrefExpr);
- }
-});
-
Module['TupleMake'] = makeExpressionWrapper({
'getNumOperands'(expr) {
return Module['_BinaryenTupleMakeGetNumOperands'](expr);
diff --git a/src/literal.h b/src/literal.h
index a6727681b..c85701a48 100644
--- a/src/literal.h
+++ b/src/literal.h
@@ -30,7 +30,6 @@
namespace wasm {
class Literals;
-struct ExceptionPackage;
struct GCData;
// Subclass the vector type so that this is not easily confused with a vector of
// types (which could be confusing on the Literal constructor).
@@ -45,8 +44,6 @@ class Literal {
uint8_t v128[16];
// funcref function name. `isNull()` indicates a `null` value.
Name func;
- // exnref package. `nullptr` indicates a `null` value.
- std::unique_ptr<ExceptionPackage> exn;
// A reference to GC data, either a Struct or an Array. For both of those
// we store the referred data as a Literals object (which is natural for an
// Array, and for a Struct, is just the fields in order). The type is used
@@ -94,8 +91,6 @@ public:
explicit Literal(const std::array<Literal, 4>&);
explicit Literal(const std::array<Literal, 2>&);
explicit Literal(Name func, Type type) : func(func), type(type) {}
- explicit Literal(std::unique_ptr<ExceptionPackage>&& exn)
- : exn(std::move(exn)), type(Type::exnref) {}
explicit Literal(std::shared_ptr<GCData> gcData, Type type);
explicit Literal(std::unique_ptr<RttSupers>&& rttSupers, Type type);
Literal(const Literal& other);
@@ -109,9 +104,6 @@ public:
if (type.isFunction()) {
return func.isNull();
}
- if (type.isException()) {
- return !exn;
- }
if (isGCData()) {
return !gcData;
}
@@ -260,9 +252,6 @@ public:
static Literal makeFunc(Name func, Type type = Type::funcref) {
return Literal(func, type);
}
- static Literal makeExn(std::unique_ptr<ExceptionPackage>&& exn) {
- return Literal(std::move(exn));
- }
static Literal makeI31(int32_t value) {
auto lit = Literal(Type::i31ref);
lit.i32 = value & 0x7fffffff;
@@ -299,7 +288,6 @@ public:
assert(type.isFunction() && !func.isNull());
return func;
}
- ExceptionPackage getExceptionPackage() const;
std::shared_ptr<GCData> getGCData() const;
const RttSupers& getRttSupers() const;
@@ -683,22 +671,8 @@ public:
bool isConcrete() { return size() != 0; }
};
-// A struct for a thrown exception, which includes a tag (event) and thrown
-// values
-struct ExceptionPackage {
- Name event;
- Literals values;
- bool operator==(const ExceptionPackage& other) const {
- return event == other.event && values == other.values;
- }
- bool operator!=(const ExceptionPackage& other) const {
- return !(*this == other);
- }
-};
-
std::ostream& operator<<(std::ostream& o, wasm::Literal literal);
std::ostream& operator<<(std::ostream& o, wasm::Literals literals);
-std::ostream& operator<<(std::ostream& o, const ExceptionPackage& exn);
// A GC Struct or Array is a set of values with a run-time type saying what it
// is.
@@ -723,12 +697,6 @@ template<> struct hash<wasm::Literal> {
wasm::rehash(digest, a.getFunc());
return digest;
}
- if (a.type.isException()) {
- auto exn = a.getExceptionPackage();
- wasm::rehash(digest, exn.event);
- wasm::rehash(digest, exn.values);
- return digest;
- }
// other non-null reference type literals cannot represent concrete
// values, i.e. there is no concrete externref, anyref or eqref other than
// null.
@@ -756,7 +724,6 @@ template<> struct hash<wasm::Literal> {
return digest;
case wasm::Type::funcref:
case wasm::Type::externref:
- case wasm::Type::exnref:
case wasm::Type::anyref:
case wasm::Type::eqref:
case wasm::Type::dataref:
@@ -812,7 +779,6 @@ template<> struct less<wasm::Literal> {
return memcmp(a.getv128Ptr(), b.getv128Ptr(), 16) < 0;
case wasm::Type::funcref:
case wasm::Type::externref:
- case wasm::Type::exnref:
case wasm::Type::anyref:
case wasm::Type::eqref:
case wasm::Type::dataref:
diff --git a/src/parsing.h b/src/parsing.h
index 68c94c4a6..68647901a 100644
--- a/src/parsing.h
+++ b/src/parsing.h
@@ -264,7 +264,6 @@ parseConst(cashew::IString s, Type type, MixedArena& allocator) {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -376,9 +375,6 @@ struct UniqueNameMapper {
void visitBreak(Break* curr) {
curr->name = mapper.sourceToUnique(curr->name);
}
- void visitBrOnExn(BrOnExn* curr) {
- curr->name = mapper.sourceToUnique(curr->name);
- }
void visitSwitch(Switch* curr) {
for (auto& target : curr->targets) {
target = mapper.sourceToUnique(target);
diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp
index a0fc11c83..5362e310d 100644
--- a/src/passes/CodeFolding.cpp
+++ b/src/passes/CodeFolding.cpp
@@ -155,8 +155,6 @@ struct CodeFolding : public WalkerPass<ControlFlowWalker<CodeFolding>> {
unoptimizables.insert(curr->default_);
}
- void visitBrOnExn(BrOnExn* curr) { unoptimizables.insert(curr->name); }
-
void visitUnreachable(Unreachable* curr) {
// we can only optimize if we are at the end of the parent block
if (!controlFlowStack.empty()) {
diff --git a/src/passes/CodePushing.cpp b/src/passes/CodePushing.cpp
index 55c955539..c43028399 100644
--- a/src/passes/CodePushing.cpp
+++ b/src/passes/CodePushing.cpp
@@ -141,7 +141,7 @@ private:
if (auto* drop = curr->dynCast<Drop>()) {
curr = drop->value;
}
- if (curr->is<If>() || curr->is<BrOnExn>()) {
+ if (curr->is<If>()) {
return true;
}
if (auto* br = curr->dynCast<Break>()) {
diff --git a/src/passes/ConstHoisting.cpp b/src/passes/ConstHoisting.cpp
index 6552cfec0..8349e7234 100644
--- a/src/passes/ConstHoisting.cpp
+++ b/src/passes/ConstHoisting.cpp
@@ -96,7 +96,6 @@ private:
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp
index ebd0f3ba8..94544ae25 100644
--- a/src/passes/Flatten.cpp
+++ b/src/passes/Flatten.cpp
@@ -69,8 +69,7 @@ struct Flatten
return;
}
- if (curr->is<Try>() || curr->is<Throw>() || curr->is<Rethrow>() ||
- curr->is<BrOnExn>()) {
+ if (curr->is<Try>() || curr->is<Throw>() || curr->is<Rethrow>()) {
Fatal() << "Flatten does not support EH instructions yet";
}
@@ -277,7 +276,6 @@ struct Flatten
}
}
}
- // TODO Handle br_on_exn
// continue for general handling of everything, control flow or otherwise
curr = getCurrent(); // we may have replaced it
diff --git a/src/passes/FuncCastEmulation.cpp b/src/passes/FuncCastEmulation.cpp
index de21cbb7a..7f7721706 100644
--- a/src/passes/FuncCastEmulation.cpp
+++ b/src/passes/FuncCastEmulation.cpp
@@ -63,7 +63,6 @@ static Expression* toABI(Expression* value, Module* module) {
}
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -110,7 +109,6 @@ static Expression* fromABI(Expression* value, Type type, Module* module) {
}
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
diff --git a/src/passes/InstrumentLocals.cpp b/src/passes/InstrumentLocals.cpp
index 99a93af69..cc1234fc5 100644
--- a/src/passes/InstrumentLocals.cpp
+++ b/src/passes/InstrumentLocals.cpp
@@ -57,7 +57,6 @@ Name get_f32("get_f32");
Name get_f64("get_f64");
Name get_funcref("get_funcref");
Name get_externref("get_externref");
-Name get_exnref("get_exnref");
Name get_anyref("get_anyref");
Name get_eqref("get_eqref");
Name get_dataref("get_dataref");
@@ -70,7 +69,6 @@ Name set_f32("set_f32");
Name set_f64("set_f64");
Name set_funcref("set_funcref");
Name set_externref("set_externref");
-Name set_exnref("set_exnref");
Name set_anyref("set_anyref");
Name set_eqref("set_eqref");
Name set_dataref("set_dataref");
@@ -103,9 +101,6 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
case Type::externref:
import = get_externref;
break;
- case Type::exnref:
- import = get_exnref;
- break;
case Type::anyref:
import = get_anyref;
break;
@@ -166,9 +161,6 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
case Type::externref:
import = set_externref;
break;
- case Type::exnref:
- import = set_exnref;
- break;
case Type::anyref:
import = set_anyref;
break;
@@ -220,12 +212,6 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
set_externref,
{Type::i32, Type::i32, Type::externref},
Type::externref);
- if (curr->features.hasExceptionHandling()) {
- addImport(
- curr, get_exnref, {Type::i32, Type::i32, Type::exnref}, Type::exnref);
- addImport(
- curr, set_exnref, {Type::i32, Type::i32, Type::exnref}, Type::exnref);
- }
if (curr->features.hasGC()) {
addImport(
curr, get_anyref, {Type::i32, Type::i32, Type::anyref}, Type::anyref);
diff --git a/src/passes/MergeBlocks.cpp b/src/passes/MergeBlocks.cpp
index 0ce776524..ef0ead133 100644
--- a/src/passes/MergeBlocks.cpp
+++ b/src/passes/MergeBlocks.cpp
@@ -129,11 +129,6 @@ struct ProblemFinder : public ControlFlowWalker<ProblemFinder> {
}
}
- void visitBrOnExn(BrOnExn* curr) {
- // We should not take exnref value out of br_on_exn
- foundProblem = true;
- }
-
bool found() {
assert(brIfs >= droppedBrIfs);
return foundProblem || brIfs > droppedBrIfs;
@@ -596,8 +591,6 @@ struct MergeBlocks : public WalkerPass<PostWalker<MergeBlocks>> {
outer = optimize(curr, curr->operands[i], outer);
}
}
-
- void visitBrOnExn(BrOnExn* curr) { optimize(curr, curr->exnref); }
};
Pass* createMergeBlocksPass() { return new MergeBlocks(); }
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 0696ea4ec..53049943a 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -1732,12 +1732,6 @@ struct PrintExpressionContents
printMedium(o, "rethrow ");
o << curr->depth;
}
- void visitBrOnExn(BrOnExn* curr) {
- printMedium(o, "br_on_exn ");
- printName(curr->name, o);
- o << " ";
- printName(curr->event, o);
- }
void visitNop(Nop* curr) { printMinor(o, "nop"); }
void visitUnreachable(Unreachable* curr) { printMinor(o, "unreachable"); }
void visitPop(Pop* curr) {
@@ -2420,13 +2414,6 @@ struct PrintSExpression : public OverriddenVisitor<PrintSExpression> {
PrintExpressionContents(currFunction, o).visit(curr);
o << ')';
}
- void visitBrOnExn(BrOnExn* curr) {
- o << '(';
- PrintExpressionContents(currFunction, o).visit(curr);
- incIndent();
- printFullLine(curr->exnref);
- decIndent();
- }
void visitNop(Nop* curr) {
o << '(';
PrintExpressionContents(currFunction, o).visit(curr);
diff --git a/src/passes/ReReloop.cpp b/src/passes/ReReloop.cpp
index 374a54bb8..f70a8afd4 100644
--- a/src/passes/ReReloop.cpp
+++ b/src/passes/ReReloop.cpp
@@ -278,8 +278,7 @@ struct ReReloop final : public Pass {
ReturnTask::handle(*this, ret);
} else if (auto* un = curr->dynCast<Unreachable>()) {
UnreachableTask::handle(*this, un);
- } else if (curr->is<Try>() || curr->is<Throw>() || curr->is<Rethrow>() ||
- curr->is<BrOnExn>()) {
+ } else if (curr->is<Try>() || curr->is<Throw>() || curr->is<Rethrow>()) {
Fatal() << "ReReloop does not support EH instructions yet";
} else {
// not control flow, so just a simple element
diff --git a/src/passes/RemoveUnusedModuleElements.cpp b/src/passes/RemoveUnusedModuleElements.cpp
index 8c4523724..70a326799 100644
--- a/src/passes/RemoveUnusedModuleElements.cpp
+++ b/src/passes/RemoveUnusedModuleElements.cpp
@@ -124,12 +124,6 @@ struct ReachabilityAnalyzer : public PostWalker<ReachabilityAnalyzer> {
queue.emplace_back(ModuleElementKind::Event, curr->event);
}
}
- void visitBrOnExn(BrOnExn* curr) {
- if (reachable.count(ModuleElement(ModuleElementKind::Event, curr->event)) ==
- 0) {
- queue.emplace_back(ModuleElementKind::Event, curr->event);
- }
- }
};
struct RemoveUnusedModuleElements : public Pass {
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp
index 9f164ae92..0649b39c4 100644
--- a/src/passes/SimplifyLocals.cpp
+++ b/src/passes/SimplifyLocals.cpp
@@ -146,10 +146,6 @@ struct SimplifyLocals
self->unoptimizableBlocks.insert(target);
}
// TODO: we could use this info to stop gathering data on these blocks
- } else if (auto* br = curr->dynCast<BrOnExn>()) {
- // We cannot optimize the block this targets to have a return value, as
- // the br_on_exn doesn't support a change to the block's type
- self->unoptimizableBlocks.insert(br->name);
}
self->sinkables.clear();
}
diff --git a/src/shell-interface.h b/src/shell-interface.h
index dc72eff5b..aeb9cc2a9 100644
--- a/src/shell-interface.h
+++ b/src/shell-interface.h
@@ -117,7 +117,6 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface {
assert(false && "v128 not implemented yet");
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
globals[import->name] = {Literal::makeNull(import->type)};
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index 749e6c31f..7e5a56ab1 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -335,9 +335,6 @@ private:
if (wasm.features.hasReferenceTypes()) {
options.push_back(Type::funcref);
options.push_back(Type::externref);
- if (wasm.features.hasExceptionHandling()) {
- options.push_back(Type::exnref);
- }
if (wasm.features.hasGC()) {
options.push_back(Type::eqref);
options.push_back(Type::i31ref);
@@ -871,8 +868,6 @@ private:
void visitBreak(Break* curr) { replaceIfInvalid(curr->name); }
- void visitBrOnExn(BrOnExn* curr) { replaceIfInvalid(curr->name); }
-
bool replaceIfInvalid(Name target) {
if (!hasBreakTarget(target)) {
// There is no valid parent, replace with something trivially safe.
@@ -1648,7 +1643,6 @@ private:
}
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1755,7 +1749,6 @@ private:
}
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1892,7 +1885,6 @@ private:
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1940,7 +1932,6 @@ private:
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2013,7 +2004,6 @@ private:
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2043,7 +2033,6 @@ private:
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2182,7 +2171,6 @@ private:
}
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2331,7 +2319,6 @@ private:
}
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2574,7 +2561,6 @@ private:
}
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2782,7 +2768,6 @@ private:
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -3047,8 +3032,6 @@ private:
.add(FeatureSet::MVP, Type::i32, Type::i64, Type::f32, Type::f64)
.add(FeatureSet::SIMD, Type::v128)
.add(FeatureSet::ReferenceTypes, Type::funcref, Type::externref)
- .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling,
- Type::exnref)
.add(FeatureSet::ReferenceTypes | FeatureSet::GC,
Type::anyref,
Type::eqref,
@@ -3063,8 +3046,6 @@ private:
return items(
FeatureOptions<Type>()
.add(FeatureSet::ReferenceTypes, Type::funcref, Type::externref)
- .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling,
- Type::exnref)
.add(FeatureSet::ReferenceTypes | FeatureSet::GC,
Type::anyref,
Type::eqref,
@@ -3137,9 +3118,7 @@ private:
loggableTypes = items(
FeatureOptions<Type>()
.add(FeatureSet::MVP, Type::i32, Type::i64, Type::f32, Type::f64)
- .add(FeatureSet::SIMD, Type::v128)
- .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling,
- Type::exnref));
+ .add(FeatureSet::SIMD, Type::v128));
}
return loggableTypes;
}
diff --git a/src/tools/spec-wrapper.h b/src/tools/spec-wrapper.h
index 6947c499e..f8081a33d 100644
--- a/src/tools/spec-wrapper.h
+++ b/src/tools/spec-wrapper.h
@@ -55,9 +55,6 @@ static std::string generateSpecWrapper(Module& wasm) {
case Type::externref:
ret += "(ref.null extern)";
break;
- case Type::exnref:
- ret += "(ref.null exn)";
- break;
case Type::anyref:
ret += "(ref.null any)";
break;
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp
index a9b3e3068..3860630af 100644
--- a/src/tools/wasm-reduce.cpp
+++ b/src/tools/wasm-reduce.cpp
@@ -608,7 +608,6 @@ struct Reducer
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -637,7 +636,6 @@ struct Reducer
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -666,7 +664,6 @@ struct Reducer
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -695,7 +692,6 @@ struct Reducer
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -710,7 +706,6 @@ struct Reducer
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 06a294c6d..8f4946786 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -359,8 +359,6 @@ enum EncodedType {
// run-time type info type, without depth index n
rtt = -0x18, // 0x68
dataref = -0x19, // 0x67
- // exception reference type TODO remove; the code for now is incorrect
- exnref = -0x1a, // 0x66
// func_type form
Func = -0x20, // 0x60
Struct = -0x21, // 0x5f
@@ -375,7 +373,6 @@ enum EncodedHeapType {
any = -0x12, // 0x6e
eq = -0x13, // 0x6d
i31 = -0x16, // 0x6a
- exn = -0x18, // 0x68
data = -0x19, // 0x67
};
@@ -1007,7 +1004,6 @@ enum ASTNodes {
CatchAll = 0x05,
Throw = 0x08,
Rethrow = 0x09,
- BrOnExn = 0x0a,
// typed function references opcodes
@@ -1472,8 +1468,6 @@ public:
void readNextDebugLocation();
void readSourceMapHeader();
- void handleBrOnExnNotTaken(Expression* curr);
-
// AST reading
int depth = 0; // only for debugging
@@ -1554,7 +1548,6 @@ public:
void visitTryOrTryInBlock(Expression*& out);
void visitThrow(Throw* curr);
void visitRethrow(Rethrow* curr);
- void visitBrOnExn(BrOnExn* curr);
void visitCallRef(CallRef* curr);
// Let is lowered into a block.
void visitLet(Block* curr);
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 7f0029e9e..0bfa317d3 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -661,20 +661,6 @@ public:
ret->finalize();
return ret;
}
- BrOnExn* makeBrOnExn(Name name, Event* event, Expression* exnref) {
- return makeBrOnExn(name, event->name, exnref, event->sig.params);
- }
- BrOnExn* makeBrOnExn(Name name, Name event, Expression* exnref, Type sent) {
- auto* ret = wasm.allocator.alloc<BrOnExn>();
- ret->name = name;
- ret->event = event;
- ret->exnref = exnref;
- // Copy params info into BrOnExn, because it is necessary when BrOnExn is
- // refinalized without the module.
- ret->sent = sent;
- ret->finalize();
- return ret;
- }
Unreachable* makeUnreachable() { return wasm.allocator.alloc<Unreachable>(); }
Pop* makePop(Type type) {
auto* ret = wasm.allocator.alloc<Pop>();
@@ -835,7 +821,6 @@ public:
TODO_SINGLE_COMPOUND(type);
switch (type.getBasic()) {
case Type::externref:
- case Type::exnref: // TODO: ExceptionPackage?
case Type::anyref:
case Type::eqref:
assert(value.isNull() && "unexpected non-null reference type literal");
@@ -1040,7 +1025,6 @@ public:
case Type::funcref:
WASM_UNREACHABLE("handled above");
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
return ExpressionManipulator::refNull(curr, curr->type);
diff --git a/src/wasm-delegations-fields.h b/src/wasm-delegations-fields.h
index b5d80b86a..60e14d0c5 100644
--- a/src/wasm-delegations-fields.h
+++ b/src/wasm-delegations-fields.h
@@ -524,15 +524,6 @@ switch (DELEGATE_ID) {
DELEGATE_END(Rethrow);
break;
}
- case Expression::Id::BrOnExnId: {
- DELEGATE_START(BrOnExn);
- DELEGATE_FIELD_CHILD(BrOnExn, exnref);
- DELEGATE_FIELD_SCOPE_NAME_USE(BrOnExn, name);
- DELEGATE_FIELD_NAME(BrOnExn, event);
- DELEGATE_FIELD_TYPE(BrOnExn, sent);
- DELEGATE_END(BrOnExn);
- break;
- }
case Expression::Id::NopId: {
DELEGATE_START(Nop);
DELEGATE_END(Nop);
diff --git a/src/wasm-delegations.h b/src/wasm-delegations.h
index f46f5cbb2..f9e163286 100644
--- a/src/wasm-delegations.h
+++ b/src/wasm-delegations.h
@@ -62,7 +62,6 @@ DELEGATE(RefEq);
DELEGATE(Try);
DELEGATE(Throw);
DELEGATE(Rethrow);
-DELEGATE(BrOnExn);
DELEGATE(TupleMake);
DELEGATE(TupleExtract);
DELEGATE(I31New);
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index a825f99ef..1336a8d10 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -1354,25 +1354,6 @@ public:
WASM_UNREACHABLE("throw");
}
Flow visitRethrow(Rethrow* curr) { WASM_UNREACHABLE("unimp"); }
- Flow visitBrOnExn(BrOnExn* curr) {
- NOTE_ENTER("BrOnExn");
- Flow flow = this->visit(curr->exnref);
- if (flow.breaking()) {
- return flow;
- }
- const auto& value = flow.getSingleValue();
- if (value.isNull()) {
- trap("br_on_exn: argument is null");
- }
- auto ex = value.getExceptionPackage();
- if (curr->event != ex.event) { // Not taken
- return flow;
- }
- // Taken
- flow.values = ex.values;
- flow.breakTo = curr->name;
- return flow;
- }
Flow visitI31New(I31New* curr) {
NOTE_ENTER("I31New");
Flow flow = visit(curr->value);
@@ -2033,7 +2014,6 @@ public:
return Literal(load128(addr).data());
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -2093,7 +2073,6 @@ public:
break;
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 074e9dbe7..b6db598ec 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -251,7 +251,6 @@ private:
Expression* makeTryOrCatchBody(Element& s, Type type, bool isTry);
Expression* makeThrow(Element& s);
Expression* makeRethrow(Element& s);
- Expression* makeBrOnExn(Element& s);
Expression* makeTupleMake(Element& s);
Expression* makeTupleExtract(Element& s);
Expression* makeCallRef(Element& s, bool isReturn);
diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h
index 53c0e4ac7..4d69eaee3 100644
--- a/src/wasm-traversal.h
+++ b/src/wasm-traversal.h
@@ -589,12 +589,6 @@ struct LinearExecutionWalker : public PostWalker<SubType, VisitorType> {
self->pushTask(SubType::doNoteNonLinear, currp);
break;
}
- case Expression::Id::BrOnExnId: {
- self->pushTask(SubType::doVisitBrOnExn, currp);
- self->pushTask(SubType::doNoteNonLinear, currp);
- self->pushTask(SubType::scan, &curr->cast<BrOnExn>()->exnref);
- break;
- }
case Expression::Id::UnreachableId: {
self->pushTask(SubType::doVisitUnreachable, currp);
self->pushTask(SubType::doNoteNonLinear, currp);
diff --git a/src/wasm-type.h b/src/wasm-type.h
index b85855f0b..6b3fdb08f 100644
--- a/src/wasm-type.h
+++ b/src/wasm-type.h
@@ -72,7 +72,6 @@ public:
v128,
funcref,
externref,
- exnref,
anyref,
eqref,
dataref,
@@ -117,8 +116,7 @@ public:
// ├─ Aliases ───╫───┼───┼───┼───┤───────┤
// │ funcref ║ x │ │ x │ x │ f n │ ┐ Ref
// │ externref ║ x │ │ x │ x │ f? n │ │ f_unc
- // │ exnref ║ x │ │ x │ x │ n │ │ n_ullable
- // │ anyref ║ x │ │ x │ x │ f? n │ │
+ // │ anyref ║ x │ │ x │ x │ f? n │ │ n_ullable
// │ eqref ║ x │ │ x │ x │ n │ │ ┐ TODO (GC)
// │ i31ref ║ x │ │ x │ x │ │ │ │
// │ dataref ║ x │ │ x │ x │ │ │ ┘
@@ -295,7 +293,6 @@ public:
enum BasicHeapType : uint32_t {
func,
ext,
- exn,
any,
eq,
data,
diff --git a/src/wasm.h b/src/wasm.h
index dd15ea7ad..0b7a09a3c 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -615,7 +615,6 @@ public:
TryId,
ThrowId,
RethrowId,
- BrOnExnId,
TupleMakeId,
TupleExtractId,
I31NewId,
@@ -1292,21 +1291,6 @@ public:
void finalize();
};
-class BrOnExn : public SpecificExpression<Expression::BrOnExnId> {
-public:
- BrOnExn() { type = Type::unreachable; }
- BrOnExn(MixedArena& allocator) : BrOnExn() {}
-
- Name name;
- Name event;
- Expression* exnref;
- // This is duplicate info of param types stored in Event, but this is required
- // for us to know the type of the value sent to the target block.
- Type sent;
-
- void finalize();
-};
-
class TupleMake : public SpecificExpression<Expression::TupleMakeId> {
public:
TupleMake(MixedArena& allocator) : operands(allocator) {}
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index e22088d9c..6d870ec55 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -35,9 +35,7 @@ Literal::Literal(Type type) : type(type) {
i32 = 0;
} else {
assert(type != Type::unreachable && (!type.isRef() || type.isNullable()));
- if (type.isException()) {
- new (&exn) std::unique_ptr<ExceptionPackage>();
- } else if (isGCData()) {
+ if (isGCData()) {
new (&gcData) std::shared_ptr<GCData>();
} else if (type.isRtt()) {
// Allocate a new RttSupers (with no data).
@@ -66,15 +64,6 @@ Literal::Literal(std::unique_ptr<RttSupers>&& rttSupers, Type type)
}
Literal::Literal(const Literal& other) : type(other.type) {
- if (type.isException()) {
- // Avoid calling the destructor on an uninitialized value
- if (other.exn != nullptr) {
- new (&exn) auto(std::make_unique<ExceptionPackage>(*other.exn));
- } else {
- new (&exn) std::unique_ptr<ExceptionPackage>();
- }
- return;
- }
if (other.isGCData()) {
new (&gcData) std::shared_ptr<GCData>(other.gcData);
return;
@@ -101,7 +90,6 @@ Literal::Literal(const Literal& other) : type(other.type) {
return;
case HeapType::func:
case HeapType::data:
- case HeapType::exn:
WASM_UNREACHABLE("invalid type");
}
}
@@ -124,7 +112,6 @@ Literal::Literal(const Literal& other) : type(other.type) {
case Type::unreachable:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -134,9 +121,7 @@ Literal::Literal(const Literal& other) : type(other.type) {
}
Literal::~Literal() {
- if (type.isException()) {
- exn.~unique_ptr();
- } else if (isGCData()) {
+ if (isGCData()) {
gcData.~shared_ptr();
} else if (type.isRtt()) {
rttSupers.~unique_ptr();
@@ -255,11 +240,6 @@ std::array<uint8_t, 16> Literal::getv128() const {
return ret;
}
-ExceptionPackage Literal::getExceptionPackage() const {
- assert(type.isException() && exn != nullptr);
- return *exn;
-}
-
std::shared_ptr<GCData> Literal::getGCData() const {
assert(isGCData());
return gcData;
@@ -349,7 +329,6 @@ void Literal::getBits(uint8_t (&buf)[16]) const {
case Type::unreachable:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -371,10 +350,6 @@ bool Literal::operator==(const Literal& other) const {
assert(func.is() && other.func.is());
return func == other.func;
}
- if (type.isException()) {
- assert(exn != nullptr && other.exn != nullptr);
- return *exn == *other.exn;
- }
// other non-null reference type literals cannot represent concrete values,
// i.e. there is no concrete externref, anyref or eqref other than null.
WASM_UNREACHABLE("unexpected type");
@@ -394,7 +369,6 @@ bool Literal::operator==(const Literal& other) const {
return memcmp(v128, other.v128, 16) == 0;
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::dataref:
case Type::eqref:
@@ -525,13 +499,6 @@ std::ostream& operator<<(std::ostream& o, Literal literal) {
assert(literal.isNull() && "unexpected non-null externref literal");
o << "externref(null)";
break;
- case HeapType::exn:
- if (literal.isNull()) {
- o << "exnref(null)";
- } else {
- o << "exnref(" << literal.getExceptionPackage() << ")";
- }
- break;
case HeapType::any:
assert(literal.isNull() && "unexpected non-null anyref literal");
o << "anyref(null)";
@@ -578,7 +545,6 @@ std::ostream& operator<<(std::ostream& o, Literal literal) {
break;
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -606,10 +572,6 @@ std::ostream& operator<<(std::ostream& o, wasm::Literals literals) {
}
}
-std::ostream& operator<<(std::ostream& o, const ExceptionPackage& exn) {
- return o << exn.event << " " << exn.values;
-}
-
Literal Literal::countLeadingZeroes() const {
if (type == Type::i32) {
return Literal((int32_t)Bits::countLeadingZeroes(i32));
@@ -807,7 +769,6 @@ Literal Literal::eqz() const {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -832,7 +793,6 @@ Literal Literal::neg() const {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -857,7 +817,6 @@ Literal Literal::abs() const {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -999,7 +958,6 @@ Literal Literal::add(const Literal& other) const {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -1024,7 +982,6 @@ Literal Literal::sub(const Literal& other) const {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -1120,7 +1077,6 @@ Literal Literal::mul(const Literal& other) const {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -1357,7 +1313,6 @@ Literal Literal::eq(const Literal& other) const {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -1382,7 +1337,6 @@ Literal Literal::ne(const Literal& other) const {
case Type::v128:
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 62c8a6cb3..a61d47102 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1045,9 +1045,6 @@ void WasmBinaryWriter::writeType(Type type) {
case Type::externref:
ret = BinaryConsts::EncodedType::externref;
break;
- case Type::exnref:
- ret = BinaryConsts::EncodedType::exnref;
- break;
case Type::anyref:
ret = BinaryConsts::EncodedType::anyref;
break;
@@ -1080,9 +1077,6 @@ void WasmBinaryWriter::writeHeapType(HeapType type) {
case HeapType::ext:
ret = BinaryConsts::EncodedHeapType::extern_;
break;
- case HeapType::exn:
- ret = BinaryConsts::EncodedHeapType::exn;
- break;
case HeapType::any:
ret = BinaryConsts::EncodedHeapType::any;
break;
@@ -1410,8 +1404,6 @@ Type WasmBinaryBuilder::getType(int initial) {
return Type::funcref;
case BinaryConsts::EncodedType::externref:
return Type::externref;
- case BinaryConsts::EncodedType::exnref:
- return Type::exnref;
case BinaryConsts::EncodedType::anyref:
return Type::anyref;
case BinaryConsts::EncodedType::eqref:
@@ -1457,8 +1449,6 @@ HeapType WasmBinaryBuilder::getHeapType() {
return HeapType::func;
case BinaryConsts::EncodedHeapType::extern_:
return HeapType::ext;
- case BinaryConsts::EncodedHeapType::exn:
- return HeapType::exn;
case BinaryConsts::EncodedHeapType::any:
return HeapType::any;
case BinaryConsts::EncodedHeapType::eq:
@@ -2874,9 +2864,6 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) {
case BinaryConsts::Rethrow:
visitRethrow((curr = allocator.alloc<Rethrow>())->cast<Rethrow>());
break;
- case BinaryConsts::BrOnExn:
- visitBrOnExn((curr = allocator.alloc<BrOnExn>())->cast<BrOnExn>());
- break;
case BinaryConsts::MemorySize: {
auto size = allocator.alloc<MemorySize>();
if (wasm.memory.is64()) {
@@ -5699,26 +5686,6 @@ void WasmBinaryBuilder::visitRethrow(Rethrow* curr) {
curr->finalize();
}
-void WasmBinaryBuilder::visitBrOnExn(BrOnExn* curr) {
- BYN_TRACE("zz node: BrOnExn\n");
- BreakTarget target = getBreakTarget(getU32LEB());
- curr->name = target.name;
- auto index = getU32LEB();
- if (index >= wasm.events.size()) {
- throwError("bad event index");
- }
- curr->event = wasm.events[index]->name;
- curr->exnref = popNonVoidExpression();
-
- Event* event = wasm.getEventOrNull(curr->event);
- assert(event && "br_on_exn's event must exist");
-
- // Copy params info into BrOnExn, because it is necessary when BrOnExn is
- // refinalized without the module.
- curr->sent = event->sig.params;
- curr->finalize();
-}
-
void WasmBinaryBuilder::visitCallRef(CallRef* curr) {
BYN_TRACE("zz node: CallRef\n");
curr->target = popNonVoidExpression();
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 0356db235..d34698131 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -858,9 +858,6 @@ Type SExpressionWasmBuilder::stringToType(const char* str,
if (strncmp(str, "externref", 9) == 0 && (prefix || str[9] == 0)) {
return Type::externref;
}
- if (strncmp(str, "exnref", 6) == 0 && (prefix || str[6] == 0)) {
- return Type::exnref;
- }
if (strncmp(str, "anyref", 6) == 0 && (prefix || str[6] == 0)) {
return Type::anyref;
}
@@ -892,14 +889,9 @@ HeapType SExpressionWasmBuilder::stringToHeapType(const char* str,
if (str[1] == 'q' && (prefix || str[2] == 0)) {
return HeapType::eq;
}
- if (str[1] == 'x') {
- if (str[2] == 'n' && (prefix || str[3] == 0)) {
- return HeapType::exn;
- }
- if (str[2] == 't' && str[3] == 'e' && str[4] == 'r' && str[5] == 'n' &&
- (prefix || str[6] == 0)) {
- return HeapType::ext;
- }
+ if (str[1] == 'x' && str[2] == 't' && str[3] == 'e' && str[4] == 'r' &&
+ str[5] == 'n' && (prefix || str[6] == 0)) {
+ return HeapType::ext;
}
}
if (str[0] == 'i') {
@@ -2073,25 +2065,6 @@ Expression* SExpressionWasmBuilder::makeRethrow(Element& s) {
return ret;
}
-Expression* SExpressionWasmBuilder::makeBrOnExn(Element& s) {
- auto ret = allocator.alloc<BrOnExn>();
- size_t i = 1;
- ret->name = getLabel(*s[i++]);
- ret->event = getEventName(*s[i++]);
- if (!wasm.getEventOrNull(ret->event)) {
- throw ParseException("bad event name", s[1]->line, s[1]->col);
- }
- ret->exnref = parseExpression(s[i]);
-
- Event* event = wasm.getEventOrNull(ret->event);
- assert(event && "br_on_exn's event must exist");
- // Copy params info into BrOnExn, because it is necessary when BrOnExn is
- // refinalized without the module.
- ret->sent = event->sig.params;
- ret->finalize();
- return ret;
-}
-
Expression* SExpressionWasmBuilder::makeTupleMake(Element& s) {
auto ret = allocator.alloc<TupleMake>();
parseCallOperands(s, 1, s.size(), ret);
diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp
index 8fc6c02c6..81858d003 100644
--- a/src/wasm/wasm-stack.cpp
+++ b/src/wasm/wasm-stack.cpp
@@ -192,7 +192,6 @@ void BinaryInstWriter::visitLoad(Load* curr) {
return;
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -297,7 +296,6 @@ void BinaryInstWriter::visitStore(Store* curr) {
break;
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -762,7 +760,6 @@ void BinaryInstWriter::visitConst(Const* curr) {
}
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1914,11 +1911,6 @@ void BinaryInstWriter::visitRethrow(Rethrow* curr) {
o << int8_t(BinaryConsts::Rethrow) << U32LEB(curr->depth);
}
-void BinaryInstWriter::visitBrOnExn(BrOnExn* curr) {
- o << int8_t(BinaryConsts::BrOnExn) << U32LEB(getBreakIndex(curr->name))
- << U32LEB(parent.getEventIndex(curr->event));
-}
-
void BinaryInstWriter::visitNop(Nop* curr) { o << int8_t(BinaryConsts::Nop); }
void BinaryInstWriter::visitUnreachable(Unreachable* curr) {
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index 862a95223..fc8f84f6f 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -302,8 +302,6 @@ struct TypeStore : Store<TypeInfo> {
return Type::funcref;
case HeapType::ext:
return Type::externref;
- case HeapType::exn:
- return Type::exnref;
case HeapType::any:
return Type::anyref;
case HeapType::eq:
@@ -386,15 +384,6 @@ bool Type::isFunction() const {
}
}
-bool Type::isException() const {
- if (isBasic()) {
- return id == exnref;
- } else {
- auto* info = getTypeInfo(*this);
- return info->isRef() && info->ref.heapType == HeapType::exn;
- }
-}
-
bool Type::isNullable() const {
if (isBasic()) {
return id >= funcref && id <= eqref; // except i31ref
@@ -452,7 +441,6 @@ unsigned Type::getByteSize() const {
return 16;
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -501,8 +489,6 @@ FeatureSet Type::getFeatures() const {
}
if (heapType.isBasic()) {
switch (heapType.getBasic()) {
- case HeapType::BasicHeapType::exn:
- return FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling;
case HeapType::BasicHeapType::any:
case HeapType::BasicHeapType::eq:
case HeapType::BasicHeapType::data:
@@ -554,8 +540,6 @@ HeapType Type::getHeapType() const {
return HeapType::func;
case Type::externref:
return HeapType::ext;
- case Type::exnref:
- return HeapType::exn;
case Type::anyref:
return HeapType::any;
case Type::eqref:
@@ -894,8 +878,6 @@ std::ostream& operator<<(std::ostream& os, Type type) {
return os << "funcref";
case Type::externref:
return os << "externref";
- case Type::exnref:
- return os << "exnref";
case Type::anyref:
return os << "anyref";
case Type::eqref:
@@ -988,8 +970,6 @@ std::ostream& operator<<(std::ostream& os, HeapType heapType) {
return os << "func";
case HeapType::ext:
return os << "extern";
- case HeapType::exn:
- return os << "exn";
case HeapType::any:
return os << "any";
case HeapType::eq:
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index cc8a2bb56..e4a70a347 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -337,7 +337,6 @@ public:
void visitTry(Try* curr);
void visitThrow(Throw* curr);
void visitRethrow(Rethrow* curr);
- void visitBrOnExn(BrOnExn* curr);
void visitTupleMake(TupleMake* curr);
void visitTupleExtract(TupleExtract* curr);
void visitCallRef(CallRef* curr);
@@ -1395,7 +1394,6 @@ void FunctionValidator::validateMemBytes(uint8_t bytes,
break;
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -2102,34 +2100,6 @@ void FunctionValidator::visitRethrow(Rethrow* curr) {
// depth 0 for C++ support.
}
-void FunctionValidator::visitBrOnExn(BrOnExn* curr) {
- shouldBeTrue(getModule()->features.hasExceptionHandling(),
- curr,
- "br_on_exn requires exception-handling to be enabled");
- Event* event = getModule()->getEventOrNull(curr->event);
- shouldBeTrue(event != nullptr, curr, "br_on_exn's event must exist");
- shouldBeTrue(event->sig.params == curr->sent,
- curr,
- "br_on_exn's event params and event's params are different");
- noteBreak(curr->name, curr->sent, curr);
- shouldBeSubTypeOrFirstIsUnreachable(
- curr->exnref->type,
- Type::exnref,
- curr,
- "br_on_exn's argument must be unreachable or exnref type or its subtype");
- if (curr->exnref->type == Type::unreachable) {
- shouldBeTrue(curr->type == Type::unreachable,
- curr,
- "If exnref argument's type is unreachable, br_on_exn should "
- "be unreachable too");
- } else {
- shouldBeTrue(curr->type == Type::exnref,
- curr,
- "br_on_exn's type should be exnref unless its exnref argument "
- "is unreachable");
- }
-}
-
void FunctionValidator::visitTupleMake(TupleMake* curr) {
shouldBeTrue(getModule()->features.hasMultivalue(),
curr,
@@ -2542,7 +2512,6 @@ void FunctionValidator::validateAlignment(
break;
case Type::funcref:
case Type::externref:
- case Type::exnref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -2859,12 +2828,6 @@ static void validateFeatures(Module& module, ValidationInfo& info) {
module.features,
"--enable-gc requires --enable-reference-types");
}
- if (module.features.hasExceptionHandling()) { // implies exnref
- info.shouldBeTrue(
- module.features.hasReferenceTypes(),
- module.features,
- "--enable-exception-handling requires --enable-reference-types");
- }
}
// TODO: If we want the validator to be part of libwasm rather than libpasses,
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 52d2af0c6..13085ca17 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -200,8 +200,6 @@ const char* getExpressionName(Expression* curr) {
return "throw";
case Expression::Id::RethrowId:
return "rethrow";
- case Expression::Id::BrOnExnId:
- return "br_on_exn";
case Expression::Id::TupleMakeId:
return "tuple.make";
case Expression::Id::TupleExtractId:
@@ -976,14 +974,6 @@ void Throw::finalize() { type = Type::unreachable; }
void Rethrow::finalize() { type = Type::unreachable; }
-void BrOnExn::finalize() {
- if (exnref->type == Type::unreachable) {
- type = Type::unreachable;
- } else {
- type = Type::exnref;
- }
-}
-
void TupleMake::finalize() {
std::vector<Type> types;
for (auto* op : operands) {
diff --git a/src/wasm2js.h b/src/wasm2js.h
index a9b57b185..745a56d59 100644
--- a/src/wasm2js.h
+++ b/src/wasm2js.h
@@ -2175,10 +2175,6 @@ Ref Wasm2JSBuilder::processFunctionBody(Module* m,
unimplemented(curr);
WASM_UNREACHABLE("unimp");
}
- Ref visitBrOnExn(BrOnExn* curr) {
- unimplemented(curr);
- WASM_UNREACHABLE("unimp");
- }
Ref visitPop(Pop* curr) {
unimplemented(curr);
WASM_UNREACHABLE("unimp");
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js
index 603ca3250..a49546b91 100644
--- a/test/binaryen.js/expressions.js
+++ b/test/binaryen.js/expressions.js
@@ -1581,43 +1581,6 @@ console.log("# Rethrow");
module.dispose();
})();
-console.log("# BrOnExn");
-(function testBrOnExn() {
- const module = new binaryen.Module();
- module.addEvent("event1", 0, binaryen.none, binaryen.none);
- module.addEvent("event2", 0, binaryen.none, binaryen.none);
-
- var name = "foo";
- var event = "event1";
- var exnref = module.local.get(1, binaryen.exnref);
- const theBrOnExn = binaryen.BrOnExn(module.br_on_exn(name, event, exnref));
- assert(theBrOnExn instanceof binaryen.BrOnExn);
- assert(theBrOnExn instanceof binaryen.Expression);
- assert(theBrOnExn.name === name);
- assert(theBrOnExn.event === event);
- assert(theBrOnExn.exnref === exnref);
- assert(theBrOnExn.type === binaryen.exnref);
-
- theBrOnExn.name = name = "bar";
- assert(theBrOnExn.name === name);
- theBrOnExn.event = event = "event2";
- assert(theBrOnExn.event === event);
- theBrOnExn.exnref = exnref = module.local.get(2, binaryen.exnref);
- assert(theBrOnExn.exnref === exnref);
- theBrOnExn.type = binaryen.f64;
- theBrOnExn.finalize();
- assert(theBrOnExn.type === binaryen.exnref);
-
- console.log(theBrOnExn.toText());
- assert(
- theBrOnExn.toText()
- ==
- "(br_on_exn $bar $event2\n (local.get $2)\n)\n"
- );
-
- module.dispose();
-})();
-
console.log("# TupleMake");
(function testTupleMake() {
const module = new binaryen.Module();
diff --git a/test/binaryen.js/expressions.js.txt b/test/binaryen.js/expressions.js.txt
index d6c090d18..f5645ff1c 100644
--- a/test/binaryen.js/expressions.js.txt
+++ b/test/binaryen.js/expressions.js.txt
@@ -292,11 +292,6 @@
# Rethrow
(rethrow 1)
-# BrOnExn
-(br_on_exn $bar $event2
- (local.get $2)
-)
-
# TupleMake
(tuple.make
(i32.const 6)
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js
index 8e7e81f26..160054fde 100644
--- a/test/binaryen.js/kitchen-sink.js
+++ b/test/binaryen.js/kitchen-sink.js
@@ -74,9 +74,6 @@ function test_types() {
console.log(" // BinaryenTypeExternref: " + binaryen.externref);
console.log(" //", binaryen.expandType(binaryen.externref).join(","));
- console.log(" // BinaryenTypeExnref: " + binaryen.exnref);
- console.log(" //", binaryen.expandType(binaryen.exnref).join(","));
-
console.log(" // BinaryenTypeAnyref: " + binaryen.anyref);
console.log(" //", binaryen.expandType(binaryen.anyref).join(","));
@@ -164,7 +161,6 @@ function test_ids() {
console.log("TryId: " + binaryen.TryId);
console.log("ThrowId: " + binaryen.ThrowId);
console.log("RethrowId: " + binaryen.RethrowId);
- console.log("BrOnExnId: " + binaryen.BrOnExnId);
console.log("TupleMakeId: " + binaryen.TupleMakeId);
console.log("TupleExtractId: " + binaryen.TupleExtractId);
console.log("I31NewId: " + binaryen.I31NewId);
@@ -591,7 +587,6 @@ function test_core() {
module.v128.pop(),
module.funcref.pop(),
module.externref.pop(),
- module.exnref.pop(),
module.anyref.pop(),
module.eqref.pop(),
module.i31ref.pop(),
@@ -642,7 +637,7 @@ function test_core() {
var body = module.block("the-body", [ nothing, makeInt32(42) ]);
// Create the function
- var sinker = module.addFunction("kitchen()sinker", iIfF, binaryen.i32, [ binaryen.i32, binaryen.exnref ], body);
+ var sinker = module.addFunction("kitchen()sinker", iIfF, binaryen.i32, [ binaryen.i32 ], body);
// Create a global
var initExpr = module.i32.const(1);
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index 204dd800c..f73990493 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -16,14 +16,12 @@
// 7
// BinaryenTypeExternref: 8
// 8
- // BinaryenTypeExnref: 9
+ // BinaryenTypeAnyref: 9
// 9
- // BinaryenTypeAnyref: 10
+ // BinaryenTypeEqref: 10
// 10
- // BinaryenTypeEqref: 11
- // 11
- // BinaryenTypeI31ref: 13
- // 13
+ // BinaryenTypeI31ref: 12
+ // 12
// BinaryenTypeAuto: -1
// 2,2
// 2,2
@@ -88,24 +86,23 @@ RefEqId: 45
TryId: 46
ThrowId: 47
RethrowId: 48
-BrOnExnId: 49
-TupleMakeId: 50
-TupleExtractId: 51
-I31NewId: 52
-I31GetId: 53
-CallRefId: 54
-RefTestId: 55
-RefCastId: 56
-BrOnCastId: 57
-RttCanonId: 58
-RttSubId: 59
-StructNewId: 60
-StructGetId: 61
-StructSetId: 62
-ArrayNewId: 63
-ArrayGetId: 64
-ArraySetId: 65
-ArrayLenId: 66
+TupleMakeId: 49
+TupleExtractId: 50
+I31NewId: 51
+I31GetId: 52
+CallRefId: 53
+RefTestId: 54
+RefCastId: 55
+BrOnCastId: 56
+RttCanonId: 57
+RttSubId: 58
+StructNewId: 59
+StructGetId: 60
+StructSetId: 61
+ArrayNewId: 62
+ArrayGetId: 63
+ArraySetId: 64
+ArrayLenId: 65
getExpressionInfo={"id":15,"type":4,"op":6}
(f32.neg
(f32.const -33.61199951171875)
@@ -142,7 +139,6 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(start $starter)
(func "$kitchen()sinker" (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32)
(local $4 i32)
- (local $5 exnref)
(block $the-body (result i32)
(block $the-nothing
(drop
@@ -1931,9 +1927,6 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(pop externref)
)
(drop
- (pop exnref)
- )
- (drop
(pop anyref)
)
(drop
@@ -2005,7 +1998,6 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(start $starter)
(func "$kitchen()sinker" (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32)
(local $4 i32)
- (local $5 exnref)
(block $the-body (result i32)
(block $the-nothing
(drop
@@ -3794,9 +3786,6 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(pop externref)
)
(drop
- (pop exnref)
- )
- (drop
(pop anyref)
)
(drop
diff --git a/test/ctor-eval/bad-indirect-call3.wast b/test/ctor-eval/bad-indirect-call3.wast
index 7a16889ce..f1cc687b6 100644
--- a/test/ctor-eval/bad-indirect-call3.wast
+++ b/test/ctor-eval/bad-indirect-call3.wast
@@ -4,7 +4,7 @@
(data (i32.const 10) "waka waka waka waka waka")
(table funcref (elem $callee))
(export "sig_mismatch" (func $sig_mismatch))
- (func $callee (param $0 exnref)
+ (func $callee (param $0 externref)
(i32.store8 (i32.const 40) (i32.const 67))
)
(func $sig_mismatch
diff --git a/test/ctor-eval/bad-indirect-call3.wast.out b/test/ctor-eval/bad-indirect-call3.wast.out
index 28a7c5ed5..5edfb58b1 100644
--- a/test/ctor-eval/bad-indirect-call3.wast.out
+++ b/test/ctor-eval/bad-indirect-call3.wast.out
@@ -1,13 +1,13 @@
(module
(type $none_=>_none (func))
(type $funcref_=>_none (func (param funcref)))
- (type $exnref_=>_none (func (param exnref)))
+ (type $externref_=>_none (func (param externref)))
(memory $0 256 256)
(data (i32.const 10) "waka waka waka waka waka")
(table $0 1 1 funcref)
(elem (i32.const 0) $callee)
(export "sig_mismatch" (func $sig_mismatch))
- (func $callee (param $0 exnref)
+ (func $callee (param $0 externref)
(i32.store8
(i32.const 40)
(i32.const 67)
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index 58b1e00aa..d70ad11eb 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -205,12 +205,6 @@ void test_types() {
BinaryenTypeExpand(externref, &valueType);
assert(valueType == externref);
- BinaryenType exnref = BinaryenTypeExnref();
- printf(" // BinaryenTypeExnref: %d\n", exnref);
- assert(BinaryenTypeArity(exnref) == 1);
- BinaryenTypeExpand(exnref, &valueType);
- assert(valueType == exnref);
-
BinaryenType anyref = BinaryenTypeAnyref();
printf(" // BinaryenTypeAnyref: %d\n", anyref);
assert(BinaryenTypeArity(anyref) == 1);
@@ -312,7 +306,6 @@ void test_core() {
BinaryenExpressionRef funcrefExpr = BinaryenRefNull(module, BinaryenTypeFuncref());
funcrefExpr =
BinaryenRefFunc(module, "kitchen()sinker", BinaryenTypeFuncref());
- BinaryenExpressionRef exnrefExpr = BinaryenRefNull(module, BinaryenTypeExnref());
BinaryenExpressionRef i31refExpr = BinaryenI31New(module, makeInt32(module, 1));
// Events
@@ -713,7 +706,6 @@ void test_core() {
// Reference types
BinaryenRefIsNull(module, externrefExpr),
BinaryenRefIsNull(module, funcrefExpr),
- BinaryenRefIsNull(module, exnrefExpr),
BinaryenSelect(
module,
temp10,
@@ -750,7 +742,6 @@ void test_core() {
BinaryenPop(module, BinaryenTypeFloat64()),
BinaryenPop(module, BinaryenTypeFuncref()),
BinaryenPop(module, BinaryenTypeExternref()),
- BinaryenPop(module, BinaryenTypeExnref()),
BinaryenPop(module, iIfF),
// Memory
BinaryenMemorySize(module),
@@ -780,7 +771,7 @@ void test_core() {
BinaryenBlock(module, "the-body", bodyList, 2, BinaryenTypeAuto());
// Create the function
- BinaryenType localTypes[] = {BinaryenTypeInt32(), BinaryenTypeExnref()};
+ BinaryenType localTypes[] = {BinaryenTypeInt32(), BinaryenTypeExternref()};
BinaryenFunctionRef sinker = BinaryenAddFunction(
module, "kitchen()sinker", iIfF, BinaryenTypeInt32(), localTypes, 2, body);
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 90634550b..350c5555f 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -7,10 +7,9 @@
// BinaryenTypeVec128: 6
// BinaryenTypeFuncref: 7
// BinaryenTypeExternref: 8
- // BinaryenTypeExnref: 9
- // BinaryenTypeAnyref: 10
- // BinaryenTypeEqref: 11
- // BinaryenTypeI31ref: 13
+ // BinaryenTypeAnyref: 9
+ // BinaryenTypeEqref: 10
+ // BinaryenTypeI31ref: 12
// BinaryenTypeAuto: -1
BinaryenFeatureMVP: 0
BinaryenFeatureAtomics: 1
@@ -48,7 +47,7 @@ BinaryenFeatureAll: 8191
(start $starter)
(func "$kitchen()sinker" (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32)
(local $4 i32)
- (local $5 exnref)
+ (local $5 externref)
(block $the-body (result i32)
(block $the-nothing
(drop
@@ -1748,11 +1747,6 @@ BinaryenFeatureAll: 8191
)
)
(drop
- (ref.is_null
- (ref.null exn)
- )
- )
- (drop
(select (result funcref)
(ref.null func)
(ref.func "$kitchen()sinker")
@@ -1837,9 +1831,6 @@ BinaryenFeatureAll: 8191
(pop externref)
)
(drop
- (pop exnref)
- )
- (drop
(pop i32 i64 f32 f64)
)
(drop
diff --git a/test/example/typeinfo.cpp b/test/example/typeinfo.cpp
index 729d57925..94d7c2317 100644
--- a/test/example/typeinfo.cpp
+++ b/test/example/typeinfo.cpp
@@ -25,14 +25,6 @@ void test_compound() {
assert(Type(extern_, NonNullable).getID() ==
Type(sameExtern, NonNullable).getID());
- HeapType exn(HeapType::exn);
- assert(Type(exn, Nullable).getID() == Type::exnref);
- assert(Type(exn, NonNullable).getID() == Type(exn, NonNullable).getID());
- assert(Type(exn, NonNullable).getID() != Type(exn, Nullable).getID());
- HeapType sameExn(HeapType::exn);
- assert(Type(exn, NonNullable).getID() ==
- Type(sameExn, NonNullable).getID());
-
HeapType any(HeapType::any);
assert(Type(any, Nullable).getID() == Type::anyref);
assert(Type(any, NonNullable).getID() == Type(any, NonNullable).getID());
@@ -160,9 +152,6 @@ void test_printing() {
std::cout << HeapType(HeapType::i31) << "\n";
std::cout << Type(HeapType::i31, Nullable) << "\n";
std::cout << Type(HeapType::i31, NonNullable) << "\n";
- std::cout << HeapType(HeapType::exn) << "\n";
- std::cout << Type(HeapType::exn, Nullable) << "\n";
- std::cout << Type(HeapType::exn, NonNullable) << "\n";
std::cout << HeapType(Signature(Type::none, Type::none)) << "\n";
std::cout << HeapType(Struct({})) << "\n";
std::cout << HeapType(Array({Type::i32, Immutable})) << "\n";
@@ -231,8 +220,6 @@ void test_printing() {
std::cout << Type(Rtt(3, HeapType::eq)) << "\n";
std::cout << Rtt(4, HeapType::i31) << "\n";
std::cout << Type(Rtt(4, HeapType::i31)) << "\n";
- std::cout << Rtt(5, HeapType::exn) << "\n";
- std::cout << Type(Rtt(5, HeapType::exn)) << "\n";
Rtt signatureRtt(6, Signature(Type::none, Type::none));
std::cout << signatureRtt << "\n";
std::cout << Type(signatureRtt) << "\n";
diff --git a/test/example/typeinfo.txt b/test/example/typeinfo.txt
index 4ba628925..c205ce431 100644
--- a/test/example/typeinfo.txt
+++ b/test/example/typeinfo.txt
@@ -14,9 +14,6 @@ eqref
i31
(ref null i31)
i31ref
-exn
-exnref
-(ref exn)
(func)
(struct)
(array i32)
@@ -62,8 +59,6 @@ none
(rtt 3 eq)
(rtt 4 i31)
(rtt 4 i31)
-(rtt 5 exn)
-(rtt 5 exn)
(rtt 6 (func))
(rtt 6 (func))
(rtt 7 (struct))
diff --git a/test/exception-handling.wast b/test/exception-handling.wast
index 72eb0be4a..b96c4d25f 100644
--- a/test/exception-handling.wast
+++ b/test/exception-handling.wast
@@ -3,10 +3,6 @@
(event $e-i64 (attr 0) (param i64))
(event $e-i32-i64 (attr 0) (param i32 i64))
- (func $exnref_test (param $0 exnref) (result exnref)
- (local.get $0)
- )
-
(func $foo)
(func $bar)
diff --git a/test/exception-handling.wast.from-wast b/test/exception-handling.wast.from-wast
index 64d78d54e..224df569b 100644
--- a/test/exception-handling.wast.from-wast
+++ b/test/exception-handling.wast.from-wast
@@ -3,13 +3,9 @@
(type $i32_=>_none (func (param i32)))
(type $i64_=>_none (func (param i64)))
(type $i32_i64_=>_none (func (param i32 i64)))
- (type $exnref_=>_exnref (func (param exnref) (result exnref)))
(event $e-i32 (attr 0) (param i32))
(event $e-i64 (attr 0) (param i64))
(event $e-i32-i64 (attr 0) (param i32 i64))
- (func $exnref_test (param $0 exnref) (result exnref)
- (local.get $0)
- )
(func $foo
(nop)
)
diff --git a/test/exception-handling.wast.fromBinary b/test/exception-handling.wast.fromBinary
index 292827970..d305aaaa9 100644
--- a/test/exception-handling.wast.fromBinary
+++ b/test/exception-handling.wast.fromBinary
@@ -3,13 +3,9 @@
(type $i32_=>_none (func (param i32)))
(type $i64_=>_none (func (param i64)))
(type $i32_i64_=>_none (func (param i32 i64)))
- (type $exnref_=>_exnref (func (param exnref) (result exnref)))
(event $event$0 (attr 0) (param i32))
(event $event$1 (attr 0) (param i64))
(event $event$2 (attr 0) (param i32 i64))
- (func $exnref_test (param $0 exnref) (result exnref)
- (local.get $0)
- )
(func $foo
(nop)
)
diff --git a/test/exception-handling.wast.fromBinary.noDebugInfo b/test/exception-handling.wast.fromBinary.noDebugInfo
index 1f1ebdb6f..d6dc4268e 100644
--- a/test/exception-handling.wast.fromBinary.noDebugInfo
+++ b/test/exception-handling.wast.fromBinary.noDebugInfo
@@ -3,20 +3,16 @@
(type $i32_=>_none (func (param i32)))
(type $i64_=>_none (func (param i64)))
(type $i32_i64_=>_none (func (param i32 i64)))
- (type $exnref_=>_exnref (func (param exnref) (result exnref)))
(event $event$0 (attr 0) (param i32))
(event $event$1 (attr 0) (param i64))
(event $event$2 (attr 0) (param i32 i64))
- (func $0 (param $0 exnref) (result exnref)
- (local.get $0)
+ (func $0
+ (nop)
)
(func $1
(nop)
)
(func $2
- (nop)
- )
- (func $3
(local $0 i32)
(local $1 i64)
(local $2 (i32 i64))
@@ -98,15 +94,15 @@
)
(try
(do
+ (call $0)
(call $1)
- (call $2)
)
(catch $event$0
(drop
(pop i32)
)
+ (call $0)
(call $1)
- (call $2)
)
)
(try
@@ -153,8 +149,8 @@
)
)
(catch_all
+ (call $0)
(call $1)
- (call $2)
)
)
(try
diff --git a/test/passes/code-pushing_all-features.txt b/test/passes/code-pushing_all-features.txt
index 1f975a2dd..4b3d93208 100644
--- a/test/passes/code-pushing_all-features.txt
+++ b/test/passes/code-pushing_all-features.txt
@@ -126,21 +126,4 @@
)
)
)
- (func $push-past-br-on-exn
- (local $x i32)
- (local $y exnref)
- (drop
- (block $out (result i32)
- (drop
- (br_on_exn $out $e
- (local.get $y)
- )
- )
- (local.set $x
- (i32.const 1)
- )
- (local.get $x)
- )
- )
- )
)
diff --git a/test/passes/code-pushing_all-features.wast b/test/passes/code-pushing_all-features.wast
index 0d18afcc5..0c17c0bab 100644
--- a/test/passes/code-pushing_all-features.wast
+++ b/test/passes/code-pushing_all-features.wast
@@ -85,18 +85,4 @@
(drop (local.get $x))
)
)
-
- (func $push-past-br-on-exn
- (local $x i32)
- (local $y exnref)
- (drop
- (block $out (result i32)
- (local.set $x (i32.const 1))
- (drop
- (br_on_exn $out $e (local.get $y))
- )
- (local.get $x)
- )
- )
- )
)
diff --git a/test/passes/inlining_all-features.txt b/test/passes/inlining_all-features.txt
index d16d60e7c..e23736fac 100644
--- a/test/passes/inlining_all-features.txt
+++ b/test/passes/inlining_all-features.txt
@@ -1,8 +1,6 @@
(module
(type $none_=>_none (func))
- (type $i32_=>_none (func (param i32)))
(type $none_=>_funcref (func (result funcref)))
- (event $e (attr 0) (param i32))
(export "ref_func_test" (func $ref_func_test))
(func $foo
(nop)
@@ -15,37 +13,6 @@
)
(ref.func $foo)
)
- (func $br_on_exn_name_uniquify_test
- (local $exn exnref)
- (local $1 exnref)
- (drop
- (block $l (result i32)
- (block
- (block $__inlined_func$func_inner
- (local.set $1
- (ref.null exn)
- )
- (drop
- (block $l0 (result i32)
- (drop
- (br_on_exn $l0 $e
- (local.get $1)
- )
- )
- (i32.const 0)
- )
- )
- )
- )
- (drop
- (br_on_exn $l $e
- (local.get $exn)
- )
- )
- (i32.const 0)
- )
- )
- )
)
(module
(type $none_=>_i32 (func (result i32)))
diff --git a/test/passes/inlining_all-features.wast b/test/passes/inlining_all-features.wast
index ae9168988..863daad9b 100644
--- a/test/passes/inlining_all-features.wast
+++ b/test/passes/inlining_all-features.wast
@@ -7,34 +7,6 @@
(call $foo)
(ref.func $foo)
)
-
- ;; Tests if UniqueNameMapper works correctly for br_on_exn labels.
- ;; We have $l in br_on_exns in both $func_inner and $br_on_name_uniquify_test,
- ;; which should become unique names respectively after inlining.
- (event $e (attr 0) (param i32))
- (func $func_inner
- (local $exn exnref)
- (drop
- (block $l (result i32)
- (drop
- (br_on_exn $l $e (local.get $exn))
- )
- (i32.const 0)
- )
- )
- )
- (func $br_on_exn_name_uniquify_test
- (local $exn exnref)
- (drop
- (block $l (result i32)
- (call $func_inner)
- (drop
- (br_on_exn $l $e (local.get $exn))
- )
- (i32.const 0)
- )
- )
- )
)
(module
;; a function reference in a global's init should be noticed, and prevent us
diff --git a/test/passes/instrument-locals_all-features_disable-typed-function-references.txt b/test/passes/instrument-locals_all-features_disable-typed-function-references.txt
index f320f0421..18bd1a10d 100644
--- a/test/passes/instrument-locals_all-features_disable-typed-function-references.txt
+++ b/test/passes/instrument-locals_all-features_disable-typed-function-references.txt
@@ -6,7 +6,6 @@
(type $i32_i32_v128_=>_v128 (func (param i32 i32 v128) (result v128)))
(type $i32_i32_funcref_=>_funcref (func (param i32 i32 funcref) (result funcref)))
(type $i32_i32_externref_=>_externref (func (param i32 i32 externref) (result externref)))
- (type $i32_i32_exnref_=>_exnref (func (param i32 i32 exnref) (result exnref)))
(type $i32_i32_anyref_=>_anyref (func (param i32 i32 anyref) (result anyref)))
(type $i32_i32_eqref_=>_eqref (func (param i32 i32 eqref) (result eqref)))
(type $i32_i32_dataref_=>_dataref (func (param i32 i32 dataref) (result dataref)))
@@ -25,8 +24,6 @@
(import "env" "set_funcref" (func $set_funcref (param i32 i32 funcref) (result funcref)))
(import "env" "get_externref" (func $get_externref (param i32 i32 externref) (result externref)))
(import "env" "set_externref" (func $set_externref (param i32 i32 externref) (result externref)))
- (import "env" "get_exnref" (func $get_exnref (param i32 i32 exnref) (result exnref)))
- (import "env" "set_exnref" (func $set_exnref (param i32 i32 exnref) (result exnref)))
(import "env" "get_anyref" (func $get_anyref (param i32 i32 anyref) (result anyref)))
(import "env" "set_anyref" (func $set_anyref (param i32 i32 anyref) (result anyref)))
(import "env" "get_eqref" (func $get_eqref (param i32 i32 eqref) (result eqref)))
@@ -45,7 +42,6 @@
(local $w f64)
(local $F funcref)
(local $X externref)
- (local $E exnref)
(local $S v128)
(drop
(call $get_i32
@@ -86,15 +82,8 @@
)
)
(drop
- (call $get_exnref
- (i32.const 5)
- (i32.const 6)
- (local.get $E)
- )
- )
- (drop
(call $get_i32
- (i32.const 6)
+ (i32.const 5)
(i32.const 0)
(local.get $x)
)
@@ -104,42 +93,35 @@
)
(drop
(call $get_f32
- (i32.const 7)
+ (i32.const 6)
(i32.const 2)
(local.get $z)
)
)
(drop
(call $get_f64
- (i32.const 8)
+ (i32.const 7)
(i32.const 3)
(local.get $w)
)
)
(drop
(call $get_funcref
- (i32.const 9)
+ (i32.const 8)
(i32.const 4)
(local.get $F)
)
)
(drop
(call $get_externref
- (i32.const 10)
+ (i32.const 9)
(i32.const 5)
(local.get $X)
)
)
- (drop
- (call $get_exnref
- (i32.const 11)
- (i32.const 6)
- (local.get $E)
- )
- )
(local.set $x
(call $set_i32
- (i32.const 12)
+ (i32.const 10)
(i32.const 0)
(i32.const 1)
)
@@ -149,14 +131,14 @@
)
(local.set $z
(call $set_f32
- (i32.const 13)
+ (i32.const 11)
(i32.const 2)
(f32.const 3.2100000381469727)
)
)
(local.set $w
(call $set_f64
- (i32.const 14)
+ (i32.const 12)
(i32.const 3)
(f64.const 4.321)
)
@@ -166,29 +148,18 @@
)
(local.set $X
(call $set_externref
- (i32.const 16)
+ (i32.const 14)
(i32.const 5)
(call $get_externref
- (i32.const 15)
+ (i32.const 13)
(i32.const 5)
(local.get $X)
)
)
)
- (local.set $E
- (call $set_exnref
- (i32.const 18)
- (i32.const 6)
- (call $get_exnref
- (i32.const 17)
- (i32.const 6)
- (local.get $E)
- )
- )
- )
(local.set $x
(call $set_i32
- (i32.const 19)
+ (i32.const 15)
(i32.const 0)
(i32.const 11)
)
@@ -198,24 +169,24 @@
)
(local.set $z
(call $set_f32
- (i32.const 20)
+ (i32.const 16)
(i32.const 2)
(f32.const 33.209999084472656)
)
)
(local.set $w
(call $set_f64
- (i32.const 21)
+ (i32.const 17)
(i32.const 3)
(f64.const 44.321)
)
)
(local.set $F
(call $set_funcref
- (i32.const 23)
+ (i32.const 19)
(i32.const 4)
(call $get_funcref
- (i32.const 22)
+ (i32.const 18)
(i32.const 4)
(local.get $F)
)
@@ -223,26 +194,15 @@
)
(local.set $X
(call $set_externref
- (i32.const 25)
+ (i32.const 21)
(i32.const 5)
(call $get_externref
- (i32.const 24)
+ (i32.const 20)
(i32.const 5)
(local.get $X)
)
)
)
- (local.set $E
- (call $set_exnref
- (i32.const 27)
- (i32.const 6)
- (call $get_exnref
- (i32.const 26)
- (i32.const 6)
- (local.get $E)
- )
- )
- )
(try
(do
(nop)
@@ -255,15 +215,15 @@
)
(drop
(call $get_v128
- (i32.const 28)
- (i32.const 7)
+ (i32.const 22)
+ (i32.const 6)
(local.get $S)
)
)
(local.set $S
(call $set_v128
- (i32.const 29)
- (i32.const 7)
+ (i32.const 23)
+ (i32.const 6)
(v128.const i32x4 0x00000000 0x00000001 0x00000002 0x00000003)
)
)
diff --git a/test/passes/instrument-locals_all-features_disable-typed-function-references.wast b/test/passes/instrument-locals_all-features_disable-typed-function-references.wast
index 53b2349fa..29de7964e 100644
--- a/test/passes/instrument-locals_all-features_disable-typed-function-references.wast
+++ b/test/passes/instrument-locals_all-features_disable-typed-function-references.wast
@@ -8,7 +8,6 @@
(local $w f64)
(local $F funcref)
(local $X externref)
- (local $E exnref)
(local $S v128)
(drop (local.get $x))
@@ -17,7 +16,6 @@
(drop (local.get $w))
(drop (local.get $F))
(drop (local.get $X))
- (drop (local.get $E))
(drop (local.get $x))
(drop (local.get $y))
@@ -25,7 +23,6 @@
(drop (local.get $w))
(drop (local.get $F))
(drop (local.get $X))
- (drop (local.get $E))
(local.set $x (i32.const 1))
(local.set $y (i64.const 2))
@@ -33,7 +30,6 @@
(local.set $w (f64.const 4.321))
(local.set $F (ref.func $test))
(local.set $X (local.get $X))
- (local.set $E (local.get $E))
(local.set $x (i32.const 11))
(local.set $y (i64.const 22))
@@ -41,7 +37,6 @@
(local.set $w (f64.const 44.321))
(local.set $F (local.get $F))
(local.set $X (local.get $X))
- (local.set $E (local.get $E))
;; Pop instructions should not be instrumented
(try
diff --git a/test/passes/precompute_all-features.txt b/test/passes/precompute_all-features.txt
index 68d7dce15..c22711cb9 100644
--- a/test/passes/precompute_all-features.txt
+++ b/test/passes/precompute_all-features.txt
@@ -10,7 +10,6 @@
(data (i32.const 0) "passive")
(global $global i32 (i32.const 1))
(global $global-mut (mut i32) (i32.const 2))
- (event $event$0 (attr 0) (param))
(func $x (param $x i32)
(call $x
(i32.const 2300)
@@ -315,13 +314,4 @@
)
)
)
- (func $unreachable-br_on_exn
- (block $label$1
- (drop
- (loop $label$2
- (br $label$2)
- )
- )
- )
- )
)
diff --git a/test/passes/precompute_all-features.wast b/test/passes/precompute_all-features.wast
index ca849b88c..589a8acf5 100644
--- a/test/passes/precompute_all-features.wast
+++ b/test/passes/precompute_all-features.wast
@@ -461,19 +461,4 @@
)
)
)
-
- ;; br_on_exn's argument becomes unreachable, so br_on_exn itself is replaced
- ;; with its argument in ReFinalize process after precompute.
- (event $event$0 (attr 0) (param))
- (func $unreachable-br_on_exn
- (block $label$1
- (drop
- (br_on_exn $label$1 $event$0
- (loop $label$2 (result exnref)
- (br $label$2)
- )
- )
- )
- )
- )
)
diff --git a/test/passes/remove-unused-names_code-folding_all-features.txt b/test/passes/remove-unused-names_code-folding_all-features.txt
index 2f78a83e7..792427112 100644
--- a/test/passes/remove-unused-names_code-folding_all-features.txt
+++ b/test/passes/remove-unused-names_code-folding_all-features.txt
@@ -5,7 +5,6 @@
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
(event $e-i32 (attr 0) (param i32))
- (event $e (attr 0) (param))
(func $ifs
(if
(i32.const 0)
@@ -1747,47 +1746,6 @@
)
(unreachable)
)
- (func $br_on_exn-target-block
- (local $exn exnref)
- (block $x
- (if
- (i32.const 0)
- (block
- (drop
- (i32.const 1)
- )
- (drop
- (i32.const 2)
- )
- (br $x)
- )
- )
- (if
- (i32.const 0)
- (block
- (drop
- (i32.const 1)
- )
- (drop
- (i32.const 2)
- )
- (br $x)
- )
- )
- (drop
- (br_on_exn $x $e
- (local.get $exn)
- )
- )
- (drop
- (i32.const 1)
- )
- (drop
- (i32.const 2)
- )
- (br $x)
- )
- )
(func $foo
(nop)
)
diff --git a/test/passes/remove-unused-names_code-folding_all-features.wast b/test/passes/remove-unused-names_code-folding_all-features.wast
index 387b8600b..320e820d8 100644
--- a/test/passes/remove-unused-names_code-folding_all-features.wast
+++ b/test/passes/remove-unused-names_code-folding_all-features.wast
@@ -1218,33 +1218,6 @@
)
)
- (event $e (attr 0)) ;; exception with no param
- (func $br_on_exn-target-block (local $exn exnref)
- ;; Here this block $x is targeted by br_on_exn, so code folding out of this
- ;; block should NOT happen.
- (block $x
- (if (i32.const 0)
- (block
- (drop (i32.const 1))
- (drop (i32.const 2))
- (br $x)
- )
- )
- (if (i32.const 0)
- (block
- (drop (i32.const 1))
- (drop (i32.const 2))
- (br $x)
- )
- )
- (drop (br_on_exn $x $e (local.get $exn)))
- ;; no fallthrough, another thing to merge
- (drop (i32.const 1))
- (drop (i32.const 2))
- (br $x)
- )
- )
-
(func $foo)
(func $try-call-optimize-terminating-tails (result i32)
(try
diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.txt b/test/passes/remove-unused-names_merge-blocks_all-features.txt
index 46d45d3fe..4efda13ca 100644
--- a/test/passes/remove-unused-names_merge-blocks_all-features.txt
+++ b/test/passes/remove-unused-names_merge-blocks_all-features.txt
@@ -1700,7 +1700,6 @@
(module
(type $none_=>_none (func))
(type $i32_=>_none (func (param i32)))
- (type $none_=>_i32 (func (result i32)))
(event $e (attr 0) (param i32))
(func $foo
(nop)
@@ -1711,29 +1710,4 @@
(i32.const 3)
)
)
- (func $br_on_exn (result i32)
- (local $0 exnref)
- (block $label$0 (result i32)
- (call $foo)
- (drop
- (br_on_exn $label$0 $e
- (local.get $0)
- )
- )
- (i32.const 3)
- )
- )
- (func $cannot_extract_br_on_exn_exnref
- (local $0 exnref)
- (drop
- (block $label$0 (result i32)
- (drop
- (br_on_exn $label$0 $e
- (local.get $0)
- )
- )
- (i32.const 5)
- )
- )
- )
)
diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.wast b/test/passes/remove-unused-names_merge-blocks_all-features.wast
index 6869db6ad..8e0145900 100644
--- a/test/passes/remove-unused-names_merge-blocks_all-features.wast
+++ b/test/passes/remove-unused-names_merge-blocks_all-features.wast
@@ -1570,36 +1570,4 @@
)
)
)
-
- ;; 'call $foo' within 'block' of `br_on_exn' can be hoisted
- (func $br_on_exn (result i32) (local $0 exnref)
- (block $label$0 (result i32)
- (drop
- (br_on_exn $label$0 $e
- (block (result exnref)
- (call $foo)
- (local.get $0)
- )
- )
- )
- (i32.const 3)
- )
- )
-
- ;; Unlike br_if, br_on_exn's exnref argument itself cannot be extracted.
- ;; Without proper handling for br_on_exn in ProblemFinder, this crashes.
- (func $cannot_extract_br_on_exn_exnref (local $0 exnref)
- (block
- (drop
- (block $label$0 (result i32)
- (drop
- (br_on_exn $label$0 $e
- (local.get $0)
- )
- )
- (i32.const 5)
- )
- )
- )
- )
)
diff --git a/test/passes/simplify-locals_all-features.txt b/test/passes/simplify-locals_all-features.txt
index 2604ad88d..34c13d442 100644
--- a/test/passes/simplify-locals_all-features.txt
+++ b/test/passes/simplify-locals_all-features.txt
@@ -1897,34 +1897,9 @@
(module
(type $none_=>_none (func))
(type $i32_=>_none (func (param i32)))
- (type $exnref_=>_none (func (param exnref)))
(type $i32_i32_=>_none (func (param i32 i32)))
(type $none_=>_i32 (func (result i32)))
- (type $none_=>_exnref (func (result exnref)))
- (event $event$0 (attr 0) (param))
- (event $event$1 (attr 0) (param exnref))
(event $e-i32 (attr 0) (param i32))
- (func $unoptimizable-br_on_exn-block (result exnref)
- (local $0 exnref)
- (block $label$0
- (local.set $0
- (br_on_exn $label$0 $event$0
- (ref.null exn)
- )
- )
- )
- (local.get $0)
- )
- (func $br_on_exn-trap
- (local $0 exnref)
- (drop
- (block $label$1 (result exnref)
- (br_on_exn $label$1 $event$1
- (ref.null exn)
- )
- )
- )
- )
(func $foo (param $0 i32) (param $1 i32)
(nop)
)
diff --git a/test/passes/simplify-locals_all-features.wast b/test/passes/simplify-locals_all-features.wast
index 13ff13679..2c54cdec3 100644
--- a/test/passes/simplify-locals_all-features.wast
+++ b/test/passes/simplify-locals_all-features.wast
@@ -1672,32 +1672,6 @@
)
)
(module
- (event $event$0 (attr 0) (param))
- (func $unoptimizable-br_on_exn-block (result exnref) (local $0 exnref)
- (block $label$0
- (local.set $0
- ;; br_on_exn's target block cannot be optimized to have a return value
- (br_on_exn $label$0 $event$0
- (ref.null exn)
- )
- )
- )
- (local.get $0)
- )
-
- (event $event$1 (attr 0) (param exnref))
- (func $br_on_exn-trap (local $0 exnref)
- ;; This dead local.set cannot be replaced with a nop because br_on_exn can
- ;; trap.
- (local.set $0
- (block $label$1 (result exnref)
- (br_on_exn $label$1 $event$1
- (ref.null exn)
- )
- )
- )
- )
-
(event $e-i32 (attr 0) (param i32))
(func $foo (param i32 i32))
(func $pop-cannot-be-sinked (local $0 i32)
diff --git a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
index 0a21ed52b..c11b58362 100644
--- a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
+++ b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
@@ -1,42 +1,38 @@
total
[events] : 1
- [exports] : 3
- [funcs] : 2
+ [exports] : 7
+ [funcs] : 8
[globals] : 6
- [imports] : 6
+ [imports] : 5
[memory-data] : 22
- [table-data] : 0
- [total] : 592
- [vars] : 1
- atomic.cmpxchg : 1
- atomic.fence : 3
- binary : 58
- block : 84
- break : 26
- call : 4
+ [table-data] : 1
+ [total] : 461
+ [vars] : 11
+ atomic.rmw : 1
+ binary : 72
+ block : 40
+ break : 5
+ call : 13
call_ref : 1
- const : 149
- data.drop : 1
+ const : 124
drop : 3
- global.get : 29
- global.set : 17
- i31.get : 2
- i31.new : 7
- if : 35
- load : 15
- local.get : 10
- local.set : 14
- loop : 13
+ global.get : 20
+ global.set : 11
+ i31.get : 1
+ i31.new : 8
+ if : 17
+ load : 19
+ local.get : 34
+ local.set : 18
+ loop : 4
memory.init : 1
- nop : 36
- ref.eq : 2
- ref.func : 2
- ref.is_null : 3
- ref.null : 8
+ nop : 8
+ ref.func : 1
+ ref.null : 11
return : 14
- select : 2
+ select : 1
simd_extract : 2
- store : 8
- tuple.extract : 5
- tuple.make : 4
- unary : 33
+ store : 3
+ tuple.extract : 1
+ tuple.make : 8
+ unary : 20
diff --git a/test/reference-types.wast b/test/reference-types.wast
index bd19aa5c5..e79508839 100644
--- a/test/reference-types.wast
+++ b/test/reference-types.wast
@@ -1,4 +1,4 @@
-;; reftype :: externref | funcref | exnref
+;; reftype :: externref | funcref
;; NOTE: the subtyping relationship has been removed from the reference-types proposal but an
;; `--enable-anyref` feature flag is present in Binaryen that we use below to test subtyping.
@@ -9,16 +9,14 @@
(module
(type $sig_externref (func (param externref)))
(type $sig_funcref (func (param funcref)))
- (type $sig_exnref (func (param exnref)))
(type $sig_anyref (func (param anyref)))
(func $take_externref (param externref))
(func $take_funcref (param funcref))
- (func $take_exnref (param exnref))
(func $take_anyref (param anyref))
(func $foo)
- (table funcref (elem $take_externref $take_funcref $take_exnref $take_anyref))
+ (table funcref (elem $take_externref $take_funcref $take_anyref))
(import "env" "import_func" (func $import_func (param externref) (result funcref)))
(import "env" "import_global" (global $import_global externref))
@@ -29,21 +27,18 @@
(global $global_externref (mut externref) (ref.null extern))
(global $global_funcref (mut funcref) (ref.null func))
(global $global_funcref_func (mut funcref) (ref.func $foo))
- (global $global_exnref (mut exnref) (ref.null exn))
(global $global_anyref (mut anyref) (ref.null any))
;; Test subtype relationship in global initializer expressions
(global $global_anyref2 (mut anyref) (ref.null extern))
(global $global_anyref3 (mut anyref) (ref.null func))
(global $global_anyref4 (mut anyref) (ref.func $foo))
- (global $global_anyref5 (mut anyref) (ref.null exn))
(event $e-i32 (attr 0) (param i32))
(func $test
(local $local_externref externref)
(local $local_funcref funcref)
- (local $local_exnref exnref)
(local $local_anyref anyref)
;; Test types for local.get/set
@@ -54,9 +49,6 @@
(local.set $local_funcref (global.get $global_funcref))
(local.set $local_funcref (ref.null func))
(local.set $local_funcref (ref.func $foo))
- (local.set $local_exnref (local.get $local_exnref))
- (local.set $local_exnref (global.get $global_exnref))
- (local.set $local_exnref (ref.null exn))
(local.set $local_anyref (local.get $local_anyref))
(local.set $local_anyref (global.get $global_anyref))
(local.set $local_anyref (ref.null any))
@@ -69,9 +61,6 @@
(local.set $local_anyref (global.get $global_funcref))
(local.set $local_anyref (ref.null func))
(local.set $local_anyref (ref.func $foo))
- (local.set $local_anyref (local.get $local_exnref))
- (local.set $local_anyref (global.get $global_exnref))
- (local.set $local_anyref (ref.null exn))
;; Test types for global.get/set
(global.set $global_externref (global.get $global_externref))
@@ -81,9 +70,6 @@
(global.set $global_funcref (local.get $local_funcref))
(global.set $global_funcref (ref.null func))
(global.set $global_funcref (ref.func $foo))
- (global.set $global_exnref (global.get $global_exnref))
- (global.set $global_exnref (local.get $local_exnref))
- (global.set $global_exnref (ref.null exn))
(global.set $global_anyref (global.get $global_anyref))
(global.set $global_anyref (local.get $local_anyref))
(global.set $global_anyref (ref.null any))
@@ -96,9 +82,6 @@
(global.set $global_anyref (local.get $local_funcref))
(global.set $global_anyref (ref.null func))
(global.set $global_anyref (ref.func $foo))
- (global.set $global_anyref (global.get $global_exnref))
- (global.set $global_anyref (local.get $local_exnref))
- (global.set $global_anyref (ref.null exn))
;; Test function call params
(call $take_externref (local.get $local_externref))
@@ -108,9 +91,6 @@
(call $take_funcref (global.get $global_funcref))
(call $take_funcref (ref.null func))
(call $take_funcref (ref.func $foo))
- (call $take_exnref (local.get $local_exnref))
- (call $take_exnref (global.get $global_exnref))
- (call $take_exnref (ref.null exn))
(call $take_anyref (local.get $local_anyref))
(call $take_anyref (global.get $global_anyref))
(call $take_anyref (ref.null any))
@@ -123,9 +103,6 @@
(call $take_anyref (global.get $global_funcref))
(call $take_anyref (ref.null func))
(call $take_anyref (ref.func $foo))
- (call $take_anyref (local.get $local_exnref))
- (call $take_anyref (global.get $global_exnref))
- (call $take_anyref (ref.null exn))
;; Test call_indirect params
(call_indirect (type $sig_externref) (local.get $local_externref) (i32.const 0))
@@ -135,9 +112,6 @@
(call_indirect (type $sig_funcref) (global.get $global_funcref) (i32.const 1))
(call_indirect (type $sig_funcref) (ref.null func) (i32.const 1))
(call_indirect (type $sig_funcref) (ref.func $foo) (i32.const 1))
- (call_indirect (type $sig_exnref) (local.get $local_exnref) (i32.const 2))
- (call_indirect (type $sig_exnref) (global.get $global_exnref) (i32.const 2))
- (call_indirect (type $sig_exnref) (ref.null exn) (i32.const 2))
(call_indirect (type $sig_anyref) (local.get $local_anyref) (i32.const 3))
(call_indirect (type $sig_anyref) (global.get $global_anyref) (i32.const 3))
(call_indirect (type $sig_anyref) (ref.null any) (i32.const 3))
@@ -150,9 +124,6 @@
(call_indirect (type $sig_anyref) (global.get $global_funcref) (i32.const 3))
(call_indirect (type $sig_anyref) (ref.null func) (i32.const 3))
(call_indirect (type $sig_anyref) (ref.func $foo) (i32.const 3))
- (call_indirect (type $sig_anyref) (local.get $local_exnref) (i32.const 3))
- (call_indirect (type $sig_anyref) (global.get $global_exnref) (i32.const 3))
- (call_indirect (type $sig_anyref) (ref.null exn) (i32.const 3))
;; Test block return type
(drop
@@ -191,21 +162,6 @@
)
)
(drop
- (block (result exnref)
- (br_if 0 (local.get $local_exnref) (i32.const 1))
- )
- )
- (drop
- (block (result exnref)
- (br_if 0 (global.get $global_exnref) (i32.const 1))
- )
- )
- (drop
- (block (result exnref)
- (br_if 0 (ref.null exn) (i32.const 1))
- )
- )
- (drop
(block (result anyref)
(br_if 0 (local.get $local_anyref) (i32.const 1))
)
@@ -234,11 +190,6 @@
)
(drop
(block (result anyref)
- (br_if 0 (local.get $local_exnref) (i32.const 1))
- )
- )
- (drop
- (block (result anyref)
(br_if 0 (ref.null extern) (i32.const 1))
)
)
@@ -252,11 +203,6 @@
(br_if 0 (ref.func $foo) (i32.const 1))
)
)
- (drop
- (block (result anyref)
- (br_if 0 (ref.null exn) (i32.const 1))
- )
- )
;; Test loop return type
(drop
@@ -295,21 +241,6 @@
)
)
(drop
- (loop (result exnref)
- (local.get $local_exnref)
- )
- )
- (drop
- (loop (result exnref)
- (global.get $global_exnref)
- )
- )
- (drop
- (loop (result exnref)
- (ref.null exn)
- )
- )
- (drop
(loop (result anyref)
(local.get $local_anyref)
)
@@ -361,21 +292,6 @@
(ref.func $foo)
)
)
- (drop
- (loop (result anyref)
- (local.get $local_exnref)
- )
- )
- (drop
- (loop (result anyref)
- (global.get $global_exnref)
- )
- )
- (drop
- (loop (result anyref)
- (ref.null exn)
- )
- )
;; Test if return type
(drop
@@ -393,13 +309,6 @@
)
)
(drop
- (if (result exnref)
- (i32.const 1)
- (local.get $local_exnref)
- (ref.null exn)
- )
- )
- (drop
(if (result anyref)
(i32.const 1)
(local.get $local_anyref)
@@ -418,20 +327,6 @@
(drop
(if (result anyref)
(i32.const 1)
- (local.get $local_externref)
- (local.get $local_exnref)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
- (local.get $local_funcref)
- (local.get $local_exnref)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
(ref.null extern)
(ref.null func)
)
@@ -439,20 +334,6 @@
(drop
(if (result anyref)
(i32.const 1)
- (ref.null extern)
- (ref.null exn)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
- (ref.null func)
- (ref.null exn)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
(ref.func $foo)
(ref.null extern)
)
@@ -481,17 +362,6 @@
)
)
)
- (drop
- (try (result exnref)
- (do
- (ref.null exn)
- )
- (catch $e-i32
- (drop (pop i32))
- (ref.null exn)
- )
- )
- )
;; Test subtype relationship for try return type
(drop
@@ -508,17 +378,6 @@
(drop
(try (result anyref)
(do
- (local.get $local_externref)
- )
- (catch $e-i32
- (drop (pop i32))
- (local.get $local_exnref)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
(ref.func $foo)
)
(catch $e-i32
@@ -527,39 +386,6 @@
)
)
)
- (drop
- (try (result anyref)
- (do
- (ref.func $foo)
- )
- (catch $e-i32
- (drop (pop i32))
- (local.get $local_exnref)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
- (ref.null exn)
- )
- (catch $e-i32
- (drop (pop i32))
- (local.get $local_externref)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
- (ref.null exn)
- )
- (catch $e-i32
- (drop (pop i32))
- (ref.func $foo)
- )
- )
- )
;; Test typed select
(drop
@@ -577,13 +403,6 @@
)
)
(drop
- (select (result exnref)
- (local.get $local_exnref)
- (ref.null exn)
- (i32.const 1)
- )
- )
- (drop
(select (result i32)
(i32.const 0)
(i32.const 2)
@@ -601,39 +420,11 @@
)
(drop
(select (result anyref)
- (local.get $local_externref)
- (local.get $local_exnref)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
(local.get $local_funcref)
(local.get $local_externref)
(i32.const 1)
)
)
- (drop
- (select (result anyref)
- (local.get $local_funcref)
- (local.get $local_exnref)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
- (local.get $local_exnref)
- (local.get $local_externref)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
- (local.get $local_exnref)
- (local.get $local_funcref)
- (i32.const 1)
- )
- )
;; ref.is_null takes any reference types
(drop (ref.is_null (local.get $local_externref)))
@@ -643,9 +434,6 @@
(drop (ref.is_null (global.get $global_funcref)))
(drop (ref.is_null (ref.null func)))
(drop (ref.is_null (ref.func $foo)))
- (drop (ref.is_null (local.get $local_exnref)))
- (drop (ref.is_null (global.get $global_exnref)))
- (drop (ref.is_null (ref.null exn)))
(drop (ref.is_null (local.get $local_anyref)))
(drop (ref.is_null (global.get $global_anyref)))
(drop (ref.is_null (ref.null any)))
@@ -675,16 +463,6 @@
(func $return_funcref_func (result funcref)
(ref.func $foo)
)
- (func $return_exnref_local (result exnref)
- (local $local_exnref exnref)
- (local.get $local_exnref)
- )
- (func $return_exnref_global (result exnref)
- (global.get $global_exnref)
- )
- (func $return_exnref_null (result exnref)
- (ref.null exn)
- )
(func $return_anyref_local (result anyref)
(local $local_anyref anyref)
(local.get $local_anyref)
@@ -720,16 +498,6 @@
(func $return_anyref8 (result anyref)
(ref.func $foo)
)
- (func $return_anyref9 (result anyref)
- (local $local_exnref exnref)
- (local.get $local_exnref)
- )
- (func $return_anyref10 (result anyref)
- (global.get $global_exnref)
- )
- (func $return_anyref11 (result anyref)
- (ref.null exn)
- )
;; Test returns
(func $returns_externref (result externref)
@@ -745,12 +513,6 @@
(return (ref.func $foo))
(return (ref.null func))
)
- (func $returns_exnref (result exnref)
- (local $local_exnref exnref)
- (return (local.get $local_exnref))
- (return (global.get $global_exnref))
- (return (ref.null exn))
- )
(func $returns_anyref (result anyref)
(local $local_anyref anyref)
(return (local.get $local_anyref))
@@ -762,7 +524,6 @@
(func $returns_anyref2 (result anyref)
(local $local_externref externref)
(local $local_funcref funcref)
- (local $local_exnref exnref)
(return (local.get $local_externref))
(return (global.get $global_externref))
(return (ref.null extern))
@@ -770,8 +531,5 @@
(return (global.get $global_funcref))
(return (ref.func $foo))
(return (ref.null func))
- (return (local.get $local_exnref))
- (return (global.get $global_exnref))
- (return (ref.null exn))
)
)
diff --git a/test/reference-types.wast.from-wast b/test/reference-types.wast.from-wast
index 9deee6a15..3d8e70c23 100644
--- a/test/reference-types.wast.from-wast
+++ b/test/reference-types.wast.from-wast
@@ -4,25 +4,21 @@
(type $funcref_=>_none (func (param funcref)))
(type $none_=>_funcref (func (result funcref)))
(type $externref_=>_none (func (param externref)))
- (type $exnref_=>_none (func (param exnref)))
(type $none_=>_externref (func (result externref)))
- (type $none_=>_exnref (func (result exnref)))
(type $none_=>_none (func))
(type $i32_=>_none (func (param i32)))
(type $externref_=>_funcref (func (param externref) (result funcref)))
(import "env" "import_global" (global $import_global externref))
(import "env" "import_func" (func $import_func (param externref) (result funcref)))
- (table $0 4 4 funcref)
- (elem (i32.const 0) $take_externref $take_funcref $take_exnref $take_anyref)
+ (table $0 3 3 funcref)
+ (elem (i32.const 0) $take_externref $take_funcref $take_anyref)
(global $global_externref (mut externref) (ref.null extern))
(global $global_funcref (mut funcref) (ref.null func))
(global $global_funcref_func (mut funcref) (ref.func $foo))
- (global $global_exnref (mut exnref) (ref.null exn))
(global $global_anyref (mut anyref) (ref.null any))
(global $global_anyref2 (mut anyref) (ref.null extern))
(global $global_anyref3 (mut anyref) (ref.null func))
(global $global_anyref4 (mut anyref) (ref.func $foo))
- (global $global_anyref5 (mut anyref) (ref.null exn))
(event $e-i32 (attr 0) (param i32))
(export "export_func" (func $import_func))
(export "export_global" (global $import_global))
@@ -32,9 +28,6 @@
(func $take_funcref (param $0 funcref)
(nop)
)
- (func $take_exnref (param $0 exnref)
- (nop)
- )
(func $take_anyref (param $0 anyref)
(nop)
)
@@ -44,7 +37,6 @@
(func $test
(local $local_externref externref)
(local $local_funcref funcref)
- (local $local_exnref exnref)
(local $local_anyref anyref)
(local.set $local_externref
(local.get $local_externref)
@@ -67,15 +59,6 @@
(local.set $local_funcref
(ref.func $foo)
)
- (local.set $local_exnref
- (local.get $local_exnref)
- )
- (local.set $local_exnref
- (global.get $global_exnref)
- )
- (local.set $local_exnref
- (ref.null exn)
- )
(local.set $local_anyref
(local.get $local_anyref)
)
@@ -106,15 +89,6 @@
(local.set $local_anyref
(ref.func $foo)
)
- (local.set $local_anyref
- (local.get $local_exnref)
- )
- (local.set $local_anyref
- (global.get $global_exnref)
- )
- (local.set $local_anyref
- (ref.null exn)
- )
(global.set $global_externref
(global.get $global_externref)
)
@@ -136,15 +110,6 @@
(global.set $global_funcref
(ref.func $foo)
)
- (global.set $global_exnref
- (global.get $global_exnref)
- )
- (global.set $global_exnref
- (local.get $local_exnref)
- )
- (global.set $global_exnref
- (ref.null exn)
- )
(global.set $global_anyref
(global.get $global_anyref)
)
@@ -175,15 +140,6 @@
(global.set $global_anyref
(ref.func $foo)
)
- (global.set $global_anyref
- (global.get $global_exnref)
- )
- (global.set $global_anyref
- (local.get $local_exnref)
- )
- (global.set $global_anyref
- (ref.null exn)
- )
(call $take_externref
(local.get $local_externref)
)
@@ -205,15 +161,6 @@
(call $take_funcref
(ref.func $foo)
)
- (call $take_exnref
- (local.get $local_exnref)
- )
- (call $take_exnref
- (global.get $global_exnref)
- )
- (call $take_exnref
- (ref.null exn)
- )
(call $take_anyref
(local.get $local_anyref)
)
@@ -244,15 +191,6 @@
(call $take_anyref
(ref.func $foo)
)
- (call $take_anyref
- (local.get $local_exnref)
- )
- (call $take_anyref
- (global.get $global_exnref)
- )
- (call $take_anyref
- (ref.null exn)
- )
(call_indirect (type $externref_=>_none)
(local.get $local_externref)
(i32.const 0)
@@ -281,18 +219,6 @@
(ref.func $foo)
(i32.const 1)
)
- (call_indirect (type $exnref_=>_none)
- (local.get $local_exnref)
- (i32.const 2)
- )
- (call_indirect (type $exnref_=>_none)
- (global.get $global_exnref)
- (i32.const 2)
- )
- (call_indirect (type $exnref_=>_none)
- (ref.null exn)
- (i32.const 2)
- )
(call_indirect (type $anyref_=>_none)
(local.get $local_anyref)
(i32.const 3)
@@ -333,18 +259,6 @@
(ref.func $foo)
(i32.const 3)
)
- (call_indirect (type $anyref_=>_none)
- (local.get $local_exnref)
- (i32.const 3)
- )
- (call_indirect (type $anyref_=>_none)
- (global.get $global_exnref)
- (i32.const 3)
- )
- (call_indirect (type $anyref_=>_none)
- (ref.null exn)
- (i32.const 3)
- )
(drop
(block $block (result externref)
(br_if $block
@@ -402,25 +316,25 @@
)
)
(drop
- (block $block6 (result exnref)
+ (block $block6 (result anyref)
(br_if $block6
- (local.get $local_exnref)
+ (local.get $local_anyref)
(i32.const 1)
)
)
)
(drop
- (block $block7 (result exnref)
+ (block $block7 (result anyref)
(br_if $block7
- (global.get $global_exnref)
+ (global.get $global_anyref)
(i32.const 1)
)
)
)
(drop
- (block $block8 (result exnref)
+ (block $block8 (result anyref)
(br_if $block8
- (ref.null exn)
+ (ref.null any)
(i32.const 1)
)
)
@@ -428,7 +342,7 @@
(drop
(block $block9 (result anyref)
(br_if $block9
- (local.get $local_anyref)
+ (local.get $local_externref)
(i32.const 1)
)
)
@@ -436,7 +350,7 @@
(drop
(block $block10 (result anyref)
(br_if $block10
- (global.get $global_anyref)
+ (local.get $local_funcref)
(i32.const 1)
)
)
@@ -444,7 +358,7 @@
(drop
(block $block11 (result anyref)
(br_if $block11
- (ref.null any)
+ (ref.null extern)
(i32.const 1)
)
)
@@ -452,7 +366,7 @@
(drop
(block $block12 (result anyref)
(br_if $block12
- (local.get $local_externref)
+ (ref.null func)
(i32.const 1)
)
)
@@ -460,167 +374,97 @@
(drop
(block $block13 (result anyref)
(br_if $block13
- (local.get $local_funcref)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $block14 (result anyref)
- (br_if $block14
- (local.get $local_exnref)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $block15 (result anyref)
- (br_if $block15
- (ref.null extern)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $block16 (result anyref)
- (br_if $block16
- (ref.null func)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $block17 (result anyref)
- (br_if $block17
(ref.func $foo)
(i32.const 1)
)
)
)
(drop
- (block $block18 (result anyref)
- (br_if $block18
- (ref.null exn)
- (i32.const 1)
- )
- )
- )
- (drop
(loop $loop-in (result externref)
(local.get $local_externref)
)
)
(drop
- (loop $loop-in19 (result externref)
+ (loop $loop-in14 (result externref)
(global.get $global_externref)
)
)
(drop
- (loop $loop-in20 (result externref)
+ (loop $loop-in15 (result externref)
(ref.null extern)
)
)
(drop
- (loop $loop-in21 (result funcref)
+ (loop $loop-in16 (result funcref)
(local.get $local_funcref)
)
)
(drop
- (loop $loop-in22 (result funcref)
+ (loop $loop-in17 (result funcref)
(global.get $global_funcref)
)
)
(drop
- (loop $loop-in23 (result funcref)
+ (loop $loop-in18 (result funcref)
(ref.null func)
)
)
(drop
- (loop $loop-in24 (result funcref)
+ (loop $loop-in19 (result funcref)
(ref.func $foo)
)
)
(drop
- (loop $loop-in25 (result exnref)
- (local.get $local_exnref)
- )
- )
- (drop
- (loop $loop-in26 (result exnref)
- (global.get $global_exnref)
- )
- )
- (drop
- (loop $loop-in27 (result exnref)
- (ref.null exn)
- )
- )
- (drop
- (loop $loop-in28 (result anyref)
+ (loop $loop-in20 (result anyref)
(local.get $local_anyref)
)
)
(drop
- (loop $loop-in29 (result anyref)
+ (loop $loop-in21 (result anyref)
(global.get $global_anyref)
)
)
(drop
- (loop $loop-in30 (result anyref)
+ (loop $loop-in22 (result anyref)
(ref.null any)
)
)
(drop
- (loop $loop-in31 (result anyref)
+ (loop $loop-in23 (result anyref)
(local.get $local_externref)
)
)
(drop
- (loop $loop-in32 (result anyref)
+ (loop $loop-in24 (result anyref)
(global.get $global_externref)
)
)
(drop
- (loop $loop-in33 (result anyref)
+ (loop $loop-in25 (result anyref)
(ref.null extern)
)
)
(drop
- (loop $loop-in34 (result anyref)
+ (loop $loop-in26 (result anyref)
(local.get $local_funcref)
)
)
(drop
- (loop $loop-in35 (result anyref)
+ (loop $loop-in27 (result anyref)
(global.get $global_funcref)
)
)
(drop
- (loop $loop-in36 (result anyref)
+ (loop $loop-in28 (result anyref)
(ref.null func)
)
)
(drop
- (loop $loop-in37 (result anyref)
+ (loop $loop-in29 (result anyref)
(ref.func $foo)
)
)
(drop
- (loop $loop-in38 (result anyref)
- (local.get $local_exnref)
- )
- )
- (drop
- (loop $loop-in39 (result anyref)
- (global.get $global_exnref)
- )
- )
- (drop
- (loop $loop-in40 (result anyref)
- (ref.null exn)
- )
- )
- (drop
(if (result externref)
(i32.const 1)
(local.get $local_externref)
@@ -635,13 +479,6 @@
)
)
(drop
- (if (result exnref)
- (i32.const 1)
- (local.get $local_exnref)
- (ref.null exn)
- )
- )
- (drop
(if (result anyref)
(i32.const 1)
(local.get $local_anyref)
@@ -658,20 +495,6 @@
(drop
(if (result anyref)
(i32.const 1)
- (local.get $local_externref)
- (local.get $local_exnref)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
- (local.get $local_funcref)
- (local.get $local_exnref)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
(ref.null extern)
(ref.null func)
)
@@ -679,20 +502,6 @@
(drop
(if (result anyref)
(i32.const 1)
- (ref.null extern)
- (ref.null exn)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
- (ref.null func)
- (ref.null exn)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
(ref.func $foo)
(ref.null extern)
)
@@ -724,19 +533,6 @@
)
)
(drop
- (try (result exnref)
- (do
- (ref.null exn)
- )
- (catch $e-i32
- (drop
- (pop i32)
- )
- (ref.null exn)
- )
- )
- )
- (drop
(try (result anyref)
(do
(local.get $local_externref)
@@ -752,69 +548,17 @@
(drop
(try (result anyref)
(do
- (local.get $local_externref)
- )
- (catch $e-i32
- (drop
- (pop i32)
- )
- (local.get $local_exnref)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
- (ref.func $foo)
- )
- (catch $e-i32
- (drop
- (pop i32)
- )
- (local.get $local_externref)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
(ref.func $foo)
)
(catch $e-i32
(drop
(pop i32)
)
- (local.get $local_exnref)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
- (ref.null exn)
- )
- (catch $e-i32
- (drop
- (pop i32)
- )
(local.get $local_externref)
)
)
)
(drop
- (try (result anyref)
- (do
- (ref.null exn)
- )
- (catch $e-i32
- (drop
- (pop i32)
- )
- (ref.func $foo)
- )
- )
- )
- (drop
(select (result externref)
(local.get $local_externref)
(ref.null extern)
@@ -829,13 +573,6 @@
)
)
(drop
- (select (result exnref)
- (local.get $local_exnref)
- (ref.null exn)
- (i32.const 1)
- )
- )
- (drop
(select
(i32.const 0)
(i32.const 2)
@@ -851,40 +588,12 @@
)
(drop
(select (result anyref)
- (local.get $local_externref)
- (local.get $local_exnref)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
(local.get $local_funcref)
(local.get $local_externref)
(i32.const 1)
)
)
(drop
- (select (result anyref)
- (local.get $local_funcref)
- (local.get $local_exnref)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
- (local.get $local_exnref)
- (local.get $local_externref)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
- (local.get $local_exnref)
- (local.get $local_funcref)
- (i32.const 1)
- )
- )
- (drop
(ref.is_null
(local.get $local_externref)
)
@@ -921,21 +630,6 @@
)
(drop
(ref.is_null
- (local.get $local_exnref)
- )
- )
- (drop
- (ref.is_null
- (global.get $global_exnref)
- )
- )
- (drop
- (ref.is_null
- (ref.null exn)
- )
- )
- (drop
- (ref.is_null
(local.get $local_anyref)
)
)
@@ -973,16 +667,6 @@
(func $return_funcref_func (result funcref)
(ref.func $foo)
)
- (func $return_exnref_local (result exnref)
- (local $local_exnref exnref)
- (local.get $local_exnref)
- )
- (func $return_exnref_global (result exnref)
- (global.get $global_exnref)
- )
- (func $return_exnref_null (result exnref)
- (ref.null exn)
- )
(func $return_anyref_local (result anyref)
(local $local_anyref anyref)
(local.get $local_anyref)
@@ -1016,16 +700,6 @@
(func $return_anyref8 (result anyref)
(ref.func $foo)
)
- (func $return_anyref9 (result anyref)
- (local $local_exnref exnref)
- (local.get $local_exnref)
- )
- (func $return_anyref10 (result anyref)
- (global.get $global_exnref)
- )
- (func $return_anyref11 (result anyref)
- (ref.null exn)
- )
(func $returns_externref (result externref)
(local $local_externref externref)
(return
@@ -1053,18 +727,6 @@
(ref.null func)
)
)
- (func $returns_exnref (result exnref)
- (local $local_exnref exnref)
- (return
- (local.get $local_exnref)
- )
- (return
- (global.get $global_exnref)
- )
- (return
- (ref.null exn)
- )
- )
(func $returns_anyref (result anyref)
(local $local_anyref anyref)
(return
@@ -1080,7 +742,6 @@
(func $returns_anyref2 (result anyref)
(local $local_externref externref)
(local $local_funcref funcref)
- (local $local_exnref exnref)
(return
(local.get $local_externref)
)
@@ -1102,14 +763,5 @@
(return
(ref.null func)
)
- (return
- (local.get $local_exnref)
- )
- (return
- (global.get $global_exnref)
- )
- (return
- (ref.null exn)
- )
)
)
diff --git a/test/reference-types.wast.fromBinary b/test/reference-types.wast.fromBinary
index 50d403caf..ae54cfcd8 100644
--- a/test/reference-types.wast.fromBinary
+++ b/test/reference-types.wast.fromBinary
@@ -4,25 +4,21 @@
(type $funcref_=>_none (func (param funcref)))
(type $none_=>_funcref (func (result funcref)))
(type $externref_=>_none (func (param externref)))
- (type $exnref_=>_none (func (param exnref)))
(type $none_=>_externref (func (result externref)))
- (type $none_=>_exnref (func (result exnref)))
(type $none_=>_none (func))
(type $i32_=>_none (func (param i32)))
(type $externref_=>_funcref (func (param externref) (result funcref)))
(import "env" "import_global" (global $import_global externref))
(import "env" "import_func" (func $import_func (param externref) (result funcref)))
- (table $0 4 4 funcref)
- (elem (i32.const 0) $take_externref $take_funcref $take_exnref $take_anyref)
+ (table $0 3 3 funcref)
+ (elem (i32.const 0) $take_externref $take_funcref $take_anyref)
(global $global_externref (mut externref) (ref.null extern))
(global $global_funcref (mut funcref) (ref.null func))
(global $global_funcref_func (mut funcref) (ref.func $foo))
- (global $global_exnref (mut exnref) (ref.null exn))
(global $global_anyref (mut anyref) (ref.null any))
(global $global_anyref2 (mut anyref) (ref.null extern))
(global $global_anyref3 (mut anyref) (ref.null func))
(global $global_anyref4 (mut anyref) (ref.func $foo))
- (global $global_anyref5 (mut anyref) (ref.null exn))
(event $event$0 (attr 0) (param i32))
(export "export_func" (func $import_func))
(export "export_global" (global $import_global))
@@ -32,9 +28,6 @@
(func $take_funcref (param $0 funcref)
(nop)
)
- (func $take_exnref (param $0 exnref)
- (nop)
- )
(func $take_anyref (param $0 anyref)
(nop)
)
@@ -44,7 +37,6 @@
(func $test
(local $local_externref funcref)
(local $local_funcref externref)
- (local $local_exnref exnref)
(local $local_anyref anyref)
(local.set $local_funcref
(local.get $local_funcref)
@@ -67,15 +59,6 @@
(local.set $local_externref
(ref.func $foo)
)
- (local.set $local_exnref
- (local.get $local_exnref)
- )
- (local.set $local_exnref
- (global.get $global_exnref)
- )
- (local.set $local_exnref
- (ref.null exn)
- )
(local.set $local_anyref
(local.get $local_anyref)
)
@@ -106,15 +89,6 @@
(local.set $local_anyref
(ref.func $foo)
)
- (local.set $local_anyref
- (local.get $local_exnref)
- )
- (local.set $local_anyref
- (global.get $global_exnref)
- )
- (local.set $local_anyref
- (ref.null exn)
- )
(global.set $global_externref
(global.get $global_externref)
)
@@ -136,15 +110,6 @@
(global.set $global_funcref
(ref.func $foo)
)
- (global.set $global_exnref
- (global.get $global_exnref)
- )
- (global.set $global_exnref
- (local.get $local_exnref)
- )
- (global.set $global_exnref
- (ref.null exn)
- )
(global.set $global_anyref
(global.get $global_anyref)
)
@@ -175,15 +140,6 @@
(global.set $global_anyref
(ref.func $foo)
)
- (global.set $global_anyref
- (global.get $global_exnref)
- )
- (global.set $global_anyref
- (local.get $local_exnref)
- )
- (global.set $global_anyref
- (ref.null exn)
- )
(call $take_externref
(local.get $local_funcref)
)
@@ -205,15 +161,6 @@
(call $take_funcref
(ref.func $foo)
)
- (call $take_exnref
- (local.get $local_exnref)
- )
- (call $take_exnref
- (global.get $global_exnref)
- )
- (call $take_exnref
- (ref.null exn)
- )
(call $take_anyref
(local.get $local_anyref)
)
@@ -244,15 +191,6 @@
(call $take_anyref
(ref.func $foo)
)
- (call $take_anyref
- (local.get $local_exnref)
- )
- (call $take_anyref
- (global.get $global_exnref)
- )
- (call $take_anyref
- (ref.null exn)
- )
(call_indirect (type $externref_=>_none)
(local.get $local_funcref)
(i32.const 0)
@@ -281,18 +219,6 @@
(ref.func $foo)
(i32.const 1)
)
- (call_indirect (type $exnref_=>_none)
- (local.get $local_exnref)
- (i32.const 2)
- )
- (call_indirect (type $exnref_=>_none)
- (global.get $global_exnref)
- (i32.const 2)
- )
- (call_indirect (type $exnref_=>_none)
- (ref.null exn)
- (i32.const 2)
- )
(call_indirect (type $anyref_=>_none)
(local.get $local_anyref)
(i32.const 3)
@@ -333,18 +259,6 @@
(ref.func $foo)
(i32.const 3)
)
- (call_indirect (type $anyref_=>_none)
- (local.get $local_exnref)
- (i32.const 3)
- )
- (call_indirect (type $anyref_=>_none)
- (global.get $global_exnref)
- (i32.const 3)
- )
- (call_indirect (type $anyref_=>_none)
- (ref.null exn)
- (i32.const 3)
- )
(drop
(block $label$1 (result externref)
(br_if $label$1
@@ -402,25 +316,25 @@
)
)
(drop
- (block $label$8 (result exnref)
+ (block $label$8 (result anyref)
(br_if $label$8
- (local.get $local_exnref)
+ (local.get $local_anyref)
(i32.const 1)
)
)
)
(drop
- (block $label$9 (result exnref)
+ (block $label$9 (result anyref)
(br_if $label$9
- (global.get $global_exnref)
+ (global.get $global_anyref)
(i32.const 1)
)
)
)
(drop
- (block $label$10 (result exnref)
+ (block $label$10 (result anyref)
(br_if $label$10
- (ref.null exn)
+ (ref.null any)
(i32.const 1)
)
)
@@ -428,7 +342,7 @@
(drop
(block $label$11 (result anyref)
(br_if $label$11
- (local.get $local_anyref)
+ (local.get $local_funcref)
(i32.const 1)
)
)
@@ -436,7 +350,7 @@
(drop
(block $label$12 (result anyref)
(br_if $label$12
- (global.get $global_anyref)
+ (local.get $local_externref)
(i32.const 1)
)
)
@@ -444,7 +358,7 @@
(drop
(block $label$13 (result anyref)
(br_if $label$13
- (ref.null any)
+ (ref.null extern)
(i32.const 1)
)
)
@@ -452,7 +366,7 @@
(drop
(block $label$14 (result anyref)
(br_if $label$14
- (local.get $local_funcref)
+ (ref.null func)
(i32.const 1)
)
)
@@ -460,167 +374,97 @@
(drop
(block $label$15 (result anyref)
(br_if $label$15
- (local.get $local_externref)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $label$16 (result anyref)
- (br_if $label$16
- (local.get $local_exnref)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $label$17 (result anyref)
- (br_if $label$17
- (ref.null extern)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $label$18 (result anyref)
- (br_if $label$18
- (ref.null func)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $label$19 (result anyref)
- (br_if $label$19
(ref.func $foo)
(i32.const 1)
)
)
)
(drop
- (block $label$20 (result anyref)
- (br_if $label$20
- (ref.null exn)
- (i32.const 1)
- )
- )
- )
- (drop
- (loop $label$21 (result externref)
+ (loop $label$16 (result externref)
(local.get $local_funcref)
)
)
(drop
- (loop $label$22 (result externref)
+ (loop $label$17 (result externref)
(global.get $global_externref)
)
)
(drop
- (loop $label$23 (result externref)
+ (loop $label$18 (result externref)
(ref.null extern)
)
)
(drop
- (loop $label$24 (result funcref)
+ (loop $label$19 (result funcref)
(local.get $local_externref)
)
)
(drop
- (loop $label$25 (result funcref)
+ (loop $label$20 (result funcref)
(global.get $global_funcref)
)
)
(drop
- (loop $label$26 (result funcref)
+ (loop $label$21 (result funcref)
(ref.null func)
)
)
(drop
- (loop $label$27 (result funcref)
+ (loop $label$22 (result funcref)
(ref.func $foo)
)
)
(drop
- (loop $label$28 (result exnref)
- (local.get $local_exnref)
- )
- )
- (drop
- (loop $label$29 (result exnref)
- (global.get $global_exnref)
- )
- )
- (drop
- (loop $label$30 (result exnref)
- (ref.null exn)
- )
- )
- (drop
- (loop $label$31 (result anyref)
+ (loop $label$23 (result anyref)
(local.get $local_anyref)
)
)
(drop
- (loop $label$32 (result anyref)
+ (loop $label$24 (result anyref)
(global.get $global_anyref)
)
)
(drop
- (loop $label$33 (result anyref)
+ (loop $label$25 (result anyref)
(ref.null any)
)
)
(drop
- (loop $label$34 (result anyref)
+ (loop $label$26 (result anyref)
(local.get $local_funcref)
)
)
(drop
- (loop $label$35 (result anyref)
+ (loop $label$27 (result anyref)
(global.get $global_externref)
)
)
(drop
- (loop $label$36 (result anyref)
+ (loop $label$28 (result anyref)
(ref.null extern)
)
)
(drop
- (loop $label$37 (result anyref)
+ (loop $label$29 (result anyref)
(local.get $local_externref)
)
)
(drop
- (loop $label$38 (result anyref)
+ (loop $label$30 (result anyref)
(global.get $global_funcref)
)
)
(drop
- (loop $label$39 (result anyref)
+ (loop $label$31 (result anyref)
(ref.null func)
)
)
(drop
- (loop $label$40 (result anyref)
+ (loop $label$32 (result anyref)
(ref.func $foo)
)
)
(drop
- (loop $label$41 (result anyref)
- (local.get $local_exnref)
- )
- )
- (drop
- (loop $label$42 (result anyref)
- (global.get $global_exnref)
- )
- )
- (drop
- (loop $label$43 (result anyref)
- (ref.null exn)
- )
- )
- (drop
(if (result externref)
(i32.const 1)
(local.get $local_funcref)
@@ -635,13 +479,6 @@
)
)
(drop
- (if (result exnref)
- (i32.const 1)
- (local.get $local_exnref)
- (ref.null exn)
- )
- )
- (drop
(if (result anyref)
(i32.const 1)
(local.get $local_anyref)
@@ -658,20 +495,6 @@
(drop
(if (result anyref)
(i32.const 1)
- (local.get $local_funcref)
- (local.get $local_exnref)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
- (local.get $local_externref)
- (local.get $local_exnref)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
(ref.null extern)
(ref.null func)
)
@@ -679,20 +502,6 @@
(drop
(if (result anyref)
(i32.const 1)
- (ref.null extern)
- (ref.null exn)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
- (ref.null func)
- (ref.null exn)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
(ref.func $foo)
(ref.null extern)
)
@@ -724,19 +533,6 @@
)
)
(drop
- (try (result exnref)
- (do
- (ref.null exn)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (ref.null exn)
- )
- )
- )
- (drop
(try (result anyref)
(do
(local.get $local_funcref)
@@ -752,19 +548,6 @@
(drop
(try (result anyref)
(do
- (local.get $local_funcref)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (local.get $local_exnref)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
(ref.func $foo)
)
(catch $event$0
@@ -776,45 +559,6 @@
)
)
(drop
- (try (result anyref)
- (do
- (ref.func $foo)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (local.get $local_exnref)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
- (ref.null exn)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (local.get $local_funcref)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
- (ref.null exn)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (ref.func $foo)
- )
- )
- )
- (drop
(select (result externref)
(local.get $local_funcref)
(ref.null extern)
@@ -829,13 +573,6 @@
)
)
(drop
- (select (result exnref)
- (local.get $local_exnref)
- (ref.null exn)
- (i32.const 1)
- )
- )
- (drop
(select
(i32.const 0)
(i32.const 2)
@@ -851,40 +588,12 @@
)
(drop
(select (result anyref)
- (local.get $local_funcref)
- (local.get $local_exnref)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
(local.get $local_externref)
(local.get $local_funcref)
(i32.const 1)
)
)
(drop
- (select (result anyref)
- (local.get $local_externref)
- (local.get $local_exnref)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
- (local.get $local_exnref)
- (local.get $local_funcref)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
- (local.get $local_exnref)
- (local.get $local_externref)
- (i32.const 1)
- )
- )
- (drop
(ref.is_null
(local.get $local_funcref)
)
@@ -921,21 +630,6 @@
)
(drop
(ref.is_null
- (local.get $local_exnref)
- )
- )
- (drop
- (ref.is_null
- (global.get $global_exnref)
- )
- )
- (drop
- (ref.is_null
- (ref.null exn)
- )
- )
- (drop
- (ref.is_null
(local.get $local_anyref)
)
)
@@ -973,16 +667,6 @@
(func $return_funcref_func (result funcref)
(ref.func $foo)
)
- (func $return_exnref_local (result exnref)
- (local $local_exnref exnref)
- (local.get $local_exnref)
- )
- (func $return_exnref_global (result exnref)
- (global.get $global_exnref)
- )
- (func $return_exnref_null (result exnref)
- (ref.null exn)
- )
(func $return_anyref_local (result anyref)
(local $local_anyref anyref)
(local.get $local_anyref)
@@ -1016,16 +700,6 @@
(func $return_anyref8 (result anyref)
(ref.func $foo)
)
- (func $return_anyref9 (result anyref)
- (local $local_exnref exnref)
- (local.get $local_exnref)
- )
- (func $return_anyref10 (result anyref)
- (global.get $global_exnref)
- )
- (func $return_anyref11 (result anyref)
- (ref.null exn)
- )
(func $returns_externref (result externref)
(local $local_externref externref)
(return
@@ -1038,12 +712,6 @@
(local.get $local_funcref)
)
)
- (func $returns_exnref (result exnref)
- (local $local_exnref exnref)
- (return
- (local.get $local_exnref)
- )
- )
(func $returns_anyref (result anyref)
(local $local_anyref anyref)
(return
@@ -1053,7 +721,6 @@
(func $returns_anyref2 (result anyref)
(local $local_externref funcref)
(local $local_funcref externref)
- (local $local_exnref exnref)
(return
(local.get $local_funcref)
)
diff --git a/test/reference-types.wast.fromBinary.noDebugInfo b/test/reference-types.wast.fromBinary.noDebugInfo
index d60129e01..08186f32b 100644
--- a/test/reference-types.wast.fromBinary.noDebugInfo
+++ b/test/reference-types.wast.fromBinary.noDebugInfo
@@ -4,25 +4,21 @@
(type $funcref_=>_none (func (param funcref)))
(type $none_=>_funcref (func (result funcref)))
(type $externref_=>_none (func (param externref)))
- (type $exnref_=>_none (func (param exnref)))
(type $none_=>_externref (func (result externref)))
- (type $none_=>_exnref (func (result exnref)))
(type $none_=>_none (func))
(type $i32_=>_none (func (param i32)))
(type $externref_=>_funcref (func (param externref) (result funcref)))
(import "env" "import_global" (global $gimport$0 externref))
(import "env" "import_func" (func $fimport$0 (param externref) (result funcref)))
- (table $0 4 4 funcref)
- (elem (i32.const 0) $0 $1 $2 $3)
+ (table $0 3 3 funcref)
+ (elem (i32.const 0) $0 $1 $2)
(global $global$0 (mut externref) (ref.null extern))
(global $global$1 (mut funcref) (ref.null func))
- (global $global$2 (mut funcref) (ref.func $4))
- (global $global$3 (mut exnref) (ref.null exn))
- (global $global$4 (mut anyref) (ref.null any))
- (global $global$5 (mut anyref) (ref.null extern))
- (global $global$6 (mut anyref) (ref.null func))
- (global $global$7 (mut anyref) (ref.func $4))
- (global $global$8 (mut anyref) (ref.null exn))
+ (global $global$2 (mut funcref) (ref.func $3))
+ (global $global$3 (mut anyref) (ref.null any))
+ (global $global$4 (mut anyref) (ref.null extern))
+ (global $global$5 (mut anyref) (ref.null func))
+ (global $global$6 (mut anyref) (ref.func $3))
(event $event$0 (attr 0) (param i32))
(export "export_func" (func $fimport$0))
(export "export_global" (global $gimport$0))
@@ -32,20 +28,16 @@
(func $1 (param $0 funcref)
(nop)
)
- (func $2 (param $0 exnref)
+ (func $2 (param $0 anyref)
(nop)
)
- (func $3 (param $0 anyref)
+ (func $3
(nop)
)
(func $4
- (nop)
- )
- (func $5
(local $0 funcref)
(local $1 externref)
- (local $2 exnref)
- (local $3 anyref)
+ (local $2 anyref)
(local.set $1
(local.get $1)
)
@@ -65,7 +57,7 @@
(ref.null func)
)
(local.set $0
- (ref.func $4)
+ (ref.func $3)
)
(local.set $2
(local.get $2)
@@ -74,46 +66,28 @@
(global.get $global$3)
)
(local.set $2
- (ref.null exn)
- )
- (local.set $3
- (local.get $3)
- )
- (local.set $3
- (global.get $global$4)
- )
- (local.set $3
(ref.null any)
)
- (local.set $3
+ (local.set $2
(local.get $1)
)
- (local.set $3
+ (local.set $2
(global.get $global$0)
)
- (local.set $3
+ (local.set $2
(ref.null extern)
)
- (local.set $3
+ (local.set $2
(local.get $0)
)
- (local.set $3
+ (local.set $2
(global.get $global$1)
)
- (local.set $3
+ (local.set $2
(ref.null func)
)
- (local.set $3
- (ref.func $4)
- )
- (local.set $3
- (local.get $2)
- )
- (local.set $3
- (global.get $global$3)
- )
- (local.set $3
- (ref.null exn)
+ (local.set $2
+ (ref.func $3)
)
(global.set $global$0
(global.get $global$0)
@@ -134,7 +108,7 @@
(ref.null func)
)
(global.set $global$1
- (ref.func $4)
+ (ref.func $3)
)
(global.set $global$3
(global.get $global$3)
@@ -143,46 +117,28 @@
(local.get $2)
)
(global.set $global$3
- (ref.null exn)
- )
- (global.set $global$4
- (global.get $global$4)
- )
- (global.set $global$4
- (local.get $3)
- )
- (global.set $global$4
(ref.null any)
)
- (global.set $global$4
+ (global.set $global$3
(global.get $global$0)
)
- (global.set $global$4
+ (global.set $global$3
(local.get $1)
)
- (global.set $global$4
+ (global.set $global$3
(ref.null extern)
)
- (global.set $global$4
+ (global.set $global$3
(global.get $global$1)
)
- (global.set $global$4
+ (global.set $global$3
(local.get $0)
)
- (global.set $global$4
+ (global.set $global$3
(ref.null func)
)
- (global.set $global$4
- (ref.func $4)
- )
- (global.set $global$4
- (global.get $global$3)
- )
- (global.set $global$4
- (local.get $2)
- )
- (global.set $global$4
- (ref.null exn)
+ (global.set $global$3
+ (ref.func $3)
)
(call $0
(local.get $1)
@@ -203,7 +159,7 @@
(ref.null func)
)
(call $1
- (ref.func $4)
+ (ref.func $3)
)
(call $2
(local.get $2)
@@ -212,46 +168,28 @@
(global.get $global$3)
)
(call $2
- (ref.null exn)
- )
- (call $3
- (local.get $3)
- )
- (call $3
- (global.get $global$4)
- )
- (call $3
(ref.null any)
)
- (call $3
+ (call $2
(local.get $1)
)
- (call $3
+ (call $2
(global.get $global$0)
)
- (call $3
+ (call $2
(ref.null extern)
)
- (call $3
+ (call $2
(local.get $0)
)
- (call $3
+ (call $2
(global.get $global$1)
)
- (call $3
+ (call $2
(ref.null func)
)
- (call $3
- (ref.func $4)
- )
- (call $3
- (local.get $2)
- )
- (call $3
- (global.get $global$3)
- )
- (call $3
- (ref.null exn)
+ (call $2
+ (ref.func $3)
)
(call_indirect (type $externref_=>_none)
(local.get $1)
@@ -278,27 +216,15 @@
(i32.const 1)
)
(call_indirect (type $funcref_=>_none)
- (ref.func $4)
+ (ref.func $3)
(i32.const 1)
)
- (call_indirect (type $exnref_=>_none)
- (local.get $2)
- (i32.const 2)
- )
- (call_indirect (type $exnref_=>_none)
- (global.get $global$3)
- (i32.const 2)
- )
- (call_indirect (type $exnref_=>_none)
- (ref.null exn)
- (i32.const 2)
- )
(call_indirect (type $anyref_=>_none)
- (local.get $3)
+ (local.get $2)
(i32.const 3)
)
(call_indirect (type $anyref_=>_none)
- (global.get $global$4)
+ (global.get $global$3)
(i32.const 3)
)
(call_indirect (type $anyref_=>_none)
@@ -330,19 +256,7 @@
(i32.const 3)
)
(call_indirect (type $anyref_=>_none)
- (ref.func $4)
- (i32.const 3)
- )
- (call_indirect (type $anyref_=>_none)
- (local.get $2)
- (i32.const 3)
- )
- (call_indirect (type $anyref_=>_none)
- (global.get $global$3)
- (i32.const 3)
- )
- (call_indirect (type $anyref_=>_none)
- (ref.null exn)
+ (ref.func $3)
(i32.const 3)
)
(drop
@@ -396,13 +310,13 @@
(drop
(block $label$7 (result funcref)
(br_if $label$7
- (ref.func $4)
+ (ref.func $3)
(i32.const 1)
)
)
)
(drop
- (block $label$8 (result exnref)
+ (block $label$8 (result anyref)
(br_if $label$8
(local.get $2)
(i32.const 1)
@@ -410,7 +324,7 @@
)
)
(drop
- (block $label$9 (result exnref)
+ (block $label$9 (result anyref)
(br_if $label$9
(global.get $global$3)
(i32.const 1)
@@ -418,9 +332,9 @@
)
)
(drop
- (block $label$10 (result exnref)
+ (block $label$10 (result anyref)
(br_if $label$10
- (ref.null exn)
+ (ref.null any)
(i32.const 1)
)
)
@@ -428,7 +342,7 @@
(drop
(block $label$11 (result anyref)
(br_if $label$11
- (local.get $3)
+ (local.get $1)
(i32.const 1)
)
)
@@ -436,7 +350,7 @@
(drop
(block $label$12 (result anyref)
(br_if $label$12
- (global.get $global$4)
+ (local.get $0)
(i32.const 1)
)
)
@@ -444,7 +358,7 @@
(drop
(block $label$13 (result anyref)
(br_if $label$13
- (ref.null any)
+ (ref.null extern)
(i32.const 1)
)
)
@@ -452,7 +366,7 @@
(drop
(block $label$14 (result anyref)
(br_if $label$14
- (local.get $1)
+ (ref.null func)
(i32.const 1)
)
)
@@ -460,164 +374,94 @@
(drop
(block $label$15 (result anyref)
(br_if $label$15
- (local.get $0)
+ (ref.func $3)
(i32.const 1)
)
)
)
(drop
- (block $label$16 (result anyref)
- (br_if $label$16
- (local.get $2)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $label$17 (result anyref)
- (br_if $label$17
- (ref.null extern)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $label$18 (result anyref)
- (br_if $label$18
- (ref.null func)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $label$19 (result anyref)
- (br_if $label$19
- (ref.func $4)
- (i32.const 1)
- )
- )
- )
- (drop
- (block $label$20 (result anyref)
- (br_if $label$20
- (ref.null exn)
- (i32.const 1)
- )
- )
- )
- (drop
- (loop $label$21 (result externref)
+ (loop $label$16 (result externref)
(local.get $1)
)
)
(drop
- (loop $label$22 (result externref)
+ (loop $label$17 (result externref)
(global.get $global$0)
)
)
(drop
- (loop $label$23 (result externref)
+ (loop $label$18 (result externref)
(ref.null extern)
)
)
(drop
- (loop $label$24 (result funcref)
+ (loop $label$19 (result funcref)
(local.get $0)
)
)
(drop
- (loop $label$25 (result funcref)
+ (loop $label$20 (result funcref)
(global.get $global$1)
)
)
(drop
- (loop $label$26 (result funcref)
+ (loop $label$21 (result funcref)
(ref.null func)
)
)
(drop
- (loop $label$27 (result funcref)
- (ref.func $4)
+ (loop $label$22 (result funcref)
+ (ref.func $3)
)
)
(drop
- (loop $label$28 (result exnref)
+ (loop $label$23 (result anyref)
(local.get $2)
)
)
(drop
- (loop $label$29 (result exnref)
+ (loop $label$24 (result anyref)
(global.get $global$3)
)
)
(drop
- (loop $label$30 (result exnref)
- (ref.null exn)
- )
- )
- (drop
- (loop $label$31 (result anyref)
- (local.get $3)
- )
- )
- (drop
- (loop $label$32 (result anyref)
- (global.get $global$4)
- )
- )
- (drop
- (loop $label$33 (result anyref)
+ (loop $label$25 (result anyref)
(ref.null any)
)
)
(drop
- (loop $label$34 (result anyref)
+ (loop $label$26 (result anyref)
(local.get $1)
)
)
(drop
- (loop $label$35 (result anyref)
+ (loop $label$27 (result anyref)
(global.get $global$0)
)
)
(drop
- (loop $label$36 (result anyref)
+ (loop $label$28 (result anyref)
(ref.null extern)
)
)
(drop
- (loop $label$37 (result anyref)
+ (loop $label$29 (result anyref)
(local.get $0)
)
)
(drop
- (loop $label$38 (result anyref)
+ (loop $label$30 (result anyref)
(global.get $global$1)
)
)
(drop
- (loop $label$39 (result anyref)
+ (loop $label$31 (result anyref)
(ref.null func)
)
)
(drop
- (loop $label$40 (result anyref)
- (ref.func $4)
- )
- )
- (drop
- (loop $label$41 (result anyref)
- (local.get $2)
- )
- )
- (drop
- (loop $label$42 (result anyref)
- (global.get $global$3)
- )
- )
- (drop
- (loop $label$43 (result anyref)
- (ref.null exn)
+ (loop $label$32 (result anyref)
+ (ref.func $3)
)
)
(drop
@@ -635,16 +479,9 @@
)
)
(drop
- (if (result exnref)
- (i32.const 1)
- (local.get $2)
- (ref.null exn)
- )
- )
- (drop
(if (result anyref)
(i32.const 1)
- (local.get $3)
+ (local.get $2)
(ref.null any)
)
)
@@ -658,20 +495,6 @@
(drop
(if (result anyref)
(i32.const 1)
- (local.get $1)
- (local.get $2)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
- (local.get $0)
- (local.get $2)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
(ref.null extern)
(ref.null func)
)
@@ -679,21 +502,7 @@
(drop
(if (result anyref)
(i32.const 1)
- (ref.null extern)
- (ref.null exn)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
- (ref.null func)
- (ref.null exn)
- )
- )
- (drop
- (if (result anyref)
- (i32.const 1)
- (ref.func $4)
+ (ref.func $3)
(ref.null extern)
)
)
@@ -713,7 +522,7 @@
(drop
(try (result funcref)
(do
- (ref.func $4)
+ (ref.func $3)
)
(catch $event$0
(drop
@@ -724,32 +533,6 @@
)
)
(drop
- (try (result exnref)
- (do
- (ref.null exn)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (ref.null exn)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
- (local.get $1)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (ref.func $4)
- )
- )
- )
- (drop
(try (result anyref)
(do
(local.get $1)
@@ -758,14 +541,14 @@
(drop
(pop i32)
)
- (local.get $2)
+ (ref.func $3)
)
)
)
(drop
(try (result anyref)
(do
- (ref.func $4)
+ (ref.func $3)
)
(catch $event$0
(drop
@@ -776,45 +559,6 @@
)
)
(drop
- (try (result anyref)
- (do
- (ref.func $4)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (local.get $2)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
- (ref.null exn)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (local.get $1)
- )
- )
- )
- (drop
- (try (result anyref)
- (do
- (ref.null exn)
- )
- (catch $event$0
- (drop
- (pop i32)
- )
- (ref.func $4)
- )
- )
- )
- (drop
(select (result externref)
(local.get $1)
(ref.null extern)
@@ -829,13 +573,6 @@
)
)
(drop
- (select (result exnref)
- (local.get $2)
- (ref.null exn)
- (i32.const 1)
- )
- )
- (drop
(select
(i32.const 0)
(i32.const 2)
@@ -851,40 +588,12 @@
)
(drop
(select (result anyref)
- (local.get $1)
- (local.get $2)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
- (local.get $0)
- (local.get $1)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
(local.get $0)
- (local.get $2)
- (i32.const 1)
- )
- )
- (drop
- (select (result anyref)
- (local.get $2)
(local.get $1)
(i32.const 1)
)
)
(drop
- (select (result anyref)
- (local.get $2)
- (local.get $0)
- (i32.const 1)
- )
- )
- (drop
(ref.is_null
(local.get $1)
)
@@ -916,7 +625,7 @@
)
(drop
(ref.is_null
- (ref.func $4)
+ (ref.func $3)
)
)
(drop
@@ -931,129 +640,87 @@
)
(drop
(ref.is_null
- (ref.null exn)
- )
- )
- (drop
- (ref.is_null
- (local.get $3)
- )
- )
- (drop
- (ref.is_null
- (global.get $global$4)
- )
- )
- (drop
- (ref.is_null
(ref.null any)
)
)
)
- (func $6 (result externref)
+ (func $5 (result externref)
(local $0 externref)
(local.get $0)
)
- (func $7 (result externref)
+ (func $6 (result externref)
(global.get $global$0)
)
- (func $8 (result externref)
+ (func $7 (result externref)
(ref.null extern)
)
- (func $9 (result funcref)
+ (func $8 (result funcref)
(local $0 funcref)
(local.get $0)
)
- (func $10 (result funcref)
+ (func $9 (result funcref)
(global.get $global$1)
)
- (func $11 (result funcref)
+ (func $10 (result funcref)
(ref.null func)
)
- (func $12 (result funcref)
- (ref.func $4)
- )
- (func $13 (result exnref)
- (local $0 exnref)
- (local.get $0)
- )
- (func $14 (result exnref)
- (global.get $global$3)
- )
- (func $15 (result exnref)
- (ref.null exn)
+ (func $11 (result funcref)
+ (ref.func $3)
)
- (func $16 (result anyref)
+ (func $12 (result anyref)
(local $0 anyref)
(local.get $0)
)
- (func $17 (result anyref)
- (global.get $global$4)
+ (func $13 (result anyref)
+ (global.get $global$3)
)
- (func $18 (result anyref)
+ (func $14 (result anyref)
(ref.null any)
)
- (func $19 (result anyref)
+ (func $15 (result anyref)
(local $0 externref)
(local.get $0)
)
- (func $20 (result anyref)
+ (func $16 (result anyref)
(global.get $global$0)
)
- (func $21 (result anyref)
+ (func $17 (result anyref)
(ref.null extern)
)
- (func $22 (result anyref)
+ (func $18 (result anyref)
(local $0 funcref)
(local.get $0)
)
- (func $23 (result anyref)
+ (func $19 (result anyref)
(global.get $global$1)
)
- (func $24 (result anyref)
+ (func $20 (result anyref)
(ref.null func)
)
- (func $25 (result anyref)
- (ref.func $4)
- )
- (func $26 (result anyref)
- (local $0 exnref)
- (local.get $0)
- )
- (func $27 (result anyref)
- (global.get $global$3)
- )
- (func $28 (result anyref)
- (ref.null exn)
+ (func $21 (result anyref)
+ (ref.func $3)
)
- (func $29 (result externref)
+ (func $22 (result externref)
(local $0 externref)
(return
(local.get $0)
)
)
- (func $30 (result funcref)
+ (func $23 (result funcref)
(local $0 funcref)
(return
(local.get $0)
)
)
- (func $31 (result exnref)
- (local $0 exnref)
- (return
- (local.get $0)
- )
- )
- (func $32 (result anyref)
+ (func $24 (result anyref)
(local $0 anyref)
(return
(local.get $0)
)
)
- (func $33 (result anyref)
+ (func $25 (result anyref)
(local $0 funcref)
(local $1 externref)
- (local $2 exnref)
(return
(local.get $1)
)
diff --git a/test/spec/call_indirect_sig_mismatch.wast b/test/spec/call_indirect_sig_mismatch.wast
index 69cca17ba..ca6c000fd 100644
--- a/test/spec/call_indirect_sig_mismatch.wast
+++ b/test/spec/call_indirect_sig_mismatch.wast
@@ -2,7 +2,7 @@
(type $funcref_=>_none (func (param funcref)))
(table funcref (elem $callee))
(export "sig_mismatch" (func $sig_mismatch))
- (func $callee (param $0 exnref))
+ (func $callee (param $0 externref))
(func $sig_mismatch
(call_indirect (type $funcref_=>_none)
(ref.null func)
diff --git a/test/spec/exception-handling.wast b/test/spec/exception-handling.wast
index d951441e0..ebca3a009 100644
--- a/test/spec/exception-handling.wast
+++ b/test/spec/exception-handling.wast
@@ -263,47 +263,3 @@
)
"event's param numbers must match"
)
-
-(assert_invalid
- (module
- (event $e-i32 (attr 0) (param i32))
- (func $f0 (result i32)
- (block $l0 (result i32)
- (drop
- (br_on_exn $l0 $e-i32 (i32.const 0))
- )
- (i32.const 0)
- )
- )
- )
- "br_on_exn's argument must be unreachable or exnref type"
-)
-
-(assert_invalid
- (module
- (event $e-i32 (attr 0) (param i32))
- (func $f0 (result i32) (local $0 exnref)
- (block $l0 (result i32)
- (i32.eqz
- (br_on_exn $l0 $e-i32 (local.get $0))
- )
- )
- )
- )
- "i32.eqz input must be i32"
-)
-
-(assert_invalid
- (module
- (event $e-i32 (attr 0) (param i32))
- (func $f0 (result f32) (local $0 exnref)
- (block $l0 (result f32)
- (drop
- (br_on_exn $l0 $e-i32 (local.get $0))
- )
- (f32.const 0)
- )
- )
- )
- "block+breaks must have right type if breaks return a value"
-)
diff --git a/test/unit/test_features.py b/test/unit/test_features.py
index 01ea4c754..7eb814e39 100644
--- a/test/unit/test_features.py
+++ b/test/unit/test_features.py
@@ -187,16 +187,6 @@ class FeatureValidationTest(utils.BinaryenTestCase):
'''
self.check_reference_types(module, 'all used types should be allowed')
- def test_exnref_local(self):
- module = '''
- (module
- (func $foo
- (local exnref)
- )
- )
- '''
- self.check_exception_handling(module, 'all used types should be allowed')
-
def test_event(self):
module = '''
(module
diff --git a/third_party/llvm-project/include/llvm/BinaryFormat/Wasm.h b/third_party/llvm-project/include/llvm/BinaryFormat/Wasm.h
index f550d880f..97f07d5f4 100644
--- a/third_party/llvm-project/include/llvm/BinaryFormat/Wasm.h
+++ b/third_party/llvm-project/include/llvm/BinaryFormat/Wasm.h
@@ -225,7 +225,6 @@ enum : unsigned {
WASM_TYPE_F64 = 0x7C,
WASM_TYPE_V128 = 0x7B,
WASM_TYPE_FUNCREF = 0x70,
- WASM_TYPE_EXNREF = 0x68,
WASM_TYPE_FUNC = 0x60,
WASM_TYPE_NORESULT = 0x40, // for blocks with no result values
};
@@ -348,7 +347,6 @@ enum class ValType {
F32 = WASM_TYPE_F32,
F64 = WASM_TYPE_F64,
V128 = WASM_TYPE_V128,
- EXNREF = WASM_TYPE_EXNREF,
};
struct WasmSignature {