From 5c19367f08d59d0edb17f7acdafe122e1d10e2a6 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 28 Nov 2015 19:02:38 -0800 Subject: optionally emit mappedGlobals in asm2wasm, and use that to help when parsing s-expressions --- src/js/post.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/js') diff --git a/src/js/post.js b/src/js/post.js index 4377ed797..2ef25e30c 100644 --- a/src/js/post.js +++ b/src/js/post.js @@ -84,6 +84,9 @@ function integrateWasmJS(Module) { Module['asm'] = function(global, env, providedBuffer) { assert(providedBuffer === Module['buffer']); // we should not even need to pass it as a 3rd arg for wasm, but that's the asm.js way. + info.global = global; + info.env = env; + // wasm code would create its own buffer, at this time. But static init code might have // written to the buffer already, and we must copy it over. We could just avoid // this copy in wasm.js polyfilling, but to be as close as possible to real wasm, @@ -112,16 +115,12 @@ function integrateWasmJS(Module) { if (method == 'asm2wasm') { wasmJS['_load_asm2wasm'](temp); } else { - wasmJS['_load_s_expr2wasm'](temp); + wasmJS['_load_s_expr2wasm'](temp, Module['read'](Module['wasmCodeFile'] + '.mappedGlobals')); } wasmJS['_free'](temp); wasmJS['_instantiate'](temp); - // write the provided data to a location the wasm instance can get at it. - info.global = global; - info.env = env; - wasmJS['_load_mapped_globals'](); // now that we have global and env, we can ready the provided imported globals, copying them to their mapped locations. return wasmJS['asmExports']; }; } -- cgit v1.2.3