From 3da8b08ecd57f5662bebc69ea73bf59e1928341e Mon Sep 17 00:00:00 2001 From: Abbas Mashayekh Date: Wed, 10 Feb 2021 01:17:28 +0330 Subject: [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. --- src/tools/wasm-split.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/tools/wasm-split.cpp') 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) { -- cgit v1.2.3