diff --git a/src/compiler/jsexecute.js b/src/compiler/jsexecute.js index 2eea0d89..22ae82ff 100644 --- a/src/compiler/jsexecute.js +++ b/src/compiler/jsexecute.js @@ -134,13 +134,12 @@ const waitPromise = function*(promise) { return returnValue; }; -const executeInCompatibilityLayer = function*(inputs, blockFunction, useFlags) { +const executeInCompatibilityLayer = function*(inputs, blockFunction, isWarp, useFlags) { const thread = globalState.thread; // reset the stackframe // we only ever use one stackframe at a time, so this shouldn't cause issues - // we assume warp mode is disabled; it doesn't actually matter what we set it to - thread.stackFrames[thread.stackFrames.length - 1].reuse(false); + thread.stackFrames[thread.stackFrames.length - 1].reuse(isWarp); const executeBlock = () => { const compatibilityLayerBlockUtility = globalState.compatibilityLayerBlockUtility; @@ -171,7 +170,7 @@ const executeInCompatibilityLayer = function*(inputs, blockFunction, useFlags) { if (thread.status === 2 /* STATUS_YIELD */) { thread.status = 0; // STATUS_RUNNING // Yield back to the event loop when stuck or not in warp mode. - if (thread.warp === 0 || isStuck()) { + if (!isWarp || isStuck()) { yield; } } else { diff --git a/src/compiler/jsgen.js b/src/compiler/jsgen.js index 954df6f3..213b2b5b 100644 --- a/src/compiler/jsgen.js +++ b/src/compiler/jsgen.js @@ -1159,7 +1159,7 @@ class JSGenerator { result += `"${sanitize(fieldName)}":"${sanitize(field)}",`; } const opcodeFunction = this.evaluateOnce(`runtime.getOpcodeFunction("${sanitize(opcode)}")`); - result += `}, ${opcodeFunction}, ${setFlags})`; + result += `}, ${opcodeFunction}, ${this.isWarp}, ${setFlags})`; return result; }