summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-04-25 14:03:21 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-04-25 14:03:21 -0700
commit15c400329191072a59db433056fbdfcc12b67257 (patch)
tree2913743741c6fa1062acab9bee1021c68c7ff270 /src
parentcb417c68cd75e01b9eaef7bb9d06c38c3068e19b (diff)
downloadbinaryen-15c400329191072a59db433056fbdfcc12b67257.tar.gz
binaryen-15c400329191072a59db433056fbdfcc12b67257.tar.bz2
binaryen-15c400329191072a59db433056fbdfcc12b67257.zip
use arities on returns
Diffstat (limited to 'src')
-rw-r--r--src/wasm-binary.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index decac5564..3fc1b3f01 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1095,10 +1095,8 @@ public:
if (debug) std::cerr << "zz node: Return" << std::endl;
if (curr->value) {
recurse(curr->value);
- } else {
- visitNop(nullptr);
}
- o << int8_t(BinaryConsts::Return);
+ o << int8_t(BinaryConsts::Return) << U32LEB(curr->value ? 1 : 0);
}
void visitHost(Host *curr) {
if (debug) std::cerr << "zz node: Host" << std::endl;
@@ -1982,7 +1980,11 @@ public:
}
void visitReturn(Return *curr) {
if (debug) std::cerr << "zz node: Return" << std::endl;
- curr->value = popExpression();
+ auto arity = getU32LEB();
+ assert(arity == 0 || arity == 1);
+ if (arity == 1) {
+ curr->value = popExpression();
+ }
}
bool maybeVisitImpl(Host *curr, uint8_t code) {
switch (code) {