summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/asm2wasm.h8
-rw-r--r--src/binaryen-c.cpp8
-rw-r--r--src/passes/Print.cpp15
-rw-r--r--src/wasm-binary.h39
-rw-r--r--src/wasm-linker.cpp7
-rw-r--r--src/wasm-linker.h1
-rw-r--r--src/wasm-s-parser.h28
-rw-r--r--src/wasm-validator.h14
-rw-r--r--src/wasm.h9
-rw-r--r--test/emcc_O2_hello_world.fromasm2
-rw-r--r--test/emcc_O2_hello_world.fromasm.imprecise2
-rw-r--r--test/emcc_O2_hello_world.fromasm.imprecise.no-opts2
-rw-r--r--test/emcc_O2_hello_world.fromasm.no-opts2
-rw-r--r--test/emcc_hello_world.fromasm2
-rw-r--r--test/emcc_hello_world.fromasm.imprecise2
-rw-r--r--test/emcc_hello_world.fromasm.imprecise.no-opts2
-rw-r--r--test/emcc_hello_world.fromasm.no-opts2
-rw-r--r--test/example/c-api-kitchen-sink.txt4
-rw-r--r--test/example/c-api-kitchen-sink.txt.txt2
-rw-r--r--test/example/relooper-fuzz.txt4
-rw-r--r--test/example/relooper-fuzz1.txt4
-rw-r--r--test/hello_world.fromasm2
-rw-r--r--test/hello_world.fromasm.imprecise2
-rw-r--r--test/hello_world.fromasm.imprecise.no-opts2
-rw-r--r--test/hello_world.fromasm.no-opts2
-rw-r--r--test/memorygrowth.fromasm2
-rw-r--r--test/memorygrowth.fromasm.imprecise2
-rw-r--r--test/memorygrowth.fromasm.imprecise.no-opts2
-rw-r--r--test/memorygrowth.fromasm.no-opts2
-rw-r--r--test/min.fromasm2
-rw-r--r--test/min.fromasm.imprecise2
-rw-r--r--test/min.fromasm.imprecise.no-opts2
-rw-r--r--test/min.fromasm.no-opts2
-rw-r--r--test/two_sides.fromasm2
-rw-r--r--test/two_sides.fromasm.imprecise2
-rw-r--r--test/two_sides.fromasm.imprecise.no-opts2
-rw-r--r--test/two_sides.fromasm.no-opts2
-rw-r--r--test/unit.fromasm2
-rw-r--r--test/unit.fromasm.imprecise2
-rw-r--r--test/unit.fromasm.imprecise.no-opts2
-rw-r--r--test/unit.fromasm.no-opts2
41 files changed, 131 insertions, 68 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 4d2ddb0cd..c88563109 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -710,6 +710,7 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
auto* export_ = new Export;
export_->name = key;
export_->value = value;
+ export_->kind = Export::Function;
wasm.addExport(export_);
exported[key] = export_;
}
@@ -813,10 +814,15 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
));
auto export_ = new Export;
export_->name = export_->value = GROW_WASM_MEMORY;
+ export_->kind = Export::Function;
wasm.addExport(export_);
}
- wasm.memory.exportName = MEMORY;
+ auto memoryExport = make_unique<Export>();
+ memoryExport->name = MEMORY;
+ memoryExport->value = Name::fromInt(0);
+ memoryExport->kind = Export::Memory;
+ wasm.addExport(memoryExport.release());
#if 0 // enable asm2wasm i64 optimizations when browsers have consistent i64 support in wasm
if (udivmoddi4.is() && getTempRet0.is()) {
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index 8703237d5..e333f64d8 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -805,7 +805,13 @@ void BinaryenSetMemory(BinaryenModuleRef module, BinaryenIndex initial, Binaryen
auto* wasm = (Module*)module;
wasm->memory.initial = initial;
wasm->memory.max = maximum;
- if (exportName) wasm->memory.exportName = exportName;
+ if (exportName) {
+ auto memoryExport = make_unique<Export>();
+ memoryExport->name = exportName;
+ memoryExport->value = Name::fromInt(0);
+ memoryExport->kind = Export::Memory;
+ wasm->addExport(memoryExport.release());
+ }
for (BinaryenIndex i = 0; i < numSegments; i++) {
wasm->memory.segments.emplace_back((Expression*)segmentOffsets[i], segments[i], segmentSizes[i]);
}
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 02e9b9065..0152f917c 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -543,7 +543,14 @@ struct PrintSExpression : public Visitor<PrintSExpression> {
void visitExport(Export *curr) {
printOpening(o, "export ");
printText(o, curr->name.str) << ' ';
- printName(curr->value) << ')';
+ switch (curr->kind) {
+ case Export::Function: printName(curr->value); break;
+ case Export::Table: o << "table"; break;
+ case Export::Memory: o << "memory"; break;
+ case Export::Global: o << "global "; printName(curr->value); break;
+ default: WASM_UNREACHABLE();
+ }
+ o << ')';
}
void visitGlobal(Global *curr) {
printOpening(o, "global ");
@@ -636,12 +643,6 @@ struct PrintSExpression : public Visitor<PrintSExpression> {
}
o << "\")\n";
}
- if (curr->memory.exportName.is()) {
- doIndent(o, indent);
- printOpening(o, "export ");
- printText(o, curr->memory.exportName.str) << " memory)";
- o << maybeNewLine;
- }
if (curr->start.is()) {
doIndent(o, indent);
printOpening(o, "start") << ' ' << curr->start << ')';
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index fa4b78c9d..e250e26ff 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -531,8 +531,7 @@ public:
if (debug) std::cerr << "== writeMemory" << std::endl;
auto start = startSection(BinaryConsts::Section::Memory);
o << U32LEB(wasm->memory.initial)
- << U32LEB(wasm->memory.max)
- << int8_t(wasm->memory.exportName.is()); // export memory
+ << U32LEB(wasm->memory.max);
finishSection(start);
}
@@ -692,7 +691,14 @@ public:
o << U32LEB(wasm->exports.size());
for (auto& curr : wasm->exports) {
if (debug) std::cerr << "write one" << std::endl;
- o << U32LEB(getFunctionIndex(curr->value));
+ o << U32LEB(curr->kind);
+ switch (curr->kind) {
+ case Export::Function: o << U32LEB(getFunctionIndex(curr->value)); break;
+ case Export::Table: o << U32LEB(0); break;
+ case Export::Memory: o << U32LEB(0); break;
+ case Export::Global: o << U32LEB(getGlobalIndex(curr->value)); break;
+ default: WASM_UNREACHABLE();
+ }
writeInlineString(curr->name.str);
}
finishSection(start);
@@ -741,6 +747,19 @@ public:
return mappedFunctions[name];
}
+ std::map<Name, uint32_t> mappedGlobals; // name of the Global => index
+ uint32_t getGlobalIndex(Name name) {
+ if (!mappedGlobals.size()) {
+ // Create name => index mapping.
+ for (size_t i = 0; i < wasm->globals.size(); i++) {
+ assert(mappedGlobals.count(wasm->globals[i]->name) == 0);
+ mappedGlobals[wasm->globals[i]->name] = i;
+ }
+ }
+ assert(mappedGlobals.count(name));
+ return mappedGlobals[name];
+ }
+
void writeFunctionTable() {
if (wasm->table.segments.size() == 0) return;
if (debug) std::cerr << "== writeFunctionTable" << std::endl;
@@ -1437,10 +1456,6 @@ public:
if (debug) std::cerr << "== readMemory" << std::endl;
wasm.memory.initial = getU32LEB();
wasm.memory.max = getU32LEB();
- auto exportMemory = getInt8();
- if (exportMemory) {
- wasm.memory.exportName = Name("memory");
- }
}
void readSignatures() {
@@ -1578,8 +1593,8 @@ public:
for (size_t i = 0; i < num; i++) {
if (debug) std::cerr << "read one" << std::endl;
auto curr = new Export;
+ curr->kind = (Export::Kind)getU32LEB();
auto index = getU32LEB();
- assert(index < functionTypes.size());
curr->name = getInlineString();
exportIndexes[curr] = index;
}
@@ -1644,7 +1659,13 @@ public:
for (auto& iter : exportIndexes) {
Export* curr = iter.first;
- curr->value = wasm.functions[iter.second]->name;
+ switch (curr->kind) {
+ case Export::Function: curr->value = wasm.functions[iter.second]->name; break;
+ case Export::Table: curr->value = Name::fromInt(0); break;
+ case Export::Memory: curr->value = Name::fromInt(0); break;
+ case Export::Global: curr->value = wasm.globals[iter.second]->name; break;
+ default: WASM_UNREACHABLE();
+ }
wasm.addExport(curr);
}
diff --git a/src/wasm-linker.cpp b/src/wasm-linker.cpp
index b1160e94a..9e968598a 100644
--- a/src/wasm-linker.cpp
+++ b/src/wasm-linker.cpp
@@ -106,7 +106,12 @@ void Linker::layout() {
}
if (userMaxMemory) out.wasm.memory.max = userMaxMemory / Memory::kPageSize;
- out.wasm.memory.exportName = MEMORY;
+
+ auto memoryExport = make_unique<Export>();
+ memoryExport->name = MEMORY;
+ memoryExport->value = Name::fromInt(0);
+ memoryExport->kind = Export::Memory;
+ out.wasm.addExport(memoryExport.release());
// XXX For now, export all functions marked .globl.
for (Name name : out.globls) exportFunction(name, false);
diff --git a/src/wasm-linker.h b/src/wasm-linker.h
index a6f5d319a..21d336273 100644
--- a/src/wasm-linker.h
+++ b/src/wasm-linker.h
@@ -310,6 +310,7 @@ class Linker {
if (out.wasm.checkExport(name)) return; // Already exported
auto exp = new Export;
exp->name = exp->value = name;
+ exp->kind = Export::Function;
out.wasm.addExport(exp);
}
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 429dde417..b6270217b 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -443,6 +443,7 @@ private:
auto ex = make_unique<Export>();
ex->name = exportName;
ex->value = name;
+ ex->kind = Export::Function;
wasm.addExport(ex.release());
}
functionCounter++;
@@ -1405,15 +1406,28 @@ private:
}
void parseExport(Element& s) {
+ std::unique_ptr<Export> ex = make_unique<Export>();
if (!s[2]->dollared() && !std::isdigit(s[2]->str()[0])) {
- assert(s[2]->str() == MEMORY);
- if (!hasMemory) throw ParseException("memory exported but no memory");
- wasm.memory.exportName = s[1]->str();
- return;
+ ex->name = s[1]->str();
+ if (s[2]->str() == MEMORY) {
+ if (!hasMemory) throw ParseException("memory exported but no memory");
+ ex->value = Name::fromInt(0);
+ ex->kind = Export::Memory;
+ } else if (s[2]->str() == TABLE) {
+ ex->value = Name::fromInt(0);
+ ex->kind = Export::Table;
+ } else if (s[2]->str() == GLOBAL) {
+ ex->value = s[3]->str();
+ ex->kind = Export::Table;
+ } else {
+ WASM_UNREACHABLE();
+ }
+ } else {
+ // function
+ ex->name = s[1]->str();
+ ex->value = s[2]->str();
+ ex->kind = Export::Function;
}
- std::unique_ptr<Export> ex = make_unique<Export>();
- ex->name = s[1]->str();
- ex->value = s[2]->str();
wasm.addExport(ex.release());
}
diff --git a/src/wasm-validator.h b/src/wasm-validator.h
index ffdd2a2b7..77bf6d3e9 100644
--- a/src/wasm-validator.h
+++ b/src/wasm-validator.h
@@ -367,14 +367,16 @@ public:
std::set<Name> exportNames;
for (auto& exp : curr->exports) {
Name name = exp->value;
- bool found = false;
- for (auto& func : curr->functions) {
- if (func->name == name) {
- found = true;
- break;
+ if (exp->kind == Export::Function) {
+ bool found = false;
+ for (auto& func : curr->functions) {
+ if (func->name == name) {
+ found = true;
+ break;
+ }
}
+ shouldBeTrue(found, name, "module exports must be found");
}
- shouldBeTrue(found, name, "module exports must be found");
Name exportName = exp->name;
shouldBeFalse(exportNames.count(exportName) > 0, exportName, "module exports must be unique");
exportNames.insert(exportName);
diff --git a/src/wasm.h b/src/wasm.h
index 43c8b192b..f93fb3a80 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -1438,8 +1438,16 @@ public:
class Export {
public:
+ enum Kind {
+ Function = 0,
+ Table = 1,
+ Memory = 2,
+ Global = 3,
+ };
+
Name name; // exported name
Name value; // internal name
+ Kind kind;
};
class Table {
@@ -1484,7 +1492,6 @@ public:
Address initial, max; // sizes are in pages
std::vector<Segment> segments;
- Name exportName;
Memory() : initial(0), max(kMaxSize) {}
};
diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm
index fce0596e6..1414e1782 100644
--- a/test/emcc_O2_hello_world.fromasm
+++ b/test/emcc_O2_hello_world.fromasm
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
@@ -42,6 +41,7 @@
(export "dynCall_ii" $dynCall_ii)
(export "dynCall_iiii" $dynCall_iiii)
(export "dynCall_vi" $dynCall_vi)
+ (export "memory" memory)
(table 18 18 anyfunc)
(elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $b1 $___stdio_write $b1 $b1 $b2 $b2 $b2 $b2 $_cleanup_418 $b2 $b2 $b2)
(func $_malloc (param $0 i32) (result i32)
diff --git a/test/emcc_O2_hello_world.fromasm.imprecise b/test/emcc_O2_hello_world.fromasm.imprecise
index 8ecf57704..769fc3dd6 100644
--- a/test/emcc_O2_hello_world.fromasm.imprecise
+++ b/test/emcc_O2_hello_world.fromasm.imprecise
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
@@ -41,6 +40,7 @@
(export "dynCall_ii" $dynCall_ii)
(export "dynCall_iiii" $dynCall_iiii)
(export "dynCall_vi" $dynCall_vi)
+ (export "memory" memory)
(table 18 18 anyfunc)
(elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $b1 $___stdio_write $b1 $b1 $b2 $b2 $b2 $b2 $_cleanup_418 $b2 $b2 $b2)
(func $_malloc (param $0 i32) (result i32)
diff --git a/test/emcc_O2_hello_world.fromasm.imprecise.no-opts b/test/emcc_O2_hello_world.fromasm.imprecise.no-opts
index 163015994..79748fc64 100644
--- a/test/emcc_O2_hello_world.fromasm.imprecise.no-opts
+++ b/test/emcc_O2_hello_world.fromasm.imprecise.no-opts
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
@@ -41,6 +40,7 @@
(export "dynCall_ii" $dynCall_ii)
(export "dynCall_iiii" $dynCall_iiii)
(export "dynCall_vi" $dynCall_vi)
+ (export "memory" memory)
(table 18 18 anyfunc)
(elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $b1 $___stdio_write $b1 $b1 $b2 $b2 $b2 $b2 $_cleanup_418 $b2 $b2 $b2)
(func $_malloc (param $i1 i32) (result i32)
diff --git a/test/emcc_O2_hello_world.fromasm.no-opts b/test/emcc_O2_hello_world.fromasm.no-opts
index d8589967a..907460e39 100644
--- a/test/emcc_O2_hello_world.fromasm.no-opts
+++ b/test/emcc_O2_hello_world.fromasm.no-opts
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
@@ -42,6 +41,7 @@
(export "dynCall_ii" $dynCall_ii)
(export "dynCall_iiii" $dynCall_iiii)
(export "dynCall_vi" $dynCall_vi)
+ (export "memory" memory)
(table 18 18 anyfunc)
(elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $b1 $___stdio_write $b1 $b1 $b2 $b2 $b2 $b2 $_cleanup_418 $b2 $b2 $b2)
(func $_malloc (param $i1 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm
index ea3485584..6154be66d 100644
--- a/test/emcc_hello_world.fromasm
+++ b/test/emcc_hello_world.fromasm
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$id (func (param f64) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
@@ -55,6 +54,7 @@
(export "dynCall_iiii" $dynCall_iiii)
(export "dynCall_vi" $dynCall_vi)
(export "___udivmoddi4" $___udivmoddi4)
+ (export "memory" memory)
(table 18 18 anyfunc)
(elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $___stdio_write $b1 $b1 $b1 $b2 $b2 $b2 $b2 $b2 $_cleanup $b2 $b2)
(func $stackAlloc (param $0 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise
index 06efe55d2..e51d8ce07 100644
--- a/test/emcc_hello_world.fromasm.imprecise
+++ b/test/emcc_hello_world.fromasm.imprecise
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
@@ -49,6 +48,7 @@
(export "dynCall_iiii" $dynCall_iiii)
(export "dynCall_vi" $dynCall_vi)
(export "___udivmoddi4" $___udivmoddi4)
+ (export "memory" memory)
(table 18 18 anyfunc)
(elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $___stdio_write $b1 $b1 $b1 $b2 $b2 $b2 $b2 $b2 $_cleanup $b2 $b2)
(func $stackAlloc (param $0 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm.imprecise.no-opts b/test/emcc_hello_world.fromasm.imprecise.no-opts
index 5e469d9bb..77f4b2a7f 100644
--- a/test/emcc_hello_world.fromasm.imprecise.no-opts
+++ b/test/emcc_hello_world.fromasm.imprecise.no-opts
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
@@ -49,6 +48,7 @@
(export "dynCall_iiii" $dynCall_iiii)
(export "dynCall_vi" $dynCall_vi)
(export "___udivmoddi4" $___udivmoddi4)
+ (export "memory" memory)
(table 18 18 anyfunc)
(elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $___stdio_write $b1 $b1 $b1 $b2 $b2 $b2 $b2 $b2 $_cleanup $b2 $b2)
(func $stackAlloc (param $size i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm.no-opts b/test/emcc_hello_world.fromasm.no-opts
index d1295a8bd..4d2fb5e7a 100644
--- a/test/emcc_hello_world.fromasm.no-opts
+++ b/test/emcc_hello_world.fromasm.no-opts
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$id (func (param f64) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
@@ -55,6 +54,7 @@
(export "dynCall_iiii" $dynCall_iiii)
(export "dynCall_vi" $dynCall_vi)
(export "___udivmoddi4" $___udivmoddi4)
+ (export "memory" memory)
(table 18 18 anyfunc)
(elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $___stdio_write $b1 $b1 $b1 $b2 $b2 $b2 $b2 $b2 $_cleanup $b2 $b2)
(func $stackAlloc (param $size i32) (result i32)
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 61b29a2eb..a49a8abcc 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -9,7 +9,6 @@ BinaryenFloat64: 4
(module
(memory 1 256)
(data (i32.const 10) "hello, world")
- (export "mem" memory)
(start $starter)
(type $iiIfF (func (param i32 i64 f32 f64) (result i32)))
(type $fiF (func (param i32 f64) (result f32)))
@@ -17,6 +16,7 @@ BinaryenFloat64: 4
(type $3 (func))
(import $an-imported "module" "base" (param i32 f64) (result f32))
(export "kitchen_sinker" "$kitchen()sinker")
+ (export "mem" memory)
(table 1 1 anyfunc)
(elem (i32.const 0) "$kitchen()sinker")
(func "$kitchen()sinker" (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32)
@@ -1600,7 +1600,6 @@ int main() {
(module
(memory 1 256)
(data (i32.const 10) "hello, world")
- (export "mem" memory)
(start $starter)
(type $iiIfF (func (param i32 i64 f32 f64) (result i32)))
(type $fiF (func (param i32 f64) (result f32)))
@@ -1608,6 +1607,7 @@ int main() {
(type $3 (func))
(import $an-imported "module" "base" (param i32 f64) (result f32))
(export "kitchen_sinker" "$kitchen()sinker")
+ (export "mem" memory)
(table 1 1 anyfunc)
(elem (i32.const 0) "$kitchen()sinker")
(func "$kitchen()sinker" (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32)
diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt
index a572b8de8..cf9177060 100644
--- a/test/example/c-api-kitchen-sink.txt.txt
+++ b/test/example/c-api-kitchen-sink.txt.txt
@@ -4,7 +4,6 @@
(module
(memory 1 256)
(data (i32.const 10) "hello, world")
- (export "mem" memory)
(start $starter)
(type $iiIfF (func (param i32 i64 f32 f64) (result i32)))
(type $fiF (func (param i32 f64) (result f32)))
@@ -12,6 +11,7 @@
(type $3 (func))
(import $an-imported "module" "base" (param i32 f64) (result f32))
(export "kitchen_sinker" "$kitchen()sinker")
+ (export "mem" memory)
(table 1 1 anyfunc)
(elem (i32.const 0) "$kitchen()sinker")
(func "$kitchen()sinker" (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32)
diff --git a/test/example/relooper-fuzz.txt b/test/example/relooper-fuzz.txt
index 2836a05de..730106cf9 100644
--- a/test/example/relooper-fuzz.txt
+++ b/test/example/relooper-fuzz.txt
@@ -1,11 +1,11 @@
(module
(memory 1 1)
- (export "mem" memory)
(start $main)
(type $i (func (result i32)))
(type $v (func))
(type $vi (func (param i32)))
(import $print "spectest" "print" (param i32))
+ (export "mem" memory)
(func $check (type $i) (result i32)
(if
(i32.eq
@@ -293,12 +293,12 @@
)
(module
(memory 1 1)
- (export "mem" memory)
(start $main)
(type $i (func (result i32)))
(type $v (func))
(type $vi (func (param i32)))
(import $print "spectest" "print" (param i32))
+ (export "mem" memory)
(func $check (type $i) (result i32)
(if
(i32.eq
diff --git a/test/example/relooper-fuzz1.txt b/test/example/relooper-fuzz1.txt
index 32456c82a..f219e9f96 100644
--- a/test/example/relooper-fuzz1.txt
+++ b/test/example/relooper-fuzz1.txt
@@ -1,11 +1,11 @@
(module
(memory 1 1)
- (export "mem" memory)
(start $main)
(type $i (func (result i32)))
(type $v (func))
(type $vi (func (param i32)))
(import $print "spectest" "print" (param i32))
+ (export "mem" memory)
(func $check (type $i) (result i32)
(if
(i32.eq
@@ -269,12 +269,12 @@
)
(module
(memory 1 1)
- (export "mem" memory)
(start $main)
(type $i (func (result i32)))
(type $v (func))
(type $vi (func (param i32)))
(import $print "spectest" "print" (param i32))
+ (export "mem" memory)
(func $check (type $i) (result i32)
(if
(i32.eq
diff --git a/test/hello_world.fromasm b/test/hello_world.fromasm
index 66f728c52..675ef17ca 100644
--- a/test/hello_world.fromasm
+++ b/test/hello_world.fromasm
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "add" $add)
+ (export "memory" memory)
(func $add (param $0 i32) (param $1 i32) (result i32)
(i32.add
(get_local $0)
diff --git a/test/hello_world.fromasm.imprecise b/test/hello_world.fromasm.imprecise
index 66f728c52..675ef17ca 100644
--- a/test/hello_world.fromasm.imprecise
+++ b/test/hello_world.fromasm.imprecise
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "add" $add)
+ (export "memory" memory)
(func $add (param $0 i32) (param $1 i32) (result i32)
(i32.add
(get_local $0)
diff --git a/test/hello_world.fromasm.imprecise.no-opts b/test/hello_world.fromasm.imprecise.no-opts
index 435e41a60..368ffaff3 100644
--- a/test/hello_world.fromasm.imprecise.no-opts
+++ b/test/hello_world.fromasm.imprecise.no-opts
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "add" $add)
+ (export "memory" memory)
(func $add (param $x i32) (param $y i32) (result i32)
(return
(i32.add
diff --git a/test/hello_world.fromasm.no-opts b/test/hello_world.fromasm.no-opts
index 435e41a60..368ffaff3 100644
--- a/test/hello_world.fromasm.no-opts
+++ b/test/hello_world.fromasm.no-opts
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "add" $add)
+ (export "memory" memory)
(func $add (param $x i32) (param $y i32) (result i32)
(return
(i32.add
diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm
index 7a7a98113..692c8438f 100644
--- a/test/memorygrowth.fromasm
+++ b/test/memorygrowth.fromasm
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
@@ -40,6 +39,7 @@
(export "dynCall_iiii" $lb)
(export "dynCall_vi" $mb)
(export "__growWasmMemory" $__growWasmMemory)
+ (export "memory" memory)
(table 8 8 anyfunc)
(elem (i32.const 0) $nb $Oa $ob $Va $Ua $Ra $pb $Sa)
(func $eb (param $0 i32) (result i32)
diff --git a/test/memorygrowth.fromasm.imprecise b/test/memorygrowth.fromasm.imprecise
index 220266314..2e22608a8 100644
--- a/test/memorygrowth.fromasm.imprecise
+++ b/test/memorygrowth.fromasm.imprecise
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
@@ -39,6 +38,7 @@
(export "dynCall_iiii" $lb)
(export "dynCall_vi" $mb)
(export "__growWasmMemory" $__growWasmMemory)
+ (export "memory" memory)
(table 8 8 anyfunc)
(elem (i32.const 0) $nb $Oa $ob $Va $Ua $Ra $pb $Sa)
(func $eb (param $0 i32) (result i32)
diff --git a/test/memorygrowth.fromasm.imprecise.no-opts b/test/memorygrowth.fromasm.imprecise.no-opts
index a25625c64..f121bfc20 100644
--- a/test/memorygrowth.fromasm.imprecise.no-opts
+++ b/test/memorygrowth.fromasm.imprecise.no-opts
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
@@ -39,6 +38,7 @@
(export "dynCall_iiii" $lb)
(export "dynCall_vi" $mb)
(export "__growWasmMemory" $__growWasmMemory)
+ (export "memory" memory)
(table 8 8 anyfunc)
(elem (i32.const 0) $nb $Oa $ob $Va $Ua $Ra $pb $Sa)
(func $eb (param $a i32) (result i32)
diff --git a/test/memorygrowth.fromasm.no-opts b/test/memorygrowth.fromasm.no-opts
index f2cf43833..88e2e1869 100644
--- a/test/memorygrowth.fromasm.no-opts
+++ b/test/memorygrowth.fromasm.no-opts
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
@@ -40,6 +39,7 @@
(export "dynCall_iiii" $lb)
(export "dynCall_vi" $mb)
(export "__growWasmMemory" $__growWasmMemory)
+ (export "memory" memory)
(table 8 8 anyfunc)
(elem (i32.const 0) $nb $Oa $ob $Va $Ua $Ra $pb $Sa)
(func $eb (param $a i32) (result i32)
diff --git a/test/min.fromasm b/test/min.fromasm
index b5d826e4f..06967379c 100644
--- a/test/min.fromasm
+++ b/test/min.fromasm
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "floats" $floats)
+ (export "memory" memory)
(func $floats (param $0 f32) (result f32)
(local $1 f32)
(f32.add
diff --git a/test/min.fromasm.imprecise b/test/min.fromasm.imprecise
index b5d826e4f..06967379c 100644
--- a/test/min.fromasm.imprecise
+++ b/test/min.fromasm.imprecise
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "floats" $floats)
+ (export "memory" memory)
(func $floats (param $0 f32) (result f32)
(local $1 f32)
(f32.add
diff --git a/test/min.fromasm.imprecise.no-opts b/test/min.fromasm.imprecise.no-opts
index bde70a203..ff101cc82 100644
--- a/test/min.fromasm.imprecise.no-opts
+++ b/test/min.fromasm.imprecise.no-opts
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "floats" $floats)
+ (export "memory" memory)
(func $floats (param $f f32) (result f32)
(local $t f32)
(return
diff --git a/test/min.fromasm.no-opts b/test/min.fromasm.no-opts
index bde70a203..ff101cc82 100644
--- a/test/min.fromasm.no-opts
+++ b/test/min.fromasm.no-opts
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "floats" $floats)
+ (export "memory" memory)
(func $floats (param $f f32) (result f32)
(local $t f32)
(return
diff --git a/test/two_sides.fromasm b/test/two_sides.fromasm
index 0b1ed182d..9d114dc8c 100644
--- a/test/two_sides.fromasm
+++ b/test/two_sides.fromasm
@@ -1,9 +1,9 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$id (func (param f64) (result i32)))
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
(export "_test" $_test)
+ (export "memory" memory)
(func $_test (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
(local $5 f64)
(if
diff --git a/test/two_sides.fromasm.imprecise b/test/two_sides.fromasm.imprecise
index 77ea9a202..3e982aef2 100644
--- a/test/two_sides.fromasm.imprecise
+++ b/test/two_sides.fromasm.imprecise
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "_test" $_test)
+ (export "memory" memory)
(func $_test (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
(local $5 f64)
(if
diff --git a/test/two_sides.fromasm.imprecise.no-opts b/test/two_sides.fromasm.imprecise.no-opts
index 6c2aa1d83..d76c31b7e 100644
--- a/test/two_sides.fromasm.imprecise.no-opts
+++ b/test/two_sides.fromasm.imprecise.no-opts
@@ -1,7 +1,7 @@
(module
(memory 256 256)
- (export "memory" memory)
(export "_test" $_test)
+ (export "memory" memory)
(func $_test (param $i1 i32) (param $i2 i32) (param $i3 i32) (param $i4 i32) (param $i5 i32) (result i32)
(local $d6 f64)
(if
diff --git a/test/two_sides.fromasm.no-opts b/test/two_sides.fromasm.no-opts
index 719566b73..e0b639049 100644
--- a/test/two_sides.fromasm.no-opts
+++ b/test/two_sides.fromasm.no-opts
@@ -1,9 +1,9 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$id (func (param f64) (result i32)))
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
(export "_test" $_test)
+ (export "memory" memory)
(func $_test (param $i1 i32) (param $i2 i32) (param $i3 i32) (param $i4 i32) (param $i5 i32) (result i32)
(local $d6 f64)
(if
diff --git a/test/unit.fromasm b/test/unit.fromasm
index 356c935c9..1abe2a5e8 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$id (func (param f64) (result i32)))
(type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
@@ -15,6 +14,7 @@
(import $i32u-div "asm2wasm" "i32u-div" (param i32 i32) (result i32))
(export "big_negative" $big_negative)
(export "pick" $big_negative)
+ (export "memory" memory)
(table 10 10 anyfunc)
(elem (i32.const 0) $big_negative $big_negative $big_negative $big_negative $big_negative $big_negative $importedDoubles $big_negative $big_negative $cneg)
(func $big_negative
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index 160047635..bba8a11a4 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
(type $FUNCSIG$vf (func (param f32)))
(type $FUNCSIG$vi (func (param i32)))
@@ -11,6 +10,7 @@
(import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))
(export "big_negative" $big_negative)
(export "pick" $big_negative)
+ (export "memory" memory)
(table 10 10 anyfunc)
(elem (i32.const 0) $big_negative $big_negative $big_negative $big_negative $big_negative $big_negative $importedDoubles $big_negative $big_negative $cneg)
(func $big_negative
diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts
index 05e93926b..824606764 100644
--- a/test/unit.fromasm.imprecise.no-opts
+++ b/test/unit.fromasm.imprecise.no-opts
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
(type $FUNCSIG$vf (func (param f32)))
(type $FUNCSIG$vi (func (param i32)))
@@ -11,6 +10,7 @@
(import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))
(export "big_negative" $big_negative)
(export "pick" $exportMe)
+ (export "memory" memory)
(table 10 10 anyfunc)
(elem (i32.const 0) $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
(func $big_negative
diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts
index ae894c99e..5fba592a6 100644
--- a/test/unit.fromasm.no-opts
+++ b/test/unit.fromasm.no-opts
@@ -1,6 +1,5 @@
(module
(memory 256 256)
- (export "memory" memory)
(type $FUNCSIG$id (func (param f64) (result i32)))
(type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
@@ -15,6 +14,7 @@
(import $i32u-div "asm2wasm" "i32u-div" (param i32 i32) (result i32))
(export "big_negative" $big_negative)
(export "pick" $exportMe)
+ (export "memory" memory)
(table 10 10 anyfunc)
(elem (i32.const 0) $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
(func $big_negative