summaryrefslogtreecommitdiff
path: root/src/tools/wasm-split.cpp
diff options
context:
space:
mode:
authorAbbas Mashayekh <martianboy2005@gmail.com>2021-02-10 01:17:28 +0330
committerGitHub <noreply@github.com>2021-02-09 13:47:28 -0800
commit3da8b08ecd57f5662bebc69ea73bf59e1928341e (patch)
tree2902eedc161579eaf37a1aed463de95916eee703 /src/tools/wasm-split.cpp
parenta12a8250da24aa5b5787bf89562b243fdc514302 (diff)
downloadbinaryen-3da8b08ecd57f5662bebc69ea73bf59e1928341e.tar.gz
binaryen-3da8b08ecd57f5662bebc69ea73bf59e1928341e.tar.bz2
binaryen-3da8b08ecd57f5662bebc69ea73bf59e1928341e.zip
[reference-types] remove single table restriction in IR (#3517)
Adds support for modules with multiple tables. Adds a field for the table name to `CallIndirect` and updates the C/JS APIs accordingly.
Diffstat (limited to 'src/tools/wasm-split.cpp')
-rw-r--r--src/tools/wasm-split.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/tools/wasm-split.cpp b/src/tools/wasm-split.cpp
index 5b44e5f0e..171774d82 100644
--- a/src/tools/wasm-split.cpp
+++ b/src/tools/wasm-split.cpp
@@ -472,18 +472,21 @@ void adjustTableSize(Module& wasm, int initialSize) {
if (initialSize < 0) {
return;
}
- if (!wasm.table.exists) {
+ if (wasm.tables.empty()) {
Fatal() << "--initial-table used but there is no table";
}
- if ((uint64_t)initialSize < wasm.table.initial) {
+
+ auto& table = wasm.tables.front();
+
+ if ((uint64_t)initialSize < table->initial) {
Fatal() << "Specified initial table size too small, should be at least "
- << wasm.table.initial;
+ << table->initial;
}
- if ((uint64_t)initialSize > wasm.table.max) {
+ if ((uint64_t)initialSize > table->max) {
Fatal() << "Specified initial table size larger than max table size "
- << wasm.table.max;
+ << table->max;
}
- wasm.table.initial = initialSize;
+ table->initial = initialSize;
}
void instrumentModule(Module& wasm, const WasmSplitOptions& options) {