summaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-10-11 13:51:34 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-10-11 15:01:04 -0700
commita3dc8bf8cba7cd1b5ece8abf0489a9dcacfa3f2e (patch)
treef49dc9cba3328a4dc2e04425e88c001efec3d3c1 /src/js
parent5e3f26285100854cead459effe409e250a6b4d2f (diff)
downloadbinaryen-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.js14
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