diff options
-rw-r--r-- | src/js/wasm.js-post.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index cc1f29c10..58e4c75cd 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -223,13 +223,6 @@ function integrateWasmJS(Module) { env['memory'] = providedBuffer; assert(env['memory'] instanceof ArrayBuffer); - if (!('memoryBase' in env)) { - env['memoryBase'] = STATIC_BASE; // tell the memory segments where to place themselves - } - if (!('tableBase' in env)) { - env['tableBase'] = 0; // tell the memory segments where to place themselves - } - wasmJS['providedTotalMemory'] = Module['buffer'].byteLength; // Prepare to generate wasm, using either asm2wasm or s-exprs @@ -297,6 +290,13 @@ function integrateWasmJS(Module) { env['table'] = new Array(TABLE_SIZE); // works in binaryen interpreter at least } } + + if (!env['memoryBase']) { + env['memoryBase'] = STATIC_BASE; // tell the memory segments where to place themselves + } + if (!env['tableBase']) { + env['tableBase'] = 0; // table starts at 0 by default, in dynamic linking this will change + } // try the methods. each should return the exports if it succeeded |