From 4752e205dc84df8b41cd6dbc7282f85a38a89e8e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 5 Dec 2015 19:40:30 -0800 Subject: coerce call arguments in wasm2asm --- src/wasm2asm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/wasm2asm.h') diff --git a/src/wasm2asm.h b/src/wasm2asm.h index 606423e8e..f139b58dd 100644 --- a/src/wasm2asm.h +++ b/src/wasm2asm.h @@ -570,7 +570,7 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) { temps.emplace_back(operand->type, parent); IString temp = temps.back().temp; ret[1]->push_back(visitAndAssign(operand, temp)); - theCall[2]->push_back(ValueBuilder::makeName(temp)); + theCall[2]->push_back(makeAsmCoercion(ValueBuilder::makeName(temp), wasmToAsmType(operand->type))); } theCall = makeAsmCoercion(theCall, wasmToAsmType(type)); if (result != NO_RESULT) { @@ -585,7 +585,7 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) { if (!isStatement(curr)) { // none of our operands is a statement; go right ahead and create a simple expression for (auto operand : curr->operands) { - theCall[2]->push_back(visit(operand, EXPRESSION_RESULT)); + theCall[2]->push_back(makeAsmCoercion(visit(operand, EXPRESSION_RESULT), wasmToAsmType(operand->type))); } return makeAsmCoercion(theCall, wasmToAsmType(curr->type)); } @@ -600,7 +600,7 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) { // none of our operands is a statement; go right ahead and create a simple expression Ref theCall = ValueBuilder::makeCall(ValueBuilder::makeSub(ValueBuilder::makeName(FUNCTION_TABLE), visit(curr->target, EXPRESSION_RESULT))); for (auto operand : curr->operands) { - theCall[2]->push_back(visit(operand, EXPRESSION_RESULT)); + theCall[2]->push_back(makeAsmCoercion(visit(operand, EXPRESSION_RESULT), wasmToAsmType(operand->type))); } return makeAsmCoercion(theCall, wasmToAsmType(curr->type)); } -- cgit v1.2.3