diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-08-16 09:40:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-16 09:40:59 -0700 |
commit | e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb (patch) | |
tree | 834f67d6ebaf295af0e1d6789bc7f52d120dff33 /src/asm2wasm.h | |
parent | e268d939b86d8639d014b8036e7664d66b6a32e9 (diff) | |
parent | 7851e3a7a3bea679f422116862c5801f1938806d (diff) | |
download | binaryen-e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb.tar.gz binaryen-e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb.tar.bz2 binaryen-e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb.zip |
Merge pull request #668 from WebAssembly/tables_n_memories
Tables and memories
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r-- | src/asm2wasm.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index c0f13ff8f..a5754f725 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -660,12 +660,17 @@ 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. - functionTableStarts[name] = wasm.table.names.size(); // this table starts here + if (wasm.table.segments.size() == 0) { + wasm.table.segments.emplace_back(wasm.allocator.alloc<Const>()->set(Literal(uint32_t(0)))); + } + auto& segment = wasm.table.segments[0]; + functionTableStarts[name] = segment.data.size(); // this table starts here Ref contents = value[1]; for (unsigned k = 0; k < contents->size(); k++) { IString curr = contents[k][1]->getIString(); - wasm.table.names.push_back(curr); + segment.data.push_back(curr); } + wasm.table.initial = wasm.table.max = segment.data.size(); } else { abort_on("invalid var element", pair); } |