Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion scripts/gen-s-parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,6 @@
("try", "makeTry(s)"),
("throw", "makeThrow(s)"),
("rethrow", "makeRethrow(s)"),
("br_on_exn", "makeBrOnExn(s)"),
# Multivalue pseudoinstructions
("tuple.make", "makeTupleMake(s)"),
("tuple.extract", "makeTupleExtract(s)"),
Expand Down
8 changes: 0 additions & 8 deletions scripts/wasm2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions src/asmjs/asm_v_wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
48 changes: 0 additions & 48 deletions src/binaryen-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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*>(
Expand Down Expand Up @@ -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;
Expand Down
26 changes: 0 additions & 26 deletions src/binaryen-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -192,7 +191,6 @@ struct BinaryenLiteral {
double f64;
uint8_t v128[16];
const char* func;
// TODO: exn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a nice way to resolve a TODO 😆

};
};

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down
12 changes: 0 additions & 12 deletions src/cfg/cfg-traversal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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: {}
}

Expand Down
3 changes: 1 addition & 2 deletions src/dataflow/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 3 additions & 11 deletions src/gen-s-parser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions src/ir/ReFinalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
2 changes: 0 additions & 2 deletions src/ir/abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions src/ir/branch-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions src/ir/cost.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 0 additions & 5 deletions src/ir/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,6 @@ class EffectAnalyzer {
// 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) {
Expand Down
40 changes: 0 additions & 40 deletions src/js/binaryen.js-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function initializeConstants() {
['v128', 'Vec128'],
['funcref', 'Funcref'],
['externref', 'Externref'],
['exnref', 'Exnref'],
['anyref', 'Anyref'],
['eqref', 'Eqref'],
['i31ref', 'I31ref'],
Expand Down Expand Up @@ -93,7 +92,6 @@ function initializeConstants() {
'Try',
'Throw',
'Rethrow',
'BrOnExn',
'TupleMake',
'TupleExtract',
'Pop',
Expand Down Expand Up @@ -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']);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
Loading