diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-10-11 13:51:34 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-10-11 15:01:04 -0700 |
commit | a3dc8bf8cba7cd1b5ece8abf0489a9dcacfa3f2e (patch) | |
tree | f49dc9cba3328a4dc2e04425e88c001efec3d3c1 /src/js | |
parent | 5e3f26285100854cead459effe409e250a6b4d2f (diff) | |
download | binaryen-a3dc8bf8cba7cd1b5ece8abf0489a9dcacfa3f2e.tar.gz binaryen-a3dc8bf8cba7cd1b5ece8abf0489a9dcacfa3f2e.tar.bz2 binaryen-a3dc8bf8cba7cd1b5ece8abf0489a9dcacfa3f2e.zip |
refactor memoryBase and tableBase init to a shared location, so it affects native builds too
Diffstat (limited to 'src/js')
-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 |