Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/compiler/iroptimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,21 @@ class IROptimizer {
return this.analyzeStack(stack, state) || modified;
}

let iterations = 0;
let modified = false;
let keepLooping;
do {
// If we are stuck in an apparent infinite loop, give up and assume the worst.
if (iterations > 10000) {
console.error('analyzeLoopedStack stuck in likely infinite loop; quitting', block, state);
modified = state.clear();
block.entryState = state.clone();
block.exitState = state.clone();
modified = this.analyzeInputs(block.inputs, state) || modified;
return this.analyzeStack(stack, state) || modified;
}
iterations++;

const newState = state.clone();
modified = this.analyzeStack(stack, newState) || modified;
modified = (keepLooping = state.or(newState)) || modified;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// TW Snapshot
// Input SHA-256: a12680688ca945364abe1e094b35cf53326f70189cb09b58d5f52b4de0c3b2a9

// Text script
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
const b0 = runtime.getOpcodeFunction("looks_say");
return function* genXYZ () {
yield* executeInCompatibilityLayer({"MESSAGE":"plan 0",}, b0, false, false, "a~", null);
thread.procedures["Wtest 1"]();
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "dh", null);
retire(); return;
}; })

// Text Wtest 1
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
const b0 = target.variables["ts-.PQ{/]mN_9@MbG:m/"];
return function funXYZ_test_1 () {
for (var a0 = (+thread.procedures["Wany procedure reporter"]() || 0); a0 >= 0.5; a0--) {
b0.value = ((+b0.value || 0) + 1);
}
return "";
}; })

// Text Wany procedure reporter
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
return function funXYZ_any_procedure_report () {
return 0;
return "";
}; })
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// TW Snapshot
// Input SHA-256: a12680688ca945364abe1e094b35cf53326f70189cb09b58d5f52b4de0c3b2a9

// Text script
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
const b0 = runtime.getOpcodeFunction("looks_say");
return function* genXYZ () {
yield* executeInCompatibilityLayer({"MESSAGE":"plan 0",}, b0, false, false, "a~", null);
yield* thread.procedures["Wtest 1"]();
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "dh", null);
retire(); return;
}; })

// Text Wtest 1
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
const b0 = target.variables["ts-.PQ{/]mN_9@MbG:m/"];
return function* genXYZ_test_1 () {
for (var a0 = (+thread.procedures["Wany procedure reporter"]() || 0); a0 >= 0.5; a0--) {
b0.value = ((+b0.value || 0) + 1);
if (isStuck()) yield;
}
return "";
}; })

// Text Wany procedure reporter
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
return function funXYZ_any_procedure_report () {
return 0;
return "";
}; })