diff options
Diffstat (limited to 'src/js/wasm.js-post.js')
-rw-r--r-- | src/js/wasm.js-post.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index 3d476c62d..12e9e5315 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -236,14 +236,19 @@ function integrateWasmJS(Module) { } else { code = Module['read'](method == 'asm2wasm' ? asmjsCodeFile : wasmTextFile); } - var temp = wasmJS['_malloc'](code.length + 1); - wasmJS['writeAsciiToMemory'](code, temp); + var temp; if (method == 'asm2wasm') { + temp = wasmJS['_malloc'](code.length + 1); + wasmJS['writeAsciiToMemory'](code, temp); wasmJS['_load_asm2wasm'](temp); } else if (method === 'wasm-s-parser') { + temp = wasmJS['_malloc'](code.length + 1); + wasmJS['writeAsciiToMemory'](code, temp); wasmJS['_load_s_expr2wasm'](temp); } else if (method === 'wasm-binary') { - wasmJS['_load_binary2wasm'](temp); + temp = wasmJS['_malloc'](code.length); + wasmJS['HEAPU8'].set(code, temp); + wasmJS['_load_binary2wasm'](temp, code.length); } else { throw 'what? ' + method; } |