summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h5
1 files changed, 4 insertions, 1 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))));
}