summaryrefslogtreecommitdiff
path: root/src/wasm-builder.h
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/wasm-builder.h
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/wasm-builder.h')
-rw-r--r--src/wasm-builder.h14
1 files changed, 13 insertions, 1 deletions
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<Table>
+ makeTable(Name name, Address initial = 0, Address max = Table::kMaxSize) {
+ auto table = std::make_unique<Table>();
+ table->name = name;
+ table->initial = initial;
+ table->max = max;
+
+ return table;
+ }
+
static std::unique_ptr<Export>
makeExport(Name name, Name value, ExternalKind kind) {
auto export_ = std::make_unique<Export>();
@@ -244,11 +254,13 @@ public:
return call;
}
template<typename T>
- CallIndirect* makeCallIndirect(Expression* target,
+ CallIndirect* makeCallIndirect(const Name table,
+ Expression* target,
const T& args,
Signature sig,
bool isReturn = false) {
auto* call = wasm.allocator.alloc<CallIndirect>();
+ call->table = table;
call->sig = sig;
call->type = sig.results;
call->target = target;