summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/asm2wasm.h5
-rw-r--r--test/empty.fromasm2
-rw-r--r--test/empty.fromasm.imprecise2
-rw-r--r--test/empty.fromasm.imprecise.no-opts2
-rw-r--r--test/empty.fromasm.no-opts2
-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/i64-setTempRet0.fromasm2
-rw-r--r--test/i64-setTempRet0.fromasm.imprecise2
-rw-r--r--test/i64-setTempRet0.fromasm.imprecise.no-opts2
-rw-r--r--test/i64-setTempRet0.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/wasm-only.fromasm2
-rw-r--r--test/wasm-only.fromasm.imprecise2
-rw-r--r--test/wasm-only.fromasm.imprecise.no-opts2
-rw-r--r--test/wasm-only.fromasm.no-opts2
25 files changed, 28 insertions, 25 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index b2e7f5512..9b503c84d 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -664,6 +664,10 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
}, debug, false /* do not validate globally yet */);
}
+ // if we see no function tables in the processing below, then the table still exists and has size 0
+
+ wasm.table.initial = wasm.table.max = 0;
+
// first pass - do almost everything, but function imports and indirect calls
for (unsigned i = 1; i < body->size(); i++) {
@@ -784,7 +788,6 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
// TODO: when not using aliasing function pointers, we could merge them by noticing that
// index 0 in each table is the null func, and each other index should only have one
// non-null func. However, that breaks down when function pointer casts are emulated.
- wasm.table.exists = true;
if (wasm.table.segments.size() == 0) {
wasm.table.segments.emplace_back(wasm.allocator.alloc<Const>()->set(Literal(uint32_t(0))));
}
diff --git a/test/empty.fromasm b/test/empty.fromasm
index 055939559..a8d289e29 100644
--- a/test/empty.fromasm
+++ b/test/empty.fromasm
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(data (get_global $memoryBase) "empty.asm.js")
diff --git a/test/empty.fromasm.imprecise b/test/empty.fromasm.imprecise
index ea0f983fc..cc8aa47c3 100644
--- a/test/empty.fromasm.imprecise
+++ b/test/empty.fromasm.imprecise
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
)
diff --git a/test/empty.fromasm.imprecise.no-opts b/test/empty.fromasm.imprecise.no-opts
index ea0f983fc..cc8aa47c3 100644
--- a/test/empty.fromasm.imprecise.no-opts
+++ b/test/empty.fromasm.imprecise.no-opts
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
)
diff --git a/test/empty.fromasm.no-opts b/test/empty.fromasm.no-opts
index ea0f983fc..cc8aa47c3 100644
--- a/test/empty.fromasm.no-opts
+++ b/test/empty.fromasm.no-opts
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
)
diff --git a/test/hello_world.fromasm b/test/hello_world.fromasm
index f88f3e94a..160736cd1 100644
--- a/test/hello_world.fromasm
+++ b/test/hello_world.fromasm
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(data (get_global $memoryBase) "hello_world.asm.js")
diff --git a/test/hello_world.fromasm.imprecise b/test/hello_world.fromasm.imprecise
index fd9a167c6..2c544bd65 100644
--- a/test/hello_world.fromasm.imprecise
+++ b/test/hello_world.fromasm.imprecise
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "add" (func $add))
diff --git a/test/hello_world.fromasm.imprecise.no-opts b/test/hello_world.fromasm.imprecise.no-opts
index 64ddcb01d..dae1480b7 100644
--- a/test/hello_world.fromasm.imprecise.no-opts
+++ b/test/hello_world.fromasm.imprecise.no-opts
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "add" (func $add))
diff --git a/test/hello_world.fromasm.no-opts b/test/hello_world.fromasm.no-opts
index 64ddcb01d..dae1480b7 100644
--- a/test/hello_world.fromasm.no-opts
+++ b/test/hello_world.fromasm.no-opts
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "add" (func $add))
diff --git a/test/i64-setTempRet0.fromasm b/test/i64-setTempRet0.fromasm
index 52710e5cc..c0fe551c8 100644
--- a/test/i64-setTempRet0.fromasm
+++ b/test/i64-setTempRet0.fromasm
@@ -4,7 +4,7 @@
(import "env" "illegalImportResult" (func $illegalImportResult (result i64)))
(import "env" "illegalImportResult" (func $legalimport$illegalImportResult (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(data (get_global $memoryBase) "i64-setTempRet0.asm.js")
diff --git a/test/i64-setTempRet0.fromasm.imprecise b/test/i64-setTempRet0.fromasm.imprecise
index 6151e53d4..ca78b824b 100644
--- a/test/i64-setTempRet0.fromasm.imprecise
+++ b/test/i64-setTempRet0.fromasm.imprecise
@@ -4,7 +4,7 @@
(import "env" "illegalImportResult" (func $illegalImportResult (result i64)))
(import "env" "illegalImportResult" (func $legalimport$illegalImportResult (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(global $tempRet0 (mut i32) (i32.const 0))
diff --git a/test/i64-setTempRet0.fromasm.imprecise.no-opts b/test/i64-setTempRet0.fromasm.imprecise.no-opts
index 7d8ea6e3a..3c26a29bd 100644
--- a/test/i64-setTempRet0.fromasm.imprecise.no-opts
+++ b/test/i64-setTempRet0.fromasm.imprecise.no-opts
@@ -4,7 +4,7 @@
(import "env" "illegalImportResult" (func $illegalImportResult (result i64)))
(import "env" "illegalImportResult" (func $legalimport$illegalImportResult (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(global $tempRet0 (mut i32) (i32.const 0))
diff --git a/test/i64-setTempRet0.fromasm.no-opts b/test/i64-setTempRet0.fromasm.no-opts
index 7d8ea6e3a..3c26a29bd 100644
--- a/test/i64-setTempRet0.fromasm.no-opts
+++ b/test/i64-setTempRet0.fromasm.no-opts
@@ -4,7 +4,7 @@
(import "env" "illegalImportResult" (func $illegalImportResult (result i64)))
(import "env" "illegalImportResult" (func $legalimport$illegalImportResult (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(global $tempRet0 (mut i32) (i32.const 0))
diff --git a/test/min.fromasm b/test/min.fromasm
index 0ce8573af..96a40e52b 100644
--- a/test/min.fromasm
+++ b/test/min.fromasm
@@ -1,7 +1,7 @@
(module
(import "env" "tempDoublePtr" (global $tDP$asm2wasm$import i32))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(data (get_global $memoryBase) "min.asm.js")
diff --git a/test/min.fromasm.imprecise b/test/min.fromasm.imprecise
index 30f58d884..219c77609 100644
--- a/test/min.fromasm.imprecise
+++ b/test/min.fromasm.imprecise
@@ -1,7 +1,7 @@
(module
(import "env" "tempDoublePtr" (global $tDP$asm2wasm$import i32))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(global $tDP (mut i32) (get_global $tDP$asm2wasm$import))
diff --git a/test/min.fromasm.imprecise.no-opts b/test/min.fromasm.imprecise.no-opts
index 8244c4c70..b6c55dd2d 100644
--- a/test/min.fromasm.imprecise.no-opts
+++ b/test/min.fromasm.imprecise.no-opts
@@ -1,7 +1,7 @@
(module
(import "env" "tempDoublePtr" (global $tDP$asm2wasm$import i32))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(global $tDP (mut i32) (get_global $tDP$asm2wasm$import))
diff --git a/test/min.fromasm.no-opts b/test/min.fromasm.no-opts
index 8244c4c70..b6c55dd2d 100644
--- a/test/min.fromasm.no-opts
+++ b/test/min.fromasm.no-opts
@@ -1,7 +1,7 @@
(module
(import "env" "tempDoublePtr" (global $tDP$asm2wasm$import i32))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(global $tDP (mut i32) (get_global $tDP$asm2wasm$import))
diff --git a/test/two_sides.fromasm b/test/two_sides.fromasm
index 8b8886727..2b9bcaf46 100644
--- a/test/two_sides.fromasm
+++ b/test/two_sides.fromasm
@@ -2,7 +2,7 @@
(type $FUNCSIG$id (func (param f64) (result i32)))
(import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(data (get_global $memoryBase) "two_sides.asm.js")
diff --git a/test/two_sides.fromasm.imprecise b/test/two_sides.fromasm.imprecise
index f0b5af618..386e2ebd9 100644
--- a/test/two_sides.fromasm.imprecise
+++ b/test/two_sides.fromasm.imprecise
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "_test" (func $_test))
diff --git a/test/two_sides.fromasm.imprecise.no-opts b/test/two_sides.fromasm.imprecise.no-opts
index 6c489599c..2abda5dca 100644
--- a/test/two_sides.fromasm.imprecise.no-opts
+++ b/test/two_sides.fromasm.imprecise.no-opts
@@ -1,6 +1,6 @@
(module
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "_test" (func $_test))
diff --git a/test/two_sides.fromasm.no-opts b/test/two_sides.fromasm.no-opts
index 46d36938a..f49fc79b3 100644
--- a/test/two_sides.fromasm.no-opts
+++ b/test/two_sides.fromasm.no-opts
@@ -2,7 +2,7 @@
(type $FUNCSIG$id (func (param f64) (result i32)))
(import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "_test" (func $_test))
diff --git a/test/wasm-only.fromasm b/test/wasm-only.fromasm
index a2c335b1c..64a30a03b 100644
--- a/test/wasm-only.fromasm
+++ b/test/wasm-only.fromasm
@@ -8,7 +8,7 @@
(import "env" "illegalImport" (func $legalimport$illegalImport (param f64 i32 i32 i32)))
(import "env" "illegalImportResult" (func $legalimport$illegalImportResult (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(data (get_global $memoryBase) "wasm-only.asm.js")
diff --git a/test/wasm-only.fromasm.imprecise b/test/wasm-only.fromasm.imprecise
index 8a9115ff9..77dc70050 100644
--- a/test/wasm-only.fromasm.imprecise
+++ b/test/wasm-only.fromasm.imprecise
@@ -8,7 +8,7 @@
(import "env" "illegalImport" (func $legalimport$illegalImport (param f64 i32 i32 i32)))
(import "env" "illegalImportResult" (func $legalimport$illegalImportResult (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "test64" (func $test64))
diff --git a/test/wasm-only.fromasm.imprecise.no-opts b/test/wasm-only.fromasm.imprecise.no-opts
index c2000c5b1..51b93cf67 100644
--- a/test/wasm-only.fromasm.imprecise.no-opts
+++ b/test/wasm-only.fromasm.imprecise.no-opts
@@ -8,7 +8,7 @@
(import "env" "illegalImport" (func $legalimport$illegalImport (param f64 i32 i32 i32)))
(import "env" "illegalImportResult" (func $legalimport$illegalImportResult (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "test64" (func $test64))
diff --git a/test/wasm-only.fromasm.no-opts b/test/wasm-only.fromasm.no-opts
index 43b9ba4cd..4d52a2eab 100644
--- a/test/wasm-only.fromasm.no-opts
+++ b/test/wasm-only.fromasm.no-opts
@@ -8,7 +8,7 @@
(import "env" "illegalImport" (func $legalimport$illegalImport (param f64 i32 i32 i32)))
(import "env" "illegalImportResult" (func $legalimport$illegalImportResult (result i32)))
(import "env" "memory" (memory $0 256 256))
- (import "env" "table" (table 0 anyfunc))
+ (import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
(export "test64" (func $test64))