summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/asm2wasm.h67
-rw-r--r--src/asm_v_wasm.h26
-rw-r--r--src/passes/RemoveImports.cpp2
-rw-r--r--src/s2wasm.h4
-rw-r--r--src/wasm-binary.h2
-rw-r--r--src/wasm-js.cpp2
-rw-r--r--src/wasm-s-parser.h13
-rw-r--r--src/wasm.h8
-rw-r--r--test/dot_s/asm_const.wast1
-rw-r--r--test/dot_s/basics.wast1
-rw-r--r--test/dot_s/exit.wast1
-rw-r--r--test/dot_s/memops.wast1
-rw-r--r--test/emcc_O2_hello_world.fromasm4
-rw-r--r--test/emcc_O2_hello_world.wast4
-rw-r--r--test/emcc_hello_world.fromasm5
-rw-r--r--test/emcc_hello_world.wast5
-rw-r--r--test/llvm_autogenerated/call.wast7
-rw-r--r--test/llvm_autogenerated/cfg-stackify.wast2
-rw-r--r--test/llvm_autogenerated/f32.wast1
-rw-r--r--test/llvm_autogenerated/f64.wast1
-rw-r--r--test/llvm_autogenerated/frem.wast2
-rw-r--r--test/llvm_autogenerated/global.wast1
-rw-r--r--test/llvm_autogenerated/legalize.wast1
-rw-r--r--test/llvm_autogenerated/switch.wast1
-rw-r--r--test/llvm_autogenerated/unreachable.wast1
-rw-r--r--test/llvm_autogenerated/unused-argument.wast1
-rw-r--r--test/llvm_autogenerated/varargs.wast1
-rw-r--r--test/passes/O.txt5
-rw-r--r--test/passes/remove-imports.txt3
-rw-r--r--test/two_sides.fromasm1
-rw-r--r--test/unit.fromasm2
-rw-r--r--test/unit.wast3
32 files changed, 110 insertions, 69 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 280624d9b..75862abc8 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -243,26 +243,10 @@ private:
}
}
- FunctionType *getFunctionType(Ref parent, ExpressionList& operands) {
+ FunctionType* getFunctionType(Ref parent, ExpressionList& operands) {
// generate signature
WasmType result = !!parent ? detectWasmType(parent, nullptr) : none;
- std::string str = "FUNCSIG$";
- str += getSig(result);
- for (auto operand : operands) {
- str += getSig(operand->type);
- }
- IString sig(str.c_str(), false);
- if (wasm.functionTypesMap.find(sig) == wasm.functionTypesMap.end()) {
- // add new type
- auto type = allocator.alloc<FunctionType>();
- type->name = sig;
- type->result = result;
- for (auto operand : operands) {
- type->params.push_back(operand->type);
- }
- wasm.addFunctionType(type);
- }
- return wasm.functionTypesMap[sig];
+ return ensureFunctionType(getSig(result, operands), &wasm, allocator);
}
public:
@@ -421,34 +405,9 @@ private:
if (base == ABS) {
assert(operands && operands->size() == 1);
WasmType type = (*operands)[0]->type;
- if (type == i32) {
- static FunctionType* builtin = nullptr;
- if (!builtin) {
- builtin = new FunctionType();
- builtin->params.push_back(i32);
- builtin->result = i32;
- }
- return builtin;
- }
- if (type == f32) {
- static FunctionType* builtin = nullptr;
- if (!builtin) {
- builtin = new FunctionType();
- builtin->params.push_back(f32);
- builtin->result = f32;
- }
- return builtin;
- }
- if (type == f64) {
- static FunctionType* builtin = nullptr;
- if (!builtin) {
- builtin = new FunctionType();
- builtin->params.push_back(f64);
- builtin->result = f64;
- }
- return builtin;
- }
-
+ if (type == i32) return ensureFunctionType("ii", &wasm, allocator);
+ if (type == f32) return ensureFunctionType("ff", &wasm, allocator);
+ if (type == f64) return ensureFunctionType("dd", &wasm, allocator);
}
}
return nullptr;
@@ -692,10 +651,10 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
// special math builtins
FunctionType* builtin = getBuiltinFunctionType(import.module, import.base);
if (builtin) {
- import.type = *builtin;
+ import.type = builtin;
continue;
}
- import.type = importedFunctionTypes[name];
+ import.type = ensureFunctionType(getSig(&importedFunctionTypes[name]), &wasm, allocator);
} else if (import.module != ASM2WASM) { // special-case the special module
// never actually used
toErase.push_back(name);
@@ -906,10 +865,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
import->name = F64_REM;
import->module = ASM2WASM;
import->base = F64_REM;
- import->type.name = F64_REM;
- import->type.result = f64;
- import->type.params.push_back(f64);
- import->type.params.push_back(f64);
+ import->type = ensureFunctionType("ddd", &wasm, allocator);
wasm.addImport(import);
}
return call;
@@ -950,8 +906,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
import->name = DEBUGGER;
import->module = ASM2WASM;
import->base = DEBUGGER;
- import->type.name = DEBUGGER;
- import->type.result = none;
+ import->type = ensureFunctionType("v", &wasm, allocator);
wasm.addImport(import);
}
return call;
@@ -1057,9 +1012,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
import->name = F64_TO_INT;
import->module = ASM2WASM;
import->base = F64_TO_INT;
- import->type.name = F64_TO_INT;
- import->type.result = i32;
- import->type.params.push_back(f64);
+ import->type = ensureFunctionType("id", &wasm, allocator);
wasm.addImport(import);
}
return ret;
diff --git a/src/asm_v_wasm.h b/src/asm_v_wasm.h
index f0065bbf9..394c7a321 100644
--- a/src/asm_v_wasm.h
+++ b/src/asm_v_wasm.h
@@ -17,6 +17,7 @@
#ifndef wasm_asm_v_wasm_h
#define wasm_asm_v_wasm_h
+#include "mixed_arena.h"
#include "emscripten-optimizer/optimizer.h"
namespace wasm {
@@ -81,6 +82,15 @@ std::string getSig(CallBase *call) {
return ret;
}
+std::string getSig(WasmType result, ExpressionList& operands) {
+ std::string ret;
+ ret += getSig(result);
+ for (auto operand : operands) {
+ ret += getSig(operand->type);
+ }
+ return ret;
+}
+
WasmType sigToWasmType(char sig) {
switch (sig) {
case 'i': return i32;
@@ -101,6 +111,22 @@ FunctionType sigToFunctionType(std::string sig) {
return ret;
}
+FunctionType* ensureFunctionType(std::string sig, Module* wasm, MixedArena& allocator) {
+ cashew::IString name(("FUNCSIG$" + sig).c_str(), false);
+ if (wasm->functionTypesMap.find(name) != wasm->functionTypesMap.end()) {
+ return wasm->functionTypesMap[name];
+ }
+ // add new type
+ auto type = allocator.alloc<FunctionType>();
+ type->name = name;
+ type->result = sigToWasmType(sig[0]);
+ for (size_t i = 1; i < sig.size(); i++) {
+ type->params.push_back(sigToWasmType(sig[i]));
+ }
+ wasm->addFunctionType(type);
+ return type;
+}
+
} // namespace wasm
#endif // wasm_asm_v_wasm_h
diff --git a/src/passes/RemoveImports.cpp b/src/passes/RemoveImports.cpp
index 44b7fc1ed..0c4924a45 100644
--- a/src/passes/RemoveImports.cpp
+++ b/src/passes/RemoveImports.cpp
@@ -37,7 +37,7 @@ struct RemoveImports : public Pass {
}
void visitCallImport(CallImport *curr) override {
- WasmType type = importsMap[curr->target]->type.result;
+ WasmType type = importsMap[curr->target]->type->result;
if (type == none) {
replaceCurrent(allocator->alloc<Nop>());
} else {
diff --git a/src/s2wasm.h b/src/s2wasm.h
index b99a71159..9cb41b8d6 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -627,7 +627,7 @@ private:
auto import = allocator.alloc<Import>();
import->name = import->base = target;
import->module = ENV;
- import->type = sigToFunctionType(getSig(curr));
+ import->type = ensureFunctionType(getSig(curr), &wasm, allocator);
wasm.addImport(import);
}
}
@@ -1120,7 +1120,7 @@ public:
auto import = parent->allocator.alloc<Import>();
import->name = import->base = curr->target;
import->module = ENV;
- import->type = sigToFunctionType(getSig(curr));
+ import->type = ensureFunctionType(getSig(curr), &parent->wasm, parent->allocator);
parent->wasm.addImport(import);
}
}
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 63a272d78..c67670c67 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -412,7 +412,7 @@ public:
Name name, type;
if (import) {
name = import->name;
- type = import->type.name;
+ type = import->type->name;
} else {
name = function->name;
type = function->type;
diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp
index fdb157319..b767b8a25 100644
--- a/src/wasm-js.cpp
+++ b/src/wasm-js.cpp
@@ -190,7 +190,7 @@ extern "C" void EMSCRIPTEN_KEEPALIVE instantiate() {
if (wasmJSDebug) std::cout << "calling import returning " << ret << '\n';
- switch (import->type.result) {
+ switch (import->type->result) {
case none: return Literal(0);
case i32: return Literal((int32_t)ret);
case f32: return Literal((float)ret);
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 719a6598b..1fb126ad0 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -28,6 +28,7 @@
#include "mixed_arena.h"
#include "shared-constants.h"
#include "parsing.h"
+#include "asm_v_wasm.h"
namespace wasm {
@@ -848,7 +849,7 @@ private:
auto ret = allocator.alloc<CallImport>();
ret->target = s[1]->str();
Import* import = wasm.importsMap[ret->target];
- ret->type = import->type.result;
+ ret->type = import->type->result;
parseCallOperands(s, 2, ret);
return ret;
}
@@ -996,28 +997,30 @@ private:
im->module = s[2]->str();
if (!s[3]->isStr()) onError();
im->base = s[3]->str();
+ FunctionType type;
if (s.size() > 4) {
Element& params = *s[4];
IString id = params[0]->str();
if (id == PARAM) {
for (size_t i = 1; i < params.size(); i++) {
- im->type.params.push_back(stringToWasmType(params[i]->str()));
+ type.params.push_back(stringToWasmType(params[i]->str()));
}
} else if (id == RESULT) {
- im->type.result = stringToWasmType(params[1]->str());
+ type.result = stringToWasmType(params[1]->str());
} else if (id == TYPE) {
IString name = params[1]->str();
assert(wasm.functionTypesMap.find(name) != wasm.functionTypesMap.end());
- im->type = *wasm.functionTypesMap[name];
+ type = *wasm.functionTypesMap[name];
} else {
onError();
}
if (s.size() > 5) {
Element& result = *s[5];
assert(result[0]->str() == RESULT);
- im->type.result = stringToWasmType(result[1]->str());
+ type.result = stringToWasmType(result[1]->str());
}
}
+ im->type = ensureFunctionType(getSig(&type), &wasm, allocator);
wasm.addImport(im);
}
diff --git a/src/wasm.h b/src/wasm.h
index c4654580a..306804c66 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -540,6 +540,8 @@ public:
WasmType result;
std::vector<WasmType> params;
+ FunctionType() : result(none) {}
+
std::ostream& print(std::ostream &o, unsigned indent, bool full=false) {
if (full) {
printOpening(o, "type") << ' ' << name << " (func";
@@ -938,13 +940,15 @@ public:
class Import {
public:
Name name, module, base; // name = module.base
- FunctionType type;
+ FunctionType* type;
+
+ Import() : type(nullptr) {}
std::ostream& print(std::ostream &o, unsigned indent) {
printOpening(o, "import ") << name << ' ';
printText(o, module.str) << ' ';
printText(o, base.str);
- type.print(o, indent);
+ if (type) type->print(o, indent);
return o << ')';
}
};
diff --git a/test/dot_s/asm_const.wast b/test/dot_s/asm_const.wast
index 56d4ba58d..750fd0989 100644
--- a/test/dot_s/asm_const.wast
+++ b/test/dot_s/asm_const.wast
@@ -1,5 +1,6 @@
(module
(memory 51 4294967295 (segment 16 "{ Module.print(\"hello, world!\"); }\00"))
+ (type $FUNCSIG$vi (func (param i32)))
(import $_emscripten_asm_const_vi "env" "_emscripten_asm_const_vi" (param i32))
(export "main" $main)
(func $main (result i32)
diff --git a/test/dot_s/basics.wast b/test/dot_s/basics.wast
index a3ce77ec2..b73f6c456 100644
--- a/test/dot_s/basics.wast
+++ b/test/dot_s/basics.wast
@@ -1,5 +1,6 @@
(module
(memory 52 4294967295 (segment 16 "hello, world!\n\00") (segment 32 "vcq") (segment 48 "\16\00\00\00"))
+ (type $FUNCSIG$vi (func (param i32)))
(import $puts "env" "puts" (param i32))
(export "main" $main)
(table $main)
diff --git a/test/dot_s/exit.wast b/test/dot_s/exit.wast
index 7ac114749..cb54d686b 100644
--- a/test/dot_s/exit.wast
+++ b/test/dot_s/exit.wast
@@ -1,5 +1,6 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$vi (func (param i32)))
(import $exit "env" "exit" (param i32))
(export "main" $main)
(func $main (result i32)
diff --git a/test/dot_s/memops.wast b/test/dot_s/memops.wast
index 784958275..e8ea14590 100644
--- a/test/dot_s/memops.wast
+++ b/test/dot_s/memops.wast
@@ -1,5 +1,6 @@
(module
(memory 67 4294967295 (segment 16 "{ Module.print(\"hello, world! \" + HEAP32[8>>2]); }\00"))
+ (type $FUNCSIG$vi (func (param i32)))
(import $_emscripten_asm_const_vi "env" "_emscripten_asm_const_vi" (param i32))
(export "_Z6reporti" $_Z6reporti)
(export "main" $main)
diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm
index ac4c031cc..d1495f7a4 100644
--- a/test/emcc_O2_hello_world.fromasm
+++ b/test/emcc_O2_hello_world.fromasm
@@ -3,6 +3,10 @@
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
+ (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
+ (type $FUNCSIG$v (func))
+ (type $FUNCSIG$vii (func (param i32 i32)))
+ (type $FUNCSIG$i (func (result i32)))
(import $abort "env" "abort" (param i32))
(import $_pthread_cleanup_pop "env" "_pthread_cleanup_pop" (param i32))
(import $_pthread_self "env" "_pthread_self" (result i32))
diff --git a/test/emcc_O2_hello_world.wast b/test/emcc_O2_hello_world.wast
index 95a130b13..c334e1955 100644
--- a/test/emcc_O2_hello_world.wast
+++ b/test/emcc_O2_hello_world.wast
@@ -3,6 +3,10 @@
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
+ (type $FUNCSIG$i (func (result i32)))
+ (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
+ (type $FUNCSIG$v (func))
+ (type $FUNCSIG$vii (func (param i32 i32)))
(import $abort "env" "abort" (param i32))
(import $_pthread_cleanup_pop "env" "_pthread_cleanup_pop" (param i32))
(import $_pthread_self "env" "_pthread_self" (result i32))
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm
index 9dbe000df..350dfce87 100644
--- a/test/emcc_hello_world.fromasm
+++ b/test/emcc_hello_world.fromasm
@@ -1,8 +1,13 @@
(module
(memory 16777216 16777216)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
+ (type $FUNCSIG$id (func (param f64) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
+ (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
+ (type $FUNCSIG$v (func))
+ (type $FUNCSIG$vii (func (param i32 i32)))
+ (type $FUNCSIG$i (func (result i32)))
(import $abort "env" "abort")
(import $nullFunc_ii "env" "nullFunc_ii" (param i32))
(import $nullFunc_iiii "env" "nullFunc_iiii" (param i32))
diff --git a/test/emcc_hello_world.wast b/test/emcc_hello_world.wast
index 01cd2f4c1..8a2345cf1 100644
--- a/test/emcc_hello_world.wast
+++ b/test/emcc_hello_world.wast
@@ -3,6 +3,11 @@
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
+ (type $FUNCSIG$v (func))
+ (type $FUNCSIG$i (func (result i32)))
+ (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
+ (type $FUNCSIG$vii (func (param i32 i32)))
+ (type $FUNCSIG$id (func (param f64) (result i32)))
(import $abort "env" "abort")
(import $nullFunc_ii "env" "nullFunc_ii" (param i32))
(import $nullFunc_iiii "env" "nullFunc_iiii" (param i32))
diff --git a/test/llvm_autogenerated/call.wast b/test/llvm_autogenerated/call.wast
index 86a81ca96..7aa3fa71b 100644
--- a/test/llvm_autogenerated/call.wast
+++ b/test/llvm_autogenerated/call.wast
@@ -1,5 +1,12 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$i (func (result i32)))
+ (type $FUNCSIG$j (func (result i64)))
+ (type $FUNCSIG$f (func (result f32)))
+ (type $FUNCSIG$d (func (result f64)))
+ (type $FUNCSIG$v (func))
+ (type $FUNCSIG$ii (func (param i32) (result i32)))
+ (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG_v (func))
(type $FUNCSIG_i (func (result i32)))
(import $i32_nullary "env" "i32_nullary" (result i32))
diff --git a/test/llvm_autogenerated/cfg-stackify.wast b/test/llvm_autogenerated/cfg-stackify.wast
index 984eecc4c..3ee288461 100644
--- a/test/llvm_autogenerated/cfg-stackify.wast
+++ b/test/llvm_autogenerated/cfg-stackify.wast
@@ -1,5 +1,7 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$v (func))
+ (type $FUNCSIG$i (func (result i32)))
(import $something "env" "something")
(import $bar "env" "bar")
(import $a "env" "a" (result i32))
diff --git a/test/llvm_autogenerated/f32.wast b/test/llvm_autogenerated/f32.wast
index e5b735328..a6ca50b42 100644
--- a/test/llvm_autogenerated/f32.wast
+++ b/test/llvm_autogenerated/f32.wast
@@ -1,5 +1,6 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$ffff (func (param f32 f32 f32) (result f32)))
(import $fmaf "env" "fmaf" (param f32 f32 f32) (result f32))
(export "fadd32" $fadd32)
(export "fsub32" $fsub32)
diff --git a/test/llvm_autogenerated/f64.wast b/test/llvm_autogenerated/f64.wast
index 5dd5552c4..665e02c76 100644
--- a/test/llvm_autogenerated/f64.wast
+++ b/test/llvm_autogenerated/f64.wast
@@ -1,5 +1,6 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$dddd (func (param f64 f64 f64) (result f64)))
(import $fma "env" "fma" (param f64 f64 f64) (result f64))
(export "fadd64" $fadd64)
(export "fsub64" $fsub64)
diff --git a/test/llvm_autogenerated/frem.wast b/test/llvm_autogenerated/frem.wast
index cd4369504..6e300a646 100644
--- a/test/llvm_autogenerated/frem.wast
+++ b/test/llvm_autogenerated/frem.wast
@@ -1,5 +1,7 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$fff (func (param f32 f32) (result f32)))
+ (type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
(import $fmodf "env" "fmodf" (param f32 f32) (result f32))
(import $fmod "env" "fmod" (param f64 f64) (result f64))
(export "frem32" $frem32)
diff --git a/test/llvm_autogenerated/global.wast b/test/llvm_autogenerated/global.wast
index cc453456c..075f6b4f9 100644
--- a/test/llvm_autogenerated/global.wast
+++ b/test/llvm_autogenerated/global.wast
@@ -1,5 +1,6 @@
(module
(memory 1184 4294967295 (segment 4 "9\05\00\00") (segment 20 "\01\00\00\00") (segment 24 "*\00\00\00") (segment 28 "\ff\ff\ff\ff") (segment 56 "\00\00\00\00\01\00\00\00") (segment 64 "\ff\ff\ff\ff\ff\ff\ff\ff") (segment 84 "\00\00\00\80") (segment 88 "\00\00\00@") (segment 120 "\00\00\00\00\00\00\00\80") (segment 128 "\00\00\00\00\00\00\00@") (segment 656 "\e0\00\00\00"))
+ (type $FUNCSIG$viii (func (param i32 i32 i32)))
(import $memcpy "env" "memcpy" (param i32 i32 i32))
(export "foo" $foo)
(export "call_memcpy" $call_memcpy)
diff --git a/test/llvm_autogenerated/legalize.wast b/test/llvm_autogenerated/legalize.wast
index 2127f8e99..c05d5bf1f 100644
--- a/test/llvm_autogenerated/legalize.wast
+++ b/test/llvm_autogenerated/legalize.wast
@@ -1,5 +1,6 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$vijjj (func (param i32 i64 i64 i64)))
(import $__lshrti3 "env" "__lshrti3" (param i32 i64 i64 i64))
(import $__ashlti3 "env" "__ashlti3" (param i32 i64 i64 i64))
(export "shl_i3" $shl_i3)
diff --git a/test/llvm_autogenerated/switch.wast b/test/llvm_autogenerated/switch.wast
index 69d6db9f1..75e1be4ce 100644
--- a/test/llvm_autogenerated/switch.wast
+++ b/test/llvm_autogenerated/switch.wast
@@ -1,5 +1,6 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$v (func))
(import $foo0 "env" "foo0")
(import $foo1 "env" "foo1")
(import $foo2 "env" "foo2")
diff --git a/test/llvm_autogenerated/unreachable.wast b/test/llvm_autogenerated/unreachable.wast
index 1d3be1405..592132990 100644
--- a/test/llvm_autogenerated/unreachable.wast
+++ b/test/llvm_autogenerated/unreachable.wast
@@ -1,5 +1,6 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$v (func))
(import $abort "env" "abort")
(export "f1" $f1)
(export "f2" $f2)
diff --git a/test/llvm_autogenerated/unused-argument.wast b/test/llvm_autogenerated/unused-argument.wast
index 96c880442..226ff8ef5 100644
--- a/test/llvm_autogenerated/unused-argument.wast
+++ b/test/llvm_autogenerated/unused-argument.wast
@@ -1,5 +1,6 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$i (func (result i32)))
(import $return_something "env" "return_something" (result i32))
(export "unused_first" $unused_first)
(export "unused_second" $unused_second)
diff --git a/test/llvm_autogenerated/varargs.wast b/test/llvm_autogenerated/varargs.wast
index 7f5e0cb7e..01a9a49ea 100644
--- a/test/llvm_autogenerated/varargs.wast
+++ b/test/llvm_autogenerated/varargs.wast
@@ -1,5 +1,6 @@
(module
(memory 0 4294967295)
+ (type $FUNCSIG$v (func))
(import $callee "env" "callee")
(export "end" $end)
(export "copy" $copy)
diff --git a/test/passes/O.txt b/test/passes/O.txt
index 23b39e920..0e6f94bf2 100644
--- a/test/passes/O.txt
+++ b/test/passes/O.txt
@@ -3,6 +3,11 @@
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
+ (type $FUNCSIG$i (func (result i32)))
+ (type $FUNCSIG$v (func))
+ (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
+ (type $FUNCSIG$vii (func (param i32 i32)))
+ (type $FUNCSIG$id (func (param f64) (result i32)))
(import $abort "env" "abort" (param i32))
(import $_pthread_cleanup_pop "env" "_pthread_cleanup_pop" (param i32))
(import $___lock "env" "___lock" (param i32))
diff --git a/test/passes/remove-imports.txt b/test/passes/remove-imports.txt
index 964486c92..f4d1d5b99 100644
--- a/test/passes/remove-imports.txt
+++ b/test/passes/remove-imports.txt
@@ -1,5 +1,8 @@
(module
(memory 1024 1024)
+ (type $FUNCSIG$v (func))
+ (type $FUNCSIG$i (func (result i32)))
+ (type $FUNCSIG$d (func (result f64)))
(func $nada
(nop)
(i32.const 0)
diff --git a/test/two_sides.fromasm b/test/two_sides.fromasm
index a9b154e61..4b8860948 100644
--- a/test/two_sides.fromasm
+++ b/test/two_sides.fromasm
@@ -1,5 +1,6 @@
(module
(memory 16777216 16777216)
+ (type $FUNCSIG$id (func (param f64) (result i32)))
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
(export "_test" $_test)
(func $_test (param $i1 i32) (param $i2 i32) (param $i3 i32) (param $i4 i32) (param $i5 i32) (result i32)
diff --git a/test/unit.fromasm b/test/unit.fromasm
index 98978436c..e8d47715f 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -1,5 +1,7 @@
(module
(memory 16777216 16777216)
+ (type $FUNCSIG$id (func (param f64) (result i32)))
+ (type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
(type $FUNCSIG$vf (func (param f32)))
(type $FUNCSIG$vi (func (param i32)))
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
diff --git a/test/unit.wast b/test/unit.wast
index 55c9e9fa1..74be1387f 100644
--- a/test/unit.wast
+++ b/test/unit.wast
@@ -1,6 +1,9 @@
(module
(memory 4096 4096 (segment 1026 "\14\00"))
(type $FUNCSIG$vf (func (param f32)))
+ (type $FUNCSIG$v (func))
+ (type $FUNCSIG$id (func (param f64) (result i32)))
+ (type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
(import $_emscripten_asm_const_vi "env" "_emscripten_asm_const_vi")
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
(import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))