diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-10-11 14:48:12 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-10-11 15:01:04 -0700 |
commit | 6e04c61c78cdf8196b6944c290041611d1f68d2d (patch) | |
tree | 569b0a1c4027c8429d4b1e43a1050bd505fbd594 /src/asm2wasm.h | |
parent | 1e783f3e96f904b88b692522de04f786feaf41a0 (diff) | |
download | binaryen-6e04c61c78cdf8196b6944c290041611d1f68d2d.tar.gz binaryen-6e04c61c78cdf8196b6944c290041611d1f68d2d.tar.bz2 binaryen-6e04c61c78cdf8196b6944c290041611d1f68d2d.zip |
if we see no asm.js function tables, the table size is 0
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r-- | src/asm2wasm.h | 5 |
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)))); } |