From 6e04c61c78cdf8196b6944c290041611d1f68d2d Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 11 Oct 2016 14:48:12 -0700 Subject: if we see no asm.js function tables, the table size is 0 --- src/asm2wasm.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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()->set(Literal(uint32_t(0)))); } -- cgit v1.2.3