diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-08-19 09:49:38 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-09-07 09:55:03 -0700 |
commit | 266e922cddf0a5c78ed22f046eeebc053a9305c0 (patch) | |
tree | 2dec707b00304b1a6c888efb8f2c1b9a19ce38f3 /src/js/wasm.js-post.js | |
parent | 9660c200eff60c10266a85aae0637b495c4cba39 (diff) | |
download | binaryen-266e922cddf0a5c78ed22f046eeebc053a9305c0.tar.gz binaryen-266e922cddf0a5c78ed22f046eeebc053a9305c0.tar.bz2 binaryen-266e922cddf0a5c78ed22f046eeebc053a9305c0.zip |
use globals in asm2wasm
Diffstat (limited to 'src/js/wasm.js-post.js')
-rw-r--r-- | src/js/wasm.js-post.js | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index ae42ef175..1c207b3f3 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -123,26 +123,6 @@ function integrateWasmJS(Module) { f64: 4 }; - // wasm lacks globals, so asm2wasm maps them into locations in memory. that information cannot - // be present in the wasm output of asm2wasm, so we store it in a side file. If we load asm2wasm - // output, either generated ahead of time or on the client, we need to apply those mapped - // globals after loading the module. - function applyMappedGlobals(globalsFileBase) { - var mappedGlobals = JSON.parse(Module['read'](globalsFileBase + '.mappedGlobals')); - for (var name in mappedGlobals) { - var global = mappedGlobals[name]; - if (!global.import) continue; // non-imports are initialized to zero in the typed array anyhow, so nothing to do here - var value = lookupImport(global.module, global.base); - var address = global.address; - switch (global.type) { - case WasmTypes.i32: Module['HEAP32'][address >> 2] = value; break; - case WasmTypes.f32: Module['HEAPF32'][address >> 2] = value; break; - case WasmTypes.f64: Module['HEAPF64'][address >> 3] = value; break; - default: abort(); - } - } - } - function fixImports(imports) { if (!{{{ WASM_BACKEND }}}) return imports; var ret = {}; @@ -208,8 +188,6 @@ function integrateWasmJS(Module) { exports = instance.exports; mergeMemory(exports.memory); - applyMappedGlobals(wasmBinaryFile); - Module["usingWasm"] = true; return exports; @@ -271,12 +249,6 @@ function integrateWasmJS(Module) { Module['newBuffer'] = null; } - if (method == 'interpret-s-expr') { - applyMappedGlobals(wasmTextFile); - } else if (method == 'interpret-binary') { - applyMappedGlobals(wasmBinaryFile); - } - exports = wasmJS['asmExports']; return exports; |