summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm-module-building.h10
-rw-r--r--test/empty.asm.js4
-rw-r--r--test/empty.fromasm4
-rw-r--r--test/empty.fromasm.imprecise4
-rw-r--r--test/empty.fromasm.imprecise.no-opts4
-rw-r--r--test/empty.fromasm.no-opts4
6 files changed, 29 insertions, 1 deletions
diff --git a/src/wasm-module-building.h b/src/wasm-module-building.h
index cb72fef3f..ead074991 100644
--- a/src/wasm-module-building.h
+++ b/src/wasm-module-building.h
@@ -86,7 +86,15 @@ class OptimizingIncrementalModuleBuilder {
public:
// numFunctions must be equal to the number of functions allocated, or higher. Knowing
// this bounds helps avoid locking.
- OptimizingIncrementalModuleBuilder(Module* wasm, Index numFunctions) : wasm(wasm), numFunctions(numFunctions), nextFunction(0), finishing(false) {
+ OptimizingIncrementalModuleBuilder(Module* wasm, Index numFunctions)
+ : wasm(wasm), numFunctions(numFunctions), endMarker(nullptr), list(nullptr), nextFunction(0),
+ numWorkers(0), liveWorkers(0), activeWorkers(0), availableFuncs(0), finishedFuncs(0),
+ finishing(false) {
+ if (numFunctions == 0) {
+ // special case: no functions to be optimized. Don't create any threads.
+ return;
+ }
+
// prepare work list
endMarker = new Function();
list = new std::atomic<Function*>[numFunctions];
diff --git a/test/empty.asm.js b/test/empty.asm.js
new file mode 100644
index 000000000..94fa6bb38
--- /dev/null
+++ b/test/empty.asm.js
@@ -0,0 +1,4 @@
+function EmptyModule() {
+ 'use asm';
+ return {};
+}
diff --git a/test/empty.fromasm b/test/empty.fromasm
new file mode 100644
index 000000000..939cbb87c
--- /dev/null
+++ b/test/empty.fromasm
@@ -0,0 +1,4 @@
+(module
+ (memory 256 256)
+ (export "memory" memory)
+)
diff --git a/test/empty.fromasm.imprecise b/test/empty.fromasm.imprecise
new file mode 100644
index 000000000..939cbb87c
--- /dev/null
+++ b/test/empty.fromasm.imprecise
@@ -0,0 +1,4 @@
+(module
+ (memory 256 256)
+ (export "memory" memory)
+)
diff --git a/test/empty.fromasm.imprecise.no-opts b/test/empty.fromasm.imprecise.no-opts
new file mode 100644
index 000000000..939cbb87c
--- /dev/null
+++ b/test/empty.fromasm.imprecise.no-opts
@@ -0,0 +1,4 @@
+(module
+ (memory 256 256)
+ (export "memory" memory)
+)
diff --git a/test/empty.fromasm.no-opts b/test/empty.fromasm.no-opts
new file mode 100644
index 000000000..939cbb87c
--- /dev/null
+++ b/test/empty.fromasm.no-opts
@@ -0,0 +1,4 @@
+(module
+ (memory 256 256)
+ (export "memory" memory)
+)