diff --git a/jelly-bf-sync.js b/jelly-bf-sync.js index 37440c2..4c5ce2a 100644 --- a/jelly-bf-sync.js +++ b/jelly-bf-sync.js @@ -1,6 +1,6 @@ var JellyBFSync={ compile:function(str,options){ - return WebAssembly.Module(JellyBFCompiler.compile(str,options)); + return new WebAssembly.Module(JellyBFCompiler.compile(str,options)); }, execute:function(module,inputuint8array,options){ options.eof_value=options.eof_value||0; @@ -17,7 +17,7 @@ var JellyBFSync={ var put_output=function(byte){ outputdata.push(byte); }; - var instance=WebAssembly.Instance(module,{ + var instance=new WebAssembly.Instance(module,{ interaction:{ input:get_input, output:put_output @@ -70,7 +70,7 @@ var JellyBFSync={ Atomics.store(outputwaitint32array,WaitArrayId.TERMINATED_FLAG,1); Atomics.store(outputwaitint32array,WaitArrayId.WRITE_HEAD,output_write_head+1); }; - var instance=WebAssembly.Instance(module,{ + var instance=new WebAssembly.Instance(module,{ interaction:{ input:get_input, output:put_output diff --git a/jelly-bf-worker.max.js b/jelly-bf-worker.max.js index 67f9c90..07c8351 100644 --- a/jelly-bf-worker.max.js +++ b/jelly-bf-worker.max.js @@ -1542,7 +1542,7 @@ var JellyBF_CloseAndAttemptUnrollLoop = function(codeChunks, options) { var JellyBFSync = { compile: function(str, options) { - return WebAssembly.Module(JellyBFCompiler.compile(str, options)); + return new WebAssembly.Module(JellyBFCompiler.compile(str, options)); }, execute: function(module, inputuint8array, options) { options.eof_value = options.eof_value || 0; @@ -1558,7 +1558,7 @@ var JellyBFSync = { var put_output = function(byte) { outputdata.push(byte); }; - var instance = WebAssembly.Instance(module, { + var instance = new WebAssembly.Instance(module, { interaction: { input: get_input, output: put_output @@ -1609,7 +1609,7 @@ var JellyBFSync = { Atomics.store(outputwaitint32array, WaitArrayId.TERMINATED_FLAG, 1); Atomics.store(outputwaitint32array, WaitArrayId.WRITE_HEAD, output_write_head + 1); }; - var instance = WebAssembly.Instance(module, { + var instance = new WebAssembly.Instance(module, { interaction: { input: get_input, output: put_output diff --git a/main.js b/main.js index e11b850..79b6156 100644 --- a/main.js +++ b/main.js @@ -31,8 +31,7 @@ window.addEventListener("load",function(){ }; var compile=function(worker,sourcecode,options,callback){ - var module=new Uint8Array(100); - worker.postMessage({type:"compile",sourcecode:sourcecode,options:options,module:module},[module.buffer]); + worker.postMessage({type:"compile",sourcecode:sourcecode,options:options}); wait_for_message(worker,"compiled",function(message){ callback(); });