diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/Print.cpp | 2 | ||||
-rw-r--r-- | src/wasm-interpreter.h | 10 | ||||
-rw-r--r-- | src/wasm-s-parser.h | 8 |
3 files changed, 12 insertions, 8 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 3c3cdd659..f365db02f 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -314,7 +314,7 @@ struct PrintSExpression : public WasmVisitor<PrintSExpression, void> { } void visitSelect(Select *curr) { o << '('; - prepareColor(o) << printWasmType(curr->type) << ".select"; + prepareColor(o) << "select"; incIndent(); printFullLine(curr->ifTrue); printFullLine(curr->ifFalse); diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 2a841f6fd..a7405e948 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -29,6 +29,10 @@ #include "support/bits.h" #include "wasm.h" +#ifdef WASM_INTERPRETER_DEBUG +#include "wasm-printing.h" +#endif + namespace wasm { using namespace cashew; @@ -166,7 +170,7 @@ private: indent++; #if WASM_INTERPRETER_DEBUG == 2 doIndent(std::cout, indent); - expression->print(std::cout, indent) << '\n'; + std::cout << "\n" << expression << '\n'; indent++; #endif } @@ -445,8 +449,8 @@ private: if (flow.breaking()) return flow; Literal right = flow.value; NOTE_EVAL2(left, right); - assert(left.type == curr->left->type); - assert(right.type == curr->right->type); + assert(isConcreteWasmType(curr->left->type) ? left.type == curr->left->type : true); + assert(isConcreteWasmType(curr->right->type) ? right.type == curr->right->type : true); if (left.type == i32) { switch (curr->op) { case Add: return left.add(right); diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index d0206bcc2..24ca1b811 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -524,7 +524,6 @@ public: abort_on(op); } case 's': { - if (op[1] == 'e') return makeSelect(s, type); if (op[1] == 'h') { if (op[2] == 'l') return makeBinary(s, BinaryOp::Shl, type); return makeBinary(s, op[4] == 'u' ? BinaryOp::ShrU : BinaryOp::ShrS, type); @@ -598,7 +597,8 @@ public: abort_on(str); } case 's': { - if (str[1] == 'e') return makeSetLocal(s); + if (str[1] == 'e' && str[2] == 't') return makeSetLocal(s); + if (str[1] == 'e' && str[2] == 'l') return makeSelect(s); abort_on(str); } case 'r': { @@ -637,12 +637,12 @@ private: return ret; } - Expression* makeSelect(Element& s, WasmType type) { + Expression* makeSelect(Element& s) { auto ret = allocator.alloc<Select>(); ret->ifTrue = parseExpression(s[1]); ret->ifFalse = parseExpression(s[2]); ret->condition = parseExpression(s[3]); - ret->type = type; + ret->finalize(); return ret; } |