summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index e27c5d9e2..0cb9b8dbe 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -840,6 +840,29 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
tableImport->base = TABLE;
tableImport->kind = Import::Table;
wasm.addImport(tableImport.release());
+
+ // Import memory offset
+ {
+ auto* import = new Import;
+ import->name = Name("memoryBase");
+ import->module = Name("env");
+ import->base = Name("memoryBase");
+ import->kind = Import::Global;
+ import->globalType = i32;
+ wasm.addImport(import);
+ }
+
+ // Import table offset
+ {
+ auto* import = new Import;
+ import->name = Name("tableBase");
+ import->module = Name("env");
+ import->base = Name("tableBase");
+ import->kind = Import::Global;
+ import->globalType = i32;
+ wasm.addImport(import);
+ }
+
#endif
#if 0 // enable asm2wasm i64 optimizations when browsers have consistent i64 support in wasm