diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/s2wasm.h | 8 | ||||
-rw-r--r-- | src/wasm.h | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index dd53fc8e0..48d6d9350 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -570,10 +570,8 @@ private: auto typeName = cashew::IString((std::string("FUNCSIG_") + getSig(call)).c_str(), false); if (wasm.functionTypesMap.count(typeName) == 0) { auto type = allocator.alloc<FunctionType>(); + *type = sigToFunctionType(getSig(curr)); type->name = typeName; - for (auto operand : call->operands) { - type->params.push_back(operand->type); - } wasm.addFunctionType(type); call->fullType = type; } else { @@ -674,8 +672,8 @@ private: break; } case 'n': { - if (match("neg")) makeUnary(UnaryOp::Neg, i32); - else if (match("nearest")) makeUnary(UnaryOp::Nearest, i32); + if (match("neg")) makeUnary(UnaryOp::Neg, type); + else if (match("nearest")) makeUnary(UnaryOp::Nearest, type); else if (match("ne")) makeBinary(BinaryOp::Ne, i32); else abort_on("type.n"); break; diff --git a/src/wasm.h b/src/wasm.h index cb137747f..e3724c612 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -213,6 +213,10 @@ struct Literal { o << "nan:" << std::hex << u.ll << std::dec; return; } + if (!std::isfinite(d)) { + o << (d < 0 ? "-infinity" : "infinity"); + return; + } const char *text = cashew::JSPrinter::numToString(d); // spec interpreter hates floats starting with '.' if (text[0] == '.') { @@ -734,7 +738,7 @@ public: case ConvertSInt64: o << "convert_s/i64"; break; case PromoteFloat32: o << "promote/f32"; break; case DemoteFloat64: o << "demote/f64"; break; - case ReinterpretInt: o << "reinterpret" << (type == f64 ? "i64" : "i32"); break; + case ReinterpretInt: o << "reinterpret/" << (type == f64 ? "i64" : "i32"); break; default: abort(); } incIndent(o, indent); |