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/wasm-builder.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/wasm-builder.h') diff --git a/src/wasm-builder.h b/src/wasm-builder.h index bb37ed340..6fc5c4dda 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -78,6 +78,16 @@ public: return func; } + static std::unique_ptr + makeTable(Name name, Address initial = 0, Address max = Table::kMaxSize) { + auto table = std::make_unique
(); + table->name = name; + table->initial = initial; + table->max = max; + + return table; + } + static std::unique_ptr makeExport(Name name, Name value, ExternalKind kind) { auto export_ = std::make_unique(); @@ -244,11 +254,13 @@ public: return call; } template - CallIndirect* makeCallIndirect(Expression* target, + CallIndirect* makeCallIndirect(const Name table, + Expression* target, const T& args, Signature sig, bool isReturn = false) { auto* call = wasm.allocator.alloc(); + call->table = table; call->sig = sig; call->type = sig.results; call->target = target; -- cgit v1.2.3