diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index e9642204..ca14d750 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project now adheres to [Semantic Versioning](https://semver.org/). +## 3.1.0 - Future release + +### Experimental features + +* Added the "backpropagation" optimization to Data Flow Optimization (closes [#151](https://github.com/cardillan/mindcode/issues/151)). + ## 3.0.0 - 2025-01-26 ### Fixed diff --git a/compiler/src/main/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowOptimizer.java b/compiler/src/main/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowOptimizer.java index ca2ee554..1f70a356 100644 --- a/compiler/src/main/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowOptimizer.java +++ b/compiler/src/main/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowOptimizer.java @@ -10,6 +10,7 @@ import info.teksol.mc.mindcode.compiler.postprocess.LogicInstructionPrinter; import info.teksol.mc.mindcode.logic.arguments.*; import info.teksol.mc.mindcode.logic.instructions.*; +import info.teksol.mc.mindcode.logic.opcodes.Opcode; import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; @@ -54,6 +55,11 @@ class DataFlowOptimizer extends BaseOptimizer { /// Instructions referencing each variable. References are accumulated (not cleared during single pass). final Map> references = new HashMap<>(); + /// Holds the variables defined by an instruction, and other instructions using that variable. + /// If there's just one such reference, and this reference is a Set instruction, the target of the Set can be + /// injected into the definition. + final Map>> definitionReferences = new IdentityHashMap<>(); + /// When a jump outside its context is encountered, current variable state is copied and assigned to the target /// label. Upon encountering the target label all stored states are merged and flushed. /// Unresolved label indicates a problem in the data flow analysis -- this would happen if the jump targeted an @@ -66,11 +72,18 @@ class DataFlowOptimizer extends BaseOptimizer { /// An instance used for variable states processing private final DataFlowVariableStates dataFlowVariableStates; + /// Instruction counter; in encountered order + private int counter = 0; + public DataFlowOptimizer(OptimizationContext optimizationContext) { super(Optimization.DATA_FLOW_OPTIMIZATION, optimizationContext); dataFlowVariableStates = new DataFlowVariableStates(this); } + int getCounter() { + return counter; + } + @Override protected boolean optimizeProgram(OptimizationPhase phase) { defines.clear(); @@ -80,6 +93,7 @@ protected boolean optimizeProgram(OptimizationPhase phase) { uninitialized.clear(); replacements.clear(); references.clear(); + definitionReferences.clear(); labelStates.clear(); functionEndStates.clear(); @@ -89,6 +103,34 @@ protected boolean optimizeProgram(OptimizationPhase phase) { getRootContext().children().forEach(this::processTopContext); + if (experimental()) { + boolean updated = false; + for (LogicInstruction instruction : definitionReferences.keySet()) { + int index = instructionIndex(instruction); + if (index < 0) continue; + + Map> logicVariableListMap = definitionReferences.get(instruction); + for (LogicVariable variable : logicVariableListMap.keySet()) { + List<@Nullable LogicInstruction> list = logicVariableListMap.get(variable); + if (list.size() == 1 && list.getFirst() instanceof SetInstruction set && set.getValue().equals(variable)) { + if (!canEliminate(instruction, variable)) continue; + if (instruction.inputArgumentsStream().anyMatch(v -> v.equals(variable))) continue; + + int setIndex = instructionIndex(set); + if (setIndex >= 0) { + invalidateInstruction(setIndex); + replaceInstruction(index, replaceAllArgs(instruction, variable, set.getResult())); + updated = true; + } + } + } + } + + if (updated) { + return true; + } + } + // Keep defining instructions for orphaned, uninitialized variables. orphans.entrySet().stream() .filter(e -> uninitialized.contains(e.getKey())) @@ -707,8 +749,6 @@ private VariableStates resolveLabel(VariableStates variableStates, LogicLabel la return variableStates; } - private int counter = 0; - /// Processes a single instruction. /// /// @param variableStates variable states before executing the instruction @@ -721,8 +761,9 @@ private VariableStates processInstruction(VariableStates variableStates, LogicIn Objects.requireNonNull(variableStates); Objects.requireNonNull(instruction); + counter++; + if (TRACE) { - counter++; trace("*" + counter + " Processing instruction ix#" + instructionIndex(instruction) + ": " + LogicInstructionPrinter.toString(instructionProcessor, instruction)); @@ -844,6 +885,8 @@ public void addUninitialized(LogicVariable variable) { /// @return true if this assignment can be safely eliminated boolean canEliminate(LogicInstruction instruction, LogicVariable variable) { if (variable.isVolatile()) return false; + if (variable.getType() == ArgumentType.FUNCTION_RETVAL + && (instruction.getOpcode() == Opcode.CALL || instruction.getOpcode() == Opcode.CALLREC)) return false; return switch (variable.getType()) { case COMPILER, FUNCTION_RETADDR, PARAMETER -> false; diff --git a/compiler/src/main/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowVariableStates.java b/compiler/src/main/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowVariableStates.java index e280580b..e6ac3f9d 100644 --- a/compiler/src/main/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowVariableStates.java +++ b/compiler/src/main/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowVariableStates.java @@ -18,8 +18,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static info.teksol.mc.mindcode.compiler.astcontext.AstSubcontextType.PARAMETERS; -import static info.teksol.mc.mindcode.compiler.astcontext.AstSubcontextType.RECURSIVE_CALL; +import static info.teksol.mc.mindcode.compiler.astcontext.AstSubcontextType.*; import static info.teksol.mc.mindcode.compiler.optimization.OptimizationCoordinator.TRACE; @NullMarked @@ -59,7 +58,10 @@ class VariableStates { /// Maps variables to a list of instructions defining its current value (potentially more than one /// due to branching). - private final Map> definitions; + private final Map definitions; + + /// Maps variables to their last encountered read instruction position. + private final Map reads; /// Identifies instructions that do not have to be kept, because they set value the variable already had. /// Organized by variable for easier housekeeping. @@ -103,6 +105,7 @@ public VariableStates() { values = new LinkedHashMap<>(); definitions = new HashMap<>(); equivalences = new HashMap<>(); + reads = new HashMap<>(); useless = new HashMap<>(); initialized = new HashSet<>(); stored = new HashSet<>(); @@ -115,6 +118,7 @@ private VariableStates(VariableStates other, int id, boolean isolated, boolean r values = new LinkedHashMap<>(other.values); definitions = deepCopy(other.definitions); equivalences = new HashMap<>(other.equivalences); + reads = new HashMap<>(other.reads); useless = new HashMap<>(other.useless); initialized = new HashSet<>(other.initialized); stored = new HashSet<>(other.stored); @@ -126,9 +130,8 @@ private VariableStates(VariableStates other, int id, boolean isolated) { this(other, id, isolated, other.reachable); } - private static Map> deepCopy(Map> original) { - return original.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, - e -> new ArrayList<>(e.getValue()))); + private static Map deepCopy(Map original) { + return original.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,e -> e.getValue().copy())); } /// @return useless instructions, organized by variable they produce. @@ -183,7 +186,7 @@ public VariableStates setDead(boolean markRead) { definitions.entrySet().stream() .filter(e -> e.getKey().isMainVariable() || e.getKey().isGlobalVariable()) .forEachOrdered(e -> optimizer.orphans.computeIfAbsent(e.getKey(), - l -> new ArrayList<>()).addAll(e.getValue())); + l -> new ArrayList<>()).addAll(e.getValue().instructions)); } dead = true; modifications++; @@ -295,7 +298,8 @@ public void valueSet(LogicVariable variable, LogicInstruction instruction, @Null optimizer.defines.add(instruction); } initialized.add(variable); - definitions.put(variable, List.of(instruction)); + definitions.put(variable, new Definition(optimizer.getCounter(), List.of(instruction))); + reads.remove(variable); // Purge expressions based on the previous value of this variable invalidateVariable(variable); @@ -350,6 +354,7 @@ public void valueReset(LogicVariable variable) { } else { trace(() -> "Value reset: " + variable.toMlog()); values.remove(variable); + reads.remove(variable); invalidateVariable(variable); } } @@ -409,6 +414,8 @@ public void updateAfterFunctionCall(MindcodeFunction function, LogicInstruction modifications++; trace(() -> "Value read: " + variable.toMlog() + " (instance " + getId() + ")" + (ixReachable ? "" : " instruction unreachable)")); + reads.put(variable, optimizer.getCounter()); + // Do not report uninitialized reads in unreachable and dead states boolean report = reportUninitialized && !isolated && !dead && reachable && ixReachable; if (report && !initialized.contains(variable) && variable.getType() != ArgumentType.BLOCK) { @@ -417,16 +424,54 @@ public void updateAfterFunctionCall(MindcodeFunction function, LogicInstruction } if (definitions.containsKey(variable)) { + List definingInstructions = definitions.get(variable).instructions; if (TRACE) { trace("Definitions of " + variable.toMlog()); - trace(definitions.get(variable).stream().map(this::printInstruction)); + trace(definingInstructions.stream().map(this::printInstruction)); } // Variable value was read, keep all instructions that define its value if (!isolated && ixReachable) { if (TRACE) { - trace(definitions.get(variable).stream().map(ix -> "--> Keeping instruction: " + ix.toMlog() + " (variable read)")); + trace(definingInstructions.stream().map(ix -> "--> Keeping instruction: " + ix.toMlog() + " (variable read)")); + } + optimizer.keep.addAll(definingInstructions); + } + + // When a variable is read, we're storing information about that read with all defining instructions + // of that variable. When it is discovered that there's precisely one set instruction reading that variable, + // the target of the set instruction can be injected into the definition and the set instruction can be + // removed. + // + // However, this is no possible if the target of the set instruction has been read between the defining + // instruction and current instruction, since this would change the value of the target variable in that + // read. + // + // When the value is read by an instruction other than set, the information is recorded too, because + // it means the substitution cannot be made. + // + // Process: + // - all defining instructions are inspected + // - a valid reference is added when these conditions are met: + // - the referring instruction is a set instruction reading current variable + // - definition of the variable is known (it is, we're here) + // - definition of the variable is just one instruction (we're being safe) + // - the result of the set wasn't read after this variable was defined + // - the set is not part of for-each iterator setup + // - in the other case, an invalid reference is added + int defineIndex = definitions.get(variable).counter; + for (LogicInstruction definition : definingInstructions) { + LogicInstruction reference; + if (definingInstructions.size() == 1 && instruction instanceof SetInstruction set && set.getValue() == variable + && !set.getAstContext().matches(ITR_LEADING, ITR_TRAILING)) { + Integer readIndex = reads.get(set.getResult()); + reference = readIndex == null || readIndex < defineIndex ? instruction : null; + } else { + reference = null; } - optimizer.keep.addAll(definitions.get(variable)); + + optimizer.definitionReferences.computeIfAbsent(definition, key -> new HashMap<>()) + .computeIfAbsent(variable, v -> new ArrayList<>()).add(reference); + trace("Registering usage of " + variable.toMlog()); } } @@ -441,9 +486,9 @@ public void updateAfterFunctionCall(MindcodeFunction function, LogicInstruction public void protectVariable(LogicVariable variable) { if (definitions.containsKey(variable)) { if (TRACE) { - trace(definitions.get(variable).stream().map(ix -> "--> Keeping instruction: " + ix.toMlog() + " (variable protected)")); + trace(definitions.get(variable).instructions.stream().map(ix -> "--> Keeping instruction: " + ix.toMlog() + " (variable protected)")); } - optimizer.keep.addAll(definitions.get(variable)); + optimizer.keep.addAll(definitions.get(variable).instructions); } } @@ -487,6 +532,12 @@ public VariableStates merge(VariableStates other, boolean propagateUninitialized merge(definitions, other.definitions); + for (LogicVariable variable : other.reads.keySet()) { + if (!reads.containsKey(variable) || reads.get(variable) < other.reads.get(variable)) { + reads.put(variable, other.reads.get(variable)); + } + } + // Only keep values that are the same in both instances values.keySet().retainAll(other.values.keySet()); for (LogicVariable variable : other.values.keySet()) { @@ -525,23 +576,24 @@ public VariableStates merge(VariableStates other, boolean propagateUninitialized /// /// @param map1 instance to merge into /// @param map2 instance to be merged - private void merge(Map> map1, Map> map2) { + private void merge(Map map1, Map map2) { for (LogicVariable variable : map2.keySet()) { if (map1.containsKey(variable)) { - List current = map1.get(variable); - List theOther = map2.get(variable); - if (!sameInstances(current, theOther)) { + Definition current = map1.get(variable); + Definition theOther = map2.get(variable); + if (current.counter != theOther.counter || !sameInstances(current.instructions, theOther.instructions)) { // Merge the two lists - if (current.size() == 1 && theOther.size() == 1) { - ArrayList union = new ArrayList<>(); - union.add(current.getFirst()); - union.add(theOther.getFirst()); - map1.put(variable, union); + if (current.instructions.size() == 1 && theOther.instructions.size() == 1) { + map1.put(variable, new Definition( + Math.min(current.counter, theOther.counter), + List.of(current.instructions.getFirst(), theOther.instructions.getFirst()))); } else { - Set union = createIdentitySet(current.size() + theOther.size()); - union.addAll(current); - union.addAll(theOther); - map1.put(variable, new ArrayList<>(union)); + Set union = createIdentitySet(current.instructions.size() + theOther.instructions.size()); + union.addAll(current.instructions); + union.addAll(theOther.instructions); + map1.put(variable, new Definition( + Math.min(current.counter, theOther.counter), + List.copyOf(union))); } invalidateVariable(variable); } @@ -572,7 +624,7 @@ void print(String title) { values.values().forEach(v -> trace(" " + v)); definitions.forEach((k, v) -> { trace(" Definitions of " + k.toMlog()); - v.forEach(ix -> trace(" " + optimizer.instructionIndex(ix) + v.instructions.forEach(ix -> trace(" " + optimizer.instructionIndex(ix) + ": " + LogicInstructionPrinter.toString(instructionProcessor, ix))); }); equivalences.forEach((k, v) -> trace(" Equivalence: " + k.toMlog() + " = " + v.toMlog())); @@ -581,6 +633,10 @@ void print(String title) { } else { trace(" Initialized: " + initialized.stream().map(LogicVariable::toMlog).collect(Collectors.joining(", "))); } + if (!reads.isEmpty()) { + trace(" Reads:"); + reads.forEach((k, v) -> trace(" " + k.toMlog() + ": " + v)); + } } } } @@ -771,6 +827,27 @@ public String toString() { } } + static class Definition { + /// The instruction counter of this variable's definition + final int counter; + + /// List of defining instructions + final List instructions; + + public Definition(int counter, LogicInstruction instruction) { + this(counter, List.of(instruction)); + } + + public Definition(int counter, List instructions) { + this.counter = counter; + this.instructions = instructions; + } + + public Definition copy() { + return new Definition(counter, List.copyOf(instructions)); + } + } + private void trace(Stream text) { optimizationContext.trace(text); } diff --git a/compiler/src/main/java/info/teksol/mc/mindcode/logic/opcodes/MindustryOpcodeVariants.java b/compiler/src/main/java/info/teksol/mc/mindcode/logic/opcodes/MindustryOpcodeVariants.java index 59c749ee..356c70cb 100644 --- a/compiler/src/main/java/info/teksol/mc/mindcode/logic/opcodes/MindustryOpcodeVariants.java +++ b/compiler/src/main/java/info/teksol/mc/mindcode/logic/opcodes/MindustryOpcodeVariants.java @@ -316,10 +316,12 @@ private List initialize() { // Virtual instructions add(list, V6, MAX, S, NONE, Opcode.NOOP); add(list, V6, MAX, S, NONE, Opcode.LABEL, label("label")); + // MUSTDO retval is a side effect and needs to be handled as such add(list, V6, MAX, S, NONE, Opcode.CALL, label("callAddr"), out("retval")); add(list, V6, MAX, S, NONE, Opcode.RETURN, in("address")); add(list, V6, MAX, S, NONE, Opcode.PUSH, block("memory"), in("value")); add(list, V6, MAX, S, NONE, Opcode.POP, block("memory"), out("value")); + // MUSTDO retval is a side effect and needs to be handled as such add(list, V6, MAX, S, NONE, Opcode.CALLREC, block("memory"), label("callAddr"), label("retAddr"), out("retval")); add(list, V6, MAX, S, NONE, Opcode.RETURNREC, block("memory")); add(list, V6, MAX, S, NONE, Opcode.MULTILABEL, label("address"), label("marker")); diff --git a/compiler/src/test/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowOptimizerTest.java b/compiler/src/test/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowOptimizerTest.java index 192422c9..abf06ea5 100644 --- a/compiler/src/test/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowOptimizerTest.java +++ b/compiler/src/test/java/info/teksol/mc/mindcode/compiler/optimization/DataFlowOptimizerTest.java @@ -840,30 +840,30 @@ def foo(n, in out a, in out b) end; foo(10, in 1, in 2); """, - createInstruction(LABEL, var(1001)), - createInstruction(JUMP, var(1001), "equal", "bank1", "null"), + createInstruction(LABEL, label(1)), + createInstruction(JUMP, label(1), "equal", "bank1", "null"), createInstruction(SET, "*sp", "0"), createInstruction(SET, ":fn0:n", "10"), createInstruction(SET, ":fn0:a", "1"), createInstruction(SET, ":fn0:b", "2"), - createInstruction(CALLREC, "bank1", var(1000), var(1002), ":fn0*retval"), - createInstruction(LABEL, var(1002)), + createInstruction(CALLREC, "bank1", label(0), label(2), ":fn0*retval"), + createInstruction(LABEL, label(2)), createInstruction(END), - createInstruction(LABEL, var(1000)), - createInstruction(JUMP, var(1004), "notEqual", ":fn0:n", "0"), + createInstruction(LABEL, label(0)), + createInstruction(JUMP, label(4), "notEqual", ":fn0:n", "0"), createInstruction(SET, ":fn0:a", "5"), createInstruction(SET, ":fn0:b", "10"), createInstruction(RETURNREC, "bank1"), - createInstruction(LABEL, var(1004)), - createInstruction(SET, var(5), ":fn0:a"), + createInstruction(LABEL, label(4)), + createInstruction(SET, tmp(5), ":fn0:a"), createInstruction(OP, "sub", ":fn0:n", ":fn0:n", "1"), createInstruction(SET, ":fn0:a", ":fn0:b"), - createInstruction(SET, ":fn0:b", var(5)), - createInstruction(CALLREC, "bank1", var(1000), var(1006), ":fn0*retval"), - createInstruction(LABEL, var(1006)), - createInstruction(SET, var(7), ":fn0:b"), - createInstruction(SET, ":fn0:b", ":fn0:a"), - createInstruction(SET, ":fn0:a", var(7)), + createInstruction(SET, ":fn0:b", tmp(5)), + createInstruction(CALLREC, "bank1", label(0), label(6), ":fn0*retval"), + createInstruction(LABEL, label(6)), + createInstruction(SET, tmp(6), ":fn0:a"), + createInstruction(SET, ":fn0:a", ":fn0:b"), + createInstruction(SET, ":fn0:b", tmp(6)), createInstruction(RETURNREC, "bank1") ); } @@ -940,7 +940,7 @@ def foo(n) } @Test - public void preservesGlobalVariablesWithFunctionCalls() { + public void handlesGlobalVariablesWithFunctionCalls() { assertCompilesTo(""" inline def bar(n) foo(n); @@ -954,19 +954,18 @@ def foo(n) foo(X); bar(Y); """, - createInstruction(OP, "rand", ".X", "1000"), - createInstruction(OP, "rand", ".Y", "1000"), - createInstruction(SET, ":fn0:n", ".X"), - createInstruction(SETADDR, ":fn0*retaddr", var(1001)), - createInstruction(CALL, var(1000), ":fn0*retval"), - createInstruction(LABEL, var(1001)), - createInstruction(SET, ":fn0:n", ".Y"), - createInstruction(SETADDR, ":fn0*retaddr", var(1003)), - createInstruction(CALL, var(1000), ":fn0*retval"), - createInstruction(LABEL, var(1003)), - createInstruction(PRINT, ".Y"), + createInstruction(OP, "rand", ":fn0:n", "1000"), + createInstruction(OP, "rand", ":fn1:n", "1000"), + createInstruction(SETADDR, ":fn0*retaddr", label(1)), + createInstruction(CALL, label(0), ":fn0*retval"), + createInstruction(LABEL, label(1)), + createInstruction(SET, ":fn0:n", ":fn1:n"), + createInstruction(SETADDR, ":fn0*retaddr", label(3)), + createInstruction(CALL, label(0), ":fn0*retval"), + createInstruction(LABEL, label(3)), + createInstruction(PRINT, ":fn1:n"), createInstruction(END), - createInstruction(LABEL, var(1000)), + createInstruction(LABEL, label(0)), createInstruction(PRINT, ":fn0:n"), createInstruction(RETURN, ":fn0*retaddr") ); @@ -975,9 +974,9 @@ def foo(n) @Test public void preservesVariableStateAcrossPushAndPop() { // Explanation of the test: - // The recursive call foo(m, n - 1) modifies __fn0_n (it is set to n - 1 when passing new value to the recursive call) + // The recursive call foo(m, n - 1) modifies :fn0:n (it is set to n - 1 when passing new value to the recursive call) // Data Flow analysis of push/pop should determine the value of n remains unchanged after the call - // Because of this, it subsequently determines the __tmp1 variable in loop condition can be replaced by __fn0_n + // Because of this, it subsequently determines the __tmp1 variable in loop condition can be replaced by :fn0:n assertCompilesTo(""" allocate stack in bank1[0...512]; def foo(n) @@ -1009,9 +1008,9 @@ def foo(n) //@Test public void preservesVariableStateAcrossPushAndPopInLoop() { // Explanation of the test: - // The recursive call foo(m, n - 1) modifies __fn0_n (it is set to n - 1 when passing new value to the recursive call) + // The recursive call foo(m, n - 1) modifies :fn0:n (it is set to n - 1 when passing new value to the recursive call) // Data Flow analysis of push/pop should determine the value of n remains unchanged after the call - // Because of this, it subsequently determines the __tmp1 variable in loop condition can be replaced by __fn0_n + // Because of this, it subsequently determines the __tmp1 variable in loop condition can be replaced by :fn0:n // // TODO Data Flow analysis currently doesn't understand push/pop. Needs to implement a functionality to save // variable state on push and restore it on pop. Might be difficult, as invalidating a variable @@ -1027,24 +1026,24 @@ def foo(n) foo(10); """, createInstruction(SET, "__sp", "0"), - createInstruction(SET, "__fn0_n", "10"), - createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), + createInstruction(SET, ":fn0:n", "10"), + createInstruction(CALLREC, "bank1", var(1000), var(1001), ":fn0*retval"), createInstruction(LABEL, var(1001)), createInstruction(END), createInstruction(LABEL, var(1000)), - createInstruction(SET, "__fn0_i", "1"), - createInstruction(JUMP, var(1005), "greaterThan", "1", "__fn0_n"), + createInstruction(SET, ":fn0:i", "1"), + createInstruction(JUMP, var(1005), "greaterThan", "1", ":fn0:n"), createInstruction(LABEL, var(1007)), - createInstruction(PRINT, "__fn0_n"), - createInstruction(PUSH, "bank1", "__fn0_n"), - createInstruction(PUSH, "bank1", "__fn0_i"), - createInstruction(OP, "sub", "__fn0_n", "__fn0_n", "1"), - createInstruction(CALLREC, "bank1", var(1000), var(1006), "__fn0retval"), + createInstruction(PRINT, ":fn0:n"), + createInstruction(PUSH, "bank1", ":fn0:n"), + createInstruction(PUSH, "bank1", ":fn0:i"), + createInstruction(OP, "sub", ":fn0:n", ":fn0:n", "1"), + createInstruction(CALLREC, "bank1", var(1000), var(1006), ":fn0*retval"), createInstruction(LABEL, var(1006)), - createInstruction(POP, "bank1", "__fn0_i"), - createInstruction(POP, "bank1", "__fn0_n"), - createInstruction(OP, "add", "__fn0_i", "__fn0_i", "1"), - createInstruction(JUMP, var(1007), "lessThanEq", "__fn0_i", "__fn0_n"), + createInstruction(POP, "bank1", ":fn0:i"), + createInstruction(POP, "bank1", ":fn0:n"), + createInstruction(OP, "add", ":fn0:i", ":fn0:i", "1"), + createInstruction(JUMP, var(1007), "lessThanEq", ":fn0:i", ":fn0:n"), createInstruction(LABEL, var(1005)), createInstruction(RETURNREC, "bank1") ); @@ -1407,11 +1406,11 @@ inline def bar(n) end; bar(0); """, - createInstruction(SET, "__fn0_n", "0"), + createInstruction(SET, ":fn0:n", "0"), createInstruction(LABEL, var(1005)), - createInstruction(OP, "add", "__fn0_n", "__fn0_n", "1"), - createInstruction(PRINT, "__fn0_n"), - createInstruction(JUMP, var(1005), "lessThan", "__fn0_n", "1000") + createInstruction(OP, "add", ":fn0:n", ":fn0:n", "1"), + createInstruction(PRINT, ":fn0:n"), + createInstruction(JUMP, var(1005), "lessThan", ":fn0:n", "1000") ); } @@ -1423,8 +1422,8 @@ inline def bar(n) end; bar(@time); """, - createInstruction(SET, "__fn0_n", "@time"), - createInstruction(PRINT, "__fn0_n") + createInstruction(SET, ":fn0:n", "@time"), + createInstruction(PRINT, ":fn0:n") ); } } diff --git a/compiler/src/test/java/info/teksol/mc/mindcode/compiler/optimization/FunctionInlinerTest.java b/compiler/src/test/java/info/teksol/mc/mindcode/compiler/optimization/FunctionInlinerTest.java index 80898aed..fe758c37 100644 --- a/compiler/src/test/java/info/teksol/mc/mindcode/compiler/optimization/FunctionInlinerTest.java +++ b/compiler/src/test/java/info/teksol/mc/mindcode/compiler/optimization/FunctionInlinerTest.java @@ -55,11 +55,10 @@ void foo(a, out b) print(x, y); """, createInstruction(SET, "c", "10"), - createInstruction(OP, "mul", "__fn0_b", "c", "10"), - createInstruction(SET, "x", "__fn0_b"), - createInstruction(OP, "mul", "__fn0_b", "c", "20"), - createInstruction(PRINT, "x"), - createInstruction(PRINT, "__fn0_b") + createInstruction(OP, "mul", ":x", "c", "10"), + createInstruction(OP, "mul", ":fn0:b", "c", "20"), + createInstruction(PRINT, ":x"), + createInstruction(PRINT, ":fn0:b") ); } @@ -146,11 +145,10 @@ def foo() end; print(foo() + foo()); """, + createInstruction(OP, "rand", tmp(0), "10"), createInstruction(OP, "rand", ":fn0*retval", "10"), - createInstruction(SET, var(0), ":fn0*retval"), - createInstruction(OP, "rand", ":fn0*retval", "10"), - createInstruction(OP, "add", var(2), var(0), ":fn0*retval"), - createInstruction(PRINT, var(2)) + createInstruction(OP, "add", tmp(2), tmp(0), ":fn0*retval"), + createInstruction(PRINT, tmp(2)) ); } @@ -164,11 +162,10 @@ def foo(n) end; print(foo(10) + foo(20)); """, - createInstruction(OP, "rand", "__fn0_t", "10"), - createInstruction(SET, var(0), "__fn0_t"), - createInstruction(OP, "rand", "__fn0_t", "20"), - createInstruction(OP, "add", var(2), var(0), "__fn0_t"), - createInstruction(PRINT, var(2)) + createInstruction(OP, "rand", tmp(0), "10"), + createInstruction(OP, "rand", ":fn0*retval", "20"), + createInstruction(OP, "add", tmp(2), tmp(0), ":fn0*retval"), + createInstruction(PRINT, tmp(2)) ); } @@ -182,10 +179,10 @@ def foo() print(foo()); print(foo()); """, - createInstruction(OP, "rand", "__fn0_t", "10"), - createInstruction(PRINT, "__fn0_t"), - createInstruction(OP, "rand", "__fn0_t", "10"), - createInstruction(PRINT, "__fn0_t") + createInstruction(OP, "rand", ":fn0*retval", "10"), + createInstruction(PRINT, ":fn0*retval"), + createInstruction(OP, "rand", ":fn0*retval", "10"), + createInstruction(PRINT, ":fn0*retval") ); } diff --git a/compiler/src/test/java/info/teksol/mc/mindcode/tests/interceptor/AbstractInterceptorTest.java b/compiler/src/test/java/info/teksol/mc/mindcode/tests/interceptor/AbstractInterceptorTest.java index 75969d58..608d5108 100644 --- a/compiler/src/test/java/info/teksol/mc/mindcode/tests/interceptor/AbstractInterceptorTest.java +++ b/compiler/src/test/java/info/teksol/mc/mindcode/tests/interceptor/AbstractInterceptorTest.java @@ -22,7 +22,7 @@ @NullMarked public abstract class AbstractInterceptorTest extends AbstractProcessorTest { - private static final boolean INTERCEPT = false; + private static final boolean INTERCEPT = true; @Override protected void setDebugPrinterProvider(MindcodeCompiler compiler) { diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/algorithms/AlgorithmsTest.txt b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/algorithms/AlgorithmsTest.txt index ef939939..ea344ad0 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/algorithms/AlgorithmsTest.txt +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/algorithms/AlgorithmsTest.txt @@ -5,6 +5,6 @@ memory-read-write.mnd: 5 5 100.0% D953 sorting with bubble-sort.mnd: 27 15477 100.0% 09F1B1A6B8B97AF2 D7E3E9274B80F9C3 sorting with heap-sort.mnd: 54 64559 100.0% 0CEFC91051987EFB A429F791F6960D43 sorting with insert-sort.mnd: 27 26064 100.0% 0AF6F57A5EBA45E2 6C9899851FCF5DC7 -sorting with quick-sort.mnd: 67 48457 98.5% 8909AE66C1E5A20F 9F4AD013C4779EC9 +sorting with quick-sort.mnd: 66 48456 98.4% 8909AE66C1E5A20F 63D441052F939A6B sorting with select-sort.mnd: 30 35153 100.0% 3F4EE1C8DB9B8B18 5065B9B69217B56E storage-display.mnd: 655 776 24.5% F7D56DB08E60751D 8D3EFBC691094BDC diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/algorithms/quick-sort.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/algorithms/quick-sort.log index 14bd7407..8778bed1 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/algorithms/quick-sort.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/algorithms/quick-sort.log @@ -5,12 +5,12 @@ 6 instructions eliminated by Single Step Elimination (2 passes, 6 iterations). 3 instructions eliminated by Expression Optimization (2 passes, 3 iterations). 1 instructions eliminated by If Expression Optimization (3 iterations). - 19 instructions eliminated by Data Flow Optimization (2 passes, 7 iterations). + 20 instructions eliminated by Data Flow Optimization (2 passes, 8 iterations). 2 instructions modified by Loop Optimization (3 iterations). 2 loops improved by Loop Optimization. 1 instructions eliminated by Unreachable Code Elimination. 28 instructions eliminated by Stack Optimization. - 67 instructions after optimizations. + 66 instructions after optimizations. Modifications by Initial phase, Dead Code Elimination, iteration 1 (-10 instructions): @@ -203,20 +203,33 @@ Modifications by Iterated phase, Expression Optimization, pass 1, iteration 1 (- Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 instructions): - 13 jump *label5 greaterThanEq :i SIZE - 14 set *tmp2 :i - 15 set *tmp4 :i + 3 set *sp 0 + 4 set ARRAY bank2 + 5 set FINAL bank3 +- * op sub *tmp0 SIZE 1 ++ 6 op sub :fn0:right SIZE 1 + 7 set :fn0:left 0 +- * set :fn0:right *tmp0 + 8 callrec bank1 *label0 *label2 :fn0*retval + 9 label *label2 + 10 set :i 0 + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 instructions): + + 12 jump *label5 greaterThanEq :i SIZE + 13 set *tmp2 :i + 14 set *tmp4 :i - * read *tmp3 FINAL *tmp2 - * read *tmp5 ARRAY *tmp4 -+ 16 read *tmp3 FINAL :i -+ 17 read *tmp5 ARRAY :i - 18 assertequals *tmp3 *tmp5 "unexpected value" - 19 label *label4 - 20 op add :i :i 1 - - 30 set :fn1:left :fn0:left - 31 set :fn1:right :fn0:right - 32 set :fn1:pivot_index :fn0:pivot_index ++ 15 read *tmp3 FINAL :i ++ 16 read *tmp5 ARRAY :i + 17 assertequals *tmp3 *tmp5 "unexpected value" + 18 label *label4 + 19 op add :i :i 1 + + 29 set :fn1:left :fn0:left + 30 set :fn1:right :fn0:right + 31 set :fn1:pivot_index :fn0:pivot_index - * set *tmp12 :fn1:pivot_index - * read :fn1:pivot ARRAY *tmp12 - * jump *label10 equal :fn1:pivot_index :fn1:right @@ -226,323 +239,323 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 - * write *tmp19 ARRAY *tmp16 - * set *tmp20 :fn1:right - * write :fn1:pivot ARRAY *tmp20 -+ 33 set *tmp12 :fn0:pivot_index -+ 34 read :fn1:pivot ARRAY :fn1:pivot_index -+ 35 jump *label10 equal :fn0:pivot_index :fn0:right -+ 36 set *tmp16 :fn0:pivot_index -+ 37 set *tmp18 :fn0:right -+ 38 read *tmp19 ARRAY :fn1:right -+ 39 write *tmp19 ARRAY :fn1:pivot_index -+ 40 set *tmp20 :fn0:right -+ 41 write :fn1:pivot ARRAY :fn1:right - 42 label *label10 - 43 label *label11 ++ 32 set *tmp12 :fn0:pivot_index ++ 33 read :fn1:pivot ARRAY :fn1:pivot_index ++ 34 jump *label10 equal :fn0:pivot_index :fn0:right ++ 35 set *tmp16 :fn0:pivot_index ++ 36 set *tmp18 :fn0:right ++ 37 read *tmp19 ARRAY :fn1:right ++ 38 write *tmp19 ARRAY :fn1:pivot_index ++ 39 set *tmp20 :fn0:right ++ 40 write :fn1:pivot ARRAY :fn1:right + 41 label *label10 + 42 label *label11 - * set :fn1:index :fn1:left - * set *tmp22 :fn1:right - * set :fn1:i :fn1:left -+ 44 set :fn1:index :fn0:left -+ 45 set *tmp22 :fn0:right -+ 46 set :fn1:i :fn0:left - 47 label *label12 ++ 43 set :fn1:index :fn0:left ++ 44 set *tmp22 :fn0:right ++ 45 set :fn1:i :fn0:left + 46 label *label12 - * jump *label14 greaterThanEq :fn1:i *tmp22 -+ 48 jump *label14 greaterThanEq :fn1:i :fn1:right - 49 set *tmp23 :fn1:i ++ 47 jump *label14 greaterThanEq :fn1:i :fn1:right + 48 set *tmp23 :fn1:i - * read :fn1:curr ARRAY *tmp23 -+ 50 read :fn1:curr ARRAY :fn1:i - 51 jump *label15 greaterThanEq :fn1:curr :fn1:pivot - 52 jump *label17 equal :fn1:i :fn1:index - 53 set *tmp29 :fn1:i - 54 set *tmp31 :fn1:index ++ 49 read :fn1:curr ARRAY :fn1:i + 50 jump *label15 greaterThanEq :fn1:curr :fn1:pivot + 51 jump *label17 equal :fn1:i :fn1:index + 52 set *tmp29 :fn1:i + 53 set *tmp31 :fn1:index - * read *tmp32 ARRAY *tmp31 - * write *tmp32 ARRAY *tmp29 -+ 55 read *tmp32 ARRAY :fn1:index -+ 56 write *tmp32 ARRAY :fn1:i - 57 set *tmp33 :fn1:index ++ 54 read *tmp32 ARRAY :fn1:index ++ 55 write *tmp32 ARRAY :fn1:i + 56 set *tmp33 :fn1:index - * write :fn1:curr ARRAY *tmp33 -+ 58 write :fn1:curr ARRAY :fn1:index - 59 label *label17 - 60 label *label18 - 61 op add :fn1:index :fn1:index 1 - - 65 op add :fn1:i :fn1:i 1 - 66 jump *label12 always - 67 label *label14 ++ 57 write :fn1:curr ARRAY :fn1:index + 58 label *label17 + 59 label *label18 + 60 op add :fn1:index :fn1:index 1 + + 64 op add :fn1:i :fn1:i 1 + 65 jump *label12 always + 66 label *label14 - * jump *label19 equal :fn1:index :fn1:right - * set *tmp37 :fn1:right -+ 68 jump *label19 equal :fn1:index :fn0:right -+ 69 set *tmp37 :fn0:right - 70 set *tmp39 :fn1:index ++ 67 jump *label19 equal :fn1:index :fn0:right ++ 68 set *tmp37 :fn0:right + 69 set *tmp39 :fn1:index - * read *tmp40 ARRAY *tmp39 - * write *tmp40 ARRAY *tmp37 -+ 71 read *tmp40 ARRAY :fn1:index -+ 72 write *tmp40 ARRAY :fn1:right - 73 set *tmp41 :fn1:index ++ 70 read *tmp40 ARRAY :fn1:index ++ 71 write *tmp40 ARRAY :fn1:right + 72 set *tmp41 :fn1:index - * write :fn1:pivot ARRAY *tmp41 -+ 74 write :fn1:pivot ARRAY :fn1:index - 75 label *label19 - 76 label *label20 - 77 set *tmp11 :fn1:index - 78 jump *label9 always ++ 73 write :fn1:pivot ARRAY :fn1:index + 74 label *label19 + 75 label *label20 + 76 set *tmp11 :fn1:index + 77 jump *label9 always - * set *tmp11 null - 79 label *label9 + 78 label *label9 - * set :fn0:new_pivot_index *tmp11 - * op sub *tmp43 :fn0:new_pivot_index 1 -+ 80 set :fn0:new_pivot_index :fn1:index -+ 81 op sub *tmp43 *tmp11 1 - 82 push bank1 :fn0:left - 83 push bank1 :fn0:right - 84 push bank1 :fn0:pivot_index ++ 79 set :fn0:new_pivot_index :fn1:index ++ 80 op sub *tmp43 *tmp11 1 + 81 push bank1 :fn0:left + 82 push bank1 :fn0:right + 83 push bank1 :fn0:pivot_index -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-15 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-15 instructions): - 11 set :i 0 - 12 label *label3 - 13 jump *label5 greaterThanEq :i SIZE + 10 set :i 0 + 11 label *label3 + 12 jump *label5 greaterThanEq :i SIZE - * set *tmp2 :i - * set *tmp4 :i - 14 read *tmp3 FINAL :i - 15 read *tmp5 ARRAY :i - 16 assertequals *tmp3 *tmp5 "unexpected value" + 13 read *tmp3 FINAL :i + 14 read *tmp5 ARRAY :i + 15 assertequals *tmp3 *tmp5 "unexpected value" - 25 op sub *tmp8 :fn0:right :fn0:left - 26 op idiv *tmp9 *tmp8 2 - 27 op add :fn0:pivot_index :fn0:left *tmp9 + 24 op sub *tmp8 :fn0:right :fn0:left + 25 op idiv *tmp9 *tmp8 2 + 26 op add :fn0:pivot_index :fn0:left *tmp9 - * set :fn1:left :fn0:left - 28 set :fn1:right :fn0:right - 29 set :fn1:pivot_index :fn0:pivot_index + 27 set :fn1:right :fn0:right + 28 set :fn1:pivot_index :fn0:pivot_index - * set *tmp12 :fn0:pivot_index - * read :fn1:pivot ARRAY :fn1:pivot_index -+ 30 read :fn1:pivot ARRAY :fn0:pivot_index - 31 jump *label10 equal :fn0:pivot_index :fn0:right ++ 29 read :fn1:pivot ARRAY :fn0:pivot_index + 30 jump *label10 equal :fn0:pivot_index :fn0:right - * set *tmp16 :fn0:pivot_index - * set *tmp18 :fn0:right - * read *tmp19 ARRAY :fn1:right - * write *tmp19 ARRAY :fn1:pivot_index - * set *tmp20 :fn0:right - * write :fn1:pivot ARRAY :fn1:right -+ 32 read *tmp19 ARRAY :fn0:right -+ 33 write *tmp19 ARRAY :fn0:pivot_index -+ 34 write :fn1:pivot ARRAY :fn0:right - 35 label *label10 - 36 label *label11 - 37 set :fn1:index :fn0:left ++ 31 read *tmp19 ARRAY :fn0:right ++ 32 write *tmp19 ARRAY :fn0:pivot_index ++ 33 write :fn1:pivot ARRAY :fn0:right + 34 label *label10 + 35 label *label11 + 36 set :fn1:index :fn0:left - * set *tmp22 :fn0:right - 38 set :fn1:i :fn0:left - 39 label *label12 + 37 set :fn1:i :fn0:left + 38 label *label12 - * jump *label14 greaterThanEq :fn1:i :fn1:right - * set *tmp23 :fn1:i -+ 40 jump *label14 greaterThanEq :fn1:i :fn0:right - 41 read :fn1:curr ARRAY :fn1:i - 42 jump *label15 greaterThanEq :fn1:curr :fn1:pivot - 43 jump *label17 equal :fn1:i :fn1:index ++ 39 jump *label14 greaterThanEq :fn1:i :fn0:right + 40 read :fn1:curr ARRAY :fn1:i + 41 jump *label15 greaterThanEq :fn1:curr :fn1:pivot + 42 jump *label17 equal :fn1:i :fn1:index - * set *tmp29 :fn1:i - * set *tmp31 :fn1:index - 44 read *tmp32 ARRAY :fn1:index - 45 write *tmp32 ARRAY :fn1:i + 43 read *tmp32 ARRAY :fn1:index + 44 write *tmp32 ARRAY :fn1:i - * set *tmp33 :fn1:index - 46 write :fn1:curr ARRAY :fn1:index - 47 label *label17 - 48 label *label18 + 45 write :fn1:curr ARRAY :fn1:index + 46 label *label17 + 47 label *label18 - 54 jump *label12 always - 55 label *label14 - 56 jump *label19 equal :fn1:index :fn0:right + 53 jump *label12 always + 54 label *label14 + 55 jump *label19 equal :fn1:index :fn0:right - * set *tmp37 :fn0:right - * set *tmp39 :fn1:index - 57 read *tmp40 ARRAY :fn1:index + 56 read *tmp40 ARRAY :fn1:index - * write *tmp40 ARRAY :fn1:right - * set *tmp41 :fn1:index -+ 58 write *tmp40 ARRAY :fn0:right - 59 write :fn1:pivot ARRAY :fn1:index - 60 label *label19 - 61 label *label20 ++ 57 write *tmp40 ARRAY :fn0:right + 58 write :fn1:pivot ARRAY :fn1:index + 59 label *label19 + 60 label *label20 - 63 jump *label9 always - 64 label *label9 - 65 set :fn0:new_pivot_index :fn1:index + 62 jump *label9 always + 63 label *label9 + 64 set :fn0:new_pivot_index :fn1:index - * op sub *tmp43 *tmp11 1 -+ 66 op sub *tmp43 :fn1:index 1 - 67 push bank1 :fn0:left - 68 push bank1 :fn0:right - 69 push bank1 :fn0:pivot_index ++ 65 op sub *tmp43 :fn1:index 1 + 66 push bank1 :fn0:left + 67 push bank1 :fn0:right + 68 push bank1 :fn0:pivot_index -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-3 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-3 instructions): - 25 op sub *tmp8 :fn0:right :fn0:left - 26 op idiv *tmp9 *tmp8 2 - 27 op add :fn0:pivot_index :fn0:left *tmp9 + 24 op sub *tmp8 :fn0:right :fn0:left + 25 op idiv *tmp9 *tmp8 2 + 26 op add :fn0:pivot_index :fn0:left *tmp9 - * set :fn1:right :fn0:right - * set :fn1:pivot_index :fn0:pivot_index - 28 read :fn1:pivot ARRAY :fn0:pivot_index - 29 jump *label10 equal :fn0:pivot_index :fn0:right - 30 read *tmp19 ARRAY :fn0:right + 27 read :fn1:pivot ARRAY :fn0:pivot_index + 28 jump *label10 equal :fn0:pivot_index :fn0:right + 29 read *tmp19 ARRAY :fn0:right - 57 write :fn1:pivot ARRAY :fn1:index - 58 label *label19 - 59 label *label20 + 56 write :fn1:pivot ARRAY :fn1:index + 57 label *label19 + 58 label *label20 - * set *tmp11 :fn1:index - 60 jump *label9 always - 61 label *label9 - 62 set :fn0:new_pivot_index :fn1:index + 59 jump *label9 always + 60 label *label9 + 61 set :fn0:new_pivot_index :fn1:index Modifications by Iterated phase, Loop Optimization, pass 1, iteration 1: - 11 set :i 0 - 12 label *label3 - 13 jump *label5 greaterThanEq :i SIZE -+ 14 label *label23 - 15 read *tmp3 FINAL :i - 16 read *tmp5 ARRAY :i - 17 assertequals *tmp3 *tmp5 "unexpected value" - 18 label *label4 - 19 op add :i :i 1 + 10 set :i 0 + 11 label *label3 + 12 jump *label5 greaterThanEq :i SIZE ++ 13 label *label23 + 14 read *tmp3 FINAL :i + 15 read *tmp5 ARRAY :i + 16 assertequals *tmp3 *tmp5 "unexpected value" + 17 label *label4 + 18 op add :i :i 1 - * jump *label3 always -+ 20 jump *label23 lessThan :i SIZE - 21 label *label5 - 22 stop - 23 end - - 37 set :fn1:i :fn0:left - 38 label *label12 - 39 jump *label14 greaterThanEq :fn1:i :fn0:right -+ 40 label *label24 - 41 read :fn1:curr ARRAY :fn1:i - 42 jump *label15 greaterThanEq :fn1:curr :fn1:pivot - 43 jump *label17 equal :fn1:i :fn1:index - - 51 label *label16 - 52 label *label13 - 53 op add :fn1:i :fn1:i 1 ++ 19 jump *label23 lessThan :i SIZE + 20 label *label5 + 21 stop + 22 end + + 36 set :fn1:i :fn0:left + 37 label *label12 + 38 jump *label14 greaterThanEq :fn1:i :fn0:right ++ 39 label *label24 + 40 read :fn1:curr ARRAY :fn1:i + 41 jump *label15 greaterThanEq :fn1:curr :fn1:pivot + 42 jump *label17 equal :fn1:i :fn1:index + + 50 label *label16 + 51 label *label13 + 52 op add :fn1:i :fn1:i 1 - * jump *label12 always -+ 54 jump *label24 lessThan :fn1:i :fn0:right - 55 label *label14 - 56 jump *label19 equal :fn1:index :fn0:right - 57 read *tmp40 ARRAY :fn1:index ++ 53 jump *label24 lessThan :fn1:i :fn0:right + 54 label *label14 + 55 jump *label19 equal :fn1:index :fn0:right + 56 read *tmp40 ARRAY :fn1:index Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 (-1 instructions): - 22 stop - 23 end - 24 label *label0 + 21 stop + 22 end + 23 label *label0 - * jump *label7 lessThanEq :fn0:right :fn0:left -+ 25 set :fn0*retval null -+ 26 jump *label8 lessThanEq :fn0:right :fn0:left - 27 op sub *tmp8 :fn0:right :fn0:left - 28 op idiv *tmp9 *tmp8 2 - 29 op add :fn0:pivot_index :fn0:left *tmp9 ++ 24 set :fn0*retval null ++ 25 jump *label8 lessThanEq :fn0:right :fn0:left + 26 op sub *tmp8 :fn0:right :fn0:left + 27 op idiv *tmp9 *tmp8 2 + 28 op add :fn0:pivot_index :fn0:left *tmp9 - 89 pop bank1 :fn0:pivot_index - 90 pop bank1 :fn0:right - 91 pop bank1 :fn0:left + 88 pop bank1 :fn0:pivot_index + 89 pop bank1 :fn0:right + 90 pop bank1 :fn0:left - * set *tmp7 :fn0*retval -+ 92 set :fn0*retval :fn0*retval - 93 jump *label8 always ++ 91 set :fn0*retval :fn0*retval + 92 jump *label8 always - * label *label7 - * set *tmp7 null - 94 label *label8 + 93 label *label8 - * set :fn0*retval *tmp7 - 95 label *label6 - 96 returnrec bank1 - 97 end + 94 label *label6 + 95 returnrec bank1 + 96 end Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (-2 instructions): - 60 write :fn1:pivot ARRAY :fn1:index - 61 label *label19 - 62 label *label20 + 59 write :fn1:pivot ARRAY :fn1:index + 60 label *label19 + 61 label *label20 - * jump *label9 always - 63 label *label9 - 64 set :fn0:new_pivot_index :fn1:index - 65 op sub *tmp43 :fn1:index 1 + 62 label *label9 + 63 set :fn0:new_pivot_index :fn1:index + 64 op sub *tmp43 :fn1:index 1 - 89 pop bank1 :fn0:right - 90 pop bank1 :fn0:left - 91 set :fn0*retval :fn0*retval + 88 pop bank1 :fn0:right + 89 pop bank1 :fn0:left + 90 set :fn0*retval :fn0*retval - * jump *label8 always - 92 label *label8 - 93 label *label6 - 94 returnrec bank1 + 91 label *label8 + 92 label *label6 + 93 returnrec bank1 Modifications by Iterated phase, Expression Optimization, pass 2, iteration 1 (-1 instructions): - 88 pop bank1 :fn0:pivot_index - 89 pop bank1 :fn0:right - 90 pop bank1 :fn0:left + 87 pop bank1 :fn0:pivot_index + 88 pop bank1 :fn0:right + 89 pop bank1 :fn0:left - * set :fn0*retval :fn0*retval - 91 label *label8 - 92 label *label6 - 93 returnrec bank1 + 90 label *label8 + 91 label *label6 + 92 returnrec bank1 Modifications by Iterated phase, Data Flow Optimization, pass 2, iteration 1: - 10 label *label2 - 11 set :i 0 - 12 label *label3 + 9 label *label2 + 10 set :i 0 + 11 label *label3 - * jump *label5 greaterThanEq :i SIZE -+ 13 jump *label5 greaterThanEq 0 SIZE - 14 label *label23 - 15 read *tmp3 FINAL :i - 16 read *tmp5 ARRAY :i - - 37 set :fn1:index :fn0:left - 38 set :fn1:i :fn0:left - 39 label *label12 ++ 12 jump *label5 greaterThanEq 0 SIZE + 13 label *label23 + 14 read *tmp3 FINAL :i + 15 read *tmp5 ARRAY :i + + 36 set :fn1:index :fn0:left + 37 set :fn1:i :fn0:left + 38 label *label12 - * jump *label14 greaterThanEq :fn1:i :fn0:right -+ 40 jump *label14 greaterThanEq :fn0:left :fn0:right - 41 label *label24 - 42 read :fn1:curr ARRAY :fn1:i - 43 jump *label15 greaterThanEq :fn1:curr :fn1:pivot ++ 39 jump *label14 greaterThanEq :fn0:left :fn0:right + 40 label *label24 + 41 read :fn1:curr ARRAY :fn1:i + 42 jump *label15 greaterThanEq :fn1:curr :fn1:pivot Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-1 instructions): - 91 label *label8 - 92 label *label6 - 93 returnrec bank1 + 90 label *label8 + 91 label *label6 + 92 returnrec bank1 - * end Modifications by Final phase, Dead Code Elimination, iteration 1 (-1 instructions): - 22 stop - 23 end - 24 label *label0 + 21 stop + 22 end + 23 label *label0 - * set :fn0*retval null - 25 jump *label8 lessThanEq :fn0:right :fn0:left - 26 op sub *tmp8 :fn0:right :fn0:left - 27 op idiv *tmp9 *tmp8 2 + 24 jump *label8 lessThanEq :fn0:right :fn0:left + 25 op sub *tmp8 :fn0:right :fn0:left + 26 op idiv *tmp9 *tmp8 2 Modifications by Final phase, Stack Optimization, iteration 1 (-28 instructions): - 62 label *label9 - 63 set :fn0:new_pivot_index :fn1:index - 64 op sub *tmp43 :fn1:index 1 + 61 label *label9 + 62 set :fn0:new_pivot_index :fn1:index + 63 op sub *tmp43 :fn1:index 1 - * push bank1 :fn0:left - 65 push bank1 :fn0:right + 64 push bank1 :fn0:right - * push bank1 :fn0:pivot_index - 66 push bank1 :fn0:new_pivot_index - 67 set :fn0:right *tmp43 - 68 callrec bank1 *label0 *label21 :fn0*retval - 69 label *label21 - 70 pop bank1 :fn0:new_pivot_index + 65 push bank1 :fn0:new_pivot_index + 66 set :fn0:right *tmp43 + 67 callrec bank1 *label0 *label21 :fn0*retval + 68 label *label21 + 69 pop bank1 :fn0:new_pivot_index - * pop bank1 :fn0:pivot_index - 71 pop bank1 :fn0:right + 70 pop bank1 :fn0:right - * pop bank1 :fn0:left - 72 op add *tmp45 :fn0:new_pivot_index 1 + 71 op add *tmp45 :fn0:new_pivot_index 1 - * push bank1 :fn0:left - * push bank1 :fn0:right - * push bank1 :fn0:pivot_index - * push bank1 :fn0:new_pivot_index - * push bank1 *tmp44 - 73 set :fn0:left *tmp45 - 74 callrec bank1 *label0 *label22 :fn0*retval - 75 label *label22 + 72 set :fn0:left *tmp45 + 73 callrec bank1 *label0 *label22 :fn0*retval + 74 label *label22 - * pop bank1 *tmp44 - * pop bank1 :fn0:new_pivot_index - * pop bank1 :fn0:pivot_index - * pop bank1 :fn0:right - * pop bank1 :fn0:left - 76 label *label8 - 77 label *label6 - 78 returnrec bank1 + 75 label *label8 + 76 label *label6 + 77 returnrec bank1 Final code before resolving virtual instructions: @@ -552,9 +565,8 @@ jump *label1 equal bank1 null set *sp 0 set ARRAY bank2 set FINAL bank3 -op sub *tmp0 SIZE 1 +op sub :fn0:right SIZE 1 set :fn0:left 0 -set :fn0:right *tmp0 callrec bank1 *label0 *label2 :fn0*retval label *label2 set :i 0 diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/OptimizerTest.txt b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/OptimizerTest.txt index cdec392e..52319912 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/OptimizerTest.txt +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/OptimizerTest.txt @@ -4,8 +4,8 @@ detector-00.mnd: 127 76B6ACE9D59CB722 7F21A factory-monitor-00.mnd: 344 863D948F911F2E7A DBBA38553539A2AF factory-monitor-silicon-00.mnd: 287 92331871E01FEB02 F64DF4B2AFB2C820 factory-monitor-surge-alloy-00.mnd: 184 B570A56D64509A07 7C4F6781B7260E06 -impact-reactor-logic-00.mnd: 830 1234A425840A18A8 2E93CE2E051AB200 -instant-overdrive-dome-00.mnd: 864 F10A217F1B75EE07 11256E2BD937FDFF +impact-reactor-logic-00.mnd: 821 1234A425840A18A8 C271B16050C2D93E +instant-overdrive-dome-00.mnd: 862 F10A217F1B75EE07 33189A4FA7EFEC22 item-counter-00.mnd: 90 DBF0CE14BD53EC86 D365C400D522FDDE item-counter-micro-00.mnd: 128 AB81229C62913E11 21E3F077FFA33257 item-rate-display-00.mnd: 657 B3F3156754BCE6C9 ABD0122246C347AA @@ -17,11 +17,11 @@ mass-driver-monitor-00.mnd: 184 6E6F762403154535 3484E mass-driver-monitor-surge-alloy-00.mnd: 93 84BE8CA14CE3386F 1178C94700120B09 reactor-control-00.mnd: 369 0B5F71D4A736D2F1 8E556662DBBD4E1C reactor-control-battery-level-00.mnd: 578 BEBDD58A4C35FD11 D18185E084EB0BF2 -regulator-00.mnd: 142 F49BECB5341151DD 7235AA51E9587EA8 +regulator-00.mnd: 142 F49BECB5341151DD 77771819A84305E3 remote-vault-00.mnd: 68 9EA444978E177496 5B693A206F892FA5 storage-display-00.mnd: 604 DDB65C7053234A4E 60067A4463B4C7D7 unit-housekeeping-00.mnd: 101 79DA8C13493B4C2F 19F6A9F747D2E07B unit-speed-00.mnd: 71 2A68EEB3B75D1513 B5C845BF9C2A5514 unit-transport-00.mnd: 673 9FCA60401C80E5E0 42D72D63A6F484FD -unit-transport-flow-rate-00.mnd: 84 DED7F4641C02F55B 188788C12F9AEBF4 +unit-transport-flow-rate-00.mnd: 83 DED7F4641C02F55B A5F5BC3D16A6647E unit-transport-single-00.mnd: 355 7B016CB555432FAE C9B4AA49C03DAF21 diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/impact-reactor-logic-00.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/impact-reactor-logic-00.log index 2c435d23..e2f2e33a 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/impact-reactor-logic-00.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/impact-reactor-logic-00.log @@ -6,26 +6,26 @@ 17 instructions eliminated by Single Step Elimination (2 passes, 7 iterations). 3 instructions eliminated by Expression Optimization (4 iterations). 3 instructions eliminated by If Expression Optimization (4 iterations). - 98 instructions eliminated by Data Flow Optimization (8 passes, 28 iterations). - 550 instructions added by Function Inlining (11 iterations). + 99 instructions eliminated by Data Flow Optimization (8 passes, 30 iterations). + 542 instructions added by Function Inlining (11 iterations). 17 function calls inlined by Function Inlining. 33 instructions updated by JumpThreading. 4 instructions eliminated by Unreachable Code Elimination. 132 instructions eliminated by Print Merging. - 830 instructions after optimizations. + 821 instructions after optimizations. -Pass 1: speed optimization selection (cost limit 520): +Pass 1: speed optimization selection (cost limit 521): * Inline function 'kilo' defined at line 117:1 cost 3, benefit 218.8, efficiency 72.9 (-4 instructions) Inline function 'update_fuel' defined at line 121:1 cost 13, benefit 337.5, efficiency 26.0 - Inline function 'calc_charge_req' defined at line 126:1 cost 64, benefit 503.9, efficiency 7.9 + Inline function 'calc_charge_req' defined at line 126:1 cost 59, benefit 503.9, efficiency 8.5 ! Inline function 'start_reactor' defined at line 140:1 cost 591, benefit 687.5, efficiency 1.2 Inline function 'check_radar' defined at line 259:1 cost 21, benefit 175.0, efficiency 8.3 Inline function call at line 69:22 cost 22, benefit 87.5, efficiency 4.0 - Inline function call at line 73:23 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 74:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 75:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 76:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 77:24 cost 13, benefit 100.0, efficiency 7.7 + Inline function call at line 73:23 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 74:24 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 75:24 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 76:24 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 77:24 cost 12, benefit 100.0, efficiency 8.3 Inline function call at line 80:14 cost 148, benefit 137.5, efficiency 0.9 Inline function call at line 82:5 cost 7, benefit 112.5, efficiency 16.1 Inline function call at line 84:14 cost 148, benefit 137.5, efficiency 0.9 @@ -38,19 +38,19 @@ Pass 1: speed optimization selection (cost limit 520): Inline function call at line 102:15 cost 2, benefit 87.5, efficiency 43.8 Inline function call at line 103:14 cost 2, benefit 87.5, efficiency 43.8 Inline function call at line 105:15 cost 2, benefit 43.8, efficiency 21.9 - Inline function call at line 173:26 cost 13, benefit 3.9, efficiency 0.3 + Inline function call at line 173:26 cost 12, benefit 3.9, efficiency 0.3 -Pass 1: speed optimization selection (cost limit 524): +Pass 1: speed optimization selection (cost limit 525): * Inline function 'update_fuel' defined at line 121:1 cost 13, benefit 337.5, efficiency 26.0 (-1 instructions) - Inline function 'calc_charge_req' defined at line 126:1 cost 64, benefit 503.9, efficiency 7.9 + Inline function 'calc_charge_req' defined at line 126:1 cost 59, benefit 503.9, efficiency 8.5 ! Inline function 'start_reactor' defined at line 140:1 cost 591, benefit 687.5, efficiency 1.2 Inline function 'check_radar' defined at line 259:1 cost 21, benefit 175.0, efficiency 8.3 Inline function call at line 69:22 cost 22, benefit 87.5, efficiency 4.0 - Inline function call at line 73:23 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 74:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 75:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 76:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 77:24 cost 13, benefit 100.0, efficiency 7.7 + Inline function call at line 73:23 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 74:24 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 75:24 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 76:24 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 77:24 cost 12, benefit 100.0, efficiency 8.3 Inline function call at line 80:14 cost 148, benefit 137.5, efficiency 0.9 Inline function call at line 82:5 cost 7, benefit 112.5, efficiency 16.1 Inline function call at line 84:14 cost 148, benefit 137.5, efficiency 0.9 @@ -60,81 +60,77 @@ Pass 1: speed optimization selection (cost limit 524): Inline function call at line 91:14 cost 148, benefit 137.5, efficiency 0.9 Inline function call at line 93:14 cost 148, benefit 137.5, efficiency 0.9 Inline function call at line 96:5 cost 7, benefit 112.5, efficiency 16.1 - Inline function call at line 173:26 cost 13, benefit 3.9, efficiency 0.3 + Inline function call at line 173:26 cost 12, benefit 3.9, efficiency 0.3 -Pass 1: speed optimization selection (cost limit 525): - Inline function 'calc_charge_req' defined at line 126:1 cost 64, benefit 503.9, efficiency 7.9 +Pass 1: speed optimization selection (cost limit 526): + * Inline function 'calc_charge_req' defined at line 126:1 cost 59, benefit 503.9, efficiency 8.5 (+39 instructions) ! Inline function 'start_reactor' defined at line 140:1 cost 591, benefit 687.5, efficiency 1.2 - * Inline function 'check_radar' defined at line 259:1 cost 21, benefit 175.0, efficiency 8.3 (+6 instructions) + Inline function 'check_radar' defined at line 259:1 cost 21, benefit 175.0, efficiency 8.3 Inline function call at line 69:22 cost 22, benefit 87.5, efficiency 4.0 - Inline function call at line 73:23 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 74:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 75:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 76:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 77:24 cost 13, benefit 100.0, efficiency 7.7 + Inline function call at line 73:23 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 74:24 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 75:24 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 76:24 cost 12, benefit 100.0, efficiency 8.3 + Inline function call at line 77:24 cost 12, benefit 100.0, efficiency 8.3 Inline function call at line 80:14 cost 148, benefit 137.5, efficiency 0.9 Inline function call at line 84:14 cost 148, benefit 137.5, efficiency 0.9 Inline function call at line 88:23 cost 22, benefit 87.5, efficiency 4.0 Inline function call at line 89:14 cost 148, benefit 137.5, efficiency 0.9 Inline function call at line 91:14 cost 148, benefit 137.5, efficiency 0.9 Inline function call at line 93:14 cost 148, benefit 137.5, efficiency 0.9 - Inline function call at line 173:26 cost 13, benefit 3.9, efficiency 0.3 - -Pass 1: speed optimization selection (cost limit 519): - * Inline function 'calc_charge_req' defined at line 126:1 cost 64, benefit 503.9, efficiency 7.9 (+44 instructions) - ! Inline function 'start_reactor' defined at line 140:1 cost 591, benefit 687.5, efficiency 1.2 - Inline function call at line 73:23 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 74:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 75:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 76:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 77:24 cost 13, benefit 100.0, efficiency 7.7 - Inline function call at line 80:14 cost 148, benefit 137.5, efficiency 0.9 - Inline function call at line 84:14 cost 148, benefit 137.5, efficiency 0.9 - Inline function call at line 89:14 cost 148, benefit 137.5, efficiency 0.9 - Inline function call at line 91:14 cost 148, benefit 137.5, efficiency 0.9 - Inline function call at line 93:14 cost 148, benefit 137.5, efficiency 0.9 - Inline function call at line 173:26 cost 13, benefit 3.9, efficiency 0.3 + Inline function call at line 173:26 cost 12, benefit 3.9, efficiency 0.3 -Pass 1: speed optimization selection (cost limit 475): - ! Inline function 'start_reactor' defined at line 140:1 cost 631, benefit 687.5, efficiency 1.1 - * Inline function call at line 80:14 cost 158, benefit 137.5, efficiency 0.9 (+150 instructions) - Inline function call at line 84:14 cost 158, benefit 137.5, efficiency 0.9 - Inline function call at line 89:14 cost 158, benefit 137.5, efficiency 0.9 - Inline function call at line 91:14 cost 158, benefit 137.5, efficiency 0.9 - Inline function call at line 93:14 cost 158, benefit 137.5, efficiency 0.9 +Pass 1: speed optimization selection (cost limit 487): + ! Inline function 'start_reactor' defined at line 140:1 cost 627, benefit 687.5, efficiency 1.1 + * Inline function 'check_radar' defined at line 259:1 cost 21, benefit 175.0, efficiency 8.3 (+6 instructions) + Inline function call at line 69:22 cost 22, benefit 87.5, efficiency 4.0 + Inline function call at line 80:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 84:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 88:23 cost 22, benefit 87.5, efficiency 4.0 + Inline function call at line 89:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 91:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 93:14 cost 157, benefit 137.5, efficiency 0.9 -Pass 1: speed optimization selection (cost limit 325): - ! Inline function 'start_reactor' defined at line 140:1 cost 473, benefit 550.0, efficiency 1.2 - * Inline function call at line 84:14 cost 158, benefit 137.5, efficiency 0.9 (+151 instructions) - Inline function call at line 89:14 cost 158, benefit 137.5, efficiency 0.9 - Inline function call at line 91:14 cost 158, benefit 137.5, efficiency 0.9 - Inline function call at line 93:14 cost 158, benefit 137.5, efficiency 0.9 +Pass 1: speed optimization selection (cost limit 481): + ! Inline function 'start_reactor' defined at line 140:1 cost 627, benefit 687.5, efficiency 1.1 + * Inline function call at line 80:14 cost 157, benefit 137.5, efficiency 0.9 (+149 instructions) + Inline function call at line 84:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 89:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 91:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 93:14 cost 157, benefit 137.5, efficiency 0.9 -Pass 1: speed optimization selection (cost limit 174): - ! Inline function 'start_reactor' defined at line 140:1 cost 315, benefit 412.5, efficiency 1.3 - * Inline function call at line 89:14 cost 158, benefit 137.5, efficiency 0.9 (+151 instructions) - Inline function call at line 91:14 cost 158, benefit 137.5, efficiency 0.9 - Inline function call at line 93:14 cost 158, benefit 137.5, efficiency 0.9 +Pass 1: speed optimization selection (cost limit 332): + ! Inline function 'start_reactor' defined at line 140:1 cost 470, benefit 550.0, efficiency 1.2 + * Inline function call at line 84:14 cost 157, benefit 137.5, efficiency 0.9 (+150 instructions) + Inline function call at line 89:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 91:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 93:14 cost 157, benefit 137.5, efficiency 0.9 -Pass 1: speed optimization selection (cost limit 23): - ! Inline function 'start_reactor' defined at line 140:1 cost 157, benefit 275.0, efficiency 1.8 - ! Inline function call at line 91:14 cost 158, benefit 137.5, efficiency 0.9 - ! Inline function call at line 93:14 cost 158, benefit 137.5, efficiency 0.9 +Pass 1: speed optimization selection (cost limit 182): + ! Inline function 'start_reactor' defined at line 140:1 cost 313, benefit 412.5, efficiency 1.3 + * Inline function call at line 89:14 cost 157, benefit 137.5, efficiency 0.9 (+150 instructions) + Inline function call at line 91:14 cost 157, benefit 137.5, efficiency 0.9 + Inline function call at line 93:14 cost 157, benefit 137.5, efficiency 0.9 -Pass 2: speed optimization selection (cost limit 33): +Pass 1: speed optimization selection (cost limit 32): ! Inline function 'start_reactor' defined at line 140:1 cost 156, benefit 275.0, efficiency 1.8 ! Inline function call at line 91:14 cost 157, benefit 137.5, efficiency 0.9 ! Inline function call at line 93:14 cost 157, benefit 137.5, efficiency 0.9 -Pass 3: speed optimization selection (cost limit 34): - ! Inline function 'start_reactor' defined at line 140:1 cost 156, benefit 275.0, efficiency 1.8 - ! Inline function call at line 91:14 cost 157, benefit 137.5, efficiency 0.9 - ! Inline function call at line 93:14 cost 157, benefit 137.5, efficiency 0.9 +Pass 2: speed optimization selection (cost limit 42): + ! Inline function 'start_reactor' defined at line 140:1 cost 155, benefit 275.0, efficiency 1.8 + ! Inline function call at line 91:14 cost 156, benefit 137.5, efficiency 0.9 + ! Inline function call at line 93:14 cost 156, benefit 137.5, efficiency 0.9 -Pass 4: speed optimization selection (cost limit 34): - ! Inline function 'start_reactor' defined at line 140:1 cost 156, benefit 275.0, efficiency 1.8 - ! Inline function call at line 91:14 cost 157, benefit 137.5, efficiency 0.9 - ! Inline function call at line 93:14 cost 157, benefit 137.5, efficiency 0.9 +Pass 3: speed optimization selection (cost limit 43): + ! Inline function 'start_reactor' defined at line 140:1 cost 155, benefit 275.0, efficiency 1.8 + ! Inline function call at line 91:14 cost 156, benefit 137.5, efficiency 0.9 + ! Inline function call at line 93:14 cost 156, benefit 137.5, efficiency 0.9 + +Pass 4: speed optimization selection (cost limit 43): + ! Inline function 'start_reactor' defined at line 140:1 cost 155, benefit 275.0, efficiency 1.8 + ! Inline function call at line 91:14 cost 156, benefit 137.5, efficiency 0.9 + ! Inline function call at line 93:14 cost 156, benefit 137.5, efficiency 0.9 Modifications by Initial phase, Dead Code Elimination, iteration 1 (-20 instructions): @@ -1179,7 +1175,36 @@ Modifications by Iterated phase, Expression Optimization, pass 1, iteration 1 (- 532 print "WAIT power. (%" 533 print :fn3:charge -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-7 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 instructions): + + 383 label *label62 + 384 op sub :fn2:time_left 30 :fn2:secs + 385 op mul *tmp110 :fn2:time_left :fn2:time_left +- * op idiv :fn2:charge_req *tmp110 0.04 +- * set :fn2*retval :fn2:charge_req ++ 386 op idiv :fn2*retval *tmp110 0.04 + 387 jump *label60 always + 388 set :fn2*retval null + 389 label *label60 + + 611 control enabled reactor5 false + 612 set :fn4*retval true + 613 jump *label97 always +- * set *tmp207 null ++ 614 set :fn4*retval null + 615 jump *label99 always + 616 label *label98 + 617 control enabled projector1 false + + 620 jump *label97 always + 621 set *tmp207 null + 622 label *label99 +- * set :fn4*retval *tmp207 + 623 label *label97 + 624 return :fn4*retaddr + 625 end + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-7 instructions): 33 set *tmp5 @tick 34 label *label6 @@ -1480,154 +1505,168 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-7 367 return :fn1*retaddr 368 end - 383 op idiv :fn2:charge_req *tmp110 0.04 - 384 set :fn2*retval :fn2:charge_req - 385 jump *label60 always + 382 op mul *tmp110 :fn2:time_left :fn2:time_left + 383 op idiv :fn2*retval *tmp110 0.04 + 384 jump *label60 always - * set :fn2*retval null - 386 label *label60 - 387 return :fn2*retaddr - 388 end + 385 label *label60 + 386 return :fn2*retaddr + 387 end - 410 print "- " - 411 jump *label64 equal :fn3:emerg_shutdown false - 412 set *tmp129 :fn3:reactor + 409 print "- " + 410 jump *label64 equal :fn3:emerg_shutdown false + 411 set *tmp129 :fn3:reactor - * control enabled *tmp129 false -+ 413 control enabled :fn3:reactor false - 414 print "emergency mode" - 415 print "\n" - 416 set :fn3:supply_fuel false - - 419 jump *label66 equal :fn3:enabled false - 420 jump *label68 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num - 421 set *tmp134 :fn3:reactor -- * control enabled *tmp134 false -+ 422 control enabled :fn3:reactor false - 423 print "STOP unwanted" - 424 print "\n" - 425 jump *label69 always ++ 412 control enabled :fn3:reactor false + 413 print "emergency mode" + 414 print "\n" + 415 set :fn3:supply_fuel false - 430 op land *tmp139 *tmp136 *tmp138 - 431 jump *label70 equal *tmp139 false - 432 set *tmp141 :fn3:reactor + 418 jump *label66 equal :fn3:enabled false + 419 jump *label68 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num + 420 set *tmp134 :fn3:reactor +- * control enabled *tmp134 false ++ 421 control enabled :fn3:reactor false + 422 print "STOP unwanted" + 423 print "\n" + 424 jump *label69 always + + 429 op land *tmp139 *tmp136 *tmp138 + 430 jump *label70 equal *tmp139 false + 431 set *tmp141 :fn3:reactor - * control enabled *tmp141 false -+ 433 control enabled :fn3:reactor false - 434 print "STOP system fuel low" - 435 print "\n" - 436 jump *label71 always - 437 label *label70 - 438 jump *label72 greaterThan :fn3:fuel 1 - 439 set *tmp145 :fn3:reactor ++ 432 control enabled :fn3:reactor false + 433 print "STOP system fuel low" + 434 print "\n" + 435 jump *label71 always + 436 label *label70 + 437 jump *label72 greaterThan :fn3:fuel 1 + 438 set *tmp145 :fn3:reactor - * control enabled *tmp145 false -+ 440 control enabled :fn3:reactor false - 441 print "STOP fuel low" - 442 print "\n" - 443 jump *label73 always - 444 label *label72 - 445 jump *label74 greaterThan :fn3:cryo .CRYO_ABORT - 446 set *tmp149 :fn3:reactor ++ 439 control enabled :fn3:reactor false + 440 print "STOP fuel low" + 441 print "\n" + 442 jump *label73 always + 443 label *label72 + 444 jump *label74 greaterThan :fn3:cryo .CRYO_ABORT + 445 set *tmp149 :fn3:reactor - * control enabled *tmp149 false -+ 447 control enabled :fn3:reactor false - 448 print "STOP out of cryo" - 449 print "\n" - 450 jump *label75 always - - 456 call *label2 :fn2*retval - 457 label *label78 - 458 set :fn3:charge_req :fn2*retval ++ 446 control enabled :fn3:reactor false + 447 print "STOP out of cryo" + 448 print "\n" + 449 jump *label75 always + + 455 call *label2 :fn2*retval + 456 label *label78 + 457 set :fn3:charge_req :fn2*retval - * op sub *tmp153 :fn3:charge :fn3:charge_req -+ 459 op sub *tmp153 :fn3:charge :fn2*retval - 460 op lessThan *tmp154 *tmp153 .PWR_ABORT - 461 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT - 462 op land *tmp156 *tmp154 *tmp155 - 463 jump *label79 equal *tmp156 false - 464 set *tmp158 :fn3:reactor ++ 458 op sub *tmp153 :fn3:charge :fn2*retval + 459 op lessThan *tmp154 *tmp153 .PWR_ABORT + 460 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT + 461 op land *tmp156 *tmp154 *tmp155 + 462 jump *label79 equal *tmp156 false + 463 set *tmp158 :fn3:reactor - * control enabled *tmp158 false -+ 465 control enabled :fn3:reactor false - 466 print "START FAIL battery" - 467 print "\n" - 468 set :fn3:supply_fuel false - - 473 print :fn3:time_left - 474 print " " - 475 print "secs, req " ++ 464 control enabled :fn3:reactor false + 465 print "START FAIL battery" + 466 print "\n" + 467 set :fn3:supply_fuel false + + 472 print :fn3:time_left + 473 print " " + 474 print "secs, req " - * print :fn3:charge_req -+ 476 print :fn2*retval - 477 print "J" - 478 print "\n" - 479 label *label80 - - 484 op land *tmp163 *tmp161 *tmp162 - 485 jump *label81 equal *tmp163 false - 486 set *tmp165 :fn3:reactor ++ 475 print :fn2*retval + 476 print "J" + 477 print "\n" + 478 label *label80 + + 483 op land *tmp163 *tmp161 *tmp162 + 484 jump *label81 equal *tmp163 false + 485 set *tmp165 :fn3:reactor - * control enabled *tmp165 false -+ 487 control enabled :fn3:reactor false - 488 print "ABANDON - battery crit" - 489 print "\n" - 490 set :fn3:supply_fuel false ++ 486 control enabled :fn3:reactor false + 487 print "ABANDON - battery crit" + 488 print "\n" + 489 set :fn3:supply_fuel false - 563 print "\n" - 564 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ - 565 set *tmp199 :fn3:reactor + 562 print "\n" + 563 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ + 564 set *tmp199 :fn3:reactor - * control enabled *tmp199 true -+ 566 control enabled :fn3:reactor true - 567 label *label94 - 568 label *label92 - 569 label *label88 - - 578 label *label96 - 579 set :fn3*retval :fn3:supply_fuel - 580 jump *label63 always ++ 565 control enabled :fn3:reactor true + 566 label *label94 + 567 label *label92 + 568 label *label88 + + 577 label *label96 + 578 set :fn3*retval :fn3:supply_fuel + 579 jump *label63 always - * set :fn3*retval null - 581 label *label63 - 582 return :fn3*retaddr - 583 end + 580 label *label63 + 581 return :fn3*retaddr + 582 end - 587 control enabled projector1 true - 588 control enabled projector2 true - 589 set *tmp210 .ULD_IN_1 + 586 control enabled projector1 true + 587 control enabled projector2 true + 588 set *tmp210 .ULD_IN_1 - * control config *tmp210 .FUEL_OFF -+ 590 control config .ULD_IN_1 .FUEL_OFF - 591 set *tmp212 .ULD_OUT_1 ++ 589 control config .ULD_IN_1 .FUEL_OFF + 590 set *tmp212 .ULD_OUT_1 - * control config *tmp212 .FUEL -+ 592 control config .ULD_OUT_1 .FUEL - 593 set *tmp214 .ULD_IN_2 ++ 591 control config .ULD_OUT_1 .FUEL + 592 set *tmp214 .ULD_IN_2 - * control config *tmp214 .FUEL_OFF -+ 594 control config .ULD_IN_2 .FUEL_OFF - 595 set *tmp216 .ULD_OUT_2 ++ 593 control config .ULD_IN_2 .FUEL_OFF + 594 set *tmp216 .ULD_OUT_2 - * control config *tmp216 .FUEL -+ 596 control config .ULD_OUT_2 .FUEL - 597 set *tmp218 .ULD_IN_MANY ++ 595 control config .ULD_OUT_2 .FUEL + 596 set *tmp218 .ULD_IN_MANY - * control config *tmp218 .FUEL_OFF -+ 598 control config .ULD_IN_MANY .FUEL_OFF - 599 set *tmp220 .ULD_OUT_MANY ++ 597 control config .ULD_IN_MANY .FUEL_OFF + 598 set *tmp220 .ULD_OUT_MANY - * control config *tmp220 .FUEL -+ 600 control config .ULD_OUT_MANY .FUEL - 601 set *tmp222 .ULD_MIXER ++ 599 control config .ULD_OUT_MANY .FUEL + 600 set *tmp222 .ULD_MIXER - * control config *tmp222 .FUEL_OFF -+ 602 control config .ULD_MIXER .FUEL_OFF - 603 control enabled reactor1 false - 604 control enabled reactor2 false - 605 control enabled reactor3 false - - 607 control enabled reactor5 false - 608 set :fn4*retval true - 609 jump *label97 always -- * set *tmp207 null - 610 jump *label99 always - 611 label *label98 - 612 control enabled projector1 false - 613 control enabled projector2 false - 614 set :fn4*retval false - 615 jump *label97 always ++ 601 control config .ULD_MIXER .FUEL_OFF + 602 control enabled reactor1 false + 603 control enabled reactor2 false + 604 control enabled reactor3 false + + 606 control enabled reactor5 false + 607 set :fn4*retval true + 608 jump *label97 always +- * set :fn4*retval null + 609 jump *label99 always + 610 label *label98 + 611 control enabled projector1 false + 612 control enabled projector2 false + 613 set :fn4*retval false + 614 jump *label97 always - * set *tmp207 null - 616 label *label99 -- * set :fn4*retval *tmp207 -+ 617 set :fn4*retval null - 618 label *label97 - 619 return :fn4*retaddr - 620 end + 615 label *label99 + 616 label *label97 + 617 return :fn4*retaddr -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-35 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-1 instructions): + + 32 label *label5 + 33 set *tmp5 @tick + 34 label *label6 +- * set :start_time *tmp5 ++ 35 set .RET_T_STARTUP *tmp5 + 36 set :t_startup1 *tmp5 + 37 set :t_startup2 *tmp5 + 38 set :t_startup3 *tmp5 + 39 set :t_startup4 *tmp5 + 40 set :t_startup5 *tmp5 +- * set .RET_T_STARTUP :start_time + 41 set .REACTORS_DESIRED 5 + 42 set .AVG_SURPLUS 500 + 43 label *label7 + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-34 instructions): 0 printflush message1 1 set .FUEL @blast-compound 2 set .FUEL_OFF @scrap @@ -1645,247 +1684,230 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-3 15 set .CRYO_REQ_EA 2 16 set .CRYO_ABORT 1 - 35 set :t_startup3 *tmp5 - 36 set :t_startup4 *tmp5 - 37 set :t_startup5 *tmp5 -- * set .RET_T_STARTUP :start_time -+ 38 set .RET_T_STARTUP *tmp5 - 39 set .REACTORS_DESIRED 5 - 40 set .AVG_SURPLUS 500 - 41 label *label7 - - 46 set .ULD_IN_MANY unloader5 - 47 set .ULD_OUT_MANY unloader6 - 48 set .ULD_MIXER unloader7 + 45 set .ULD_IN_MANY unloader5 + 46 set .ULD_OUT_MANY unloader6 + 47 set .ULD_MIXER unloader7 - * set .TOWER cyclone1 - 49 set .CONTAINER vault1 - 50 set .NODE node1 - 51 set :fn4:unit cyclone1 - 52 setaddr :fn4*retaddr *label10 - 53 call *label4 :fn4*retval - 54 label *label10 + 48 set .CONTAINER vault1 + 49 set .NODE node1 + 50 set :fn4:unit cyclone1 + 51 setaddr :fn4*retaddr *label10 + 52 call *label4 :fn4*retval + 53 label *label10 - * set :emerg_shutdown :fn4*retval - 55 op notEqual *tmp9 switch1 null - 56 sensor *tmp10 switch1 @enabled - 57 op equal *tmp11 *tmp10 false + 54 op notEqual *tmp9 switch1 null + 55 sensor *tmp10 switch1 @enabled + 56 op equal *tmp11 *tmp10 false - 78 setaddr :fn2*retaddr *label15 - 79 call *label2 :fn2*retval - 80 label *label15 + 77 setaddr :fn2*retaddr *label15 + 78 call *label2 :fn2*retval + 79 label *label15 - * set *tmp15 :fn2*retval - 81 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval - 82 set :fn2:reactor reactor3 - 83 set :fn2:time :t_startup3 - 84 setaddr :fn2*retaddr *label16 - 85 call *label2 :fn2*retval - 86 label *label16 + 80 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval + 81 set :fn2:reactor reactor3 + 82 set :fn2:time :t_startup3 + 83 setaddr :fn2*retaddr *label16 + 84 call *label2 :fn2*retval + 85 label *label16 - * set *tmp16 :fn2*retval - 87 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval - 88 set :fn2:reactor reactor4 - 89 set :fn2:time :t_startup4 - 90 setaddr :fn2*retaddr *label17 - 91 call *label2 :fn2*retval - 92 label *label17 + 86 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval + 87 set :fn2:reactor reactor4 + 88 set :fn2:time :t_startup4 + 89 setaddr :fn2*retaddr *label17 + 90 call *label2 :fn2*retval + 91 label *label17 - * set *tmp17 :fn2*retval - 93 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval - 94 set :fn2:reactor reactor5 - 95 set :fn2:time :t_startup5 - 96 setaddr :fn2*retaddr *label18 - 97 call *label2 :fn2*retval - 98 label *label18 + 92 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval + 93 set :fn2:reactor reactor5 + 94 set :fn2:time :t_startup5 + 95 setaddr :fn2*retaddr *label18 + 96 call *label2 :fn2*retval + 97 label *label18 - * set *tmp18 :fn2*retval - 99 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval - 100 set :fn3:reactor reactor1 - 101 set :fn3:reactor_num 1 + 98 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval + 99 set :fn3:reactor reactor1 + 100 set :fn3:reactor_num 1 - 133 setaddr :fn4*retaddr *label23 - 134 call *label4 :fn4*retval - 135 label *label23 + 132 setaddr :fn4*retaddr *label23 + 133 call *label4 :fn4*retval + 134 label *label23 - * set *tmp23 :fn4*retval - 136 op or :emerg_shutdown :emerg_shutdown :fn4*retval - 137 set :fn3:reactor reactor3 - 138 set :fn3:reactor_num 3 + 135 op or :emerg_shutdown :emerg_shutdown :fn4*retval + 136 set :fn3:reactor reactor3 + 137 set :fn3:reactor_num 3 - 174 label *label27 - 175 op or *tmp30 :fuel_1 :fuel_2 - 176 op or :fn6:reactors_fueled *tmp30 :fuel_many + 173 label *label27 + 174 op or *tmp30 :fuel_1 :fuel_2 + 175 op or :fn6:reactors_fueled *tmp30 :fuel_many - * set :fn6:emerg_shutdown :emerg_shutdown - 177 sensor *tmp33 node1 @powerNetStored - 178 op floor :fn6:charge *tmp33 - 179 sensor *tmp35 node1 @powerNetIn + 176 sensor *tmp33 node1 @powerNetStored + 177 op floor :fn6:charge *tmp33 + 178 sensor *tmp35 node1 @powerNetIn - 210 print :fn6:fuel_stored - 211 print " " - 212 print "/ " + 209 print :fn6:fuel_stored + 210 print " " + 211 print "/ " - * print .FUEL_LIMIT_LOW -+ 213 print 150 - 214 print " " - 215 print "(due to emergency)" - 216 print "\n" - - 221 print :fn6:fuel_stored - 222 print " " - 223 print "/ " ++ 212 print 150 + 213 print " " + 214 print "(due to emergency)" + 215 print "\n" + + 220 print :fn6:fuel_stored + 221 print " " + 222 print "/ " - * print .FUEL_LIMIT -+ 224 print 800 - 225 print "\" - 226 print "n" - 227 label *label34 - - 229 op lessThan *tmp32 :fn6:fuel_stored :fn6:limit - 230 jump *label28 always - 231 label *label28 ++ 223 print 800 + 224 print "\" + 225 print "n" + 226 label *label34 + + 228 op lessThan *tmp32 :fn6:fuel_stored :fn6:limit + 229 jump *label28 always + 230 label *label28 - * set :feed_mixers *tmp32 - * set *tmp49 unloader7 - 232 jump *label35 equal *tmp32 false - 233 set *tmp51 @pyratite - 234 jump *label36 always - 235 label *label35 - 236 set *tmp51 @scrap - 237 label *label36 + 231 jump *label35 equal *tmp32 false + 232 set *tmp51 @pyratite + 233 jump *label36 always + 234 label *label35 + 235 set *tmp51 @scrap + 236 label *label36 - * control config .ULD_MIXER *tmp51 -+ 238 control config unloader7 *tmp51 - 239 sensor *tmp53 node1 @powerNetStored - 240 sensor *tmp54 node1 @powerNetCapacity - 241 op div :fn7:stored_pc *tmp53 *tmp54 - - 268 setaddr :fn0*retaddr *label44 - 269 call *label0 :fn0*retval - 270 label *label44 ++ 237 control config unloader7 *tmp51 + 238 sensor *tmp53 node1 @powerNetStored + 239 sensor *tmp54 node1 @powerNetCapacity + 240 op div :fn7:stored_pc *tmp53 *tmp54 + + 267 setaddr :fn0*retaddr *label44 + 268 call *label0 :fn0*retval + 269 label *label44 - * set :req :fn0*retval - 271 print "Req " - 272 print :fn0*retval - 273 print "kJ / " + 270 print "Req " + 271 print :fn0*retval + 272 print "kJ / " - 288 sensor *tmp72 node1 @powerNetCapacity - 289 op div :fn8:stored *tmp71 *tmp72 - 290 op greaterThan *tmp74 :fn8:stored 0.98 + 287 sensor *tmp72 node1 @powerNetCapacity + 288 op div :fn8:stored *tmp71 *tmp72 + 289 op greaterThan *tmp74 :fn8:stored 0.98 - * op add *tmp75 6500 10000 - 291 op greaterThan *tmp76 .AVG_SURPLUS 16500 - 292 op land *tmp77 *tmp74 *tmp76 - 293 jump *label46 equal *tmp77 false + 290 op greaterThan *tmp76 .AVG_SURPLUS 16500 + 291 op land *tmp77 *tmp74 *tmp76 + 292 jump *label46 equal *tmp77 false - 299 label *label46 - 300 label *label47 - 301 op lessThan *tmp81 :fn8:stored 0.8 + 298 label *label46 + 299 label *label47 + 300 op lessThan *tmp81 :fn8:stored 0.8 - * op mul *tmp82 10000 0.8 - 302 op lessThan *tmp83 .AVG_SURPLUS 8000 - 303 op land *tmp84 *tmp81 *tmp83 - 304 jump *label50 equal *tmp84 false + 301 op lessThan *tmp83 .AVG_SURPLUS 8000 + 302 op land *tmp84 *tmp81 *tmp83 + 303 jump *label50 equal *tmp84 false - 331 return :fn0*retaddr - 332 end - 333 label *label1 + 330 return :fn0*retaddr + 331 end + 332 label *label1 - * set *tmp95 :fn1:uld_in - 334 jump *label56 equal :fn1:fuel false - 335 set *tmp97 .FUEL - 336 jump *label57 always + 333 jump *label56 equal :fn1:fuel false + 334 set *tmp97 .FUEL + 335 jump *label57 always - 338 set *tmp97 .FUEL_OFF - 339 label *label57 - 340 control config :fn1:uld_in *tmp97 + 337 set *tmp97 .FUEL_OFF + 338 label *label57 + 339 control config :fn1:uld_in *tmp97 - * set *tmp98 :fn1:uld_out - 341 jump *label58 notEqual :fn1:fuel false - 342 set *tmp101 .FUEL - 343 jump *label59 always + 340 jump *label58 notEqual :fn1:fuel false + 341 set *tmp101 .FUEL + 342 jump *label59 always - 391 print " " - 392 print "- " - 393 jump *label64 equal :fn3:emerg_shutdown false + 389 print " " + 390 print "- " + 391 jump *label64 equal :fn3:emerg_shutdown false - * set *tmp129 :fn3:reactor - 394 control enabled :fn3:reactor false - 395 print "emergency mode" - 396 print "\n" + 392 control enabled :fn3:reactor false + 393 print "emergency mode" + 394 print "\n" - 399 label *label64 - 400 jump *label66 equal :fn3:enabled false - 401 jump *label68 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num + 397 label *label64 + 398 jump *label66 equal :fn3:enabled false + 399 jump *label68 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num - * set *tmp134 :fn3:reactor - 402 control enabled :fn3:reactor false - 403 print "STOP unwanted" - 404 print "\n" + 400 control enabled :fn3:reactor false + 401 print "STOP unwanted" + 402 print "\n" - 409 op lessThan *tmp138 :fn3:fuel_stored *tmp137 - 410 op land *tmp139 *tmp136 *tmp138 - 411 jump *label70 equal *tmp139 false + 407 op lessThan *tmp138 :fn3:fuel_stored *tmp137 + 408 op land *tmp139 *tmp136 *tmp138 + 409 jump *label70 equal *tmp139 false - * set *tmp141 :fn3:reactor - 412 control enabled :fn3:reactor false - 413 print "STOP system fuel low" - 414 print "\n" - 415 jump *label71 always - 416 label *label70 - 417 jump *label72 greaterThan :fn3:fuel 1 + 410 control enabled :fn3:reactor false + 411 print "STOP system fuel low" + 412 print "\n" + 413 jump *label71 always + 414 label *label70 + 415 jump *label72 greaterThan :fn3:fuel 1 - * set *tmp145 :fn3:reactor - 418 control enabled :fn3:reactor false - 419 print "STOP fuel low" - 420 print "\n" - 421 jump *label73 always - 422 label *label72 - 423 jump *label74 greaterThan :fn3:cryo .CRYO_ABORT + 416 control enabled :fn3:reactor false + 417 print "STOP fuel low" + 418 print "\n" + 419 jump *label73 always + 420 label *label72 + 421 jump *label74 greaterThan :fn3:cryo .CRYO_ABORT - * set *tmp149 :fn3:reactor - 424 control enabled :fn3:reactor false - 425 print "STOP out of cryo" - 426 print "\n" + 422 control enabled :fn3:reactor false + 423 print "STOP out of cryo" + 424 print "\n" - 432 setaddr :fn2*retaddr *label78 - 433 call *label2 :fn2*retval - 434 label *label78 + 430 setaddr :fn2*retaddr *label78 + 431 call *label2 :fn2*retval + 432 label *label78 - * set :fn3:charge_req :fn2*retval - 435 op sub *tmp153 :fn3:charge :fn2*retval - 436 op lessThan *tmp154 *tmp153 .PWR_ABORT - 437 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT - 438 op land *tmp156 *tmp154 *tmp155 - 439 jump *label79 equal *tmp156 false + 433 op sub *tmp153 :fn3:charge :fn2*retval + 434 op lessThan *tmp154 *tmp153 .PWR_ABORT + 435 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT + 436 op land *tmp156 *tmp154 *tmp155 + 437 jump *label79 equal *tmp156 false - * set *tmp158 :fn3:reactor - 440 control enabled :fn3:reactor false - 441 print "START FAIL battery" - 442 print "\n" + 438 control enabled :fn3:reactor false + 439 print "START FAIL battery" + 440 print "\n" - 458 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT - 459 op land *tmp163 *tmp161 *tmp162 - 460 jump *label81 equal *tmp163 false + 456 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT + 457 op land *tmp163 *tmp161 *tmp162 + 458 jump *label81 equal *tmp163 false - * set *tmp165 :fn3:reactor - 461 control enabled :fn3:reactor false - 462 print "ABANDON - battery crit" - 463 print "\n" + 459 control enabled :fn3:reactor false + 460 print "ABANDON - battery crit" + 461 print "\n" - 536 print "STARTUP" - 537 print "\n" - 538 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ + 534 print "STARTUP" + 535 print "\n" + 536 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ - * set *tmp199 :fn3:reactor - 539 control enabled :fn3:reactor true - 540 label *label94 - 541 label *label92 + 537 control enabled :fn3:reactor true + 538 label *label94 + 539 label *label92 - 559 jump *label98 equal :fn4:enemy_found null - 560 control enabled projector1 true - 561 control enabled projector2 true + 557 jump *label98 equal :fn4:enemy_found null + 558 control enabled projector1 true + 559 control enabled projector2 true - * set *tmp210 .ULD_IN_1 - 562 control config .ULD_IN_1 .FUEL_OFF + 560 control config .ULD_IN_1 .FUEL_OFF - * set *tmp212 .ULD_OUT_1 - 563 control config .ULD_OUT_1 .FUEL + 561 control config .ULD_OUT_1 .FUEL - * set *tmp214 .ULD_IN_2 - 564 control config .ULD_IN_2 .FUEL_OFF + 562 control config .ULD_IN_2 .FUEL_OFF - * set *tmp216 .ULD_OUT_2 - 565 control config .ULD_OUT_2 .FUEL + 563 control config .ULD_OUT_2 .FUEL - * set *tmp218 .ULD_IN_MANY - 566 control config .ULD_IN_MANY .FUEL_OFF + 564 control config .ULD_IN_MANY .FUEL_OFF - * set *tmp220 .ULD_OUT_MANY - 567 control config .ULD_OUT_MANY .FUEL + 565 control config .ULD_OUT_MANY .FUEL - * set *tmp222 .ULD_MIXER - 568 control config .ULD_MIXER .FUEL_OFF - 569 control enabled reactor1 false - 570 control enabled reactor2 false - - 580 set :fn4*retval false - 581 jump *label97 always - 582 label *label99 -- * set :fn4*retval null - 583 label *label97 - 584 return :fn4*retaddr - 585 end + 566 control config .ULD_MIXER .FUEL_OFF + 567 control enabled reactor1 false + 568 control enabled reactor2 false -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-3 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 5 (-2 instructions): 8 set .FLOW_ABORT -500 9 set .FUEL_REQ 10 @@ -1895,14 +1917,6 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-3 11 set .FUEL_TOT_ABORT 15 12 set .CRYO_REQ 3 13 set .CRYO_REQ_EA 2 - - 27 label *label5 - 28 set *tmp5 @tick - 29 label *label6 -- * set :start_time *tmp5 - 30 set :t_startup1 *tmp5 - 31 set :t_startup2 *tmp5 - 32 set :t_startup3 *tmp5 Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 (-3 instructions): @@ -2238,6 +2252,316 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-9 183 jump *label119 equal :fuel_many false 184 control config unloader5 @blast-compound +Modifications by Inline function 'calc_charge_req' defined at line 126:1 (+51 instructions): + + 66 op or :emerg_shutdown :fn4*retval *tmp8 + 67 set :fn2:reactor reactor1 + 68 set :fn2:time :t_startup1 +- * setaddr :fn2*retaddr *label14 +- * call *label2 :fn2*retval +- * label *label14 ++ 69 label *label124 ++ 70 op sub *tmp102 @tick :fn2:time ++ 71 op idiv :fn2:secs *tmp102 60 ++ 72 op greaterThan *tmp104 :fn2:secs 30 ++ 73 sensor *tmp105 :fn2:reactor @enabled ++ 74 op equal *tmp106 *tmp105 false ++ 75 op or *tmp107 *tmp104 *tmp106 ++ 76 jump *label125 equal *tmp107 false ++ 77 set :fn2*retval 0 ++ 78 jump *label127 always ++ 79 label *label125 ++ 80 label *label126 ++ 81 op sub :fn2:time_left 30 :fn2:secs ++ 82 op mul *tmp110 :fn2:time_left :fn2:time_left ++ 83 op idiv :fn2*retval *tmp110 0.04 ++ 84 jump *label127 always ++ 85 label *label127 + 86 set .START_POWER_REQ :fn2*retval + 87 set :fn2:reactor reactor2 + 88 set :fn2:time :t_startup2 +- * setaddr :fn2*retaddr *label15 +- * call *label2 :fn2*retval +- * label *label15 ++ 89 label *label128 ++ 90 op sub *tmp102 @tick :fn2:time ++ 91 op idiv :fn2:secs *tmp102 60 ++ 92 op greaterThan *tmp104 :fn2:secs 30 ++ 93 sensor *tmp105 :fn2:reactor @enabled ++ 94 op equal *tmp106 *tmp105 false ++ 95 op or *tmp107 *tmp104 *tmp106 ++ 96 jump *label129 equal *tmp107 false ++ 97 set :fn2*retval 0 ++ 98 jump *label131 always ++ 99 label *label129 ++ 100 label *label130 ++ 101 op sub :fn2:time_left 30 :fn2:secs ++ 102 op mul *tmp110 :fn2:time_left :fn2:time_left ++ 103 op idiv :fn2*retval *tmp110 0.04 ++ 104 jump *label131 always ++ 105 label *label131 + 106 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval + 107 set :fn2:reactor reactor3 + 108 set :fn2:time :t_startup3 +- * setaddr :fn2*retaddr *label16 +- * call *label2 :fn2*retval +- * label *label16 ++ 109 label *label132 ++ 110 op sub *tmp102 @tick :fn2:time ++ 111 op idiv :fn2:secs *tmp102 60 ++ 112 op greaterThan *tmp104 :fn2:secs 30 ++ 113 sensor *tmp105 :fn2:reactor @enabled ++ 114 op equal *tmp106 *tmp105 false ++ 115 op or *tmp107 *tmp104 *tmp106 ++ 116 jump *label133 equal *tmp107 false ++ 117 set :fn2*retval 0 ++ 118 jump *label135 always ++ 119 label *label133 ++ 120 label *label134 ++ 121 op sub :fn2:time_left 30 :fn2:secs ++ 122 op mul *tmp110 :fn2:time_left :fn2:time_left ++ 123 op idiv :fn2*retval *tmp110 0.04 ++ 124 jump *label135 always ++ 125 label *label135 + 126 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval + 127 set :fn2:reactor reactor4 + 128 set :fn2:time :t_startup4 +- * setaddr :fn2*retaddr *label17 +- * call *label2 :fn2*retval +- * label *label17 ++ 129 label *label136 ++ 130 op sub *tmp102 @tick :fn2:time ++ 131 op idiv :fn2:secs *tmp102 60 ++ 132 op greaterThan *tmp104 :fn2:secs 30 ++ 133 sensor *tmp105 :fn2:reactor @enabled ++ 134 op equal *tmp106 *tmp105 false ++ 135 op or *tmp107 *tmp104 *tmp106 ++ 136 jump *label137 equal *tmp107 false ++ 137 set :fn2*retval 0 ++ 138 jump *label139 always ++ 139 label *label137 ++ 140 label *label138 ++ 141 op sub :fn2:time_left 30 :fn2:secs ++ 142 op mul *tmp110 :fn2:time_left :fn2:time_left ++ 143 op idiv :fn2*retval *tmp110 0.04 ++ 144 jump *label139 always ++ 145 label *label139 + 146 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval + 147 set :fn2:reactor reactor5 + 148 set :fn2:time :t_startup5 +- * setaddr :fn2*retaddr *label18 +- * call *label2 :fn2*retval +- * label *label18 ++ 149 label *label140 ++ 150 op sub *tmp102 @tick :fn2:time ++ 151 op idiv :fn2:secs *tmp102 60 ++ 152 op greaterThan *tmp104 :fn2:secs 30 ++ 153 sensor *tmp105 :fn2:reactor @enabled ++ 154 op equal *tmp106 *tmp105 false ++ 155 op or *tmp107 *tmp104 *tmp106 ++ 156 jump *label141 equal *tmp107 false ++ 157 set :fn2*retval 0 ++ 158 jump *label143 always ++ 159 label *label141 ++ 160 label *label142 ++ 161 op sub :fn2:time_left 30 :fn2:secs ++ 162 op mul *tmp110 :fn2:time_left :fn2:time_left ++ 163 op idiv :fn2*retval *tmp110 0.04 ++ 164 jump *label143 always ++ 165 label *label143 + 166 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval + 167 set :fn3:reactor reactor1 + 168 set :fn3:reactor_num 1 + + 417 jump *label7 always + 418 label *label9 + 419 end +- * label *label2 +- * op sub *tmp102 @tick :fn2:time +- * op idiv :fn2:secs *tmp102 60 +- * op greaterThan *tmp104 :fn2:secs 30 +- * sensor *tmp105 :fn2:reactor @enabled +- * op equal *tmp106 *tmp105 false +- * op or *tmp107 *tmp104 *tmp106 +- * jump *label61 equal *tmp107 false +- * set :fn2*retval 0 +- * jump *label60 always +- * label *label61 +- * label *label62 +- * op sub :fn2:time_left 30 :fn2:secs +- * op mul *tmp110 :fn2:time_left :fn2:time_left +- * op idiv :fn2*retval *tmp110 0.04 +- * jump *label60 always +- * label *label60 +- * return :fn2*retaddr +- * end + 420 label *label3 + 421 set .RET_T_STARTUP :fn3:t_startup + 422 op sub *tmp113 @tick :fn3:t_startup + + 478 jump *label76 greaterThanEq :fn3:secs 30 + 479 set :fn2:reactor :fn3:reactor + 480 set :fn2:time :fn3:t_startup +- * setaddr :fn2*retaddr *label78 +- * call *label2 :fn2*retval +- * label *label78 ++ 481 label *label144 ++ 482 op sub *tmp102 @tick :fn2:time ++ 483 op idiv :fn2:secs *tmp102 60 ++ 484 op greaterThan *tmp104 :fn2:secs 30 ++ 485 sensor *tmp105 :fn2:reactor @enabled ++ 486 op equal *tmp106 *tmp105 false ++ 487 op or *tmp107 *tmp104 *tmp106 ++ 488 jump *label145 equal *tmp107 false ++ 489 set :fn2*retval 0 ++ 490 jump *label147 always ++ 491 label *label145 ++ 492 label *label146 ++ 493 op sub :fn2:time_left 30 :fn2:secs ++ 494 op mul *tmp110 :fn2:time_left :fn2:time_left ++ 495 op idiv :fn2*retval *tmp110 0.04 ++ 496 jump *label147 always ++ 497 label *label147 + 498 op sub *tmp153 :fn3:charge :fn2*retval + 499 op lessThan *tmp154 *tmp153 .PWR_ABORT + 500 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: + + 67 set :fn2:reactor reactor1 + 68 set :fn2:time :t_startup1 + 69 label *label124 +- * op sub *tmp102 @tick :fn2:time ++ 70 op sub *tmp102 @tick :t_startup1 + 71 op idiv :fn2:secs *tmp102 60 + 72 op greaterThan *tmp104 :fn2:secs 30 +- * sensor *tmp105 :fn2:reactor @enabled ++ 73 sensor *tmp105 reactor1 @enabled + 74 op equal *tmp106 *tmp105 false + 75 op or *tmp107 *tmp104 *tmp106 + 76 jump *label125 equal *tmp107 false + + 87 set :fn2:reactor reactor2 + 88 set :fn2:time :t_startup2 + 89 label *label128 +- * op sub *tmp102 @tick :fn2:time ++ 90 op sub *tmp102 @tick :t_startup2 + 91 op idiv :fn2:secs *tmp102 60 + 92 op greaterThan *tmp104 :fn2:secs 30 +- * sensor *tmp105 :fn2:reactor @enabled ++ 93 sensor *tmp105 reactor2 @enabled + 94 op equal *tmp106 *tmp105 false + 95 op or *tmp107 *tmp104 *tmp106 + 96 jump *label129 equal *tmp107 false + + 107 set :fn2:reactor reactor3 + 108 set :fn2:time :t_startup3 + 109 label *label132 +- * op sub *tmp102 @tick :fn2:time ++ 110 op sub *tmp102 @tick :t_startup3 + 111 op idiv :fn2:secs *tmp102 60 + 112 op greaterThan *tmp104 :fn2:secs 30 +- * sensor *tmp105 :fn2:reactor @enabled ++ 113 sensor *tmp105 reactor3 @enabled + 114 op equal *tmp106 *tmp105 false + 115 op or *tmp107 *tmp104 *tmp106 + 116 jump *label133 equal *tmp107 false + + 127 set :fn2:reactor reactor4 + 128 set :fn2:time :t_startup4 + 129 label *label136 +- * op sub *tmp102 @tick :fn2:time ++ 130 op sub *tmp102 @tick :t_startup4 + 131 op idiv :fn2:secs *tmp102 60 + 132 op greaterThan *tmp104 :fn2:secs 30 +- * sensor *tmp105 :fn2:reactor @enabled ++ 133 sensor *tmp105 reactor4 @enabled + 134 op equal *tmp106 *tmp105 false + 135 op or *tmp107 *tmp104 *tmp106 + 136 jump *label137 equal *tmp107 false + + 147 set :fn2:reactor reactor5 + 148 set :fn2:time :t_startup5 + 149 label *label140 +- * op sub *tmp102 @tick :fn2:time ++ 150 op sub *tmp102 @tick :t_startup5 + 151 op idiv :fn2:secs *tmp102 60 + 152 op greaterThan *tmp104 :fn2:secs 30 +- * sensor *tmp105 :fn2:reactor @enabled ++ 153 sensor *tmp105 reactor5 @enabled + 154 op equal *tmp106 *tmp105 false + 155 op or *tmp107 *tmp104 *tmp106 + 156 jump *label141 equal *tmp107 false + + 479 set :fn2:reactor :fn3:reactor + 480 set :fn2:time :fn3:t_startup + 481 label *label144 +- * op sub *tmp102 @tick :fn2:time ++ 482 op sub *tmp102 @tick :fn3:t_startup + 483 op idiv :fn2:secs *tmp102 60 + 484 op greaterThan *tmp104 :fn2:secs 30 +- * sensor *tmp105 :fn2:reactor @enabled ++ 485 sensor *tmp105 :fn3:reactor @enabled + 486 op equal *tmp106 *tmp105 false + 487 op or *tmp107 *tmp104 *tmp106 + 488 jump *label145 equal *tmp107 false + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-12 instructions): + + 64 jump *label11 always + 65 label *label11 + 66 op or :emerg_shutdown :fn4*retval *tmp8 +- * set :fn2:reactor reactor1 +- * set :fn2:time :t_startup1 + 67 label *label124 + 68 op sub *tmp102 @tick :t_startup1 + 69 op idiv :fn2:secs *tmp102 60 + + 82 jump *label127 always + 83 label *label127 + 84 set .START_POWER_REQ :fn2*retval +- * set :fn2:reactor reactor2 +- * set :fn2:time :t_startup2 + 85 label *label128 + 86 op sub *tmp102 @tick :t_startup2 + 87 op idiv :fn2:secs *tmp102 60 + + 100 jump *label131 always + 101 label *label131 + 102 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval +- * set :fn2:reactor reactor3 +- * set :fn2:time :t_startup3 + 103 label *label132 + 104 op sub *tmp102 @tick :t_startup3 + 105 op idiv :fn2:secs *tmp102 60 + + 118 jump *label135 always + 119 label *label135 + 120 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval +- * set :fn2:reactor reactor4 +- * set :fn2:time :t_startup4 + 121 label *label136 + 122 op sub *tmp102 @tick :t_startup4 + 123 op idiv :fn2:secs *tmp102 60 + + 136 jump *label139 always + 137 label *label139 + 138 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval +- * set :fn2:reactor reactor5 +- * set :fn2:time :t_startup5 + 139 label *label140 + 140 op sub *tmp102 @tick :t_startup5 + 141 op idiv :fn2:secs *tmp102 60 + + 466 jump *label75 always + 467 label *label74 + 468 jump *label76 greaterThanEq :fn3:secs 30 +- * set :fn2:reactor :fn3:reactor +- * set :fn2:time :fn3:t_startup + 469 label *label144 + 470 op sub *tmp102 @tick :fn3:t_startup + 471 op idiv :fn2:secs *tmp102 60 + Modifications by Inline function 'check_radar' defined at line 259:1 (+17 instructions): 46 set .CONTAINER vault1 @@ -2246,9 +2570,9 @@ Modifications by Inline function 'check_radar' defined at line 259:1 (+17 instru - * setaddr :fn4*retaddr *label10 - * call *label4 :fn4*retval - * label *label10 -+ 49 label *label124 ++ 49 label *label148 + 50 radar enemy any any health :fn4:unit 1 :fn4:enemy_found -+ 51 jump *label125 equal :fn4:enemy_found null ++ 51 jump *label149 equal :fn4:enemy_found null + 52 control enabled projector1 true + 53 control enabled projector2 true + 54 control config .ULD_IN_1 .FUEL_OFF @@ -2264,59 +2588,59 @@ Modifications by Inline function 'check_radar' defined at line 259:1 (+17 instru + 64 control enabled reactor4 false + 65 control enabled reactor5 false + 66 set :fn4*retval true -+ 67 jump *label127 always -+ 68 jump *label126 always -+ 69 label *label125 ++ 67 jump *label151 always ++ 68 jump *label150 always ++ 69 label *label149 + 70 control enabled projector1 false + 71 control enabled projector2 false + 72 set :fn4*retval false -+ 73 jump *label127 always -+ 74 label *label126 -+ 75 label *label127 ++ 73 jump *label151 always ++ 74 label *label150 ++ 75 label *label151 76 op notEqual *tmp9 switch1 null 77 sensor *tmp10 switch1 @enabled 78 op equal *tmp11 *tmp10 false - 167 label *label116 - 168 label *label117 - 169 set :fn4:unit cyclone1 + 227 label *label116 + 228 label *label117 + 229 set :fn4:unit cyclone1 - * setaddr :fn4*retaddr *label23 - * call *label4 :fn4*retval - * label *label23 -+ 170 label *label128 -+ 171 radar enemy any any health :fn4:unit 1 :fn4:enemy_found -+ 172 jump *label129 equal :fn4:enemy_found null -+ 173 control enabled projector1 true -+ 174 control enabled projector2 true -+ 175 control config .ULD_IN_1 .FUEL_OFF -+ 176 control config .ULD_OUT_1 .FUEL -+ 177 control config .ULD_IN_2 .FUEL_OFF -+ 178 control config .ULD_OUT_2 .FUEL -+ 179 control config .ULD_IN_MANY .FUEL_OFF -+ 180 control config .ULD_OUT_MANY .FUEL -+ 181 control config .ULD_MIXER .FUEL_OFF -+ 182 control enabled reactor1 false -+ 183 control enabled reactor2 false -+ 184 control enabled reactor3 false -+ 185 control enabled reactor4 false -+ 186 control enabled reactor5 false -+ 187 set :fn4*retval true -+ 188 jump *label131 always -+ 189 jump *label130 always -+ 190 label *label129 -+ 191 control enabled projector1 false -+ 192 control enabled projector2 false -+ 193 set :fn4*retval false -+ 194 jump *label131 always -+ 195 label *label130 -+ 196 label *label131 - 197 op or :emerg_shutdown :emerg_shutdown :fn4*retval - 198 set :fn3:reactor reactor3 - 199 set :fn3:reactor_num 3 - - 601 label *label63 - 602 return :fn3*retaddr - 603 end ++ 230 label *label152 ++ 231 radar enemy any any health :fn4:unit 1 :fn4:enemy_found ++ 232 jump *label153 equal :fn4:enemy_found null ++ 233 control enabled projector1 true ++ 234 control enabled projector2 true ++ 235 control config .ULD_IN_1 .FUEL_OFF ++ 236 control config .ULD_OUT_1 .FUEL ++ 237 control config .ULD_IN_2 .FUEL_OFF ++ 238 control config .ULD_OUT_2 .FUEL ++ 239 control config .ULD_IN_MANY .FUEL_OFF ++ 240 control config .ULD_OUT_MANY .FUEL ++ 241 control config .ULD_MIXER .FUEL_OFF ++ 242 control enabled reactor1 false ++ 243 control enabled reactor2 false ++ 244 control enabled reactor3 false ++ 245 control enabled reactor4 false ++ 246 control enabled reactor5 false ++ 247 set :fn4*retval true ++ 248 jump *label155 always ++ 249 jump *label154 always ++ 250 label *label153 ++ 251 control enabled projector1 false ++ 252 control enabled projector2 false ++ 253 set :fn4*retval false ++ 254 jump *label155 always ++ 255 label *label154 ++ 256 label *label155 + 257 op or :emerg_shutdown :emerg_shutdown :fn4*retval + 258 set :fn3:reactor reactor3 + 259 set :fn3:reactor_num 3 + + 653 label *label63 + 654 return :fn3*retaddr + 655 end - * label *label4 - * radar enemy any any health :fn4:unit 1 :fn4:enemy_found - * jump *label98 equal :fn4:enemy_found null @@ -2351,10 +2675,10 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 47 set .NODE node1 48 set :fn4:unit cyclone1 - 49 label *label124 + 49 label *label148 - * radar enemy any any health :fn4:unit 1 :fn4:enemy_found + 50 radar enemy any any health cyclone1 1 :fn4:enemy_found - 51 jump *label125 equal :fn4:enemy_found null + 51 jump *label149 equal :fn4:enemy_found null 52 control enabled projector1 true 53 control enabled projector2 true - * control config .ULD_IN_1 .FUEL_OFF @@ -2375,14 +2699,14 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 62 control enabled reactor2 false 63 control enabled reactor3 false - 168 label *label117 - 169 set :fn4:unit cyclone1 - 170 label *label128 + 228 label *label117 + 229 set :fn4:unit cyclone1 + 230 label *label152 - * radar enemy any any health :fn4:unit 1 :fn4:enemy_found -+ 171 radar enemy any any health cyclone1 1 :fn4:enemy_found - 172 jump *label129 equal :fn4:enemy_found null - 173 control enabled projector1 true - 174 control enabled projector2 true ++ 231 radar enemy any any health cyclone1 1 :fn4:enemy_found + 232 jump *label153 equal :fn4:enemy_found null + 233 control enabled projector1 true + 234 control enabled projector2 true - * control config .ULD_IN_1 .FUEL_OFF - * control config .ULD_OUT_1 .FUEL - * control config .ULD_IN_2 .FUEL_OFF @@ -2390,16 +2714,16 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * control config .ULD_IN_MANY .FUEL_OFF - * control config .ULD_OUT_MANY .FUEL - * control config .ULD_MIXER .FUEL_OFF -+ 175 control config unloader1 @scrap -+ 176 control config unloader2 @blast-compound -+ 177 control config unloader3 @scrap -+ 178 control config unloader4 @blast-compound -+ 179 control config unloader5 @scrap -+ 180 control config unloader6 @blast-compound -+ 181 control config unloader7 @scrap - 182 control enabled reactor1 false - 183 control enabled reactor2 false - 184 control enabled reactor3 false ++ 235 control config unloader1 @scrap ++ 236 control config unloader2 @blast-compound ++ 237 control config unloader3 @scrap ++ 238 control config unloader4 @blast-compound ++ 239 control config unloader5 @scrap ++ 240 control config unloader6 @blast-compound ++ 241 control config unloader7 @scrap + 242 control enabled reactor1 false + 243 control enabled reactor2 false + 244 control enabled reactor3 false Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-11 instructions): 0 printflush message1 @@ -2422,2115 +2746,1795 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 37 set .CONTAINER vault1 38 set .NODE node1 - * set :fn4:unit cyclone1 - 39 label *label124 + 39 label *label148 40 radar enemy any any health cyclone1 1 :fn4:enemy_found - 41 jump *label125 equal :fn4:enemy_found null + 41 jump *label149 equal :fn4:enemy_found null - 156 control config unloader4 @scrap - 157 label *label116 - 158 label *label117 + 216 control config unloader4 @scrap + 217 label *label116 + 218 label *label117 - * set :fn4:unit cyclone1 - 159 label *label128 - 160 radar enemy any any health cyclone1 1 :fn4:enemy_found - 161 jump *label129 equal :fn4:enemy_found null - -Modifications by Inline function 'calc_charge_req' defined at line 126:1 (+56 instructions): - - 80 op or :emerg_shutdown :fn4*retval *tmp8 - 81 set :fn2:reactor reactor1 - 82 set :fn2:time :t_startup1 -- * setaddr :fn2*retaddr *label14 -- * call *label2 :fn2*retval -- * label *label14 -+ 83 label *label132 -+ 84 op sub *tmp102 @tick :fn2:time -+ 85 op idiv :fn2:secs *tmp102 60 -+ 86 op greaterThan *tmp104 :fn2:secs 30 -+ 87 sensor *tmp105 :fn2:reactor @enabled -+ 88 op equal *tmp106 *tmp105 false -+ 89 op or *tmp107 *tmp104 *tmp106 -+ 90 jump *label133 equal *tmp107 false -+ 91 set :fn2*retval 0 -+ 92 jump *label135 always -+ 93 label *label133 -+ 94 label *label134 -+ 95 op sub :fn2:time_left 30 :fn2:secs -+ 96 op mul *tmp110 :fn2:time_left :fn2:time_left -+ 97 op idiv :fn2:charge_req *tmp110 0.04 -+ 98 set :fn2*retval :fn2:charge_req -+ 99 jump *label135 always -+ 100 label *label135 - 101 set .START_POWER_REQ :fn2*retval - 102 set :fn2:reactor reactor2 - 103 set :fn2:time :t_startup2 -- * setaddr :fn2*retaddr *label15 -- * call *label2 :fn2*retval -- * label *label15 -+ 104 label *label136 -+ 105 op sub *tmp102 @tick :fn2:time -+ 106 op idiv :fn2:secs *tmp102 60 -+ 107 op greaterThan *tmp104 :fn2:secs 30 -+ 108 sensor *tmp105 :fn2:reactor @enabled -+ 109 op equal *tmp106 *tmp105 false -+ 110 op or *tmp107 *tmp104 *tmp106 -+ 111 jump *label137 equal *tmp107 false -+ 112 set :fn2*retval 0 -+ 113 jump *label139 always -+ 114 label *label137 -+ 115 label *label138 -+ 116 op sub :fn2:time_left 30 :fn2:secs -+ 117 op mul *tmp110 :fn2:time_left :fn2:time_left -+ 118 op idiv :fn2:charge_req *tmp110 0.04 -+ 119 set :fn2*retval :fn2:charge_req -+ 120 jump *label139 always -+ 121 label *label139 - 122 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval - 123 set :fn2:reactor reactor3 - 124 set :fn2:time :t_startup3 -- * setaddr :fn2*retaddr *label16 -- * call *label2 :fn2*retval -- * label *label16 -+ 125 label *label140 -+ 126 op sub *tmp102 @tick :fn2:time -+ 127 op idiv :fn2:secs *tmp102 60 -+ 128 op greaterThan *tmp104 :fn2:secs 30 -+ 129 sensor *tmp105 :fn2:reactor @enabled -+ 130 op equal *tmp106 *tmp105 false -+ 131 op or *tmp107 *tmp104 *tmp106 -+ 132 jump *label141 equal *tmp107 false -+ 133 set :fn2*retval 0 -+ 134 jump *label143 always -+ 135 label *label141 -+ 136 label *label142 -+ 137 op sub :fn2:time_left 30 :fn2:secs -+ 138 op mul *tmp110 :fn2:time_left :fn2:time_left -+ 139 op idiv :fn2:charge_req *tmp110 0.04 -+ 140 set :fn2*retval :fn2:charge_req -+ 141 jump *label143 always -+ 142 label *label143 - 143 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval - 144 set :fn2:reactor reactor4 - 145 set :fn2:time :t_startup4 -- * setaddr :fn2*retaddr *label17 -- * call *label2 :fn2*retval -- * label *label17 -+ 146 label *label144 -+ 147 op sub *tmp102 @tick :fn2:time -+ 148 op idiv :fn2:secs *tmp102 60 -+ 149 op greaterThan *tmp104 :fn2:secs 30 -+ 150 sensor *tmp105 :fn2:reactor @enabled -+ 151 op equal *tmp106 *tmp105 false -+ 152 op or *tmp107 *tmp104 *tmp106 -+ 153 jump *label145 equal *tmp107 false -+ 154 set :fn2*retval 0 -+ 155 jump *label147 always -+ 156 label *label145 -+ 157 label *label146 -+ 158 op sub :fn2:time_left 30 :fn2:secs -+ 159 op mul *tmp110 :fn2:time_left :fn2:time_left -+ 160 op idiv :fn2:charge_req *tmp110 0.04 -+ 161 set :fn2*retval :fn2:charge_req -+ 162 jump *label147 always -+ 163 label *label147 - 164 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval - 165 set :fn2:reactor reactor5 - 166 set :fn2:time :t_startup5 -- * setaddr :fn2*retaddr *label18 -- * call *label2 :fn2*retval -- * label *label18 -+ 167 label *label148 -+ 168 op sub *tmp102 @tick :fn2:time -+ 169 op idiv :fn2:secs *tmp102 60 -+ 170 op greaterThan *tmp104 :fn2:secs 30 -+ 171 sensor *tmp105 :fn2:reactor @enabled -+ 172 op equal *tmp106 *tmp105 false -+ 173 op or *tmp107 *tmp104 *tmp106 -+ 174 jump *label149 equal *tmp107 false -+ 175 set :fn2*retval 0 -+ 176 jump *label151 always -+ 177 label *label149 -+ 178 label *label150 -+ 179 op sub :fn2:time_left 30 :fn2:secs -+ 180 op mul *tmp110 :fn2:time_left :fn2:time_left -+ 181 op idiv :fn2:charge_req *tmp110 0.04 -+ 182 set :fn2*retval :fn2:charge_req -+ 183 jump *label151 always -+ 184 label *label151 - 185 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval - 186 set :fn3:reactor reactor1 - 187 set :fn3:reactor_num 1 - - 459 jump *label7 always - 460 label *label9 - 461 end -- * label *label2 -- * op sub *tmp102 @tick :fn2:time -- * op idiv :fn2:secs *tmp102 60 -- * op greaterThan *tmp104 :fn2:secs 30 -- * sensor *tmp105 :fn2:reactor @enabled -- * op equal *tmp106 *tmp105 false -- * op or *tmp107 *tmp104 *tmp106 -- * jump *label61 equal *tmp107 false -- * set :fn2*retval 0 -- * jump *label60 always -- * label *label61 -- * label *label62 -- * op sub :fn2:time_left 30 :fn2:secs -- * op mul *tmp110 :fn2:time_left :fn2:time_left -- * op idiv :fn2:charge_req *tmp110 0.04 -- * set :fn2*retval :fn2:charge_req -- * jump *label60 always -- * label *label60 -- * return :fn2*retaddr -- * end - 462 label *label3 - 463 set .RET_T_STARTUP :fn3:t_startup - 464 op sub *tmp113 @tick :fn3:t_startup - - 520 jump *label76 greaterThanEq :fn3:secs 30 - 521 set :fn2:reactor :fn3:reactor - 522 set :fn2:time :fn3:t_startup -- * setaddr :fn2*retaddr *label78 -- * call *label2 :fn2*retval -- * label *label78 -+ 523 label *label152 -+ 524 op sub *tmp102 @tick :fn2:time -+ 525 op idiv :fn2:secs *tmp102 60 -+ 526 op greaterThan *tmp104 :fn2:secs 30 -+ 527 sensor *tmp105 :fn2:reactor @enabled -+ 528 op equal *tmp106 *tmp105 false -+ 529 op or *tmp107 *tmp104 *tmp106 -+ 530 jump *label153 equal *tmp107 false -+ 531 set :fn2*retval 0 -+ 532 jump *label155 always -+ 533 label *label153 -+ 534 label *label154 -+ 535 op sub :fn2:time_left 30 :fn2:secs -+ 536 op mul *tmp110 :fn2:time_left :fn2:time_left -+ 537 op idiv :fn2:charge_req *tmp110 0.04 -+ 538 set :fn2*retval :fn2:charge_req -+ 539 jump *label155 always -+ 540 label *label155 - 541 op sub *tmp153 :fn3:charge :fn2*retval - 542 op lessThan *tmp154 *tmp153 .PWR_ABORT - 543 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT - -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - - 81 set :fn2:reactor reactor1 - 82 set :fn2:time :t_startup1 - 83 label *label132 -- * op sub *tmp102 @tick :fn2:time -+ 84 op sub *tmp102 @tick :t_startup1 - 85 op idiv :fn2:secs *tmp102 60 - 86 op greaterThan *tmp104 :fn2:secs 30 -- * sensor *tmp105 :fn2:reactor @enabled -+ 87 sensor *tmp105 reactor1 @enabled - 88 op equal *tmp106 *tmp105 false - 89 op or *tmp107 *tmp104 *tmp106 - 90 jump *label133 equal *tmp107 false - - 102 set :fn2:reactor reactor2 - 103 set :fn2:time :t_startup2 - 104 label *label136 -- * op sub *tmp102 @tick :fn2:time -+ 105 op sub *tmp102 @tick :t_startup2 - 106 op idiv :fn2:secs *tmp102 60 - 107 op greaterThan *tmp104 :fn2:secs 30 -- * sensor *tmp105 :fn2:reactor @enabled -+ 108 sensor *tmp105 reactor2 @enabled - 109 op equal *tmp106 *tmp105 false - 110 op or *tmp107 *tmp104 *tmp106 - 111 jump *label137 equal *tmp107 false - - 123 set :fn2:reactor reactor3 - 124 set :fn2:time :t_startup3 - 125 label *label140 -- * op sub *tmp102 @tick :fn2:time -+ 126 op sub *tmp102 @tick :t_startup3 - 127 op idiv :fn2:secs *tmp102 60 - 128 op greaterThan *tmp104 :fn2:secs 30 -- * sensor *tmp105 :fn2:reactor @enabled -+ 129 sensor *tmp105 reactor3 @enabled - 130 op equal *tmp106 *tmp105 false - 131 op or *tmp107 *tmp104 *tmp106 - 132 jump *label141 equal *tmp107 false - - 144 set :fn2:reactor reactor4 - 145 set :fn2:time :t_startup4 - 146 label *label144 -- * op sub *tmp102 @tick :fn2:time -+ 147 op sub *tmp102 @tick :t_startup4 - 148 op idiv :fn2:secs *tmp102 60 - 149 op greaterThan *tmp104 :fn2:secs 30 -- * sensor *tmp105 :fn2:reactor @enabled -+ 150 sensor *tmp105 reactor4 @enabled - 151 op equal *tmp106 *tmp105 false - 152 op or *tmp107 *tmp104 *tmp106 - 153 jump *label145 equal *tmp107 false - - 165 set :fn2:reactor reactor5 - 166 set :fn2:time :t_startup5 - 167 label *label148 -- * op sub *tmp102 @tick :fn2:time -+ 168 op sub *tmp102 @tick :t_startup5 - 169 op idiv :fn2:secs *tmp102 60 - 170 op greaterThan *tmp104 :fn2:secs 30 -- * sensor *tmp105 :fn2:reactor @enabled -+ 171 sensor *tmp105 reactor5 @enabled - 172 op equal *tmp106 *tmp105 false - 173 op or *tmp107 *tmp104 *tmp106 - 174 jump *label149 equal *tmp107 false - - 521 set :fn2:reactor :fn3:reactor - 522 set :fn2:time :fn3:t_startup - 523 label *label152 -- * op sub *tmp102 @tick :fn2:time -+ 524 op sub *tmp102 @tick :fn3:t_startup - 525 op idiv :fn2:secs *tmp102 60 - 526 op greaterThan *tmp104 :fn2:secs 30 -- * sensor *tmp105 :fn2:reactor @enabled -+ 527 sensor *tmp105 :fn3:reactor @enabled - 528 op equal *tmp106 *tmp105 false - 529 op or *tmp107 *tmp104 *tmp106 - 530 jump *label153 equal *tmp107 false + 219 label *label152 + 220 radar enemy any any health cyclone1 1 :fn4:enemy_found + 221 jump *label153 equal :fn4:enemy_found null -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-12 instructions): - - 78 jump *label11 always - 79 label *label11 - 80 op or :emerg_shutdown :fn4*retval *tmp8 -- * set :fn2:reactor reactor1 -- * set :fn2:time :t_startup1 - 81 label *label132 - 82 op sub *tmp102 @tick :t_startup1 - 83 op idiv :fn2:secs *tmp102 60 +Modifications by Inline function call at line 80:14 (+156 instructions): - 97 jump *label135 always - 98 label *label135 - 99 set .START_POWER_REQ :fn2*retval -- * set :fn2:reactor reactor2 -- * set :fn2:time :t_startup2 - 100 label *label136 - 101 op sub *tmp102 @tick :t_startup2 - 102 op idiv :fn2:secs *tmp102 60 - - 116 jump *label139 always - 117 label *label139 - 118 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval -- * set :fn2:reactor reactor3 -- * set :fn2:time :t_startup3 - 119 label *label140 - 120 op sub *tmp102 @tick :t_startup3 - 121 op idiv :fn2:secs *tmp102 60 - - 135 jump *label143 always - 136 label *label143 - 137 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval -- * set :fn2:reactor reactor4 -- * set :fn2:time :t_startup4 - 138 label *label144 - 139 op sub *tmp102 @tick :t_startup4 - 140 op idiv :fn2:secs *tmp102 60 - - 154 jump *label147 always - 155 label *label147 - 156 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval -- * set :fn2:reactor reactor5 -- * set :fn2:time :t_startup5 - 157 label *label148 - 158 op sub *tmp102 @tick :t_startup5 - 159 op idiv :fn2:secs *tmp102 60 - - 508 jump *label75 always - 509 label *label74 - 510 jump *label76 greaterThanEq :fn3:secs 30 -- * set :fn2:reactor :fn3:reactor -- * set :fn2:time :fn3:t_startup - 511 label *label152 - 512 op sub *tmp102 @tick :fn3:t_startup - 513 op idiv :fn2:secs *tmp102 60 - -Modifications by Inline function call at line 80:14 (+157 instructions): - - 178 set :fn3:emerg_shutdown :emerg_shutdown - 179 set :fn3:fuel_on :fuel_1 - 180 set :fn3:t_startup :t_startup1 + 173 set :fn3:emerg_shutdown :emerg_shutdown + 174 set :fn3:fuel_on :fuel_1 + 175 set :fn3:t_startup :t_startup1 - * setaddr :fn3*retaddr *label19 - * call *label3 :fn3*retval - * label *label19 -+ 181 label *label156 -+ 182 set .RET_T_STARTUP :fn3:t_startup -+ 183 op sub *tmp113 @tick :fn3:t_startup -+ 184 op idiv :fn3:secs *tmp113 60 -+ 185 sensor :fn3:fuel :fn3:reactor @blast-compound -+ 186 set :fn3:supply_fuel true -+ 187 sensor :fn3:fuel_stored .CONTAINER @blast-compound -+ 188 sensor :fn3:cryo :fn3:reactor @cryofluid -+ 189 sensor *tmp118 .NODE @powerNetStored -+ 190 op floor :fn3:charge *tmp118 -+ 191 sensor *tmp120 .NODE @powerNetIn -+ 192 sensor *tmp121 .NODE @powerNetOut -+ 193 op sub *tmp122 *tmp120 *tmp121 -+ 194 op floor :fn3:surplus *tmp122 -+ 195 op mul *tmp124 .AVG_SURPLUS 0.8 -+ 196 op mul *tmp125 :fn3:surplus 0.2 -+ 197 op add .AVG_SURPLUS *tmp124 *tmp125 -+ 198 sensor :fn3:enabled :fn3:reactor @enabled -+ 199 print "#" -+ 200 print :fn3:reactor_num -+ 201 print " " -+ 202 print "- " -+ 203 jump *label157 equal :fn3:emerg_shutdown false -+ 204 control enabled :fn3:reactor false -+ 205 print "emergency mode" -+ 206 print "\n" -+ 207 set :fn3:supply_fuel false -+ 208 jump *label190 always -+ 209 label *label157 -+ 210 jump *label176 equal :fn3:enabled false -+ 211 jump *label158 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num -+ 212 control enabled :fn3:reactor false -+ 213 print "STOP unwanted" -+ 214 print "\n" -+ 215 jump *label175 always -+ 216 label *label158 -+ 217 op greaterThan *tmp136 :fn3:reactor_num 1 -+ 218 op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num -+ 219 op lessThan *tmp138 :fn3:fuel_stored *tmp137 -+ 220 op land *tmp139 *tmp136 *tmp138 -+ 221 jump *label159 equal *tmp139 false -+ 222 control enabled :fn3:reactor false -+ 223 print "STOP system fuel low" -+ 224 print "\n" -+ 225 jump *label174 always -+ 226 label *label159 -+ 227 jump *label160 greaterThan :fn3:fuel 1 -+ 228 control enabled :fn3:reactor false -+ 229 print "STOP fuel low" -+ 230 print "\n" -+ 231 jump *label173 always -+ 232 label *label160 -+ 233 jump *label161 greaterThan :fn3:cryo .CRYO_ABORT -+ 234 control enabled :fn3:reactor false -+ 235 print "STOP out of cryo" -+ 236 print "\n" -+ 237 jump *label172 always -+ 238 label *label161 -+ 239 jump *label168 greaterThanEq :fn3:secs 30 -+ 240 label *label162 -+ 241 op sub *tmp102 @tick :fn3:t_startup -+ 242 op idiv :fn2:secs *tmp102 60 -+ 243 op greaterThan *tmp104 :fn2:secs 30 -+ 244 sensor *tmp105 :fn3:reactor @enabled -+ 245 op equal *tmp106 *tmp105 false -+ 246 op or *tmp107 *tmp104 *tmp106 -+ 247 jump *label163 equal *tmp107 false -+ 248 set :fn2*retval 0 -+ 249 jump *label165 always -+ 250 label *label163 -+ 251 label *label164 -+ 252 op sub :fn2:time_left 30 :fn2:secs -+ 253 op mul *tmp110 :fn2:time_left :fn2:time_left -+ 254 op idiv :fn2:charge_req *tmp110 0.04 -+ 255 set :fn2*retval :fn2:charge_req -+ 256 jump *label165 always -+ 257 label *label165 -+ 258 op sub *tmp153 :fn3:charge :fn2*retval -+ 259 op lessThan *tmp154 *tmp153 .PWR_ABORT -+ 260 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT -+ 261 op land *tmp156 *tmp154 *tmp155 -+ 262 jump *label166 equal *tmp156 false -+ 263 control enabled :fn3:reactor false -+ 264 print "START FAIL battery" -+ 265 print "\n" -+ 266 set :fn3:supply_fuel false -+ 267 jump *label167 always -+ 268 label *label166 -+ 269 op sub :fn3:time_left 30 :fn3:secs -+ 270 print "Starting " -+ 271 print :fn3:time_left -+ 272 print " " -+ 273 print "secs, req " -+ 274 print :fn2*retval -+ 275 print "J" -+ 276 print "\n" -+ 277 label *label167 -+ 278 jump *label171 always -+ 279 label *label168 -+ 280 op lessThan *tmp161 :fn3:charge .PWR_ABANDON -+ 281 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT -+ 282 op land *tmp163 *tmp161 *tmp162 -+ 283 jump *label169 equal *tmp163 false -+ 284 control enabled :fn3:reactor false -+ 285 print "ABANDON - battery crit" -+ 286 print "\n" -+ 287 set :fn3:supply_fuel false -+ 288 jump *label170 always -+ 289 label *label169 -+ 290 op idiv :fn3:mins :fn3:secs 6 -+ 291 op div :fn3:mins :fn3:mins 10 -+ 292 print "RUN " -+ 293 print :fn3:mins -+ 294 print " " -+ 295 print "mins" -+ 296 print "\n" -+ 297 label *label170 -+ 298 label *label171 -+ 299 label *label172 -+ 300 label *label173 -+ 301 label *label174 -+ 302 label *label175 -+ 303 jump *label189 always -+ 304 label *label176 -+ 305 op sub *tmp169 :fn3:charge .START_POWER_REQ -+ 306 op sub *tmp170 *tmp169 .PWR_ABORT -+ 307 op div *tmp171 *tmp170 .PWR_REQ -+ 308 op mul :fn3:charge_units *tmp171 .PWR_RESERVE -+ 309 op div *tmp173 :fn3:surplus .FLOW_REQ -+ 310 op max :fn3:flow_units -0.1 *tmp173 -+ 311 op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num -+ 312 op add :fn3:cryo_req .CRYO_REQ *tmp175 -+ 313 jump *label177 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num -+ 314 print "IDLE" -+ 315 print "\n" -+ 316 set :fn3:supply_fuel false -+ 317 jump *label188 always -+ 318 label *label177 -+ 319 op add *tmp179 :fn3:flow_units :fn3:charge_units -+ 320 jump *label178 greaterThanEq *tmp179 1 -+ 321 op idiv *tmp183 :fn3:flow_units 0.001 -+ 322 op div :fn3:flow *tmp183 10 -+ 323 op idiv *tmp186 :fn3:charge_units 0.001 -+ 324 op div :fn3:charge *tmp186 10 -+ 325 print "WAIT power. (%" -+ 326 print :fn3:charge -+ 327 print "J + %" -+ 328 print :fn3:flow -+ 329 print "W)" -+ 330 print "\n" -+ 331 set :fn3:supply_fuel false -+ 332 jump *label187 always -+ 333 label *label178 -+ 334 op lessThan *tmp188 :fn3:fuel .FUEL_REQ -+ 335 op land *tmp189 :fn3:fuel_on *tmp188 -+ 336 jump *label181 equal *tmp189 false -+ 337 op add *tmp191 :fn3:fuel :fn3:fuel_stored -+ 338 jump *label179 lessThanEq *tmp191 .FUEL_REQ -+ 339 print "WAIT fuel" -+ 340 print "\n" -+ 341 jump *label180 always -+ 342 label *label179 -+ 343 print "WAIT system fuel" -+ 344 print "\n" -+ 345 label *label180 -+ 346 jump *label186 always -+ 347 label *label181 -+ 348 op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num -+ 349 jump *label182 greaterThanEq :fn3:fuel_stored *tmp194 -+ 350 print "WAIT buffer fuel" -+ 351 print "\n" -+ 352 jump *label185 always -+ 353 label *label182 -+ 354 jump *label183 greaterThanEq :fn3:cryo :fn3:cryo_req -+ 355 print "WAIT cryo" -+ 356 print "\n" -+ 357 jump *label184 always -+ 358 label *label183 -+ 359 print "STARTUP" -+ 360 print "\n" -+ 361 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ -+ 362 control enabled :fn3:reactor true -+ 363 label *label184 -+ 364 label *label185 -+ 365 label *label186 -+ 366 label *label187 -+ 367 label *label188 -+ 368 label *label189 -+ 369 label *label190 -+ 370 sensor *tmp201 :fn3:reactor @enabled -+ 371 jump *label191 equal :fn3:enabled *tmp201 -+ 372 set .RET_T_STARTUP @tick -+ 373 label *label191 -+ 374 label *label192 -+ 375 set :fn3*retval :fn3:supply_fuel -+ 376 jump *label193 always -+ 377 label *label193 - 378 set :fuel_1 :fn3*retval - 379 set :t_startup1 .RET_T_STARTUP - 380 label *label106 ++ 176 label *label156 ++ 177 set .RET_T_STARTUP :fn3:t_startup ++ 178 op sub *tmp113 @tick :fn3:t_startup ++ 179 op idiv :fn3:secs *tmp113 60 ++ 180 sensor :fn3:fuel :fn3:reactor @blast-compound ++ 181 set :fn3:supply_fuel true ++ 182 sensor :fn3:fuel_stored .CONTAINER @blast-compound ++ 183 sensor :fn3:cryo :fn3:reactor @cryofluid ++ 184 sensor *tmp118 .NODE @powerNetStored ++ 185 op floor :fn3:charge *tmp118 ++ 186 sensor *tmp120 .NODE @powerNetIn ++ 187 sensor *tmp121 .NODE @powerNetOut ++ 188 op sub *tmp122 *tmp120 *tmp121 ++ 189 op floor :fn3:surplus *tmp122 ++ 190 op mul *tmp124 .AVG_SURPLUS 0.8 ++ 191 op mul *tmp125 :fn3:surplus 0.2 ++ 192 op add .AVG_SURPLUS *tmp124 *tmp125 ++ 193 sensor :fn3:enabled :fn3:reactor @enabled ++ 194 print "#" ++ 195 print :fn3:reactor_num ++ 196 print " " ++ 197 print "- " ++ 198 jump *label157 equal :fn3:emerg_shutdown false ++ 199 control enabled :fn3:reactor false ++ 200 print "emergency mode" ++ 201 print "\n" ++ 202 set :fn3:supply_fuel false ++ 203 jump *label190 always ++ 204 label *label157 ++ 205 jump *label176 equal :fn3:enabled false ++ 206 jump *label158 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num ++ 207 control enabled :fn3:reactor false ++ 208 print "STOP unwanted" ++ 209 print "\n" ++ 210 jump *label175 always ++ 211 label *label158 ++ 212 op greaterThan *tmp136 :fn3:reactor_num 1 ++ 213 op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num ++ 214 op lessThan *tmp138 :fn3:fuel_stored *tmp137 ++ 215 op land *tmp139 *tmp136 *tmp138 ++ 216 jump *label159 equal *tmp139 false ++ 217 control enabled :fn3:reactor false ++ 218 print "STOP system fuel low" ++ 219 print "\n" ++ 220 jump *label174 always ++ 221 label *label159 ++ 222 jump *label160 greaterThan :fn3:fuel 1 ++ 223 control enabled :fn3:reactor false ++ 224 print "STOP fuel low" ++ 225 print "\n" ++ 226 jump *label173 always ++ 227 label *label160 ++ 228 jump *label161 greaterThan :fn3:cryo .CRYO_ABORT ++ 229 control enabled :fn3:reactor false ++ 230 print "STOP out of cryo" ++ 231 print "\n" ++ 232 jump *label172 always ++ 233 label *label161 ++ 234 jump *label168 greaterThanEq :fn3:secs 30 ++ 235 label *label162 ++ 236 op sub *tmp102 @tick :fn3:t_startup ++ 237 op idiv :fn2:secs *tmp102 60 ++ 238 op greaterThan *tmp104 :fn2:secs 30 ++ 239 sensor *tmp105 :fn3:reactor @enabled ++ 240 op equal *tmp106 *tmp105 false ++ 241 op or *tmp107 *tmp104 *tmp106 ++ 242 jump *label163 equal *tmp107 false ++ 243 set :fn2*retval 0 ++ 244 jump *label165 always ++ 245 label *label163 ++ 246 label *label164 ++ 247 op sub :fn2:time_left 30 :fn2:secs ++ 248 op mul *tmp110 :fn2:time_left :fn2:time_left ++ 249 op idiv :fn2*retval *tmp110 0.04 ++ 250 jump *label165 always ++ 251 label *label165 ++ 252 op sub *tmp153 :fn3:charge :fn2*retval ++ 253 op lessThan *tmp154 *tmp153 .PWR_ABORT ++ 254 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT ++ 255 op land *tmp156 *tmp154 *tmp155 ++ 256 jump *label166 equal *tmp156 false ++ 257 control enabled :fn3:reactor false ++ 258 print "START FAIL battery" ++ 259 print "\n" ++ 260 set :fn3:supply_fuel false ++ 261 jump *label167 always ++ 262 label *label166 ++ 263 op sub :fn3:time_left 30 :fn3:secs ++ 264 print "Starting " ++ 265 print :fn3:time_left ++ 266 print " " ++ 267 print "secs, req " ++ 268 print :fn2*retval ++ 269 print "J" ++ 270 print "\n" ++ 271 label *label167 ++ 272 jump *label171 always ++ 273 label *label168 ++ 274 op lessThan *tmp161 :fn3:charge .PWR_ABANDON ++ 275 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT ++ 276 op land *tmp163 *tmp161 *tmp162 ++ 277 jump *label169 equal *tmp163 false ++ 278 control enabled :fn3:reactor false ++ 279 print "ABANDON - battery crit" ++ 280 print "\n" ++ 281 set :fn3:supply_fuel false ++ 282 jump *label170 always ++ 283 label *label169 ++ 284 op idiv :fn3:mins :fn3:secs 6 ++ 285 op div :fn3:mins :fn3:mins 10 ++ 286 print "RUN " ++ 287 print :fn3:mins ++ 288 print " " ++ 289 print "mins" ++ 290 print "\n" ++ 291 label *label170 ++ 292 label *label171 ++ 293 label *label172 ++ 294 label *label173 ++ 295 label *label174 ++ 296 label *label175 ++ 297 jump *label189 always ++ 298 label *label176 ++ 299 op sub *tmp169 :fn3:charge .START_POWER_REQ ++ 300 op sub *tmp170 *tmp169 .PWR_ABORT ++ 301 op div *tmp171 *tmp170 .PWR_REQ ++ 302 op mul :fn3:charge_units *tmp171 .PWR_RESERVE ++ 303 op div *tmp173 :fn3:surplus .FLOW_REQ ++ 304 op max :fn3:flow_units -0.1 *tmp173 ++ 305 op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num ++ 306 op add :fn3:cryo_req .CRYO_REQ *tmp175 ++ 307 jump *label177 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num ++ 308 print "IDLE" ++ 309 print "\n" ++ 310 set :fn3:supply_fuel false ++ 311 jump *label188 always ++ 312 label *label177 ++ 313 op add *tmp179 :fn3:flow_units :fn3:charge_units ++ 314 jump *label178 greaterThanEq *tmp179 1 ++ 315 op idiv *tmp183 :fn3:flow_units 0.001 ++ 316 op div :fn3:flow *tmp183 10 ++ 317 op idiv *tmp186 :fn3:charge_units 0.001 ++ 318 op div :fn3:charge *tmp186 10 ++ 319 print "WAIT power. (%" ++ 320 print :fn3:charge ++ 321 print "J + %" ++ 322 print :fn3:flow ++ 323 print "W)" ++ 324 print "\n" ++ 325 set :fn3:supply_fuel false ++ 326 jump *label187 always ++ 327 label *label178 ++ 328 op lessThan *tmp188 :fn3:fuel .FUEL_REQ ++ 329 op land *tmp189 :fn3:fuel_on *tmp188 ++ 330 jump *label181 equal *tmp189 false ++ 331 op add *tmp191 :fn3:fuel :fn3:fuel_stored ++ 332 jump *label179 lessThanEq *tmp191 .FUEL_REQ ++ 333 print "WAIT fuel" ++ 334 print "\n" ++ 335 jump *label180 always ++ 336 label *label179 ++ 337 print "WAIT system fuel" ++ 338 print "\n" ++ 339 label *label180 ++ 340 jump *label186 always ++ 341 label *label181 ++ 342 op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num ++ 343 jump *label182 greaterThanEq :fn3:fuel_stored *tmp194 ++ 344 print "WAIT buffer fuel" ++ 345 print "\n" ++ 346 jump *label185 always ++ 347 label *label182 ++ 348 jump *label183 greaterThanEq :fn3:cryo :fn3:cryo_req ++ 349 print "WAIT cryo" ++ 350 print "\n" ++ 351 jump *label184 always ++ 352 label *label183 ++ 353 print "STARTUP" ++ 354 print "\n" ++ 355 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ ++ 356 control enabled :fn3:reactor true ++ 357 label *label184 ++ 358 label *label185 ++ 359 label *label186 ++ 360 label *label187 ++ 361 label *label188 ++ 362 label *label189 ++ 363 label *label190 ++ 364 sensor *tmp201 :fn3:reactor @enabled ++ 365 jump *label191 equal :fn3:enabled *tmp201 ++ 366 set .RET_T_STARTUP @tick ++ 367 label *label191 ++ 368 label *label192 ++ 369 set :fn3*retval :fn3:supply_fuel ++ 370 jump *label193 always ++ 371 label *label193 + 372 set :fuel_1 :fn3*retval + 373 set :t_startup1 .RET_T_STARTUP + 374 label *label106 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 instructions): - 30 set :t_startup3 *tmp5 - 31 set :t_startup4 *tmp5 - 32 set :t_startup5 *tmp5 + 25 label *label5 + 26 set *tmp5 @tick + 27 label *label6 - * set .RET_T_STARTUP *tmp5 - 33 set .REACTORS_DESIRED 5 - 34 set .AVG_SURPLUS 500 - 35 label *label7 + 28 set :t_startup1 *tmp5 + 29 set :t_startup2 *tmp5 + 30 set :t_startup3 *tmp5 - 178 set :fn3:fuel_on :fuel_1 - 179 set :fn3:t_startup :t_startup1 - 180 label *label156 + 173 set :fn3:fuel_on :fuel_1 + 174 set :fn3:t_startup :t_startup1 + 175 label *label156 - * set .RET_T_STARTUP :fn3:t_startup - * op sub *tmp113 @tick :fn3:t_startup -+ 181 set .RET_T_STARTUP :t_startup1 -+ 182 op sub *tmp113 @tick :t_startup1 - 183 op idiv :fn3:secs *tmp113 60 ++ 176 set .RET_T_STARTUP :t_startup1 ++ 177 op sub *tmp113 @tick :t_startup1 + 178 op idiv :fn3:secs *tmp113 60 - * sensor :fn3:fuel :fn3:reactor @blast-compound -+ 184 sensor :fn3:fuel reactor1 @blast-compound - 185 set :fn3:supply_fuel true ++ 179 sensor :fn3:fuel reactor1 @blast-compound + 180 set :fn3:supply_fuel true - * sensor :fn3:fuel_stored .CONTAINER @blast-compound - * sensor :fn3:cryo :fn3:reactor @cryofluid - * sensor *tmp118 .NODE @powerNetStored -+ 186 sensor :fn3:fuel_stored vault1 @blast-compound -+ 187 sensor :fn3:cryo reactor1 @cryofluid -+ 188 sensor *tmp118 node1 @powerNetStored - 189 op floor :fn3:charge *tmp118 ++ 181 sensor :fn3:fuel_stored vault1 @blast-compound ++ 182 sensor :fn3:cryo reactor1 @cryofluid ++ 183 sensor *tmp118 node1 @powerNetStored + 184 op floor :fn3:charge *tmp118 - * sensor *tmp120 .NODE @powerNetIn - * sensor *tmp121 .NODE @powerNetOut -+ 190 sensor *tmp120 node1 @powerNetIn -+ 191 sensor *tmp121 node1 @powerNetOut - 192 op sub *tmp122 *tmp120 *tmp121 - 193 op floor :fn3:surplus *tmp122 - 194 op mul *tmp124 .AVG_SURPLUS 0.8 - 195 op mul *tmp125 :fn3:surplus 0.2 - 196 op add .AVG_SURPLUS *tmp124 *tmp125 ++ 185 sensor *tmp120 node1 @powerNetIn ++ 186 sensor *tmp121 node1 @powerNetOut + 187 op sub *tmp122 *tmp120 *tmp121 + 188 op floor :fn3:surplus *tmp122 + 189 op mul *tmp124 .AVG_SURPLUS 0.8 + 190 op mul *tmp125 :fn3:surplus 0.2 + 191 op add .AVG_SURPLUS *tmp124 *tmp125 - * sensor :fn3:enabled :fn3:reactor @enabled -+ 197 sensor :fn3:enabled reactor1 @enabled - 198 print "#" ++ 192 sensor :fn3:enabled reactor1 @enabled + 193 print "#" - * print :fn3:reactor_num -+ 199 print 1 - 200 print " " - 201 print "- " ++ 194 print 1 + 195 print " " + 196 print "- " - * jump *label157 equal :fn3:emerg_shutdown false - * control enabled :fn3:reactor false -+ 202 jump *label157 equal :emerg_shutdown false -+ 203 control enabled reactor1 false - 204 print "emergency mode" - 205 print "\n" - 206 set :fn3:supply_fuel false - 207 jump *label190 always - 208 label *label157 - 209 jump *label176 equal :fn3:enabled false ++ 197 jump *label157 equal :emerg_shutdown false ++ 198 control enabled reactor1 false + 199 print "emergency mode" + 200 print "\n" + 201 set :fn3:supply_fuel false + 202 jump *label190 always + 203 label *label157 + 204 jump *label176 equal :fn3:enabled false - * jump *label158 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num - * control enabled :fn3:reactor false -+ 210 jump *label158 greaterThanEq .REACTORS_DESIRED 1 -+ 211 control enabled reactor1 false - 212 print "STOP unwanted" - 213 print "\n" - 214 jump *label175 always - 215 label *label158 ++ 205 jump *label158 greaterThanEq .REACTORS_DESIRED 1 ++ 206 control enabled reactor1 false + 207 print "STOP unwanted" + 208 print "\n" + 209 jump *label175 always + 210 label *label158 - * op greaterThan *tmp136 :fn3:reactor_num 1 - * op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num - * op lessThan *tmp138 :fn3:fuel_stored *tmp137 - * op land *tmp139 *tmp136 *tmp138 -+ 216 op greaterThan *tmp136 1 1 -+ 217 op mul *tmp137 15 1 -+ 218 op lessThan *tmp138 :fn3:fuel_stored 15 -+ 219 op land *tmp139 false *tmp138 - 220 jump *label159 equal *tmp139 false ++ 211 op greaterThan *tmp136 1 1 ++ 212 op mul *tmp137 15 1 ++ 213 op lessThan *tmp138 :fn3:fuel_stored 15 ++ 214 op land *tmp139 false *tmp138 + 215 jump *label159 equal *tmp139 false - * control enabled :fn3:reactor false -+ 221 control enabled reactor1 false - 222 print "STOP system fuel low" - 223 print "\n" - 224 jump *label174 always - 225 label *label159 - 226 jump *label160 greaterThan :fn3:fuel 1 ++ 216 control enabled reactor1 false + 217 print "STOP system fuel low" + 218 print "\n" + 219 jump *label174 always + 220 label *label159 + 221 jump *label160 greaterThan :fn3:fuel 1 - * control enabled :fn3:reactor false -+ 227 control enabled reactor1 false - 228 print "STOP fuel low" - 229 print "\n" - 230 jump *label173 always - 231 label *label160 ++ 222 control enabled reactor1 false + 223 print "STOP fuel low" + 224 print "\n" + 225 jump *label173 always + 226 label *label160 - * jump *label161 greaterThan :fn3:cryo .CRYO_ABORT - * control enabled :fn3:reactor false -+ 232 jump *label161 greaterThan :fn3:cryo 1 -+ 233 control enabled reactor1 false - 234 print "STOP out of cryo" - 235 print "\n" - 236 jump *label172 always - 237 label *label161 - 238 jump *label168 greaterThanEq :fn3:secs 30 - 239 label *label162 ++ 227 jump *label161 greaterThan :fn3:cryo 1 ++ 228 control enabled reactor1 false + 229 print "STOP out of cryo" + 230 print "\n" + 231 jump *label172 always + 232 label *label161 + 233 jump *label168 greaterThanEq :fn3:secs 30 + 234 label *label162 - * op sub *tmp102 @tick :fn3:t_startup -+ 240 op sub *tmp102 @tick :t_startup1 - 241 op idiv :fn2:secs *tmp102 60 - 242 op greaterThan *tmp104 :fn2:secs 30 ++ 235 op sub *tmp102 @tick :t_startup1 + 236 op idiv :fn2:secs *tmp102 60 + 237 op greaterThan *tmp104 :fn2:secs 30 - * sensor *tmp105 :fn3:reactor @enabled -+ 243 sensor *tmp105 reactor1 @enabled - 244 op equal *tmp106 *tmp105 false - 245 op or *tmp107 *tmp104 *tmp106 - 246 jump *label163 equal *tmp107 false - - 255 jump *label165 always - 256 label *label165 - 257 op sub *tmp153 :fn3:charge :fn2*retval ++ 238 sensor *tmp105 reactor1 @enabled + 239 op equal *tmp106 *tmp105 false + 240 op or *tmp107 *tmp104 *tmp106 + 241 jump *label163 equal *tmp107 false + + 249 jump *label165 always + 250 label *label165 + 251 op sub *tmp153 :fn3:charge :fn2*retval - * op lessThan *tmp154 *tmp153 .PWR_ABORT - * op lessThan *tmp155 :fn3:surplus .FLOW_ABORT -+ 258 op lessThan *tmp154 *tmp153 5000 -+ 259 op lessThan *tmp155 :fn3:surplus -500 - 260 op land *tmp156 *tmp154 *tmp155 - 261 jump *label166 equal *tmp156 false ++ 252 op lessThan *tmp154 *tmp153 5000 ++ 253 op lessThan *tmp155 :fn3:surplus -500 + 254 op land *tmp156 *tmp154 *tmp155 + 255 jump *label166 equal *tmp156 false - * control enabled :fn3:reactor false -+ 262 control enabled reactor1 false - 263 print "START FAIL battery" - 264 print "\n" - 265 set :fn3:supply_fuel false - - 276 label *label167 - 277 jump *label171 always - 278 label *label168 ++ 256 control enabled reactor1 false + 257 print "START FAIL battery" + 258 print "\n" + 259 set :fn3:supply_fuel false + + 270 label *label167 + 271 jump *label171 always + 272 label *label168 - * op lessThan *tmp161 :fn3:charge .PWR_ABANDON - * op lessThan *tmp162 :fn3:surplus .FLOW_ABORT -+ 279 op lessThan *tmp161 :fn3:charge 2000 -+ 280 op lessThan *tmp162 :fn3:surplus -500 - 281 op land *tmp163 *tmp161 *tmp162 - 282 jump *label169 equal *tmp163 false ++ 273 op lessThan *tmp161 :fn3:charge 2000 ++ 274 op lessThan *tmp162 :fn3:surplus -500 + 275 op land *tmp163 *tmp161 *tmp162 + 276 jump *label169 equal *tmp163 false - * control enabled :fn3:reactor false -+ 283 control enabled reactor1 false - 284 print "ABANDON - battery crit" - 285 print "\n" - 286 set :fn3:supply_fuel false - - 302 jump *label189 always - 303 label *label176 - 304 op sub *tmp169 :fn3:charge .START_POWER_REQ ++ 277 control enabled reactor1 false + 278 print "ABANDON - battery crit" + 279 print "\n" + 280 set :fn3:supply_fuel false + + 296 jump *label189 always + 297 label *label176 + 298 op sub *tmp169 :fn3:charge .START_POWER_REQ - * op sub *tmp170 *tmp169 .PWR_ABORT - * op div *tmp171 *tmp170 .PWR_REQ - * op mul :fn3:charge_units *tmp171 .PWR_RESERVE - * op div *tmp173 :fn3:surplus .FLOW_REQ -+ 305 op sub *tmp170 *tmp169 5000 -+ 306 op div *tmp171 *tmp170 23000 -+ 307 op mul :fn3:charge_units *tmp171 0.6 -+ 308 op div *tmp173 :fn3:surplus 2000 - 309 op max :fn3:flow_units -0.1 *tmp173 ++ 299 op sub *tmp170 *tmp169 5000 ++ 300 op div *tmp171 *tmp170 23000 ++ 301 op mul :fn3:charge_units *tmp171 0.6 ++ 302 op div *tmp173 :fn3:surplus 2000 + 303 op max :fn3:flow_units -0.1 *tmp173 - * op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num - * op add :fn3:cryo_req .CRYO_REQ *tmp175 - * jump *label177 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num -+ 310 op mul *tmp175 2 1 -+ 311 op add :fn3:cryo_req 3 2 -+ 312 jump *label177 greaterThanEq .REACTORS_DESIRED 1 - 313 print "IDLE" - 314 print "\n" - 315 set :fn3:supply_fuel false - - 330 set :fn3:supply_fuel false - 331 jump *label187 always - 332 label *label178 ++ 304 op mul *tmp175 2 1 ++ 305 op add :fn3:cryo_req 3 2 ++ 306 jump *label177 greaterThanEq .REACTORS_DESIRED 1 + 307 print "IDLE" + 308 print "\n" + 309 set :fn3:supply_fuel false + + 324 set :fn3:supply_fuel false + 325 jump *label187 always + 326 label *label178 - * op lessThan *tmp188 :fn3:fuel .FUEL_REQ - * op land *tmp189 :fn3:fuel_on *tmp188 -+ 333 op lessThan *tmp188 :fn3:fuel 10 -+ 334 op land *tmp189 :fuel_1 *tmp188 - 335 jump *label181 equal *tmp189 false - 336 op add *tmp191 :fn3:fuel :fn3:fuel_stored ++ 327 op lessThan *tmp188 :fn3:fuel 10 ++ 328 op land *tmp189 :fuel_1 *tmp188 + 329 jump *label181 equal *tmp189 false + 330 op add *tmp191 :fn3:fuel :fn3:fuel_stored - * jump *label179 lessThanEq *tmp191 .FUEL_REQ -+ 337 jump *label179 lessThanEq *tmp191 10 - 338 print "WAIT fuel" - 339 print "\n" - 340 jump *label180 always - - 344 label *label180 - 345 jump *label186 always - 346 label *label181 ++ 331 jump *label179 lessThanEq *tmp191 10 + 332 print "WAIT fuel" + 333 print "\n" + 334 jump *label180 always + + 338 label *label180 + 339 jump *label186 always + 340 label *label181 - * op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num - * jump *label182 greaterThanEq :fn3:fuel_stored *tmp194 -+ 347 op mul *tmp194 45 1 -+ 348 jump *label182 greaterThanEq :fn3:fuel_stored 45 - 349 print "WAIT buffer fuel" - 350 print "\n" - 351 jump *label185 always - 352 label *label182 ++ 341 op mul *tmp194 45 1 ++ 342 jump *label182 greaterThanEq :fn3:fuel_stored 45 + 343 print "WAIT buffer fuel" + 344 print "\n" + 345 jump *label185 always + 346 label *label182 - * jump *label183 greaterThanEq :fn3:cryo :fn3:cryo_req -+ 353 jump *label183 greaterThanEq :fn3:cryo 5 - 354 print "WAIT cryo" - 355 print "\n" - 356 jump *label184 always - 357 label *label183 - 358 print "STARTUP" - 359 print "\n" ++ 347 jump *label183 greaterThanEq :fn3:cryo 5 + 348 print "WAIT cryo" + 349 print "\n" + 350 jump *label184 always + 351 label *label183 + 352 print "STARTUP" + 353 print "\n" - * op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ - * control enabled :fn3:reactor true -+ 360 op add .START_POWER_REQ .START_POWER_REQ 23000 -+ 361 control enabled reactor1 true - 362 label *label184 - 363 label *label185 - 364 label *label186 - - 366 label *label188 - 367 label *label189 - 368 label *label190 ++ 354 op add .START_POWER_REQ .START_POWER_REQ 23000 ++ 355 control enabled reactor1 true + 356 label *label184 + 357 label *label185 + 358 label *label186 + + 360 label *label188 + 361 label *label189 + 362 label *label190 - * sensor *tmp201 :fn3:reactor @enabled -+ 369 sensor *tmp201 reactor1 @enabled - 370 jump *label191 equal :fn3:enabled *tmp201 - 371 set .RET_T_STARTUP @tick - 372 label *label191 - - 374 set :fn3*retval :fn3:supply_fuel - 375 jump *label193 always - 376 label *label193 ++ 363 sensor *tmp201 reactor1 @enabled + 364 jump *label191 equal :fn3:enabled *tmp201 + 365 set .RET_T_STARTUP @tick + 366 label *label191 + + 368 set :fn3*retval :fn3:supply_fuel + 369 jump *label193 always + 370 label *label193 - * set :fuel_1 :fn3*retval -+ 377 set :fuel_1 :fn3:supply_fuel - 378 set :t_startup1 .RET_T_STARTUP - 379 label *label106 ++ 371 set :fuel_1 :fn3:supply_fuel + 372 set :t_startup1 .RET_T_STARTUP + 373 label *label106 - * jump *label107 equal :fn3*retval false -+ 380 jump *label107 equal :fn3:supply_fuel false - 381 control config unloader1 @blast-compound - 382 jump *label108 always - 383 label *label107 - 384 control config unloader1 @scrap - 385 label *label108 ++ 374 jump *label107 equal :fn3:supply_fuel false + 375 control config unloader1 @blast-compound + 376 jump *label108 always + 377 label *label107 + 378 control config unloader1 @scrap + 379 label *label108 - * jump *label109 notEqual :fn3*retval false -+ 386 jump *label109 notEqual :fn3:supply_fuel false - 387 control config unloader2 @blast-compound - 388 jump *label110 always - 389 label *label109 ++ 380 jump *label109 notEqual :fn3:supply_fuel false + 381 control config unloader2 @blast-compound + 382 jump *label110 always + 383 label *label109 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-6 instructions): - 172 jump *label151 always - 173 label *label151 - 174 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval + 167 jump *label143 always + 168 label *label143 + 169 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval - * set :fn3:reactor reactor1 - * set :fn3:reactor_num 1 - * set :fn3:emerg_shutdown :emerg_shutdown - * set :fn3:fuel_on :fuel_1 - * set :fn3:t_startup :t_startup1 - 175 label *label156 - 176 set .RET_T_STARTUP :t_startup1 - 177 op sub *tmp113 @tick :t_startup1 + 170 label *label156 + 171 set .RET_T_STARTUP :t_startup1 + 172 op sub *tmp113 @tick :t_startup1 - 299 op sub *tmp169 :fn3:charge .START_POWER_REQ - 300 op sub *tmp170 *tmp169 5000 - 301 op div *tmp171 *tmp170 23000 + 293 op sub *tmp169 :fn3:charge .START_POWER_REQ + 294 op sub *tmp170 *tmp169 5000 + 295 op div *tmp171 *tmp170 23000 - * op mul :fn3:charge_units *tmp171 0.6 -+ 302 op div :fn3:charge_units *tmp170 38333.333333333336 - 303 op div *tmp173 :fn3:surplus 2000 - 304 op max :fn3:flow_units -0.1 *tmp173 - 305 op mul *tmp175 2 1 - - 366 set .RET_T_STARTUP @tick - 367 label *label191 - 368 label *label192 ++ 296 op div :fn3:charge_units *tmp170 38333.333333333336 + 297 op div *tmp173 :fn3:surplus 2000 + 298 op max :fn3:flow_units -0.1 *tmp173 + 299 op mul *tmp175 2 1 + + 360 set .RET_T_STARTUP @tick + 361 label *label191 + 362 label *label192 - * set :fn3*retval :fn3:supply_fuel - 369 jump *label193 always - 370 label *label193 - 371 set :fuel_1 :fn3:supply_fuel + 363 jump *label193 always + 364 label *label193 + 365 set :fuel_1 :fn3:supply_fuel -Modifications by Inline function call at line 84:14 (+157 instructions): +Modifications by Inline function call at line 84:14 (+156 instructions): - 389 set :fn3:emerg_shutdown :emerg_shutdown - 390 set :fn3:fuel_on :fuel_2 - 391 set :fn3:t_startup :t_startup2 + 383 set :fn3:emerg_shutdown :emerg_shutdown + 384 set :fn3:fuel_on :fuel_2 + 385 set :fn3:t_startup :t_startup2 - * setaddr :fn3*retaddr *label21 - * call *label3 :fn3*retval - * label *label21 -+ 392 label *label194 -+ 393 set .RET_T_STARTUP :fn3:t_startup -+ 394 op sub *tmp113 @tick :fn3:t_startup -+ 395 op idiv :fn3:secs *tmp113 60 -+ 396 sensor :fn3:fuel :fn3:reactor @blast-compound -+ 397 set :fn3:supply_fuel true -+ 398 sensor :fn3:fuel_stored .CONTAINER @blast-compound -+ 399 sensor :fn3:cryo :fn3:reactor @cryofluid -+ 400 sensor *tmp118 .NODE @powerNetStored -+ 401 op floor :fn3:charge *tmp118 -+ 402 sensor *tmp120 .NODE @powerNetIn -+ 403 sensor *tmp121 .NODE @powerNetOut -+ 404 op sub *tmp122 *tmp120 *tmp121 -+ 405 op floor :fn3:surplus *tmp122 -+ 406 op mul *tmp124 .AVG_SURPLUS 0.8 -+ 407 op mul *tmp125 :fn3:surplus 0.2 -+ 408 op add .AVG_SURPLUS *tmp124 *tmp125 -+ 409 sensor :fn3:enabled :fn3:reactor @enabled -+ 410 print "#" -+ 411 print :fn3:reactor_num -+ 412 print " " -+ 413 print "- " -+ 414 jump *label195 equal :fn3:emerg_shutdown false -+ 415 control enabled :fn3:reactor false -+ 416 print "emergency mode" -+ 417 print "\n" -+ 418 set :fn3:supply_fuel false -+ 419 jump *label228 always -+ 420 label *label195 -+ 421 jump *label214 equal :fn3:enabled false -+ 422 jump *label196 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num -+ 423 control enabled :fn3:reactor false -+ 424 print "STOP unwanted" -+ 425 print "\n" -+ 426 jump *label213 always -+ 427 label *label196 -+ 428 op greaterThan *tmp136 :fn3:reactor_num 1 -+ 429 op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num -+ 430 op lessThan *tmp138 :fn3:fuel_stored *tmp137 -+ 431 op land *tmp139 *tmp136 *tmp138 -+ 432 jump *label197 equal *tmp139 false ++ 386 label *label194 ++ 387 set .RET_T_STARTUP :fn3:t_startup ++ 388 op sub *tmp113 @tick :fn3:t_startup ++ 389 op idiv :fn3:secs *tmp113 60 ++ 390 sensor :fn3:fuel :fn3:reactor @blast-compound ++ 391 set :fn3:supply_fuel true ++ 392 sensor :fn3:fuel_stored .CONTAINER @blast-compound ++ 393 sensor :fn3:cryo :fn3:reactor @cryofluid ++ 394 sensor *tmp118 .NODE @powerNetStored ++ 395 op floor :fn3:charge *tmp118 ++ 396 sensor *tmp120 .NODE @powerNetIn ++ 397 sensor *tmp121 .NODE @powerNetOut ++ 398 op sub *tmp122 *tmp120 *tmp121 ++ 399 op floor :fn3:surplus *tmp122 ++ 400 op mul *tmp124 .AVG_SURPLUS 0.8 ++ 401 op mul *tmp125 :fn3:surplus 0.2 ++ 402 op add .AVG_SURPLUS *tmp124 *tmp125 ++ 403 sensor :fn3:enabled :fn3:reactor @enabled ++ 404 print "#" ++ 405 print :fn3:reactor_num ++ 406 print " " ++ 407 print "- " ++ 408 jump *label195 equal :fn3:emerg_shutdown false ++ 409 control enabled :fn3:reactor false ++ 410 print "emergency mode" ++ 411 print "\n" ++ 412 set :fn3:supply_fuel false ++ 413 jump *label228 always ++ 414 label *label195 ++ 415 jump *label214 equal :fn3:enabled false ++ 416 jump *label196 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num ++ 417 control enabled :fn3:reactor false ++ 418 print "STOP unwanted" ++ 419 print "\n" ++ 420 jump *label213 always ++ 421 label *label196 ++ 422 op greaterThan *tmp136 :fn3:reactor_num 1 ++ 423 op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num ++ 424 op lessThan *tmp138 :fn3:fuel_stored *tmp137 ++ 425 op land *tmp139 *tmp136 *tmp138 ++ 426 jump *label197 equal *tmp139 false ++ 427 control enabled :fn3:reactor false ++ 428 print "STOP system fuel low" ++ 429 print "\n" ++ 430 jump *label212 always ++ 431 label *label197 ++ 432 jump *label198 greaterThan :fn3:fuel 1 + 433 control enabled :fn3:reactor false -+ 434 print "STOP system fuel low" ++ 434 print "STOP fuel low" + 435 print "\n" -+ 436 jump *label212 always -+ 437 label *label197 -+ 438 jump *label198 greaterThan :fn3:fuel 1 ++ 436 jump *label211 always ++ 437 label *label198 ++ 438 jump *label199 greaterThan :fn3:cryo .CRYO_ABORT + 439 control enabled :fn3:reactor false -+ 440 print "STOP fuel low" ++ 440 print "STOP out of cryo" + 441 print "\n" -+ 442 jump *label211 always -+ 443 label *label198 -+ 444 jump *label199 greaterThan :fn3:cryo .CRYO_ABORT -+ 445 control enabled :fn3:reactor false -+ 446 print "STOP out of cryo" -+ 447 print "\n" -+ 448 jump *label210 always -+ 449 label *label199 -+ 450 jump *label206 greaterThanEq :fn3:secs 30 -+ 451 label *label200 -+ 452 op sub *tmp102 @tick :fn3:t_startup -+ 453 op idiv :fn2:secs *tmp102 60 -+ 454 op greaterThan *tmp104 :fn2:secs 30 -+ 455 sensor *tmp105 :fn3:reactor @enabled -+ 456 op equal *tmp106 *tmp105 false -+ 457 op or *tmp107 *tmp104 *tmp106 -+ 458 jump *label201 equal *tmp107 false -+ 459 set :fn2*retval 0 ++ 442 jump *label210 always ++ 443 label *label199 ++ 444 jump *label206 greaterThanEq :fn3:secs 30 ++ 445 label *label200 ++ 446 op sub *tmp102 @tick :fn3:t_startup ++ 447 op idiv :fn2:secs *tmp102 60 ++ 448 op greaterThan *tmp104 :fn2:secs 30 ++ 449 sensor *tmp105 :fn3:reactor @enabled ++ 450 op equal *tmp106 *tmp105 false ++ 451 op or *tmp107 *tmp104 *tmp106 ++ 452 jump *label201 equal *tmp107 false ++ 453 set :fn2*retval 0 ++ 454 jump *label203 always ++ 455 label *label201 ++ 456 label *label202 ++ 457 op sub :fn2:time_left 30 :fn2:secs ++ 458 op mul *tmp110 :fn2:time_left :fn2:time_left ++ 459 op idiv :fn2*retval *tmp110 0.04 + 460 jump *label203 always -+ 461 label *label201 -+ 462 label *label202 -+ 463 op sub :fn2:time_left 30 :fn2:secs -+ 464 op mul *tmp110 :fn2:time_left :fn2:time_left -+ 465 op idiv :fn2:charge_req *tmp110 0.04 -+ 466 set :fn2*retval :fn2:charge_req -+ 467 jump *label203 always -+ 468 label *label203 -+ 469 op sub *tmp153 :fn3:charge :fn2*retval -+ 470 op lessThan *tmp154 *tmp153 .PWR_ABORT -+ 471 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT -+ 472 op land *tmp156 *tmp154 *tmp155 -+ 473 jump *label204 equal *tmp156 false -+ 474 control enabled :fn3:reactor false -+ 475 print "START FAIL battery" -+ 476 print "\n" -+ 477 set :fn3:supply_fuel false -+ 478 jump *label205 always -+ 479 label *label204 -+ 480 op sub :fn3:time_left 30 :fn3:secs -+ 481 print "Starting " -+ 482 print :fn3:time_left -+ 483 print " " -+ 484 print "secs, req " -+ 485 print :fn2*retval -+ 486 print "J" -+ 487 print "\n" -+ 488 label *label205 -+ 489 jump *label209 always -+ 490 label *label206 -+ 491 op lessThan *tmp161 :fn3:charge .PWR_ABANDON -+ 492 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT -+ 493 op land *tmp163 *tmp161 *tmp162 -+ 494 jump *label207 equal *tmp163 false -+ 495 control enabled :fn3:reactor false -+ 496 print "ABANDON - battery crit" -+ 497 print "\n" -+ 498 set :fn3:supply_fuel false -+ 499 jump *label208 always -+ 500 label *label207 -+ 501 op idiv :fn3:mins :fn3:secs 6 -+ 502 op div :fn3:mins :fn3:mins 10 -+ 503 print "RUN " -+ 504 print :fn3:mins -+ 505 print " " -+ 506 print "mins" -+ 507 print "\n" -+ 508 label *label208 -+ 509 label *label209 -+ 510 label *label210 -+ 511 label *label211 -+ 512 label *label212 -+ 513 label *label213 -+ 514 jump *label227 always -+ 515 label *label214 -+ 516 op sub *tmp169 :fn3:charge .START_POWER_REQ -+ 517 op sub *tmp170 *tmp169 .PWR_ABORT -+ 518 op div *tmp171 *tmp170 .PWR_REQ -+ 519 op mul :fn3:charge_units *tmp171 .PWR_RESERVE -+ 520 op div *tmp173 :fn3:surplus .FLOW_REQ -+ 521 op max :fn3:flow_units -0.1 *tmp173 -+ 522 op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num -+ 523 op add :fn3:cryo_req .CRYO_REQ *tmp175 -+ 524 jump *label215 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num -+ 525 print "IDLE" -+ 526 print "\n" -+ 527 set :fn3:supply_fuel false -+ 528 jump *label226 always -+ 529 label *label215 -+ 530 op add *tmp179 :fn3:flow_units :fn3:charge_units -+ 531 jump *label216 greaterThanEq *tmp179 1 -+ 532 op idiv *tmp183 :fn3:flow_units 0.001 -+ 533 op div :fn3:flow *tmp183 10 -+ 534 op idiv *tmp186 :fn3:charge_units 0.001 -+ 535 op div :fn3:charge *tmp186 10 -+ 536 print "WAIT power. (%" -+ 537 print :fn3:charge -+ 538 print "J + %" -+ 539 print :fn3:flow -+ 540 print "W)" -+ 541 print "\n" -+ 542 set :fn3:supply_fuel false -+ 543 jump *label225 always -+ 544 label *label216 -+ 545 op lessThan *tmp188 :fn3:fuel .FUEL_REQ -+ 546 op land *tmp189 :fn3:fuel_on *tmp188 -+ 547 jump *label219 equal *tmp189 false -+ 548 op add *tmp191 :fn3:fuel :fn3:fuel_stored -+ 549 jump *label217 lessThanEq *tmp191 .FUEL_REQ -+ 550 print "WAIT fuel" -+ 551 print "\n" -+ 552 jump *label218 always -+ 553 label *label217 -+ 554 print "WAIT system fuel" ++ 461 label *label203 ++ 462 op sub *tmp153 :fn3:charge :fn2*retval ++ 463 op lessThan *tmp154 *tmp153 .PWR_ABORT ++ 464 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT ++ 465 op land *tmp156 *tmp154 *tmp155 ++ 466 jump *label204 equal *tmp156 false ++ 467 control enabled :fn3:reactor false ++ 468 print "START FAIL battery" ++ 469 print "\n" ++ 470 set :fn3:supply_fuel false ++ 471 jump *label205 always ++ 472 label *label204 ++ 473 op sub :fn3:time_left 30 :fn3:secs ++ 474 print "Starting " ++ 475 print :fn3:time_left ++ 476 print " " ++ 477 print "secs, req " ++ 478 print :fn2*retval ++ 479 print "J" ++ 480 print "\n" ++ 481 label *label205 ++ 482 jump *label209 always ++ 483 label *label206 ++ 484 op lessThan *tmp161 :fn3:charge .PWR_ABANDON ++ 485 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT ++ 486 op land *tmp163 *tmp161 *tmp162 ++ 487 jump *label207 equal *tmp163 false ++ 488 control enabled :fn3:reactor false ++ 489 print "ABANDON - battery crit" ++ 490 print "\n" ++ 491 set :fn3:supply_fuel false ++ 492 jump *label208 always ++ 493 label *label207 ++ 494 op idiv :fn3:mins :fn3:secs 6 ++ 495 op div :fn3:mins :fn3:mins 10 ++ 496 print "RUN " ++ 497 print :fn3:mins ++ 498 print " " ++ 499 print "mins" ++ 500 print "\n" ++ 501 label *label208 ++ 502 label *label209 ++ 503 label *label210 ++ 504 label *label211 ++ 505 label *label212 ++ 506 label *label213 ++ 507 jump *label227 always ++ 508 label *label214 ++ 509 op sub *tmp169 :fn3:charge .START_POWER_REQ ++ 510 op sub *tmp170 *tmp169 .PWR_ABORT ++ 511 op div *tmp171 *tmp170 .PWR_REQ ++ 512 op mul :fn3:charge_units *tmp171 .PWR_RESERVE ++ 513 op div *tmp173 :fn3:surplus .FLOW_REQ ++ 514 op max :fn3:flow_units -0.1 *tmp173 ++ 515 op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num ++ 516 op add :fn3:cryo_req .CRYO_REQ *tmp175 ++ 517 jump *label215 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num ++ 518 print "IDLE" ++ 519 print "\n" ++ 520 set :fn3:supply_fuel false ++ 521 jump *label226 always ++ 522 label *label215 ++ 523 op add *tmp179 :fn3:flow_units :fn3:charge_units ++ 524 jump *label216 greaterThanEq *tmp179 1 ++ 525 op idiv *tmp183 :fn3:flow_units 0.001 ++ 526 op div :fn3:flow *tmp183 10 ++ 527 op idiv *tmp186 :fn3:charge_units 0.001 ++ 528 op div :fn3:charge *tmp186 10 ++ 529 print "WAIT power. (%" ++ 530 print :fn3:charge ++ 531 print "J + %" ++ 532 print :fn3:flow ++ 533 print "W)" ++ 534 print "\n" ++ 535 set :fn3:supply_fuel false ++ 536 jump *label225 always ++ 537 label *label216 ++ 538 op lessThan *tmp188 :fn3:fuel .FUEL_REQ ++ 539 op land *tmp189 :fn3:fuel_on *tmp188 ++ 540 jump *label219 equal *tmp189 false ++ 541 op add *tmp191 :fn3:fuel :fn3:fuel_stored ++ 542 jump *label217 lessThanEq *tmp191 .FUEL_REQ ++ 543 print "WAIT fuel" ++ 544 print "\n" ++ 545 jump *label218 always ++ 546 label *label217 ++ 547 print "WAIT system fuel" ++ 548 print "\n" ++ 549 label *label218 ++ 550 jump *label224 always ++ 551 label *label219 ++ 552 op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num ++ 553 jump *label220 greaterThanEq :fn3:fuel_stored *tmp194 ++ 554 print "WAIT buffer fuel" + 555 print "\n" -+ 556 label *label218 -+ 557 jump *label224 always -+ 558 label *label219 -+ 559 op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num -+ 560 jump *label220 greaterThanEq :fn3:fuel_stored *tmp194 -+ 561 print "WAIT buffer fuel" -+ 562 print "\n" -+ 563 jump *label223 always -+ 564 label *label220 -+ 565 jump *label221 greaterThanEq :fn3:cryo :fn3:cryo_req -+ 566 print "WAIT cryo" -+ 567 print "\n" -+ 568 jump *label222 always -+ 569 label *label221 -+ 570 print "STARTUP" -+ 571 print "\n" -+ 572 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ -+ 573 control enabled :fn3:reactor true -+ 574 label *label222 -+ 575 label *label223 -+ 576 label *label224 -+ 577 label *label225 -+ 578 label *label226 -+ 579 label *label227 -+ 580 label *label228 -+ 581 sensor *tmp201 :fn3:reactor @enabled -+ 582 jump *label229 equal :fn3:enabled *tmp201 -+ 583 set .RET_T_STARTUP @tick -+ 584 label *label229 -+ 585 label *label230 -+ 586 set :fn3*retval :fn3:supply_fuel -+ 587 jump *label231 always -+ 588 label *label231 - 589 set :fuel_2 :fn3*retval - 590 set :t_startup2 .RET_T_STARTUP - 591 label *label112 ++ 556 jump *label223 always ++ 557 label *label220 ++ 558 jump *label221 greaterThanEq :fn3:cryo :fn3:cryo_req ++ 559 print "WAIT cryo" ++ 560 print "\n" ++ 561 jump *label222 always ++ 562 label *label221 ++ 563 print "STARTUP" ++ 564 print "\n" ++ 565 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ ++ 566 control enabled :fn3:reactor true ++ 567 label *label222 ++ 568 label *label223 ++ 569 label *label224 ++ 570 label *label225 ++ 571 label *label226 ++ 572 label *label227 ++ 573 label *label228 ++ 574 sensor *tmp201 :fn3:reactor @enabled ++ 575 jump *label229 equal :fn3:enabled *tmp201 ++ 576 set .RET_T_STARTUP @tick ++ 577 label *label229 ++ 578 label *label230 ++ 579 set :fn3*retval :fn3:supply_fuel ++ 580 jump *label231 always ++ 581 label *label231 + 582 set :fuel_2 :fn3*retval + 583 set :t_startup2 .RET_T_STARTUP + 584 label *label112 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - 390 set :fn3:fuel_on :fuel_2 - 391 set :fn3:t_startup :t_startup2 - 392 label *label194 + 384 set :fn3:fuel_on :fuel_2 + 385 set :fn3:t_startup :t_startup2 + 386 label *label194 - * set .RET_T_STARTUP :fn3:t_startup - * op sub *tmp113 @tick :fn3:t_startup -+ 393 set .RET_T_STARTUP :t_startup2 -+ 394 op sub *tmp113 @tick :t_startup2 - 395 op idiv :fn3:secs *tmp113 60 ++ 387 set .RET_T_STARTUP :t_startup2 ++ 388 op sub *tmp113 @tick :t_startup2 + 389 op idiv :fn3:secs *tmp113 60 - * sensor :fn3:fuel :fn3:reactor @blast-compound -+ 396 sensor :fn3:fuel reactor2 @blast-compound - 397 set :fn3:supply_fuel true ++ 390 sensor :fn3:fuel reactor2 @blast-compound + 391 set :fn3:supply_fuel true - * sensor :fn3:fuel_stored .CONTAINER @blast-compound - * sensor :fn3:cryo :fn3:reactor @cryofluid - * sensor *tmp118 .NODE @powerNetStored -+ 398 sensor :fn3:fuel_stored vault1 @blast-compound -+ 399 sensor :fn3:cryo reactor2 @cryofluid -+ 400 sensor *tmp118 node1 @powerNetStored - 401 op floor :fn3:charge *tmp118 ++ 392 sensor :fn3:fuel_stored vault1 @blast-compound ++ 393 sensor :fn3:cryo reactor2 @cryofluid ++ 394 sensor *tmp118 node1 @powerNetStored + 395 op floor :fn3:charge *tmp118 - * sensor *tmp120 .NODE @powerNetIn - * sensor *tmp121 .NODE @powerNetOut -+ 402 sensor *tmp120 node1 @powerNetIn -+ 403 sensor *tmp121 node1 @powerNetOut - 404 op sub *tmp122 *tmp120 *tmp121 - 405 op floor :fn3:surplus *tmp122 - 406 op mul *tmp124 .AVG_SURPLUS 0.8 - 407 op mul *tmp125 :fn3:surplus 0.2 - 408 op add .AVG_SURPLUS *tmp124 *tmp125 ++ 396 sensor *tmp120 node1 @powerNetIn ++ 397 sensor *tmp121 node1 @powerNetOut + 398 op sub *tmp122 *tmp120 *tmp121 + 399 op floor :fn3:surplus *tmp122 + 400 op mul *tmp124 .AVG_SURPLUS 0.8 + 401 op mul *tmp125 :fn3:surplus 0.2 + 402 op add .AVG_SURPLUS *tmp124 *tmp125 - * sensor :fn3:enabled :fn3:reactor @enabled -+ 409 sensor :fn3:enabled reactor2 @enabled - 410 print "#" ++ 403 sensor :fn3:enabled reactor2 @enabled + 404 print "#" - * print :fn3:reactor_num -+ 411 print 2 - 412 print " " - 413 print "- " ++ 405 print 2 + 406 print " " + 407 print "- " - * jump *label195 equal :fn3:emerg_shutdown false - * control enabled :fn3:reactor false -+ 414 jump *label195 equal :emerg_shutdown false -+ 415 control enabled reactor2 false - 416 print "emergency mode" - 417 print "\n" - 418 set :fn3:supply_fuel false - 419 jump *label228 always - 420 label *label195 - 421 jump *label214 equal :fn3:enabled false ++ 408 jump *label195 equal :emerg_shutdown false ++ 409 control enabled reactor2 false + 410 print "emergency mode" + 411 print "\n" + 412 set :fn3:supply_fuel false + 413 jump *label228 always + 414 label *label195 + 415 jump *label214 equal :fn3:enabled false - * jump *label196 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num - * control enabled :fn3:reactor false -+ 422 jump *label196 greaterThanEq .REACTORS_DESIRED 2 -+ 423 control enabled reactor2 false - 424 print "STOP unwanted" - 425 print "\n" - 426 jump *label213 always - 427 label *label196 ++ 416 jump *label196 greaterThanEq .REACTORS_DESIRED 2 ++ 417 control enabled reactor2 false + 418 print "STOP unwanted" + 419 print "\n" + 420 jump *label213 always + 421 label *label196 - * op greaterThan *tmp136 :fn3:reactor_num 1 - * op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num - * op lessThan *tmp138 :fn3:fuel_stored *tmp137 - * op land *tmp139 *tmp136 *tmp138 -+ 428 op greaterThan *tmp136 2 1 -+ 429 op mul *tmp137 15 2 -+ 430 op lessThan *tmp138 :fn3:fuel_stored 30 -+ 431 op land *tmp139 true *tmp138 - 432 jump *label197 equal *tmp139 false ++ 422 op greaterThan *tmp136 2 1 ++ 423 op mul *tmp137 15 2 ++ 424 op lessThan *tmp138 :fn3:fuel_stored 30 ++ 425 op land *tmp139 true *tmp138 + 426 jump *label197 equal *tmp139 false +- * control enabled :fn3:reactor false ++ 427 control enabled reactor2 false + 428 print "STOP system fuel low" + 429 print "\n" + 430 jump *label212 always + 431 label *label197 + 432 jump *label198 greaterThan :fn3:fuel 1 - * control enabled :fn3:reactor false + 433 control enabled reactor2 false - 434 print "STOP system fuel low" + 434 print "STOP fuel low" 435 print "\n" - 436 jump *label212 always - 437 label *label197 - 438 jump *label198 greaterThan :fn3:fuel 1 + 436 jump *label211 always + 437 label *label198 +- * jump *label199 greaterThan :fn3:cryo .CRYO_ABORT - * control enabled :fn3:reactor false ++ 438 jump *label199 greaterThan :fn3:cryo 1 + 439 control enabled reactor2 false - 440 print "STOP fuel low" + 440 print "STOP out of cryo" 441 print "\n" - 442 jump *label211 always - 443 label *label198 -- * jump *label199 greaterThan :fn3:cryo .CRYO_ABORT -- * control enabled :fn3:reactor false -+ 444 jump *label199 greaterThan :fn3:cryo 1 -+ 445 control enabled reactor2 false - 446 print "STOP out of cryo" - 447 print "\n" - 448 jump *label210 always - 449 label *label199 - 450 jump *label206 greaterThanEq :fn3:secs 30 - 451 label *label200 + 442 jump *label210 always + 443 label *label199 + 444 jump *label206 greaterThanEq :fn3:secs 30 + 445 label *label200 - * op sub *tmp102 @tick :fn3:t_startup -+ 452 op sub *tmp102 @tick :t_startup2 - 453 op idiv :fn2:secs *tmp102 60 - 454 op greaterThan *tmp104 :fn2:secs 30 ++ 446 op sub *tmp102 @tick :t_startup2 + 447 op idiv :fn2:secs *tmp102 60 + 448 op greaterThan *tmp104 :fn2:secs 30 - * sensor *tmp105 :fn3:reactor @enabled -+ 455 sensor *tmp105 reactor2 @enabled - 456 op equal *tmp106 *tmp105 false - 457 op or *tmp107 *tmp104 *tmp106 - 458 jump *label201 equal *tmp107 false - - 467 jump *label203 always - 468 label *label203 - 469 op sub *tmp153 :fn3:charge :fn2*retval ++ 449 sensor *tmp105 reactor2 @enabled + 450 op equal *tmp106 *tmp105 false + 451 op or *tmp107 *tmp104 *tmp106 + 452 jump *label201 equal *tmp107 false + + 460 jump *label203 always + 461 label *label203 + 462 op sub *tmp153 :fn3:charge :fn2*retval - * op lessThan *tmp154 *tmp153 .PWR_ABORT - * op lessThan *tmp155 :fn3:surplus .FLOW_ABORT -+ 470 op lessThan *tmp154 *tmp153 5000 -+ 471 op lessThan *tmp155 :fn3:surplus -500 - 472 op land *tmp156 *tmp154 *tmp155 - 473 jump *label204 equal *tmp156 false ++ 463 op lessThan *tmp154 *tmp153 5000 ++ 464 op lessThan *tmp155 :fn3:surplus -500 + 465 op land *tmp156 *tmp154 *tmp155 + 466 jump *label204 equal *tmp156 false - * control enabled :fn3:reactor false -+ 474 control enabled reactor2 false - 475 print "START FAIL battery" - 476 print "\n" - 477 set :fn3:supply_fuel false - - 488 label *label205 - 489 jump *label209 always - 490 label *label206 ++ 467 control enabled reactor2 false + 468 print "START FAIL battery" + 469 print "\n" + 470 set :fn3:supply_fuel false + + 481 label *label205 + 482 jump *label209 always + 483 label *label206 - * op lessThan *tmp161 :fn3:charge .PWR_ABANDON - * op lessThan *tmp162 :fn3:surplus .FLOW_ABORT -+ 491 op lessThan *tmp161 :fn3:charge 2000 -+ 492 op lessThan *tmp162 :fn3:surplus -500 - 493 op land *tmp163 *tmp161 *tmp162 - 494 jump *label207 equal *tmp163 false ++ 484 op lessThan *tmp161 :fn3:charge 2000 ++ 485 op lessThan *tmp162 :fn3:surplus -500 + 486 op land *tmp163 *tmp161 *tmp162 + 487 jump *label207 equal *tmp163 false - * control enabled :fn3:reactor false -+ 495 control enabled reactor2 false - 496 print "ABANDON - battery crit" - 497 print "\n" - 498 set :fn3:supply_fuel false ++ 488 control enabled reactor2 false + 489 print "ABANDON - battery crit" + 490 print "\n" + 491 set :fn3:supply_fuel false - 514 jump *label227 always - 515 label *label214 - 516 op sub *tmp169 :fn3:charge .START_POWER_REQ + 507 jump *label227 always + 508 label *label214 + 509 op sub *tmp169 :fn3:charge .START_POWER_REQ - * op sub *tmp170 *tmp169 .PWR_ABORT - * op div *tmp171 *tmp170 .PWR_REQ - * op mul :fn3:charge_units *tmp171 .PWR_RESERVE - * op div *tmp173 :fn3:surplus .FLOW_REQ -+ 517 op sub *tmp170 *tmp169 5000 -+ 518 op div *tmp171 *tmp170 23000 -+ 519 op mul :fn3:charge_units *tmp171 0.6 -+ 520 op div *tmp173 :fn3:surplus 2000 - 521 op max :fn3:flow_units -0.1 *tmp173 ++ 510 op sub *tmp170 *tmp169 5000 ++ 511 op div *tmp171 *tmp170 23000 ++ 512 op mul :fn3:charge_units *tmp171 0.6 ++ 513 op div *tmp173 :fn3:surplus 2000 + 514 op max :fn3:flow_units -0.1 *tmp173 - * op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num - * op add :fn3:cryo_req .CRYO_REQ *tmp175 - * jump *label215 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num -+ 522 op mul *tmp175 2 2 -+ 523 op add :fn3:cryo_req 3 4 -+ 524 jump *label215 greaterThanEq .REACTORS_DESIRED 2 - 525 print "IDLE" - 526 print "\n" - 527 set :fn3:supply_fuel false - - 542 set :fn3:supply_fuel false - 543 jump *label225 always - 544 label *label216 ++ 515 op mul *tmp175 2 2 ++ 516 op add :fn3:cryo_req 3 4 ++ 517 jump *label215 greaterThanEq .REACTORS_DESIRED 2 + 518 print "IDLE" + 519 print "\n" + 520 set :fn3:supply_fuel false + + 535 set :fn3:supply_fuel false + 536 jump *label225 always + 537 label *label216 - * op lessThan *tmp188 :fn3:fuel .FUEL_REQ - * op land *tmp189 :fn3:fuel_on *tmp188 -+ 545 op lessThan *tmp188 :fn3:fuel 10 -+ 546 op land *tmp189 :fuel_2 *tmp188 - 547 jump *label219 equal *tmp189 false - 548 op add *tmp191 :fn3:fuel :fn3:fuel_stored ++ 538 op lessThan *tmp188 :fn3:fuel 10 ++ 539 op land *tmp189 :fuel_2 *tmp188 + 540 jump *label219 equal *tmp189 false + 541 op add *tmp191 :fn3:fuel :fn3:fuel_stored - * jump *label217 lessThanEq *tmp191 .FUEL_REQ -+ 549 jump *label217 lessThanEq *tmp191 10 - 550 print "WAIT fuel" - 551 print "\n" - 552 jump *label218 always - - 556 label *label218 - 557 jump *label224 always - 558 label *label219 ++ 542 jump *label217 lessThanEq *tmp191 10 + 543 print "WAIT fuel" + 544 print "\n" + 545 jump *label218 always + + 549 label *label218 + 550 jump *label224 always + 551 label *label219 - * op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num - * jump *label220 greaterThanEq :fn3:fuel_stored *tmp194 -+ 559 op mul *tmp194 45 2 -+ 560 jump *label220 greaterThanEq :fn3:fuel_stored 90 - 561 print "WAIT buffer fuel" - 562 print "\n" - 563 jump *label223 always - 564 label *label220 ++ 552 op mul *tmp194 45 2 ++ 553 jump *label220 greaterThanEq :fn3:fuel_stored 90 + 554 print "WAIT buffer fuel" + 555 print "\n" + 556 jump *label223 always + 557 label *label220 - * jump *label221 greaterThanEq :fn3:cryo :fn3:cryo_req -+ 565 jump *label221 greaterThanEq :fn3:cryo 7 - 566 print "WAIT cryo" - 567 print "\n" - 568 jump *label222 always - 569 label *label221 - 570 print "STARTUP" - 571 print "\n" ++ 558 jump *label221 greaterThanEq :fn3:cryo 7 + 559 print "WAIT cryo" + 560 print "\n" + 561 jump *label222 always + 562 label *label221 + 563 print "STARTUP" + 564 print "\n" - * op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ - * control enabled :fn3:reactor true -+ 572 op add .START_POWER_REQ .START_POWER_REQ 23000 -+ 573 control enabled reactor2 true - 574 label *label222 - 575 label *label223 - 576 label *label224 - - 578 label *label226 - 579 label *label227 - 580 label *label228 ++ 565 op add .START_POWER_REQ .START_POWER_REQ 23000 ++ 566 control enabled reactor2 true + 567 label *label222 + 568 label *label223 + 569 label *label224 + + 571 label *label226 + 572 label *label227 + 573 label *label228 - * sensor *tmp201 :fn3:reactor @enabled -+ 581 sensor *tmp201 reactor2 @enabled - 582 jump *label229 equal :fn3:enabled *tmp201 - 583 set .RET_T_STARTUP @tick - 584 label *label229 ++ 574 sensor *tmp201 reactor2 @enabled + 575 jump *label229 equal :fn3:enabled *tmp201 + 576 set .RET_T_STARTUP @tick + 577 label *label229 - 586 set :fn3*retval :fn3:supply_fuel - 587 jump *label231 always - 588 label *label231 + 579 set :fn3*retval :fn3:supply_fuel + 580 jump *label231 always + 581 label *label231 - * set :fuel_2 :fn3*retval -+ 589 set :fuel_2 :fn3:supply_fuel - 590 set :t_startup2 .RET_T_STARTUP - 591 label *label112 ++ 582 set :fuel_2 :fn3:supply_fuel + 583 set :t_startup2 .RET_T_STARTUP + 584 label *label112 - * jump *label113 equal :fn3*retval false -+ 592 jump *label113 equal :fn3:supply_fuel false - 593 control config unloader3 @blast-compound - 594 jump *label114 always - 595 label *label113 - 596 control config unloader3 @scrap - 597 label *label114 ++ 585 jump *label113 equal :fn3:supply_fuel false + 586 control config unloader3 @blast-compound + 587 jump *label114 always + 588 label *label113 + 589 control config unloader3 @scrap + 590 label *label114 - * jump *label115 notEqual :fn3*retval false -+ 598 jump *label115 notEqual :fn3:supply_fuel false - 599 control config unloader4 @blast-compound - 600 jump *label116 always - 601 label *label115 ++ 591 jump *label115 notEqual :fn3:supply_fuel false + 592 control config unloader4 @blast-compound + 593 jump *label116 always + 594 label *label115 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-6 instructions): - 384 control config unloader2 @scrap - 385 label *label110 - 386 label *label111 + 378 control config unloader2 @scrap + 379 label *label110 + 380 label *label111 - * set :fn3:reactor reactor2 - * set :fn3:reactor_num 2 - * set :fn3:emerg_shutdown :emerg_shutdown - * set :fn3:fuel_on :fuel_2 - * set :fn3:t_startup :t_startup2 - 387 label *label194 - 388 set .RET_T_STARTUP :t_startup2 - 389 op sub *tmp113 @tick :t_startup2 + 381 label *label194 + 382 set .RET_T_STARTUP :t_startup2 + 383 op sub *tmp113 @tick :t_startup2 - 511 op sub *tmp169 :fn3:charge .START_POWER_REQ - 512 op sub *tmp170 *tmp169 5000 - 513 op div *tmp171 *tmp170 23000 + 504 op sub *tmp169 :fn3:charge .START_POWER_REQ + 505 op sub *tmp170 *tmp169 5000 + 506 op div *tmp171 *tmp170 23000 - * op mul :fn3:charge_units *tmp171 0.6 -+ 514 op div :fn3:charge_units *tmp170 38333.333333333336 - 515 op div *tmp173 :fn3:surplus 2000 - 516 op max :fn3:flow_units -0.1 *tmp173 - 517 op mul *tmp175 2 2 - - 578 set .RET_T_STARTUP @tick - 579 label *label229 - 580 label *label230 ++ 507 op div :fn3:charge_units *tmp170 38333.333333333336 + 508 op div *tmp173 :fn3:surplus 2000 + 509 op max :fn3:flow_units -0.1 *tmp173 + 510 op mul *tmp175 2 2 + + 571 set .RET_T_STARTUP @tick + 572 label *label229 + 573 label *label230 - * set :fn3*retval :fn3:supply_fuel - 581 jump *label231 always - 582 label *label231 - 583 set :fuel_2 :fn3:supply_fuel + 574 jump *label231 always + 575 label *label231 + 576 set :fuel_2 :fn3:supply_fuel -Modifications by Inline function call at line 89:14 (+157 instructions): +Modifications by Inline function call at line 89:14 (+156 instructions): - 629 set :fn3:emerg_shutdown :emerg_shutdown - 630 set :fn3:fuel_on :fuel_3 - 631 set :fn3:t_startup :t_startup3 + 622 set :fn3:emerg_shutdown :emerg_shutdown + 623 set :fn3:fuel_on :fuel_3 + 624 set :fn3:t_startup :t_startup3 - * setaddr :fn3*retaddr *label24 - * call *label3 :fn3*retval - * label *label24 -+ 632 label *label232 -+ 633 set .RET_T_STARTUP :fn3:t_startup -+ 634 op sub *tmp113 @tick :fn3:t_startup -+ 635 op idiv :fn3:secs *tmp113 60 -+ 636 sensor :fn3:fuel :fn3:reactor @blast-compound -+ 637 set :fn3:supply_fuel true -+ 638 sensor :fn3:fuel_stored .CONTAINER @blast-compound -+ 639 sensor :fn3:cryo :fn3:reactor @cryofluid -+ 640 sensor *tmp118 .NODE @powerNetStored -+ 641 op floor :fn3:charge *tmp118 -+ 642 sensor *tmp120 .NODE @powerNetIn -+ 643 sensor *tmp121 .NODE @powerNetOut -+ 644 op sub *tmp122 *tmp120 *tmp121 -+ 645 op floor :fn3:surplus *tmp122 -+ 646 op mul *tmp124 .AVG_SURPLUS 0.8 -+ 647 op mul *tmp125 :fn3:surplus 0.2 -+ 648 op add .AVG_SURPLUS *tmp124 *tmp125 -+ 649 sensor :fn3:enabled :fn3:reactor @enabled -+ 650 print "#" -+ 651 print :fn3:reactor_num -+ 652 print " " -+ 653 print "- " -+ 654 jump *label233 equal :fn3:emerg_shutdown false -+ 655 control enabled :fn3:reactor false -+ 656 print "emergency mode" -+ 657 print "\n" -+ 658 set :fn3:supply_fuel false -+ 659 jump *label266 always -+ 660 label *label233 -+ 661 jump *label252 equal :fn3:enabled false -+ 662 jump *label234 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num -+ 663 control enabled :fn3:reactor false -+ 664 print "STOP unwanted" -+ 665 print "\n" -+ 666 jump *label251 always -+ 667 label *label234 -+ 668 op greaterThan *tmp136 :fn3:reactor_num 1 -+ 669 op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num -+ 670 op lessThan *tmp138 :fn3:fuel_stored *tmp137 -+ 671 op land *tmp139 *tmp136 *tmp138 -+ 672 jump *label235 equal *tmp139 false -+ 673 control enabled :fn3:reactor false -+ 674 print "STOP system fuel low" -+ 675 print "\n" -+ 676 jump *label250 always -+ 677 label *label235 -+ 678 jump *label236 greaterThan :fn3:fuel 1 -+ 679 control enabled :fn3:reactor false -+ 680 print "STOP fuel low" -+ 681 print "\n" -+ 682 jump *label249 always -+ 683 label *label236 -+ 684 jump *label237 greaterThan :fn3:cryo .CRYO_ABORT -+ 685 control enabled :fn3:reactor false -+ 686 print "STOP out of cryo" -+ 687 print "\n" -+ 688 jump *label248 always -+ 689 label *label237 -+ 690 jump *label244 greaterThanEq :fn3:secs 30 -+ 691 label *label238 -+ 692 op sub *tmp102 @tick :fn3:t_startup -+ 693 op idiv :fn2:secs *tmp102 60 -+ 694 op greaterThan *tmp104 :fn2:secs 30 -+ 695 sensor *tmp105 :fn3:reactor @enabled -+ 696 op equal *tmp106 *tmp105 false -+ 697 op or *tmp107 *tmp104 *tmp106 -+ 698 jump *label239 equal *tmp107 false -+ 699 set :fn2*retval 0 -+ 700 jump *label241 always -+ 701 label *label239 -+ 702 label *label240 -+ 703 op sub :fn2:time_left 30 :fn2:secs -+ 704 op mul *tmp110 :fn2:time_left :fn2:time_left -+ 705 op idiv :fn2:charge_req *tmp110 0.04 -+ 706 set :fn2*retval :fn2:charge_req -+ 707 jump *label241 always -+ 708 label *label241 -+ 709 op sub *tmp153 :fn3:charge :fn2*retval -+ 710 op lessThan *tmp154 *tmp153 .PWR_ABORT -+ 711 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT -+ 712 op land *tmp156 *tmp154 *tmp155 -+ 713 jump *label242 equal *tmp156 false -+ 714 control enabled :fn3:reactor false -+ 715 print "START FAIL battery" -+ 716 print "\n" -+ 717 set :fn3:supply_fuel false -+ 718 jump *label243 always -+ 719 label *label242 -+ 720 op sub :fn3:time_left 30 :fn3:secs -+ 721 print "Starting " -+ 722 print :fn3:time_left -+ 723 print " " -+ 724 print "secs, req " -+ 725 print :fn2*retval -+ 726 print "J" -+ 727 print "\n" -+ 728 label *label243 -+ 729 jump *label247 always -+ 730 label *label244 -+ 731 op lessThan *tmp161 :fn3:charge .PWR_ABANDON -+ 732 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT -+ 733 op land *tmp163 *tmp161 *tmp162 -+ 734 jump *label245 equal *tmp163 false -+ 735 control enabled :fn3:reactor false -+ 736 print "ABANDON - battery crit" -+ 737 print "\n" -+ 738 set :fn3:supply_fuel false -+ 739 jump *label246 always -+ 740 label *label245 -+ 741 op idiv :fn3:mins :fn3:secs 6 -+ 742 op div :fn3:mins :fn3:mins 10 -+ 743 print "RUN " -+ 744 print :fn3:mins -+ 745 print " " -+ 746 print "mins" -+ 747 print "\n" -+ 748 label *label246 -+ 749 label *label247 -+ 750 label *label248 -+ 751 label *label249 -+ 752 label *label250 -+ 753 label *label251 -+ 754 jump *label265 always -+ 755 label *label252 -+ 756 op sub *tmp169 :fn3:charge .START_POWER_REQ -+ 757 op sub *tmp170 *tmp169 .PWR_ABORT -+ 758 op div *tmp171 *tmp170 .PWR_REQ -+ 759 op mul :fn3:charge_units *tmp171 .PWR_RESERVE -+ 760 op div *tmp173 :fn3:surplus .FLOW_REQ -+ 761 op max :fn3:flow_units -0.1 *tmp173 -+ 762 op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num -+ 763 op add :fn3:cryo_req .CRYO_REQ *tmp175 -+ 764 jump *label253 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num -+ 765 print "IDLE" -+ 766 print "\n" -+ 767 set :fn3:supply_fuel false -+ 768 jump *label264 always -+ 769 label *label253 -+ 770 op add *tmp179 :fn3:flow_units :fn3:charge_units -+ 771 jump *label254 greaterThanEq *tmp179 1 -+ 772 op idiv *tmp183 :fn3:flow_units 0.001 -+ 773 op div :fn3:flow *tmp183 10 -+ 774 op idiv *tmp186 :fn3:charge_units 0.001 -+ 775 op div :fn3:charge *tmp186 10 -+ 776 print "WAIT power. (%" -+ 777 print :fn3:charge -+ 778 print "J + %" -+ 779 print :fn3:flow -+ 780 print "W)" -+ 781 print "\n" -+ 782 set :fn3:supply_fuel false -+ 783 jump *label263 always -+ 784 label *label254 -+ 785 op lessThan *tmp188 :fn3:fuel .FUEL_REQ -+ 786 op land *tmp189 :fn3:fuel_on *tmp188 -+ 787 jump *label257 equal *tmp189 false -+ 788 op add *tmp191 :fn3:fuel :fn3:fuel_stored -+ 789 jump *label255 lessThanEq *tmp191 .FUEL_REQ -+ 790 print "WAIT fuel" -+ 791 print "\n" -+ 792 jump *label256 always -+ 793 label *label255 -+ 794 print "WAIT system fuel" -+ 795 print "\n" -+ 796 label *label256 -+ 797 jump *label262 always -+ 798 label *label257 -+ 799 op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num -+ 800 jump *label258 greaterThanEq :fn3:fuel_stored *tmp194 -+ 801 print "WAIT buffer fuel" -+ 802 print "\n" -+ 803 jump *label261 always -+ 804 label *label258 -+ 805 jump *label259 greaterThanEq :fn3:cryo :fn3:cryo_req -+ 806 print "WAIT cryo" -+ 807 print "\n" -+ 808 jump *label260 always -+ 809 label *label259 -+ 810 print "STARTUP" -+ 811 print "\n" -+ 812 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ -+ 813 control enabled :fn3:reactor true -+ 814 label *label260 -+ 815 label *label261 -+ 816 label *label262 -+ 817 label *label263 -+ 818 label *label264 -+ 819 label *label265 -+ 820 label *label266 -+ 821 sensor *tmp201 :fn3:reactor @enabled -+ 822 jump *label267 equal :fn3:enabled *tmp201 -+ 823 set .RET_T_STARTUP @tick -+ 824 label *label267 -+ 825 label *label268 -+ 826 set :fn3*retval :fn3:supply_fuel -+ 827 jump *label269 always -+ 828 label *label269 - 829 set :fuel_3 :fn3*retval - 830 set :t_startup3 .RET_T_STARTUP - 831 set :fn3:reactor reactor4 ++ 625 label *label232 ++ 626 set .RET_T_STARTUP :fn3:t_startup ++ 627 op sub *tmp113 @tick :fn3:t_startup ++ 628 op idiv :fn3:secs *tmp113 60 ++ 629 sensor :fn3:fuel :fn3:reactor @blast-compound ++ 630 set :fn3:supply_fuel true ++ 631 sensor :fn3:fuel_stored .CONTAINER @blast-compound ++ 632 sensor :fn3:cryo :fn3:reactor @cryofluid ++ 633 sensor *tmp118 .NODE @powerNetStored ++ 634 op floor :fn3:charge *tmp118 ++ 635 sensor *tmp120 .NODE @powerNetIn ++ 636 sensor *tmp121 .NODE @powerNetOut ++ 637 op sub *tmp122 *tmp120 *tmp121 ++ 638 op floor :fn3:surplus *tmp122 ++ 639 op mul *tmp124 .AVG_SURPLUS 0.8 ++ 640 op mul *tmp125 :fn3:surplus 0.2 ++ 641 op add .AVG_SURPLUS *tmp124 *tmp125 ++ 642 sensor :fn3:enabled :fn3:reactor @enabled ++ 643 print "#" ++ 644 print :fn3:reactor_num ++ 645 print " " ++ 646 print "- " ++ 647 jump *label233 equal :fn3:emerg_shutdown false ++ 648 control enabled :fn3:reactor false ++ 649 print "emergency mode" ++ 650 print "\n" ++ 651 set :fn3:supply_fuel false ++ 652 jump *label266 always ++ 653 label *label233 ++ 654 jump *label252 equal :fn3:enabled false ++ 655 jump *label234 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num ++ 656 control enabled :fn3:reactor false ++ 657 print "STOP unwanted" ++ 658 print "\n" ++ 659 jump *label251 always ++ 660 label *label234 ++ 661 op greaterThan *tmp136 :fn3:reactor_num 1 ++ 662 op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num ++ 663 op lessThan *tmp138 :fn3:fuel_stored *tmp137 ++ 664 op land *tmp139 *tmp136 *tmp138 ++ 665 jump *label235 equal *tmp139 false ++ 666 control enabled :fn3:reactor false ++ 667 print "STOP system fuel low" ++ 668 print "\n" ++ 669 jump *label250 always ++ 670 label *label235 ++ 671 jump *label236 greaterThan :fn3:fuel 1 ++ 672 control enabled :fn3:reactor false ++ 673 print "STOP fuel low" ++ 674 print "\n" ++ 675 jump *label249 always ++ 676 label *label236 ++ 677 jump *label237 greaterThan :fn3:cryo .CRYO_ABORT ++ 678 control enabled :fn3:reactor false ++ 679 print "STOP out of cryo" ++ 680 print "\n" ++ 681 jump *label248 always ++ 682 label *label237 ++ 683 jump *label244 greaterThanEq :fn3:secs 30 ++ 684 label *label238 ++ 685 op sub *tmp102 @tick :fn3:t_startup ++ 686 op idiv :fn2:secs *tmp102 60 ++ 687 op greaterThan *tmp104 :fn2:secs 30 ++ 688 sensor *tmp105 :fn3:reactor @enabled ++ 689 op equal *tmp106 *tmp105 false ++ 690 op or *tmp107 *tmp104 *tmp106 ++ 691 jump *label239 equal *tmp107 false ++ 692 set :fn2*retval 0 ++ 693 jump *label241 always ++ 694 label *label239 ++ 695 label *label240 ++ 696 op sub :fn2:time_left 30 :fn2:secs ++ 697 op mul *tmp110 :fn2:time_left :fn2:time_left ++ 698 op idiv :fn2*retval *tmp110 0.04 ++ 699 jump *label241 always ++ 700 label *label241 ++ 701 op sub *tmp153 :fn3:charge :fn2*retval ++ 702 op lessThan *tmp154 *tmp153 .PWR_ABORT ++ 703 op lessThan *tmp155 :fn3:surplus .FLOW_ABORT ++ 704 op land *tmp156 *tmp154 *tmp155 ++ 705 jump *label242 equal *tmp156 false ++ 706 control enabled :fn3:reactor false ++ 707 print "START FAIL battery" ++ 708 print "\n" ++ 709 set :fn3:supply_fuel false ++ 710 jump *label243 always ++ 711 label *label242 ++ 712 op sub :fn3:time_left 30 :fn3:secs ++ 713 print "Starting " ++ 714 print :fn3:time_left ++ 715 print " " ++ 716 print "secs, req " ++ 717 print :fn2*retval ++ 718 print "J" ++ 719 print "\n" ++ 720 label *label243 ++ 721 jump *label247 always ++ 722 label *label244 ++ 723 op lessThan *tmp161 :fn3:charge .PWR_ABANDON ++ 724 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT ++ 725 op land *tmp163 *tmp161 *tmp162 ++ 726 jump *label245 equal *tmp163 false ++ 727 control enabled :fn3:reactor false ++ 728 print "ABANDON - battery crit" ++ 729 print "\n" ++ 730 set :fn3:supply_fuel false ++ 731 jump *label246 always ++ 732 label *label245 ++ 733 op idiv :fn3:mins :fn3:secs 6 ++ 734 op div :fn3:mins :fn3:mins 10 ++ 735 print "RUN " ++ 736 print :fn3:mins ++ 737 print " " ++ 738 print "mins" ++ 739 print "\n" ++ 740 label *label246 ++ 741 label *label247 ++ 742 label *label248 ++ 743 label *label249 ++ 744 label *label250 ++ 745 label *label251 ++ 746 jump *label265 always ++ 747 label *label252 ++ 748 op sub *tmp169 :fn3:charge .START_POWER_REQ ++ 749 op sub *tmp170 *tmp169 .PWR_ABORT ++ 750 op div *tmp171 *tmp170 .PWR_REQ ++ 751 op mul :fn3:charge_units *tmp171 .PWR_RESERVE ++ 752 op div *tmp173 :fn3:surplus .FLOW_REQ ++ 753 op max :fn3:flow_units -0.1 *tmp173 ++ 754 op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num ++ 755 op add :fn3:cryo_req .CRYO_REQ *tmp175 ++ 756 jump *label253 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num ++ 757 print "IDLE" ++ 758 print "\n" ++ 759 set :fn3:supply_fuel false ++ 760 jump *label264 always ++ 761 label *label253 ++ 762 op add *tmp179 :fn3:flow_units :fn3:charge_units ++ 763 jump *label254 greaterThanEq *tmp179 1 ++ 764 op idiv *tmp183 :fn3:flow_units 0.001 ++ 765 op div :fn3:flow *tmp183 10 ++ 766 op idiv *tmp186 :fn3:charge_units 0.001 ++ 767 op div :fn3:charge *tmp186 10 ++ 768 print "WAIT power. (%" ++ 769 print :fn3:charge ++ 770 print "J + %" ++ 771 print :fn3:flow ++ 772 print "W)" ++ 773 print "\n" ++ 774 set :fn3:supply_fuel false ++ 775 jump *label263 always ++ 776 label *label254 ++ 777 op lessThan *tmp188 :fn3:fuel .FUEL_REQ ++ 778 op land *tmp189 :fn3:fuel_on *tmp188 ++ 779 jump *label257 equal *tmp189 false ++ 780 op add *tmp191 :fn3:fuel :fn3:fuel_stored ++ 781 jump *label255 lessThanEq *tmp191 .FUEL_REQ ++ 782 print "WAIT fuel" ++ 783 print "\n" ++ 784 jump *label256 always ++ 785 label *label255 ++ 786 print "WAIT system fuel" ++ 787 print "\n" ++ 788 label *label256 ++ 789 jump *label262 always ++ 790 label *label257 ++ 791 op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num ++ 792 jump *label258 greaterThanEq :fn3:fuel_stored *tmp194 ++ 793 print "WAIT buffer fuel" ++ 794 print "\n" ++ 795 jump *label261 always ++ 796 label *label258 ++ 797 jump *label259 greaterThanEq :fn3:cryo :fn3:cryo_req ++ 798 print "WAIT cryo" ++ 799 print "\n" ++ 800 jump *label260 always ++ 801 label *label259 ++ 802 print "STARTUP" ++ 803 print "\n" ++ 804 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ ++ 805 control enabled :fn3:reactor true ++ 806 label *label260 ++ 807 label *label261 ++ 808 label *label262 ++ 809 label *label263 ++ 810 label *label264 ++ 811 label *label265 ++ 812 label *label266 ++ 813 sensor *tmp201 :fn3:reactor @enabled ++ 814 jump *label267 equal :fn3:enabled *tmp201 ++ 815 set .RET_T_STARTUP @tick ++ 816 label *label267 ++ 817 label *label268 ++ 818 set :fn3*retval :fn3:supply_fuel ++ 819 jump *label269 always ++ 820 label *label269 + 821 set :fuel_3 :fn3*retval + 822 set :t_startup3 .RET_T_STARTUP + 823 set :fn3:reactor reactor4 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - 630 set :fn3:fuel_on :fuel_3 - 631 set :fn3:t_startup :t_startup3 - 632 label *label232 + 623 set :fn3:fuel_on :fuel_3 + 624 set :fn3:t_startup :t_startup3 + 625 label *label232 - * set .RET_T_STARTUP :fn3:t_startup - * op sub *tmp113 @tick :fn3:t_startup -+ 633 set .RET_T_STARTUP :t_startup3 -+ 634 op sub *tmp113 @tick :t_startup3 - 635 op idiv :fn3:secs *tmp113 60 ++ 626 set .RET_T_STARTUP :t_startup3 ++ 627 op sub *tmp113 @tick :t_startup3 + 628 op idiv :fn3:secs *tmp113 60 - * sensor :fn3:fuel :fn3:reactor @blast-compound -+ 636 sensor :fn3:fuel reactor3 @blast-compound - 637 set :fn3:supply_fuel true ++ 629 sensor :fn3:fuel reactor3 @blast-compound + 630 set :fn3:supply_fuel true - * sensor :fn3:fuel_stored .CONTAINER @blast-compound - * sensor :fn3:cryo :fn3:reactor @cryofluid - * sensor *tmp118 .NODE @powerNetStored -+ 638 sensor :fn3:fuel_stored vault1 @blast-compound -+ 639 sensor :fn3:cryo reactor3 @cryofluid -+ 640 sensor *tmp118 node1 @powerNetStored - 641 op floor :fn3:charge *tmp118 ++ 631 sensor :fn3:fuel_stored vault1 @blast-compound ++ 632 sensor :fn3:cryo reactor3 @cryofluid ++ 633 sensor *tmp118 node1 @powerNetStored + 634 op floor :fn3:charge *tmp118 - * sensor *tmp120 .NODE @powerNetIn - * sensor *tmp121 .NODE @powerNetOut -+ 642 sensor *tmp120 node1 @powerNetIn -+ 643 sensor *tmp121 node1 @powerNetOut - 644 op sub *tmp122 *tmp120 *tmp121 - 645 op floor :fn3:surplus *tmp122 - 646 op mul *tmp124 .AVG_SURPLUS 0.8 - 647 op mul *tmp125 :fn3:surplus 0.2 - 648 op add .AVG_SURPLUS *tmp124 *tmp125 ++ 635 sensor *tmp120 node1 @powerNetIn ++ 636 sensor *tmp121 node1 @powerNetOut + 637 op sub *tmp122 *tmp120 *tmp121 + 638 op floor :fn3:surplus *tmp122 + 639 op mul *tmp124 .AVG_SURPLUS 0.8 + 640 op mul *tmp125 :fn3:surplus 0.2 + 641 op add .AVG_SURPLUS *tmp124 *tmp125 - * sensor :fn3:enabled :fn3:reactor @enabled -+ 649 sensor :fn3:enabled reactor3 @enabled - 650 print "#" ++ 642 sensor :fn3:enabled reactor3 @enabled + 643 print "#" - * print :fn3:reactor_num -+ 651 print 3 - 652 print " " - 653 print "- " ++ 644 print 3 + 645 print " " + 646 print "- " - * jump *label233 equal :fn3:emerg_shutdown false - * control enabled :fn3:reactor false -+ 654 jump *label233 equal :emerg_shutdown false -+ 655 control enabled reactor3 false - 656 print "emergency mode" - 657 print "\n" - 658 set :fn3:supply_fuel false - 659 jump *label266 always - 660 label *label233 - 661 jump *label252 equal :fn3:enabled false ++ 647 jump *label233 equal :emerg_shutdown false ++ 648 control enabled reactor3 false + 649 print "emergency mode" + 650 print "\n" + 651 set :fn3:supply_fuel false + 652 jump *label266 always + 653 label *label233 + 654 jump *label252 equal :fn3:enabled false - * jump *label234 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num - * control enabled :fn3:reactor false -+ 662 jump *label234 greaterThanEq .REACTORS_DESIRED 3 -+ 663 control enabled reactor3 false - 664 print "STOP unwanted" - 665 print "\n" - 666 jump *label251 always - 667 label *label234 ++ 655 jump *label234 greaterThanEq .REACTORS_DESIRED 3 ++ 656 control enabled reactor3 false + 657 print "STOP unwanted" + 658 print "\n" + 659 jump *label251 always + 660 label *label234 - * op greaterThan *tmp136 :fn3:reactor_num 1 - * op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num - * op lessThan *tmp138 :fn3:fuel_stored *tmp137 - * op land *tmp139 *tmp136 *tmp138 -+ 668 op greaterThan *tmp136 3 1 -+ 669 op mul *tmp137 15 3 -+ 670 op lessThan *tmp138 :fn3:fuel_stored 45 -+ 671 op land *tmp139 true *tmp138 - 672 jump *label235 equal *tmp139 false ++ 661 op greaterThan *tmp136 3 1 ++ 662 op mul *tmp137 15 3 ++ 663 op lessThan *tmp138 :fn3:fuel_stored 45 ++ 664 op land *tmp139 true *tmp138 + 665 jump *label235 equal *tmp139 false - * control enabled :fn3:reactor false -+ 673 control enabled reactor3 false - 674 print "STOP system fuel low" - 675 print "\n" - 676 jump *label250 always - 677 label *label235 - 678 jump *label236 greaterThan :fn3:fuel 1 ++ 666 control enabled reactor3 false + 667 print "STOP system fuel low" + 668 print "\n" + 669 jump *label250 always + 670 label *label235 + 671 jump *label236 greaterThan :fn3:fuel 1 - * control enabled :fn3:reactor false -+ 679 control enabled reactor3 false - 680 print "STOP fuel low" - 681 print "\n" - 682 jump *label249 always - 683 label *label236 ++ 672 control enabled reactor3 false + 673 print "STOP fuel low" + 674 print "\n" + 675 jump *label249 always + 676 label *label236 - * jump *label237 greaterThan :fn3:cryo .CRYO_ABORT - * control enabled :fn3:reactor false -+ 684 jump *label237 greaterThan :fn3:cryo 1 -+ 685 control enabled reactor3 false - 686 print "STOP out of cryo" - 687 print "\n" - 688 jump *label248 always - 689 label *label237 - 690 jump *label244 greaterThanEq :fn3:secs 30 - 691 label *label238 ++ 677 jump *label237 greaterThan :fn3:cryo 1 ++ 678 control enabled reactor3 false + 679 print "STOP out of cryo" + 680 print "\n" + 681 jump *label248 always + 682 label *label237 + 683 jump *label244 greaterThanEq :fn3:secs 30 + 684 label *label238 - * op sub *tmp102 @tick :fn3:t_startup -+ 692 op sub *tmp102 @tick :t_startup3 - 693 op idiv :fn2:secs *tmp102 60 - 694 op greaterThan *tmp104 :fn2:secs 30 ++ 685 op sub *tmp102 @tick :t_startup3 + 686 op idiv :fn2:secs *tmp102 60 + 687 op greaterThan *tmp104 :fn2:secs 30 - * sensor *tmp105 :fn3:reactor @enabled -+ 695 sensor *tmp105 reactor3 @enabled - 696 op equal *tmp106 *tmp105 false - 697 op or *tmp107 *tmp104 *tmp106 - 698 jump *label239 equal *tmp107 false - - 707 jump *label241 always - 708 label *label241 - 709 op sub *tmp153 :fn3:charge :fn2*retval ++ 688 sensor *tmp105 reactor3 @enabled + 689 op equal *tmp106 *tmp105 false + 690 op or *tmp107 *tmp104 *tmp106 + 691 jump *label239 equal *tmp107 false + + 699 jump *label241 always + 700 label *label241 + 701 op sub *tmp153 :fn3:charge :fn2*retval - * op lessThan *tmp154 *tmp153 .PWR_ABORT - * op lessThan *tmp155 :fn3:surplus .FLOW_ABORT -+ 710 op lessThan *tmp154 *tmp153 5000 -+ 711 op lessThan *tmp155 :fn3:surplus -500 - 712 op land *tmp156 *tmp154 *tmp155 - 713 jump *label242 equal *tmp156 false ++ 702 op lessThan *tmp154 *tmp153 5000 ++ 703 op lessThan *tmp155 :fn3:surplus -500 + 704 op land *tmp156 *tmp154 *tmp155 + 705 jump *label242 equal *tmp156 false - * control enabled :fn3:reactor false -+ 714 control enabled reactor3 false - 715 print "START FAIL battery" - 716 print "\n" - 717 set :fn3:supply_fuel false - - 728 label *label243 - 729 jump *label247 always - 730 label *label244 ++ 706 control enabled reactor3 false + 707 print "START FAIL battery" + 708 print "\n" + 709 set :fn3:supply_fuel false + + 720 label *label243 + 721 jump *label247 always + 722 label *label244 - * op lessThan *tmp161 :fn3:charge .PWR_ABANDON - * op lessThan *tmp162 :fn3:surplus .FLOW_ABORT -+ 731 op lessThan *tmp161 :fn3:charge 2000 -+ 732 op lessThan *tmp162 :fn3:surplus -500 - 733 op land *tmp163 *tmp161 *tmp162 - 734 jump *label245 equal *tmp163 false ++ 723 op lessThan *tmp161 :fn3:charge 2000 ++ 724 op lessThan *tmp162 :fn3:surplus -500 + 725 op land *tmp163 *tmp161 *tmp162 + 726 jump *label245 equal *tmp163 false - * control enabled :fn3:reactor false -+ 735 control enabled reactor3 false - 736 print "ABANDON - battery crit" - 737 print "\n" - 738 set :fn3:supply_fuel false - - 754 jump *label265 always - 755 label *label252 - 756 op sub *tmp169 :fn3:charge .START_POWER_REQ ++ 727 control enabled reactor3 false + 728 print "ABANDON - battery crit" + 729 print "\n" + 730 set :fn3:supply_fuel false + + 746 jump *label265 always + 747 label *label252 + 748 op sub *tmp169 :fn3:charge .START_POWER_REQ - * op sub *tmp170 *tmp169 .PWR_ABORT - * op div *tmp171 *tmp170 .PWR_REQ - * op mul :fn3:charge_units *tmp171 .PWR_RESERVE - * op div *tmp173 :fn3:surplus .FLOW_REQ -+ 757 op sub *tmp170 *tmp169 5000 -+ 758 op div *tmp171 *tmp170 23000 -+ 759 op mul :fn3:charge_units *tmp171 0.6 -+ 760 op div *tmp173 :fn3:surplus 2000 - 761 op max :fn3:flow_units -0.1 *tmp173 ++ 749 op sub *tmp170 *tmp169 5000 ++ 750 op div *tmp171 *tmp170 23000 ++ 751 op mul :fn3:charge_units *tmp171 0.6 ++ 752 op div *tmp173 :fn3:surplus 2000 + 753 op max :fn3:flow_units -0.1 *tmp173 - * op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num - * op add :fn3:cryo_req .CRYO_REQ *tmp175 - * jump *label253 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num -+ 762 op mul *tmp175 2 3 -+ 763 op add :fn3:cryo_req 3 6 -+ 764 jump *label253 greaterThanEq .REACTORS_DESIRED 3 - 765 print "IDLE" - 766 print "\n" - 767 set :fn3:supply_fuel false - - 782 set :fn3:supply_fuel false - 783 jump *label263 always - 784 label *label254 ++ 754 op mul *tmp175 2 3 ++ 755 op add :fn3:cryo_req 3 6 ++ 756 jump *label253 greaterThanEq .REACTORS_DESIRED 3 + 757 print "IDLE" + 758 print "\n" + 759 set :fn3:supply_fuel false + + 774 set :fn3:supply_fuel false + 775 jump *label263 always + 776 label *label254 - * op lessThan *tmp188 :fn3:fuel .FUEL_REQ - * op land *tmp189 :fn3:fuel_on *tmp188 -+ 785 op lessThan *tmp188 :fn3:fuel 10 -+ 786 op land *tmp189 :fuel_3 *tmp188 - 787 jump *label257 equal *tmp189 false - 788 op add *tmp191 :fn3:fuel :fn3:fuel_stored ++ 777 op lessThan *tmp188 :fn3:fuel 10 ++ 778 op land *tmp189 :fuel_3 *tmp188 + 779 jump *label257 equal *tmp189 false + 780 op add *tmp191 :fn3:fuel :fn3:fuel_stored - * jump *label255 lessThanEq *tmp191 .FUEL_REQ -+ 789 jump *label255 lessThanEq *tmp191 10 - 790 print "WAIT fuel" - 791 print "\n" - 792 jump *label256 always - - 796 label *label256 - 797 jump *label262 always - 798 label *label257 ++ 781 jump *label255 lessThanEq *tmp191 10 + 782 print "WAIT fuel" + 783 print "\n" + 784 jump *label256 always + + 788 label *label256 + 789 jump *label262 always + 790 label *label257 - * op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num - * jump *label258 greaterThanEq :fn3:fuel_stored *tmp194 -+ 799 op mul *tmp194 45 3 -+ 800 jump *label258 greaterThanEq :fn3:fuel_stored 135 - 801 print "WAIT buffer fuel" - 802 print "\n" - 803 jump *label261 always - 804 label *label258 ++ 791 op mul *tmp194 45 3 ++ 792 jump *label258 greaterThanEq :fn3:fuel_stored 135 + 793 print "WAIT buffer fuel" + 794 print "\n" + 795 jump *label261 always + 796 label *label258 - * jump *label259 greaterThanEq :fn3:cryo :fn3:cryo_req -+ 805 jump *label259 greaterThanEq :fn3:cryo 9 - 806 print "WAIT cryo" - 807 print "\n" - 808 jump *label260 always - 809 label *label259 - 810 print "STARTUP" - 811 print "\n" ++ 797 jump *label259 greaterThanEq :fn3:cryo 9 + 798 print "WAIT cryo" + 799 print "\n" + 800 jump *label260 always + 801 label *label259 + 802 print "STARTUP" + 803 print "\n" - * op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ - * control enabled :fn3:reactor true -+ 812 op add .START_POWER_REQ .START_POWER_REQ 23000 -+ 813 control enabled reactor3 true - 814 label *label260 - 815 label *label261 - 816 label *label262 - - 818 label *label264 - 819 label *label265 - 820 label *label266 ++ 804 op add .START_POWER_REQ .START_POWER_REQ 23000 ++ 805 control enabled reactor3 true + 806 label *label260 + 807 label *label261 + 808 label *label262 + + 810 label *label264 + 811 label *label265 + 812 label *label266 - * sensor *tmp201 :fn3:reactor @enabled -+ 821 sensor *tmp201 reactor3 @enabled - 822 jump *label267 equal :fn3:enabled *tmp201 - 823 set .RET_T_STARTUP @tick - 824 label *label267 - - 826 set :fn3*retval :fn3:supply_fuel - 827 jump *label269 always - 828 label *label269 ++ 813 sensor *tmp201 reactor3 @enabled + 814 jump *label267 equal :fn3:enabled *tmp201 + 815 set .RET_T_STARTUP @tick + 816 label *label267 + + 818 set :fn3*retval :fn3:supply_fuel + 819 jump *label269 always + 820 label *label269 - * set :fuel_3 :fn3*retval -+ 829 set :fuel_3 :fn3:supply_fuel - 830 set :t_startup3 .RET_T_STARTUP - 831 set :fn3:reactor reactor4 - 832 set :fn3:reactor_num 4 ++ 821 set :fuel_3 :fn3:supply_fuel + 822 set :t_startup3 .RET_T_STARTUP + 823 set :fn3:reactor reactor4 + 824 set :fn3:reactor_num 4 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-6 instructions): - 624 label *label130 - 625 label *label131 - 626 op or :emerg_shutdown :emerg_shutdown :fn4*retval + 617 label *label154 + 618 label *label155 + 619 op or :emerg_shutdown :emerg_shutdown :fn4*retval - * set :fn3:reactor reactor3 - * set :fn3:reactor_num 3 - * set :fn3:emerg_shutdown :emerg_shutdown - * set :fn3:fuel_on :fuel_3 - * set :fn3:t_startup :t_startup3 - 627 label *label232 - 628 set .RET_T_STARTUP :t_startup3 - 629 op sub *tmp113 @tick :t_startup3 + 620 label *label232 + 621 set .RET_T_STARTUP :t_startup3 + 622 op sub *tmp113 @tick :t_startup3 - 751 op sub *tmp169 :fn3:charge .START_POWER_REQ - 752 op sub *tmp170 *tmp169 5000 - 753 op div *tmp171 *tmp170 23000 + 743 op sub *tmp169 :fn3:charge .START_POWER_REQ + 744 op sub *tmp170 *tmp169 5000 + 745 op div *tmp171 *tmp170 23000 - * op mul :fn3:charge_units *tmp171 0.6 -+ 754 op div :fn3:charge_units *tmp170 38333.333333333336 - 755 op div *tmp173 :fn3:surplus 2000 - 756 op max :fn3:flow_units -0.1 *tmp173 - 757 op mul *tmp175 2 3 - - 818 set .RET_T_STARTUP @tick - 819 label *label267 - 820 label *label268 ++ 746 op div :fn3:charge_units *tmp170 38333.333333333336 + 747 op div *tmp173 :fn3:surplus 2000 + 748 op max :fn3:flow_units -0.1 *tmp173 + 749 op mul *tmp175 2 3 + + 810 set .RET_T_STARTUP @tick + 811 label *label267 + 812 label *label268 - * set :fn3*retval :fn3:supply_fuel - 821 jump *label269 always - 822 label *label269 - 823 set :fuel_3 :fn3:supply_fuel + 813 jump *label269 always + 814 label *label269 + 815 set :fuel_3 :fn3:supply_fuel Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (-10 instructions): 59 control enabled projector1 false 60 control enabled projector2 false 61 set :fn4*retval false -- * jump *label127 always - 62 label *label126 - 63 label *label127 +- * jump *label151 always + 62 label *label150 + 63 label *label151 64 op notEqual *tmp9 switch1 null - 365 set .RET_T_STARTUP @tick - 366 label *label191 - 367 label *label192 + 359 set .RET_T_STARTUP @tick + 360 label *label191 + 361 label *label192 - * jump *label193 always - 368 label *label193 - 369 set :fuel_1 :fn3:supply_fuel - 370 set :t_startup1 .RET_T_STARTUP + 362 label *label193 + 363 set :fuel_1 :fn3:supply_fuel + 364 set :t_startup1 .RET_T_STARTUP - 576 set .RET_T_STARTUP @tick - 577 label *label229 - 578 label *label230 + 569 set .RET_T_STARTUP @tick + 570 label *label229 + 571 label *label230 - * jump *label231 always - 579 label *label231 - 580 set :fuel_2 :fn3:supply_fuel - 581 set :t_startup2 .RET_T_STARTUP - - 617 control enabled projector1 false - 618 control enabled projector2 false - 619 set :fn4*retval false -- * jump *label131 always - 620 label *label130 - 621 label *label131 - 622 op or :emerg_shutdown :emerg_shutdown :fn4*retval - - 814 set .RET_T_STARTUP @tick - 815 label *label267 - 816 label *label268 + 572 label *label231 + 573 set :fuel_2 :fn3:supply_fuel + 574 set :t_startup2 .RET_T_STARTUP + + 610 control enabled projector1 false + 611 control enabled projector2 false + 612 set :fn4*retval false +- * jump *label155 always + 613 label *label154 + 614 label *label155 + 615 op or :emerg_shutdown :emerg_shutdown :fn4*retval + + 806 set .RET_T_STARTUP @tick + 807 label *label267 + 808 label *label268 - * jump *label269 always - 817 label *label269 - 818 set :fuel_3 :fn3:supply_fuel - 819 set :t_startup3 .RET_T_STARTUP + 809 label *label269 + 810 set :fuel_3 :fn3:supply_fuel + 811 set :t_startup3 .RET_T_STARTUP - 908 label *label34 - 909 label *label30 - 910 op lessThan *tmp32 :fn6:fuel_stored :fn6:limit + 900 label *label34 + 901 label *label30 + 902 op lessThan *tmp32 :fn6:fuel_stored :fn6:limit - * jump *label28 always - 911 label *label28 - 912 jump *label35 equal *tmp32 false - 913 control config unloader7 @pyratite + 903 label *label28 + 904 jump *label35 equal *tmp32 false + 905 control config unloader7 @pyratite - 935 label *label100 - 936 op idiv *tmp93 .AVG_SURPLUS 100 - 937 op div :fn0*retval *tmp93 10 + 927 label *label100 + 928 op idiv *tmp93 .AVG_SURPLUS 100 + 929 op div :fn0*retval *tmp93 10 - * jump *label101 always - 938 label *label101 - 939 set :surplus :fn0*retval - 940 sensor :fn0:val node1 @powerNetStored - 941 label *label102 - 942 op idiv *tmp93 :fn0:val 100 - 943 op div :fn0*retval *tmp93 10 + 930 label *label101 + 931 set :surplus :fn0*retval + 932 sensor :fn0:val node1 @powerNetStored + 933 label *label102 + 934 op idiv *tmp93 :fn0:val 100 + 935 op div :fn0*retval *tmp93 10 - * jump *label103 always - 944 label *label103 - 945 set :charge :fn0*retval - 946 jump *label42 lessThanEq .START_POWER_REQ 0 - 947 label *label104 - 948 op idiv *tmp93 .START_POWER_REQ 100 - 949 op div :fn0*retval *tmp93 10 + 936 label *label103 + 937 set :charge :fn0*retval + 938 jump *label42 lessThanEq .START_POWER_REQ 0 + 939 label *label104 + 940 op idiv *tmp93 .START_POWER_REQ 100 + 941 op div :fn0*retval *tmp93 10 - * jump *label105 always - 950 label *label105 - 951 print "Req " - 952 print :fn0*retval + 942 label *label105 + 943 print "Req " + 944 print :fn0*retval - 1198 label *label95 - 1199 label *label96 - 1200 set :fn3*retval :fn3:supply_fuel + 1189 label *label95 + 1190 label *label96 + 1191 set :fn3*retval :fn3:supply_fuel - * jump *label63 always - 1201 label *label63 - 1202 return :fn3*retaddr - 1203 end + 1192 label *label63 + 1193 return :fn3*retaddr + 1194 end Modifications by Iterated phase, Jump Optimization, pass 3, iteration 1 (-1 instructions): - 907 print "n" - 908 label *label34 - 909 label *label30 + 899 print "n" + 900 label *label34 + 901 label *label30 - * op lessThan *tmp32 :fn6:fuel_stored :fn6:limit - 910 label *label28 + 902 label *label28 - * jump *label35 equal *tmp32 false -+ 911 jump *label35 greaterThanEq :fn6:fuel_stored :fn6:limit - 912 control config unloader7 @pyratite - 913 jump *label36 always - 914 label *label35 ++ 903 jump *label35 greaterThanEq :fn6:fuel_stored :fn6:limit + 904 control config unloader7 @pyratite + 905 jump *label36 always + 906 label *label35 Modifications by Final phase, Jump Threading, iteration 1: - 205 control enabled reactor1 false - 206 print "STOP unwanted" - 207 print "\n" + 200 control enabled reactor1 false + 201 print "STOP unwanted" + 202 print "\n" - * jump *label175 always -+ 208 jump *label189 always - 209 label *label158 - 210 op greaterThan *tmp136 1 1 - 211 op mul *tmp137 15 1 - - 215 control enabled reactor1 false - 216 print "STOP system fuel low" - 217 print "\n" ++ 203 jump *label189 always + 204 label *label158 + 205 op greaterThan *tmp136 1 1 + 206 op mul *tmp137 15 1 + + 210 control enabled reactor1 false + 211 print "STOP system fuel low" + 212 print "\n" - * jump *label174 always -+ 218 jump *label189 always - 219 label *label159 - 220 jump *label160 greaterThan :fn3:fuel 1 - 221 control enabled reactor1 false - 222 print "STOP fuel low" - 223 print "\n" ++ 213 jump *label189 always + 214 label *label159 + 215 jump *label160 greaterThan :fn3:fuel 1 + 216 control enabled reactor1 false + 217 print "STOP fuel low" + 218 print "\n" - * jump *label173 always -+ 224 jump *label189 always - 225 label *label160 - 226 jump *label161 greaterThan :fn3:cryo 1 - 227 control enabled reactor1 false - 228 print "STOP out of cryo" - 229 print "\n" ++ 219 jump *label189 always + 220 label *label160 + 221 jump *label161 greaterThan :fn3:cryo 1 + 222 control enabled reactor1 false + 223 print "STOP out of cryo" + 224 print "\n" - * jump *label172 always -+ 230 jump *label189 always - 231 label *label161 - 232 jump *label168 greaterThanEq :fn3:secs 30 - 233 label *label162 - - 257 print "START FAIL battery" - 258 print "\n" - 259 set :fn3:supply_fuel false ++ 225 jump *label189 always + 226 label *label161 + 227 jump *label168 greaterThanEq :fn3:secs 30 + 228 label *label162 + + 251 print "START FAIL battery" + 252 print "\n" + 253 set :fn3:supply_fuel false - * jump *label167 always -+ 260 jump *label189 always - 261 label *label166 - 262 op sub :fn3:time_left 30 :fn3:secs - 263 print "Starting " - - 268 print "J" - 269 print "\n" - 270 label *label167 ++ 254 jump *label189 always + 255 label *label166 + 256 op sub :fn3:time_left 30 :fn3:secs + 257 print "Starting " + + 262 print "J" + 263 print "\n" + 264 label *label167 - * jump *label171 always -+ 271 jump *label189 always - 272 label *label168 - 273 op lessThan *tmp161 :fn3:charge 2000 - 274 op lessThan *tmp162 :fn3:surplus -500 - - 278 print "ABANDON - battery crit" - 279 print "\n" - 280 set :fn3:supply_fuel false ++ 265 jump *label189 always + 266 label *label168 + 267 op lessThan *tmp161 :fn3:charge 2000 + 268 op lessThan *tmp162 :fn3:surplus -500 + + 272 print "ABANDON - battery crit" + 273 print "\n" + 274 set :fn3:supply_fuel false - * jump *label170 always -+ 281 jump *label189 always - 282 label *label169 - 283 op idiv :fn3:mins :fn3:secs 6 - 284 op div :fn3:mins :fn3:mins 10 - - 331 jump *label179 lessThanEq *tmp191 10 - 332 print "WAIT fuel" - 333 print "\n" ++ 275 jump *label189 always + 276 label *label169 + 277 op idiv :fn3:mins :fn3:secs 6 + 278 op div :fn3:mins :fn3:mins 10 + + 325 jump *label179 lessThanEq *tmp191 10 + 326 print "WAIT fuel" + 327 print "\n" - * jump *label180 always -+ 334 jump *label186 always - 335 label *label179 - 336 print "WAIT system fuel" - 337 print "\n" - - 416 control enabled reactor2 false - 417 print "STOP unwanted" - 418 print "\n" ++ 328 jump *label186 always + 329 label *label179 + 330 print "WAIT system fuel" + 331 print "\n" + + 410 control enabled reactor2 false + 411 print "STOP unwanted" + 412 print "\n" - * jump *label213 always -+ 419 jump *label227 always - 420 label *label196 - 421 op greaterThan *tmp136 2 1 - 422 op mul *tmp137 15 2 - ++ 413 jump *label227 always + 414 label *label196 + 415 op greaterThan *tmp136 2 1 + 416 op mul *tmp137 15 2 + + 420 control enabled reactor2 false + 421 print "STOP system fuel low" + 422 print "\n" +- * jump *label212 always ++ 423 jump *label227 always + 424 label *label197 + 425 jump *label198 greaterThan :fn3:fuel 1 426 control enabled reactor2 false - 427 print "STOP system fuel low" + 427 print "STOP fuel low" 428 print "\n" -- * jump *label212 always +- * jump *label211 always + 429 jump *label227 always - 430 label *label197 - 431 jump *label198 greaterThan :fn3:fuel 1 + 430 label *label198 + 431 jump *label199 greaterThan :fn3:cryo 1 432 control enabled reactor2 false - 433 print "STOP fuel low" + 433 print "STOP out of cryo" 434 print "\n" -- * jump *label211 always -+ 435 jump *label227 always - 436 label *label198 - 437 jump *label199 greaterThan :fn3:cryo 1 - 438 control enabled reactor2 false - 439 print "STOP out of cryo" - 440 print "\n" - * jump *label210 always -+ 441 jump *label227 always - 442 label *label199 - 443 jump *label206 greaterThanEq :fn3:secs 30 - 444 label *label200 ++ 435 jump *label227 always + 436 label *label199 + 437 jump *label206 greaterThanEq :fn3:secs 30 + 438 label *label200 - 468 print "START FAIL battery" - 469 print "\n" - 470 set :fn3:supply_fuel false + 461 print "START FAIL battery" + 462 print "\n" + 463 set :fn3:supply_fuel false - * jump *label205 always -+ 471 jump *label227 always - 472 label *label204 - 473 op sub :fn3:time_left 30 :fn3:secs - 474 print "Starting " - - 479 print "J" - 480 print "\n" - 481 label *label205 ++ 464 jump *label227 always + 465 label *label204 + 466 op sub :fn3:time_left 30 :fn3:secs + 467 print "Starting " + + 472 print "J" + 473 print "\n" + 474 label *label205 - * jump *label209 always -+ 482 jump *label227 always - 483 label *label206 - 484 op lessThan *tmp161 :fn3:charge 2000 - 485 op lessThan *tmp162 :fn3:surplus -500 - - 489 print "ABANDON - battery crit" - 490 print "\n" - 491 set :fn3:supply_fuel false ++ 475 jump *label227 always + 476 label *label206 + 477 op lessThan *tmp161 :fn3:charge 2000 + 478 op lessThan *tmp162 :fn3:surplus -500 + + 482 print "ABANDON - battery crit" + 483 print "\n" + 484 set :fn3:supply_fuel false - * jump *label208 always -+ 492 jump *label227 always - 493 label *label207 - 494 op idiv :fn3:mins :fn3:secs 6 - 495 op div :fn3:mins :fn3:mins 10 ++ 485 jump *label227 always + 486 label *label207 + 487 op idiv :fn3:mins :fn3:secs 6 + 488 op div :fn3:mins :fn3:mins 10 - 542 jump *label217 lessThanEq *tmp191 10 - 543 print "WAIT fuel" - 544 print "\n" + 535 jump *label217 lessThanEq *tmp191 10 + 536 print "WAIT fuel" + 537 print "\n" - * jump *label218 always -+ 545 jump *label224 always - 546 label *label217 - 547 print "WAIT system fuel" - 548 print "\n" - - 654 control enabled reactor3 false - 655 print "STOP unwanted" - 656 print "\n" ++ 538 jump *label224 always + 539 label *label217 + 540 print "WAIT system fuel" + 541 print "\n" + + 647 control enabled reactor3 false + 648 print "STOP unwanted" + 649 print "\n" - * jump *label251 always -+ 657 jump *label265 always - 658 label *label234 - 659 op greaterThan *tmp136 3 1 - 660 op mul *tmp137 15 3 - - 664 control enabled reactor3 false - 665 print "STOP system fuel low" - 666 print "\n" ++ 650 jump *label265 always + 651 label *label234 + 652 op greaterThan *tmp136 3 1 + 653 op mul *tmp137 15 3 + + 657 control enabled reactor3 false + 658 print "STOP system fuel low" + 659 print "\n" - * jump *label250 always -+ 667 jump *label265 always - 668 label *label235 - 669 jump *label236 greaterThan :fn3:fuel 1 - 670 control enabled reactor3 false - 671 print "STOP fuel low" - 672 print "\n" ++ 660 jump *label265 always + 661 label *label235 + 662 jump *label236 greaterThan :fn3:fuel 1 + 663 control enabled reactor3 false + 664 print "STOP fuel low" + 665 print "\n" - * jump *label249 always -+ 673 jump *label265 always - 674 label *label236 - 675 jump *label237 greaterThan :fn3:cryo 1 - 676 control enabled reactor3 false - 677 print "STOP out of cryo" - 678 print "\n" ++ 666 jump *label265 always + 667 label *label236 + 668 jump *label237 greaterThan :fn3:cryo 1 + 669 control enabled reactor3 false + 670 print "STOP out of cryo" + 671 print "\n" - * jump *label248 always -+ 679 jump *label265 always - 680 label *label237 - 681 jump *label244 greaterThanEq :fn3:secs 30 - 682 label *label238 - - 706 print "START FAIL battery" - 707 print "\n" - 708 set :fn3:supply_fuel false ++ 672 jump *label265 always + 673 label *label237 + 674 jump *label244 greaterThanEq :fn3:secs 30 + 675 label *label238 + + 698 print "START FAIL battery" + 699 print "\n" + 700 set :fn3:supply_fuel false - * jump *label243 always -+ 709 jump *label265 always - 710 label *label242 - 711 op sub :fn3:time_left 30 :fn3:secs - 712 print "Starting " - - 717 print "J" - 718 print "\n" - 719 label *label243 ++ 701 jump *label265 always + 702 label *label242 + 703 op sub :fn3:time_left 30 :fn3:secs + 704 print "Starting " + + 709 print "J" + 710 print "\n" + 711 label *label243 - * jump *label247 always -+ 720 jump *label265 always - 721 label *label244 - 722 op lessThan *tmp161 :fn3:charge 2000 - 723 op lessThan *tmp162 :fn3:surplus -500 - - 727 print "ABANDON - battery crit" - 728 print "\n" - 729 set :fn3:supply_fuel false ++ 712 jump *label265 always + 713 label *label244 + 714 op lessThan *tmp161 :fn3:charge 2000 + 715 op lessThan *tmp162 :fn3:surplus -500 + + 719 print "ABANDON - battery crit" + 720 print "\n" + 721 set :fn3:supply_fuel false - * jump *label246 always -+ 730 jump *label265 always - 731 label *label245 - 732 op idiv :fn3:mins :fn3:secs 6 - 733 op div :fn3:mins :fn3:mins 10 - - 780 jump *label255 lessThanEq *tmp191 10 - 781 print "WAIT fuel" - 782 print "\n" ++ 722 jump *label265 always + 723 label *label245 + 724 op idiv :fn3:mins :fn3:secs 6 + 725 op div :fn3:mins :fn3:mins 10 + + 772 jump *label255 lessThanEq *tmp191 10 + 773 print "WAIT fuel" + 774 print "\n" - * jump *label256 always -+ 783 jump *label262 always - 784 label *label255 - 785 print "WAIT system fuel" - 786 print "\n" - - 878 jump *label31 equal :emerg_shutdown false - 879 print " Enemies detected." - 880 print "\n" ++ 775 jump *label262 always + 776 label *label255 + 777 print "WAIT system fuel" + 778 print "\n" + + 870 jump *label31 equal :emerg_shutdown false + 871 print " Enemies detected." + 872 print "\n" - * jump *label32 always -+ 881 jump *label30 always - 882 label *label31 - 883 print " Critical power." - 884 print "\n" - - 1036 control enabled :fn3:reactor false - 1037 print "STOP unwanted" - 1038 print "\n" ++ 873 jump *label30 always + 874 label *label31 + 875 print " Critical power." + 876 print "\n" + + 1028 control enabled :fn3:reactor false + 1029 print "STOP unwanted" + 1030 print "\n" - * jump *label69 always -+ 1039 jump *label67 always - 1040 label *label68 - 1041 op greaterThan *tmp136 :fn3:reactor_num 1 - 1042 op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num - - 1046 control enabled :fn3:reactor false - 1047 print "STOP system fuel low" - 1048 print "\n" ++ 1031 jump *label67 always + 1032 label *label68 + 1033 op greaterThan *tmp136 :fn3:reactor_num 1 + 1034 op mul *tmp137 .FUEL_TOT_ABORT :fn3:reactor_num + + 1038 control enabled :fn3:reactor false + 1039 print "STOP system fuel low" + 1040 print "\n" - * jump *label71 always -+ 1049 jump *label67 always - 1050 label *label70 - 1051 jump *label72 greaterThan :fn3:fuel 1 - 1052 control enabled :fn3:reactor false - 1053 print "STOP fuel low" - 1054 print "\n" ++ 1041 jump *label67 always + 1042 label *label70 + 1043 jump *label72 greaterThan :fn3:fuel 1 + 1044 control enabled :fn3:reactor false + 1045 print "STOP fuel low" + 1046 print "\n" - * jump *label73 always -+ 1055 jump *label67 always - 1056 label *label72 - 1057 jump *label74 greaterThan :fn3:cryo .CRYO_ABORT - 1058 control enabled :fn3:reactor false - 1059 print "STOP out of cryo" - 1060 print "\n" ++ 1047 jump *label67 always + 1048 label *label72 + 1049 jump *label74 greaterThan :fn3:cryo .CRYO_ABORT + 1050 control enabled :fn3:reactor false + 1051 print "STOP out of cryo" + 1052 print "\n" - * jump *label75 always -+ 1061 jump *label67 always - 1062 label *label74 - 1063 jump *label76 greaterThanEq :fn3:secs 30 - 1064 label *label152 - - 1088 print "START FAIL battery" - 1089 print "\n" - 1090 set :fn3:supply_fuel false ++ 1053 jump *label67 always + 1054 label *label74 + 1055 jump *label76 greaterThanEq :fn3:secs 30 + 1056 label *label144 + + 1079 print "START FAIL battery" + 1080 print "\n" + 1081 set :fn3:supply_fuel false - * jump *label80 always -+ 1091 jump *label67 always - 1092 label *label79 - 1093 op sub :fn3:time_left 30 :fn3:secs - 1094 print "Starting " - - 1099 print "J" - 1100 print "\n" - 1101 label *label80 ++ 1082 jump *label67 always + 1083 label *label79 + 1084 op sub :fn3:time_left 30 :fn3:secs + 1085 print "Starting " + + 1090 print "J" + 1091 print "\n" + 1092 label *label80 - * jump *label77 always -+ 1102 jump *label67 always - 1103 label *label76 - 1104 op lessThan *tmp161 :fn3:charge .PWR_ABANDON - 1105 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT - - 1109 print "ABANDON - battery crit" - 1110 print "\n" - 1111 set :fn3:supply_fuel false ++ 1093 jump *label67 always + 1094 label *label76 + 1095 op lessThan *tmp161 :fn3:charge .PWR_ABANDON + 1096 op lessThan *tmp162 :fn3:surplus .FLOW_ABORT + + 1100 print "ABANDON - battery crit" + 1101 print "\n" + 1102 set :fn3:supply_fuel false - * jump *label82 always -+ 1112 jump *label67 always - 1113 label *label81 - 1114 op idiv :fn3:mins :fn3:secs 6 - 1115 op div :fn3:mins :fn3:mins 10 - - 1162 jump *label89 lessThanEq *tmp191 .FUEL_REQ - 1163 print "WAIT fuel" - 1164 print "\n" ++ 1103 jump *label67 always + 1104 label *label81 + 1105 op idiv :fn3:mins :fn3:secs 6 + 1106 op div :fn3:mins :fn3:mins 10 + + 1153 jump *label89 lessThanEq *tmp191 .FUEL_REQ + 1154 print "WAIT fuel" + 1155 print "\n" - * jump *label90 always -+ 1165 jump *label88 always - 1166 label *label89 - 1167 print "WAIT system fuel" - 1168 print "\n" ++ 1156 jump *label88 always + 1157 label *label89 + 1158 print "WAIT system fuel" + 1159 print "\n" Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-4 instructions): 54 control enabled reactor5 false 55 set :fn4*retval true - 56 jump *label127 always -- * jump *label126 always - 57 label *label125 + 56 jump *label151 always +- * jump *label150 always + 57 label *label149 58 control enabled projector1 false 59 control enabled projector2 false - 611 control enabled reactor5 false - 612 set :fn4*retval true - 613 jump *label131 always -- * jump *label130 always - 614 label *label129 - 615 control enabled projector1 false - 616 control enabled projector2 false - - 998 printflush message1 - 999 label *label8 - 1000 jump *label7 always + 604 control enabled reactor5 false + 605 set :fn4*retval true + 606 jump *label155 always +- * jump *label154 always + 607 label *label153 + 608 control enabled projector1 false + 609 control enabled projector2 false + + 990 printflush message1 + 991 label *label8 + 992 jump *label7 always - * label *label9 - * end - 1001 label *label3 - 1002 set .RET_T_STARTUP :fn3:t_startup - 1003 op sub *tmp113 @tick :fn3:t_startup + 993 label *label3 + 994 set .RET_T_STARTUP :fn3:t_startup + 995 op sub *tmp113 @tick :fn3:t_startup - 1195 set :fn3*retval :fn3:supply_fuel - 1196 label *label63 - 1197 return :fn3*retaddr + 1186 set :fn3*retval :fn3:supply_fuel + 1187 label *label63 + 1188 return :fn3*retaddr - * end Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): @@ -4545,66 +4549,66 @@ Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): 70 jump *label11 always 71 label *label12 - 187 op mul *tmp125 :fn3:surplus 0.2 - 188 op add .AVG_SURPLUS *tmp124 *tmp125 - 189 sensor :fn3:enabled reactor1 @enabled + 182 op mul *tmp125 :fn3:surplus 0.2 + 183 op add .AVG_SURPLUS *tmp124 *tmp125 + 184 sensor :fn3:enabled reactor1 @enabled - * print "#" - * print 1 - * print " " - * print "- " -+ 190 print "#1 - " - 191 jump *label157 equal :emerg_shutdown false - 192 control enabled reactor1 false ++ 185 print "#1 - " + 186 jump *label157 equal :emerg_shutdown false + 187 control enabled reactor1 false - * print "emergency mode" - * print "\n" -+ 193 print "emergency mode\n" - 194 set :fn3:supply_fuel false - 195 jump *label190 always - 196 label *label157 - 197 jump *label176 equal :fn3:enabled false - 198 jump *label158 greaterThanEq .REACTORS_DESIRED 1 - 199 control enabled reactor1 false ++ 188 print "emergency mode\n" + 189 set :fn3:supply_fuel false + 190 jump *label190 always + 191 label *label157 + 192 jump *label176 equal :fn3:enabled false + 193 jump *label158 greaterThanEq .REACTORS_DESIRED 1 + 194 control enabled reactor1 false - * print "STOP unwanted" - * print "\n" -+ 200 print "STOP unwanted\n" - 201 jump *label189 always - 202 label *label158 - 203 op greaterThan *tmp136 1 1 - - 206 op land *tmp139 false *tmp138 - 207 jump *label159 equal *tmp139 false - 208 control enabled reactor1 false ++ 195 print "STOP unwanted\n" + 196 jump *label189 always + 197 label *label158 + 198 op greaterThan *tmp136 1 1 + + 201 op land *tmp139 false *tmp138 + 202 jump *label159 equal *tmp139 false + 203 control enabled reactor1 false - * print "STOP system fuel low" - * print "\n" -+ 209 print "STOP system fuel low\n" - 210 jump *label189 always - 211 label *label159 - 212 jump *label160 greaterThan :fn3:fuel 1 - 213 control enabled reactor1 false ++ 204 print "STOP system fuel low\n" + 205 jump *label189 always + 206 label *label159 + 207 jump *label160 greaterThan :fn3:fuel 1 + 208 control enabled reactor1 false - * print "STOP fuel low" - * print "\n" -+ 214 print "STOP fuel low\n" - 215 jump *label189 always - 216 label *label160 - 217 jump *label161 greaterThan :fn3:cryo 1 - 218 control enabled reactor1 false ++ 209 print "STOP fuel low\n" + 210 jump *label189 always + 211 label *label160 + 212 jump *label161 greaterThan :fn3:cryo 1 + 213 control enabled reactor1 false - * print "STOP out of cryo" - * print "\n" -+ 219 print "STOP out of cryo\n" - 220 jump *label189 always - 221 label *label161 - 222 jump *label168 greaterThanEq :fn3:secs 30 - - 244 op land *tmp156 *tmp154 *tmp155 - 245 jump *label166 equal *tmp156 false - 246 control enabled reactor1 false ++ 214 print "STOP out of cryo\n" + 215 jump *label189 always + 216 label *label161 + 217 jump *label168 greaterThanEq :fn3:secs 30 + + 238 op land *tmp156 *tmp154 *tmp155 + 239 jump *label166 equal *tmp156 false + 240 control enabled reactor1 false - * print "START FAIL battery" - * print "\n" -+ 247 print "START FAIL battery\n" - 248 set :fn3:supply_fuel false - 249 jump *label189 always - 250 label *label166 - 251 op sub :fn3:time_left 30 :fn3:secs ++ 241 print "START FAIL battery\n" + 242 set :fn3:supply_fuel false + 243 jump *label189 always + 244 label *label166 + 245 op sub :fn3:time_left 30 :fn3:secs - * print "Starting " - * print :fn3:time_left - * print " " @@ -4612,155 +4616,155 @@ Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): - * print :fn2*retval - * print "J" - * print "\n" -+ 252 print "Starting {0} secs, req {0}J\n" -+ 253 format :fn3:time_left -+ 254 format :fn2*retval - 255 label *label167 - 256 jump *label189 always - 257 label *label168 - - 260 op land *tmp163 *tmp161 *tmp162 - 261 jump *label169 equal *tmp163 false - 262 control enabled reactor1 false ++ 246 print "Starting {0} secs, req {0}J\n" ++ 247 format :fn3:time_left ++ 248 format :fn2*retval + 249 label *label167 + 250 jump *label189 always + 251 label *label168 + + 254 op land *tmp163 *tmp161 *tmp162 + 255 jump *label169 equal *tmp163 false + 256 control enabled reactor1 false - * print "ABANDON - battery crit" - * print "\n" -+ 263 print "ABANDON - battery crit\n" - 264 set :fn3:supply_fuel false - 265 jump *label189 always - 266 label *label169 - 267 op idiv :fn3:mins :fn3:secs 6 - 268 op div :fn3:mins :fn3:mins 10 ++ 257 print "ABANDON - battery crit\n" + 258 set :fn3:supply_fuel false + 259 jump *label189 always + 260 label *label169 + 261 op idiv :fn3:mins :fn3:secs 6 + 262 op div :fn3:mins :fn3:mins 10 - * print "RUN " - * print :fn3:mins - * print " " - * print "mins" - * print "\n" -+ 269 print "RUN {0} mins\n" -+ 270 format :fn3:mins - 271 label *label170 - 272 label *label171 - 273 label *label172 - - 285 op mul *tmp175 2 1 - 286 op add :fn3:cryo_req 3 2 - 287 jump *label177 greaterThanEq .REACTORS_DESIRED 1 ++ 263 print "RUN {0} mins\n" ++ 264 format :fn3:mins + 265 label *label170 + 266 label *label171 + 267 label *label172 + + 279 op mul *tmp175 2 1 + 280 op add :fn3:cryo_req 3 2 + 281 jump *label177 greaterThanEq .REACTORS_DESIRED 1 - * print "IDLE" - * print "\n" -+ 288 print "IDLE\n" - 289 set :fn3:supply_fuel false - 290 jump *label188 always - 291 label *label177 - - 295 op div :fn3:flow *tmp183 10 - 296 op idiv *tmp186 :fn3:charge_units 0.001 - 297 op div :fn3:charge *tmp186 10 ++ 282 print "IDLE\n" + 283 set :fn3:supply_fuel false + 284 jump *label188 always + 285 label *label177 + + 289 op div :fn3:flow *tmp183 10 + 290 op idiv *tmp186 :fn3:charge_units 0.001 + 291 op div :fn3:charge *tmp186 10 - * print "WAIT power. (%" - * print :fn3:charge - * print "J + %" - * print :fn3:flow - * print "W)" - * print "\n" -+ 298 print "WAIT power. (%{0}J + %{0}W)\n" -+ 299 format :fn3:charge -+ 300 format :fn3:flow - 301 set :fn3:supply_fuel false - 302 jump *label187 always - 303 label *label178 - - 306 jump *label181 equal *tmp189 false - 307 op add *tmp191 :fn3:fuel :fn3:fuel_stored - 308 jump *label179 lessThanEq *tmp191 10 ++ 292 print "WAIT power. (%{0}J + %{0}W)\n" ++ 293 format :fn3:charge ++ 294 format :fn3:flow + 295 set :fn3:supply_fuel false + 296 jump *label187 always + 297 label *label178 + + 300 jump *label181 equal *tmp189 false + 301 op add *tmp191 :fn3:fuel :fn3:fuel_stored + 302 jump *label179 lessThanEq *tmp191 10 - * print "WAIT fuel" - * print "\n" -+ 309 print "WAIT fuel\n" - 310 jump *label186 always - 311 label *label179 ++ 303 print "WAIT fuel\n" + 304 jump *label186 always + 305 label *label179 - * print "WAIT system fuel" - * print "\n" -+ 312 print "WAIT system fuel\n" - 313 label *label180 - 314 jump *label186 always - 315 label *label181 - 316 op mul *tmp194 45 1 - 317 jump *label182 greaterThanEq :fn3:fuel_stored 45 ++ 306 print "WAIT system fuel\n" + 307 label *label180 + 308 jump *label186 always + 309 label *label181 + 310 op mul *tmp194 45 1 + 311 jump *label182 greaterThanEq :fn3:fuel_stored 45 - * print "WAIT buffer fuel" - * print "\n" -+ 318 print "WAIT buffer fuel\n" - 319 jump *label185 always - 320 label *label182 - 321 jump *label183 greaterThanEq :fn3:cryo 5 ++ 312 print "WAIT buffer fuel\n" + 313 jump *label185 always + 314 label *label182 + 315 jump *label183 greaterThanEq :fn3:cryo 5 - * print "WAIT cryo" - * print "\n" -+ 322 print "WAIT cryo\n" - 323 jump *label184 always - 324 label *label183 ++ 316 print "WAIT cryo\n" + 317 jump *label184 always + 318 label *label183 - * print "STARTUP" - * print "\n" -+ 325 print "STARTUP\n" - 326 op add .START_POWER_REQ .START_POWER_REQ 23000 - 327 control enabled reactor1 true - 328 label *label184 - - 372 op mul *tmp125 :fn3:surplus 0.2 - 373 op add .AVG_SURPLUS *tmp124 *tmp125 - 374 sensor :fn3:enabled reactor2 @enabled ++ 319 print "STARTUP\n" + 320 op add .START_POWER_REQ .START_POWER_REQ 23000 + 321 control enabled reactor1 true + 322 label *label184 + + 366 op mul *tmp125 :fn3:surplus 0.2 + 367 op add .AVG_SURPLUS *tmp124 *tmp125 + 368 sensor :fn3:enabled reactor2 @enabled - * print "#" - * print 2 - * print " " - * print "- " -+ 375 print "#2 - " - 376 jump *label195 equal :emerg_shutdown false - 377 control enabled reactor2 false ++ 369 print "#2 - " + 370 jump *label195 equal :emerg_shutdown false + 371 control enabled reactor2 false - * print "emergency mode" - * print "\n" -+ 378 print "emergency mode\n" - 379 set :fn3:supply_fuel false - 380 jump *label228 always - 381 label *label195 - 382 jump *label214 equal :fn3:enabled false - 383 jump *label196 greaterThanEq .REACTORS_DESIRED 2 - 384 control enabled reactor2 false ++ 372 print "emergency mode\n" + 373 set :fn3:supply_fuel false + 374 jump *label228 always + 375 label *label195 + 376 jump *label214 equal :fn3:enabled false + 377 jump *label196 greaterThanEq .REACTORS_DESIRED 2 + 378 control enabled reactor2 false - * print "STOP unwanted" - * print "\n" -+ 385 print "STOP unwanted\n" - 386 jump *label227 always - 387 label *label196 - 388 op greaterThan *tmp136 2 1 - - 391 op land *tmp139 true *tmp138 - 392 jump *label197 equal *tmp139 false - 393 control enabled reactor2 false ++ 379 print "STOP unwanted\n" + 380 jump *label227 always + 381 label *label196 + 382 op greaterThan *tmp136 2 1 + + 385 op land *tmp139 true *tmp138 + 386 jump *label197 equal *tmp139 false + 387 control enabled reactor2 false - * print "STOP system fuel low" - * print "\n" -+ 394 print "STOP system fuel low\n" - 395 jump *label227 always - 396 label *label197 - 397 jump *label198 greaterThan :fn3:fuel 1 - 398 control enabled reactor2 false ++ 388 print "STOP system fuel low\n" + 389 jump *label227 always + 390 label *label197 + 391 jump *label198 greaterThan :fn3:fuel 1 + 392 control enabled reactor2 false - * print "STOP fuel low" - * print "\n" -+ 399 print "STOP fuel low\n" - 400 jump *label227 always - 401 label *label198 - 402 jump *label199 greaterThan :fn3:cryo 1 - 403 control enabled reactor2 false ++ 393 print "STOP fuel low\n" + 394 jump *label227 always + 395 label *label198 + 396 jump *label199 greaterThan :fn3:cryo 1 + 397 control enabled reactor2 false - * print "STOP out of cryo" - * print "\n" -+ 404 print "STOP out of cryo\n" - 405 jump *label227 always - 406 label *label199 - 407 jump *label206 greaterThanEq :fn3:secs 30 - - 429 op land *tmp156 *tmp154 *tmp155 - 430 jump *label204 equal *tmp156 false - 431 control enabled reactor2 false ++ 398 print "STOP out of cryo\n" + 399 jump *label227 always + 400 label *label199 + 401 jump *label206 greaterThanEq :fn3:secs 30 + + 422 op land *tmp156 *tmp154 *tmp155 + 423 jump *label204 equal *tmp156 false + 424 control enabled reactor2 false - * print "START FAIL battery" - * print "\n" -+ 432 print "START FAIL battery\n" - 433 set :fn3:supply_fuel false - 434 jump *label227 always - 435 label *label204 - 436 op sub :fn3:time_left 30 :fn3:secs ++ 425 print "START FAIL battery\n" + 426 set :fn3:supply_fuel false + 427 jump *label227 always + 428 label *label204 + 429 op sub :fn3:time_left 30 :fn3:secs - * print "Starting " - * print :fn3:time_left - * print " " @@ -4768,155 +4772,155 @@ Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): - * print :fn2*retval - * print "J" - * print "\n" -+ 437 print "Starting {0} secs, req {0}J\n" -+ 438 format :fn3:time_left -+ 439 format :fn2*retval - 440 label *label205 - 441 jump *label227 always - 442 label *label206 - - 445 op land *tmp163 *tmp161 *tmp162 - 446 jump *label207 equal *tmp163 false - 447 control enabled reactor2 false ++ 430 print "Starting {0} secs, req {0}J\n" ++ 431 format :fn3:time_left ++ 432 format :fn2*retval + 433 label *label205 + 434 jump *label227 always + 435 label *label206 + + 438 op land *tmp163 *tmp161 *tmp162 + 439 jump *label207 equal *tmp163 false + 440 control enabled reactor2 false - * print "ABANDON - battery crit" - * print "\n" -+ 448 print "ABANDON - battery crit\n" - 449 set :fn3:supply_fuel false - 450 jump *label227 always - 451 label *label207 - 452 op idiv :fn3:mins :fn3:secs 6 - 453 op div :fn3:mins :fn3:mins 10 ++ 441 print "ABANDON - battery crit\n" + 442 set :fn3:supply_fuel false + 443 jump *label227 always + 444 label *label207 + 445 op idiv :fn3:mins :fn3:secs 6 + 446 op div :fn3:mins :fn3:mins 10 - * print "RUN " - * print :fn3:mins - * print " " - * print "mins" - * print "\n" -+ 454 print "RUN {0} mins\n" -+ 455 format :fn3:mins - 456 label *label208 - 457 label *label209 - 458 label *label210 - - 470 op mul *tmp175 2 2 - 471 op add :fn3:cryo_req 3 4 - 472 jump *label215 greaterThanEq .REACTORS_DESIRED 2 ++ 447 print "RUN {0} mins\n" ++ 448 format :fn3:mins + 449 label *label208 + 450 label *label209 + 451 label *label210 + + 463 op mul *tmp175 2 2 + 464 op add :fn3:cryo_req 3 4 + 465 jump *label215 greaterThanEq .REACTORS_DESIRED 2 - * print "IDLE" - * print "\n" -+ 473 print "IDLE\n" - 474 set :fn3:supply_fuel false - 475 jump *label226 always - 476 label *label215 - - 480 op div :fn3:flow *tmp183 10 - 481 op idiv *tmp186 :fn3:charge_units 0.001 - 482 op div :fn3:charge *tmp186 10 ++ 466 print "IDLE\n" + 467 set :fn3:supply_fuel false + 468 jump *label226 always + 469 label *label215 + + 473 op div :fn3:flow *tmp183 10 + 474 op idiv *tmp186 :fn3:charge_units 0.001 + 475 op div :fn3:charge *tmp186 10 - * print "WAIT power. (%" - * print :fn3:charge - * print "J + %" - * print :fn3:flow - * print "W)" - * print "\n" -+ 483 print "WAIT power. (%{0}J + %{0}W)\n" -+ 484 format :fn3:charge -+ 485 format :fn3:flow - 486 set :fn3:supply_fuel false - 487 jump *label225 always - 488 label *label216 - - 491 jump *label219 equal *tmp189 false - 492 op add *tmp191 :fn3:fuel :fn3:fuel_stored - 493 jump *label217 lessThanEq *tmp191 10 ++ 476 print "WAIT power. (%{0}J + %{0}W)\n" ++ 477 format :fn3:charge ++ 478 format :fn3:flow + 479 set :fn3:supply_fuel false + 480 jump *label225 always + 481 label *label216 + + 484 jump *label219 equal *tmp189 false + 485 op add *tmp191 :fn3:fuel :fn3:fuel_stored + 486 jump *label217 lessThanEq *tmp191 10 - * print "WAIT fuel" - * print "\n" -+ 494 print "WAIT fuel\n" - 495 jump *label224 always - 496 label *label217 ++ 487 print "WAIT fuel\n" + 488 jump *label224 always + 489 label *label217 - * print "WAIT system fuel" - * print "\n" -+ 497 print "WAIT system fuel\n" - 498 label *label218 - 499 jump *label224 always - 500 label *label219 - 501 op mul *tmp194 45 2 - 502 jump *label220 greaterThanEq :fn3:fuel_stored 90 ++ 490 print "WAIT system fuel\n" + 491 label *label218 + 492 jump *label224 always + 493 label *label219 + 494 op mul *tmp194 45 2 + 495 jump *label220 greaterThanEq :fn3:fuel_stored 90 - * print "WAIT buffer fuel" - * print "\n" -+ 503 print "WAIT buffer fuel\n" - 504 jump *label223 always - 505 label *label220 - 506 jump *label221 greaterThanEq :fn3:cryo 7 ++ 496 print "WAIT buffer fuel\n" + 497 jump *label223 always + 498 label *label220 + 499 jump *label221 greaterThanEq :fn3:cryo 7 - * print "WAIT cryo" - * print "\n" -+ 507 print "WAIT cryo\n" - 508 jump *label222 always - 509 label *label221 ++ 500 print "WAIT cryo\n" + 501 jump *label222 always + 502 label *label221 - * print "STARTUP" - * print "\n" -+ 510 print "STARTUP\n" - 511 op add .START_POWER_REQ .START_POWER_REQ 23000 - 512 control enabled reactor2 true - 513 label *label222 - - 583 op mul *tmp125 :fn3:surplus 0.2 - 584 op add .AVG_SURPLUS *tmp124 *tmp125 - 585 sensor :fn3:enabled reactor3 @enabled ++ 503 print "STARTUP\n" + 504 op add .START_POWER_REQ .START_POWER_REQ 23000 + 505 control enabled reactor2 true + 506 label *label222 + + 576 op mul *tmp125 :fn3:surplus 0.2 + 577 op add .AVG_SURPLUS *tmp124 *tmp125 + 578 sensor :fn3:enabled reactor3 @enabled - * print "#" - * print 3 - * print " " - * print "- " -+ 586 print "#3 - " - 587 jump *label233 equal :emerg_shutdown false - 588 control enabled reactor3 false ++ 579 print "#3 - " + 580 jump *label233 equal :emerg_shutdown false + 581 control enabled reactor3 false - * print "emergency mode" - * print "\n" -+ 589 print "emergency mode\n" - 590 set :fn3:supply_fuel false - 591 jump *label266 always - 592 label *label233 - 593 jump *label252 equal :fn3:enabled false - 594 jump *label234 greaterThanEq .REACTORS_DESIRED 3 - 595 control enabled reactor3 false ++ 582 print "emergency mode\n" + 583 set :fn3:supply_fuel false + 584 jump *label266 always + 585 label *label233 + 586 jump *label252 equal :fn3:enabled false + 587 jump *label234 greaterThanEq .REACTORS_DESIRED 3 + 588 control enabled reactor3 false - * print "STOP unwanted" - * print "\n" -+ 596 print "STOP unwanted\n" - 597 jump *label265 always - 598 label *label234 - 599 op greaterThan *tmp136 3 1 - - 602 op land *tmp139 true *tmp138 - 603 jump *label235 equal *tmp139 false - 604 control enabled reactor3 false ++ 589 print "STOP unwanted\n" + 590 jump *label265 always + 591 label *label234 + 592 op greaterThan *tmp136 3 1 + + 595 op land *tmp139 true *tmp138 + 596 jump *label235 equal *tmp139 false + 597 control enabled reactor3 false - * print "STOP system fuel low" - * print "\n" -+ 605 print "STOP system fuel low\n" - 606 jump *label265 always - 607 label *label235 - 608 jump *label236 greaterThan :fn3:fuel 1 - 609 control enabled reactor3 false ++ 598 print "STOP system fuel low\n" + 599 jump *label265 always + 600 label *label235 + 601 jump *label236 greaterThan :fn3:fuel 1 + 602 control enabled reactor3 false - * print "STOP fuel low" - * print "\n" -+ 610 print "STOP fuel low\n" - 611 jump *label265 always - 612 label *label236 - 613 jump *label237 greaterThan :fn3:cryo 1 - 614 control enabled reactor3 false ++ 603 print "STOP fuel low\n" + 604 jump *label265 always + 605 label *label236 + 606 jump *label237 greaterThan :fn3:cryo 1 + 607 control enabled reactor3 false - * print "STOP out of cryo" - * print "\n" -+ 615 print "STOP out of cryo\n" - 616 jump *label265 always - 617 label *label237 - 618 jump *label244 greaterThanEq :fn3:secs 30 - - 640 op land *tmp156 *tmp154 *tmp155 - 641 jump *label242 equal *tmp156 false - 642 control enabled reactor3 false ++ 608 print "STOP out of cryo\n" + 609 jump *label265 always + 610 label *label237 + 611 jump *label244 greaterThanEq :fn3:secs 30 + + 632 op land *tmp156 *tmp154 *tmp155 + 633 jump *label242 equal *tmp156 false + 634 control enabled reactor3 false - * print "START FAIL battery" - * print "\n" -+ 643 print "START FAIL battery\n" - 644 set :fn3:supply_fuel false - 645 jump *label265 always - 646 label *label242 - 647 op sub :fn3:time_left 30 :fn3:secs ++ 635 print "START FAIL battery\n" + 636 set :fn3:supply_fuel false + 637 jump *label265 always + 638 label *label242 + 639 op sub :fn3:time_left 30 :fn3:secs - * print "Starting " - * print :fn3:time_left - * print " " @@ -4924,98 +4928,98 @@ Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): - * print :fn2*retval - * print "J" - * print "\n" -+ 648 print "Starting {0} secs, req {0}J\n" -+ 649 format :fn3:time_left -+ 650 format :fn2*retval - 651 label *label243 - 652 jump *label265 always - 653 label *label244 - - 656 op land *tmp163 *tmp161 *tmp162 - 657 jump *label245 equal *tmp163 false - 658 control enabled reactor3 false ++ 640 print "Starting {0} secs, req {0}J\n" ++ 641 format :fn3:time_left ++ 642 format :fn2*retval + 643 label *label243 + 644 jump *label265 always + 645 label *label244 + + 648 op land *tmp163 *tmp161 *tmp162 + 649 jump *label245 equal *tmp163 false + 650 control enabled reactor3 false - * print "ABANDON - battery crit" - * print "\n" -+ 659 print "ABANDON - battery crit\n" - 660 set :fn3:supply_fuel false - 661 jump *label265 always - 662 label *label245 - 663 op idiv :fn3:mins :fn3:secs 6 - 664 op div :fn3:mins :fn3:mins 10 ++ 651 print "ABANDON - battery crit\n" + 652 set :fn3:supply_fuel false + 653 jump *label265 always + 654 label *label245 + 655 op idiv :fn3:mins :fn3:secs 6 + 656 op div :fn3:mins :fn3:mins 10 - * print "RUN " - * print :fn3:mins - * print " " - * print "mins" - * print "\n" -+ 665 print "RUN {0} mins\n" -+ 666 format :fn3:mins - 667 label *label246 - 668 label *label247 - 669 label *label248 - - 681 op mul *tmp175 2 3 - 682 op add :fn3:cryo_req 3 6 - 683 jump *label253 greaterThanEq .REACTORS_DESIRED 3 ++ 657 print "RUN {0} mins\n" ++ 658 format :fn3:mins + 659 label *label246 + 660 label *label247 + 661 label *label248 + + 673 op mul *tmp175 2 3 + 674 op add :fn3:cryo_req 3 6 + 675 jump *label253 greaterThanEq .REACTORS_DESIRED 3 - * print "IDLE" - * print "\n" -+ 684 print "IDLE\n" - 685 set :fn3:supply_fuel false - 686 jump *label264 always - 687 label *label253 - - 691 op div :fn3:flow *tmp183 10 - 692 op idiv *tmp186 :fn3:charge_units 0.001 - 693 op div :fn3:charge *tmp186 10 ++ 676 print "IDLE\n" + 677 set :fn3:supply_fuel false + 678 jump *label264 always + 679 label *label253 + + 683 op div :fn3:flow *tmp183 10 + 684 op idiv *tmp186 :fn3:charge_units 0.001 + 685 op div :fn3:charge *tmp186 10 - * print "WAIT power. (%" - * print :fn3:charge - * print "J + %" - * print :fn3:flow - * print "W)" - * print "\n" -+ 694 print "WAIT power. (%{0}J + %{0}W)\n" -+ 695 format :fn3:charge -+ 696 format :fn3:flow - 697 set :fn3:supply_fuel false - 698 jump *label263 always - 699 label *label254 - - 702 jump *label257 equal *tmp189 false - 703 op add *tmp191 :fn3:fuel :fn3:fuel_stored - 704 jump *label255 lessThanEq *tmp191 10 ++ 686 print "WAIT power. (%{0}J + %{0}W)\n" ++ 687 format :fn3:charge ++ 688 format :fn3:flow + 689 set :fn3:supply_fuel false + 690 jump *label263 always + 691 label *label254 + + 694 jump *label257 equal *tmp189 false + 695 op add *tmp191 :fn3:fuel :fn3:fuel_stored + 696 jump *label255 lessThanEq *tmp191 10 - * print "WAIT fuel" - * print "\n" -+ 705 print "WAIT fuel\n" - 706 jump *label262 always - 707 label *label255 ++ 697 print "WAIT fuel\n" + 698 jump *label262 always + 699 label *label255 - * print "WAIT system fuel" - * print "\n" -+ 708 print "WAIT system fuel\n" - 709 label *label256 - 710 jump *label262 always - 711 label *label257 - 712 op mul *tmp194 45 3 - 713 jump *label258 greaterThanEq :fn3:fuel_stored 135 ++ 700 print "WAIT system fuel\n" + 701 label *label256 + 702 jump *label262 always + 703 label *label257 + 704 op mul *tmp194 45 3 + 705 jump *label258 greaterThanEq :fn3:fuel_stored 135 - * print "WAIT buffer fuel" - * print "\n" -+ 714 print "WAIT buffer fuel\n" - 715 jump *label261 always - 716 label *label258 - 717 jump *label259 greaterThanEq :fn3:cryo 9 ++ 706 print "WAIT buffer fuel\n" + 707 jump *label261 always + 708 label *label258 + 709 jump *label259 greaterThanEq :fn3:cryo 9 - * print "WAIT cryo" - * print "\n" -+ 718 print "WAIT cryo\n" - 719 jump *label260 always - 720 label *label259 ++ 710 print "WAIT cryo\n" + 711 jump *label260 always + 712 label *label259 - * print "STARTUP" - * print "\n" -+ 721 print "STARTUP\n" - 722 op add .START_POWER_REQ .START_POWER_REQ 23000 - 723 control enabled reactor3 true - 724 label *label260 - - 787 op or *tmp43 *tmp42 :emerg_shutdown - 788 jump *label29 equal *tmp43 false - 789 set :fn6:limit 0 ++ 713 print "STARTUP\n" + 714 op add .START_POWER_REQ .START_POWER_REQ 23000 + 715 control enabled reactor3 true + 716 label *label260 + + 779 op or *tmp43 *tmp42 :emerg_shutdown + 780 jump *label29 equal *tmp43 false + 781 set :fn6:limit 0 - * print "Central Fuel at " - * print :fn6:fuel_stored - * print " " @@ -5023,22 +5027,22 @@ Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): - * print 0 - * print " " - * print "- " -+ 790 print "Central Fuel at {0} / 0 - " -+ 791 format :fn6:fuel_stored - 792 jump *label31 equal :emerg_shutdown false ++ 782 print "Central Fuel at {0} / 0 - " ++ 783 format :fn6:fuel_stored + 784 jump *label31 equal :emerg_shutdown false - * print " Enemies detected." - * print "\n" -+ 793 print " Enemies detected.\n" - 794 jump *label30 always - 795 label *label31 ++ 785 print " Enemies detected.\n" + 786 jump *label30 always + 787 label *label31 - * print " Critical power." - * print "\n" -+ 796 print " Critical power.\n" - 797 label *label32 - 798 jump *label30 always - 799 label *label29 - 800 jump *label33 notEqual :fn6:reactors_fueled false - 801 set :fn6:limit 150 ++ 788 print " Critical power.\n" + 789 label *label32 + 790 jump *label30 always + 791 label *label29 + 792 jump *label33 notEqual :fn6:reactors_fueled false + 793 set :fn6:limit 150 - * print "Fuel " - * print :fn6:fuel_stored - * print " " @@ -5047,11 +5051,11 @@ Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): - * print " " - * print "(due to emergency)" - * print "\n" -+ 802 print "Fuel {0} / 150 (due to emergency)\n" -+ 803 format :fn6:fuel_stored - 804 jump *label34 always - 805 label *label33 - 806 set :fn6:limit 800 ++ 794 print "Fuel {0} / 150 (due to emergency)\n" ++ 795 format :fn6:fuel_stored + 796 jump *label34 always + 797 label *label33 + 798 set :fn6:limit 800 - * print "Fuel " - * print :fn6:fuel_stored - * print " " @@ -5059,25 +5063,25 @@ Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): - * print 800 - * print "\" - * print "n" -+ 807 print "Fuel {0} / 800\n" -+ 808 format :fn6:fuel_stored - 809 label *label34 - 810 label *label30 - 811 label *label28 - - 822 op lessThan *tmp57 .START_POWER_REQ 10 - 823 op land *tmp58 *tmp56 *tmp57 - 824 jump *label38 equal *tmp58 false ++ 799 print "Fuel {0} / 800\n" ++ 800 format :fn6:fuel_stored + 801 label *label34 + 802 label *label30 + 803 label *label28 + + 814 op lessThan *tmp57 .START_POWER_REQ 10 + 815 op land *tmp58 *tmp56 *tmp57 + 816 jump *label38 equal *tmp58 false - * print "Differential now idle." - * print "\n" -+ 825 print "Differential now idle.\n" - 826 control enabled generator1 false - 827 control enabled generator2 false - 828 jump *label39 always - - 847 op idiv *tmp93 .START_POWER_REQ 100 - 848 op div :fn0*retval *tmp93 10 - 849 label *label105 ++ 817 print "Differential now idle.\n" + 818 control enabled generator1 false + 819 control enabled generator2 false + 820 jump *label39 always + + 839 op idiv *tmp93 .START_POWER_REQ 100 + 840 op div :fn0*retval *tmp93 10 + 841 label *label105 - * print "Req " - * print :fn0*retval - * print "kJ / " @@ -5086,99 +5090,99 @@ Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): - * print :surplus - * print "kW flow." - * print "\n" -+ 850 print "Req {0}kJ / {0}kJ. {0}kW flow.\n" -+ 851 format :fn0*retval -+ 852 format :charge -+ 853 format :surplus - 854 jump *label43 always - 855 label *label42 ++ 842 print "Req {0}kJ / {0}kJ. {0}kW flow.\n" ++ 843 format :fn0*retval ++ 844 format :charge ++ 845 format :surplus + 846 jump *label43 always + 847 label *label42 - * print "Power " - * print :surplus - * print "kW, " - * print :fn0*retval - * print "kJ" - * print "\n" -+ 856 print "Power {0}kW, {0}kJ\n" -+ 857 format :surplus -+ 858 format :fn0*retval - 859 sensor *tmp71 node1 @powerNetStored - 860 sensor *tmp72 node1 @powerNetCapacity - 861 op div :fn8:stored *tmp71 *tmp72 - - 884 label *label45 - 885 label *label43 - 886 jump *label52 equal .REACTORS_DESIRED 5 ++ 848 print "Power {0}kW, {0}kJ\n" ++ 849 format :surplus ++ 850 format :fn0*retval + 851 sensor *tmp71 node1 @powerNetStored + 852 sensor *tmp72 node1 @powerNetCapacity + 853 op div :fn8:stored *tmp71 *tmp72 + + 876 label *label45 + 877 label *label43 + 878 jump *label52 equal .REACTORS_DESIRED 5 - * print "Require only " - * print .REACTORS_DESIRED - * print "/5 reactors." - * print "\n" -+ 887 print "Require only {0}/5 reactors.\n" -+ 888 format .REACTORS_DESIRED - 889 label *label52 - 890 label *label53 - 891 printflush message1 - - 909 op mul *tmp125 :fn3:surplus 0.2 - 910 op add .AVG_SURPLUS *tmp124 *tmp125 - 911 sensor :fn3:enabled :fn3:reactor @enabled ++ 879 print "Require only {0}/5 reactors.\n" ++ 880 format .REACTORS_DESIRED + 881 label *label52 + 882 label *label53 + 883 printflush message1 + + 901 op mul *tmp125 :fn3:surplus 0.2 + 902 op add .AVG_SURPLUS *tmp124 *tmp125 + 903 sensor :fn3:enabled :fn3:reactor @enabled - * print "#" - * print :fn3:reactor_num - * print " " - * print "- " -+ 912 print "#{0} - " -+ 913 format :fn3:reactor_num - 914 jump *label64 equal :fn3:emerg_shutdown false - 915 control enabled :fn3:reactor false ++ 904 print "#{0} - " ++ 905 format :fn3:reactor_num + 906 jump *label64 equal :fn3:emerg_shutdown false + 907 control enabled :fn3:reactor false - * print "emergency mode" - * print "\n" -+ 916 print "emergency mode\n" - 917 set :fn3:supply_fuel false - 918 jump *label65 always - 919 label *label64 - 920 jump *label66 equal :fn3:enabled false - 921 jump *label68 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num - 922 control enabled :fn3:reactor false ++ 908 print "emergency mode\n" + 909 set :fn3:supply_fuel false + 910 jump *label65 always + 911 label *label64 + 912 jump *label66 equal :fn3:enabled false + 913 jump *label68 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num + 914 control enabled :fn3:reactor false - * print "STOP unwanted" - * print "\n" -+ 923 print "STOP unwanted\n" - 924 jump *label67 always - 925 label *label68 - 926 op greaterThan *tmp136 :fn3:reactor_num 1 - - 929 op land *tmp139 *tmp136 *tmp138 - 930 jump *label70 equal *tmp139 false - 931 control enabled :fn3:reactor false ++ 915 print "STOP unwanted\n" + 916 jump *label67 always + 917 label *label68 + 918 op greaterThan *tmp136 :fn3:reactor_num 1 + + 921 op land *tmp139 *tmp136 *tmp138 + 922 jump *label70 equal *tmp139 false + 923 control enabled :fn3:reactor false - * print "STOP system fuel low" - * print "\n" -+ 932 print "STOP system fuel low\n" - 933 jump *label67 always - 934 label *label70 - 935 jump *label72 greaterThan :fn3:fuel 1 - 936 control enabled :fn3:reactor false ++ 924 print "STOP system fuel low\n" + 925 jump *label67 always + 926 label *label70 + 927 jump *label72 greaterThan :fn3:fuel 1 + 928 control enabled :fn3:reactor false - * print "STOP fuel low" - * print "\n" -+ 937 print "STOP fuel low\n" - 938 jump *label67 always - 939 label *label72 - 940 jump *label74 greaterThan :fn3:cryo .CRYO_ABORT - 941 control enabled :fn3:reactor false ++ 929 print "STOP fuel low\n" + 930 jump *label67 always + 931 label *label72 + 932 jump *label74 greaterThan :fn3:cryo .CRYO_ABORT + 933 control enabled :fn3:reactor false - * print "STOP out of cryo" - * print "\n" -+ 942 print "STOP out of cryo\n" - 943 jump *label67 always - 944 label *label74 - 945 jump *label76 greaterThanEq :fn3:secs 30 - - 967 op land *tmp156 *tmp154 *tmp155 - 968 jump *label79 equal *tmp156 false - 969 control enabled :fn3:reactor false ++ 934 print "STOP out of cryo\n" + 935 jump *label67 always + 936 label *label74 + 937 jump *label76 greaterThanEq :fn3:secs 30 + + 958 op land *tmp156 *tmp154 *tmp155 + 959 jump *label79 equal *tmp156 false + 960 control enabled :fn3:reactor false - * print "START FAIL battery" - * print "\n" -+ 970 print "START FAIL battery\n" - 971 set :fn3:supply_fuel false - 972 jump *label67 always - 973 label *label79 - 974 op sub :fn3:time_left 30 :fn3:secs ++ 961 print "START FAIL battery\n" + 962 set :fn3:supply_fuel false + 963 jump *label67 always + 964 label *label79 + 965 op sub :fn3:time_left 30 :fn3:secs - * print "Starting " - * print :fn3:time_left - * print " " @@ -5186,94 +5190,94 @@ Modifications by Final phase, Print Merging, iteration 1 (-132 instructions): - * print :fn2*retval - * print "J" - * print "\n" -+ 975 print "Starting {0} secs, req {0}J\n" -+ 976 format :fn3:time_left -+ 977 format :fn2*retval - 978 label *label80 - 979 jump *label67 always - 980 label *label76 - - 983 op land *tmp163 *tmp161 *tmp162 - 984 jump *label81 equal *tmp163 false - 985 control enabled :fn3:reactor false ++ 966 print "Starting {0} secs, req {0}J\n" ++ 967 format :fn3:time_left ++ 968 format :fn2*retval + 969 label *label80 + 970 jump *label67 always + 971 label *label76 + + 974 op land *tmp163 *tmp161 *tmp162 + 975 jump *label81 equal *tmp163 false + 976 control enabled :fn3:reactor false - * print "ABANDON - battery crit" - * print "\n" -+ 986 print "ABANDON - battery crit\n" - 987 set :fn3:supply_fuel false - 988 jump *label67 always - 989 label *label81 - 990 op idiv :fn3:mins :fn3:secs 6 - 991 op div :fn3:mins :fn3:mins 10 ++ 977 print "ABANDON - battery crit\n" + 978 set :fn3:supply_fuel false + 979 jump *label67 always + 980 label *label81 + 981 op idiv :fn3:mins :fn3:secs 6 + 982 op div :fn3:mins :fn3:mins 10 - * print "RUN " - * print :fn3:mins - * print " " - * print "mins" - * print "\n" -+ 992 print "RUN {0} mins\n" -+ 993 format :fn3:mins - 994 label *label82 - 995 label *label77 - 996 label *label75 - - 1008 op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num - 1009 op add :fn3:cryo_req .CRYO_REQ *tmp175 - 1010 jump *label83 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num ++ 983 print "RUN {0} mins\n" ++ 984 format :fn3:mins + 985 label *label82 + 986 label *label77 + 987 label *label75 + + 999 op mul *tmp175 .CRYO_REQ_EA :fn3:reactor_num + 1000 op add :fn3:cryo_req .CRYO_REQ *tmp175 + 1001 jump *label83 greaterThanEq .REACTORS_DESIRED :fn3:reactor_num - * print "IDLE" - * print "\n" -+ 1011 print "IDLE\n" - 1012 set :fn3:supply_fuel false - 1013 jump *label84 always - 1014 label *label83 - - 1018 op div :fn3:flow *tmp183 10 - 1019 op idiv *tmp186 :fn3:charge_units 0.001 - 1020 op div :fn3:charge *tmp186 10 ++ 1002 print "IDLE\n" + 1003 set :fn3:supply_fuel false + 1004 jump *label84 always + 1005 label *label83 + + 1009 op div :fn3:flow *tmp183 10 + 1010 op idiv *tmp186 :fn3:charge_units 0.001 + 1011 op div :fn3:charge *tmp186 10 - * print "WAIT power. (%" - * print :fn3:charge - * print "J + %" - * print :fn3:flow - * print "W)" - * print "\n" -+ 1021 print "WAIT power. (%{0}J + %{0}W)\n" -+ 1022 format :fn3:charge -+ 1023 format :fn3:flow - 1024 set :fn3:supply_fuel false - 1025 jump *label86 always - 1026 label *label85 - - 1029 jump *label87 equal *tmp189 false - 1030 op add *tmp191 :fn3:fuel :fn3:fuel_stored - 1031 jump *label89 lessThanEq *tmp191 .FUEL_REQ ++ 1012 print "WAIT power. (%{0}J + %{0}W)\n" ++ 1013 format :fn3:charge ++ 1014 format :fn3:flow + 1015 set :fn3:supply_fuel false + 1016 jump *label86 always + 1017 label *label85 + + 1020 jump *label87 equal *tmp189 false + 1021 op add *tmp191 :fn3:fuel :fn3:fuel_stored + 1022 jump *label89 lessThanEq *tmp191 .FUEL_REQ - * print "WAIT fuel" - * print "\n" -+ 1032 print "WAIT fuel\n" - 1033 jump *label88 always - 1034 label *label89 ++ 1023 print "WAIT fuel\n" + 1024 jump *label88 always + 1025 label *label89 - * print "WAIT system fuel" - * print "\n" -+ 1035 print "WAIT system fuel\n" - 1036 label *label90 - 1037 jump *label88 always - 1038 label *label87 - 1039 op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num - 1040 jump *label91 greaterThanEq :fn3:fuel_stored *tmp194 ++ 1026 print "WAIT system fuel\n" + 1027 label *label90 + 1028 jump *label88 always + 1029 label *label87 + 1030 op mul *tmp194 .FUEL_TOT_REQ :fn3:reactor_num + 1031 jump *label91 greaterThanEq :fn3:fuel_stored *tmp194 - * print "WAIT buffer fuel" - * print "\n" -+ 1041 print "WAIT buffer fuel\n" - 1042 jump *label92 always - 1043 label *label91 - 1044 jump *label93 greaterThanEq :fn3:cryo :fn3:cryo_req ++ 1032 print "WAIT buffer fuel\n" + 1033 jump *label92 always + 1034 label *label91 + 1035 jump *label93 greaterThanEq :fn3:cryo :fn3:cryo_req - * print "WAIT cryo" - * print "\n" -+ 1045 print "WAIT cryo\n" - 1046 jump *label94 always - 1047 label *label93 ++ 1036 print "WAIT cryo\n" + 1037 jump *label94 always + 1038 label *label93 - * print "STARTUP" - * print "\n" -+ 1048 print "STARTUP\n" - 1049 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ - 1050 control enabled :fn3:reactor true - 1051 label *label94 ++ 1039 print "STARTUP\n" + 1040 op add .START_POWER_REQ .START_POWER_REQ .PWR_REQ + 1041 control enabled :fn3:reactor true + 1042 label *label94 Final code before resolving virtual instructions: @@ -5316,7 +5320,7 @@ label *label7 set .CONTAINER vault1 set .NODE node1 radar enemy any any health cyclone1 1 :fn4:enemy_found -jump *label125 equal :fn4:enemy_found null +jump *label149 equal :fn4:enemy_found null control enabled projector1 true 0 0 0 control enabled projector2 true 0 0 0 control config unloader1 @scrap 0 0 0 @@ -5332,12 +5336,12 @@ control enabled reactor3 false 0 0 0 control enabled reactor4 false 0 0 0 control enabled reactor5 false 0 0 0 set :fn4*retval true -jump *label127 always 0 0 -label *label125 +jump *label151 always 0 0 +label *label149 control enabled projector1 false 0 0 0 control enabled projector2 false 0 0 0 set :fn4*retval false -label *label127 +label *label151 op notEqual *tmp9 switch1 null sensor *tmp10 switch1 @enabled op equal *tmp11 *tmp10 false @@ -5357,16 +5361,15 @@ op greaterThan *tmp104 :fn2:secs 30 sensor *tmp105 reactor1 @enabled op equal *tmp106 *tmp105 false op or *tmp107 *tmp104 *tmp106 -jump *label133 equal *tmp107 false +jump *label125 equal *tmp107 false set :fn2*retval 0 -jump *label135 always 0 0 -label *label133 +jump *label127 always 0 0 +label *label125 op sub :fn2:time_left 30 :fn2:secs op mul *tmp110 :fn2:time_left :fn2:time_left -op idiv :fn2:charge_req *tmp110 0.04 -set :fn2*retval :fn2:charge_req -jump *label135 always 0 0 -label *label135 +op idiv :fn2*retval *tmp110 0.04 +jump *label127 always 0 0 +label *label127 set .START_POWER_REQ :fn2*retval op sub *tmp102 @tick :t_startup2 op idiv :fn2:secs *tmp102 60 @@ -5374,16 +5377,15 @@ op greaterThan *tmp104 :fn2:secs 30 sensor *tmp105 reactor2 @enabled op equal *tmp106 *tmp105 false op or *tmp107 *tmp104 *tmp106 -jump *label137 equal *tmp107 false +jump *label129 equal *tmp107 false set :fn2*retval 0 -jump *label139 always 0 0 -label *label137 +jump *label131 always 0 0 +label *label129 op sub :fn2:time_left 30 :fn2:secs op mul *tmp110 :fn2:time_left :fn2:time_left -op idiv :fn2:charge_req *tmp110 0.04 -set :fn2*retval :fn2:charge_req -jump *label139 always 0 0 -label *label139 +op idiv :fn2*retval *tmp110 0.04 +jump *label131 always 0 0 +label *label131 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval op sub *tmp102 @tick :t_startup3 op idiv :fn2:secs *tmp102 60 @@ -5391,16 +5393,15 @@ op greaterThan *tmp104 :fn2:secs 30 sensor *tmp105 reactor3 @enabled op equal *tmp106 *tmp105 false op or *tmp107 *tmp104 *tmp106 -jump *label141 equal *tmp107 false +jump *label133 equal *tmp107 false set :fn2*retval 0 -jump *label143 always 0 0 -label *label141 +jump *label135 always 0 0 +label *label133 op sub :fn2:time_left 30 :fn2:secs op mul *tmp110 :fn2:time_left :fn2:time_left -op idiv :fn2:charge_req *tmp110 0.04 -set :fn2*retval :fn2:charge_req -jump *label143 always 0 0 -label *label143 +op idiv :fn2*retval *tmp110 0.04 +jump *label135 always 0 0 +label *label135 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval op sub *tmp102 @tick :t_startup4 op idiv :fn2:secs *tmp102 60 @@ -5408,16 +5409,15 @@ op greaterThan *tmp104 :fn2:secs 30 sensor *tmp105 reactor4 @enabled op equal *tmp106 *tmp105 false op or *tmp107 *tmp104 *tmp106 -jump *label145 equal *tmp107 false +jump *label137 equal *tmp107 false set :fn2*retval 0 -jump *label147 always 0 0 -label *label145 +jump *label139 always 0 0 +label *label137 op sub :fn2:time_left 30 :fn2:secs op mul *tmp110 :fn2:time_left :fn2:time_left -op idiv :fn2:charge_req *tmp110 0.04 -set :fn2*retval :fn2:charge_req -jump *label147 always 0 0 -label *label147 +op idiv :fn2*retval *tmp110 0.04 +jump *label139 always 0 0 +label *label139 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval op sub *tmp102 @tick :t_startup5 op idiv :fn2:secs *tmp102 60 @@ -5425,16 +5425,15 @@ op greaterThan *tmp104 :fn2:secs 30 sensor *tmp105 reactor5 @enabled op equal *tmp106 *tmp105 false op or *tmp107 *tmp104 *tmp106 -jump *label149 equal *tmp107 false +jump *label141 equal *tmp107 false set :fn2*retval 0 -jump *label151 always 0 0 -label *label149 +jump *label143 always 0 0 +label *label141 op sub :fn2:time_left 30 :fn2:secs op mul *tmp110 :fn2:time_left :fn2:time_left -op idiv :fn2:charge_req *tmp110 0.04 -set :fn2*retval :fn2:charge_req -jump *label151 always 0 0 -label *label151 +op idiv :fn2*retval *tmp110 0.04 +jump *label143 always 0 0 +label *label143 op add .START_POWER_REQ .START_POWER_REQ :fn2*retval set .RET_T_STARTUP :t_startup1 op sub *tmp113 @tick :t_startup1 @@ -5498,8 +5497,7 @@ jump *label165 always 0 0 label *label163 op sub :fn2:time_left 30 :fn2:secs op mul *tmp110 :fn2:time_left :fn2:time_left -op idiv :fn2:charge_req *tmp110 0.04 -set :fn2*retval :fn2:charge_req +op idiv :fn2*retval *tmp110 0.04 jump *label165 always 0 0 label *label165 op sub *tmp153 :fn3:charge :fn2*retval @@ -5668,8 +5666,7 @@ jump *label203 always 0 0 label *label201 op sub :fn2:time_left 30 :fn2:secs op mul *tmp110 :fn2:time_left :fn2:time_left -op idiv :fn2:charge_req *tmp110 0.04 -set :fn2*retval :fn2:charge_req +op idiv :fn2*retval *tmp110 0.04 jump *label203 always 0 0 label *label203 op sub *tmp153 :fn3:charge :fn2*retval @@ -5777,7 +5774,7 @@ label *label115 control config unloader4 @scrap 0 0 0 label *label116 radar enemy any any health cyclone1 1 :fn4:enemy_found -jump *label129 equal :fn4:enemy_found null +jump *label153 equal :fn4:enemy_found null control enabled projector1 true 0 0 0 control enabled projector2 true 0 0 0 control config unloader1 @scrap 0 0 0 @@ -5793,12 +5790,12 @@ control enabled reactor3 false 0 0 0 control enabled reactor4 false 0 0 0 control enabled reactor5 false 0 0 0 set :fn4*retval true -jump *label131 always 0 0 -label *label129 +jump *label155 always 0 0 +label *label153 control enabled projector1 false 0 0 0 control enabled projector2 false 0 0 0 set :fn4*retval false -label *label131 +label *label155 op or :emerg_shutdown :emerg_shutdown :fn4*retval set .RET_T_STARTUP :t_startup3 op sub *tmp113 @tick :t_startup3 @@ -5862,8 +5859,7 @@ jump *label241 always 0 0 label *label239 op sub :fn2:time_left 30 :fn2:secs op mul *tmp110 :fn2:time_left :fn2:time_left -op idiv :fn2:charge_req *tmp110 0.04 -set :fn2*retval :fn2:charge_req +op idiv :fn2*retval *tmp110 0.04 jump *label241 always 0 0 label *label241 op sub *tmp153 :fn3:charge :fn2*retval @@ -6154,16 +6150,15 @@ op greaterThan *tmp104 :fn2:secs 30 sensor *tmp105 :fn3:reactor @enabled op equal *tmp106 *tmp105 false op or *tmp107 *tmp104 *tmp106 -jump *label153 equal *tmp107 false +jump *label145 equal *tmp107 false set :fn2*retval 0 -jump *label155 always 0 0 -label *label153 +jump *label147 always 0 0 +label *label145 op sub :fn2:time_left 30 :fn2:secs op mul *tmp110 :fn2:time_left :fn2:time_left -op idiv :fn2:charge_req *tmp110 0.04 -set :fn2*retval :fn2:charge_req -jump *label155 always 0 0 -label *label155 +op idiv :fn2*retval *tmp110 0.04 +jump *label147 always 0 0 +label *label147 op sub *tmp153 :fn3:charge :fn2*retval op lessThan *tmp154 *tmp153 .PWR_ABORT op lessThan *tmp155 :fn3:surplus .FLOW_ABORT diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/instant-overdrive-dome-00.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/instant-overdrive-dome-00.log index bd9b05be..2a49104b 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/instant-overdrive-dome-00.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/instant-overdrive-dome-00.log @@ -6,7 +6,7 @@ 113 instructions eliminated by Single Step Elimination (4 passes, 9 iterations). 5 instructions modified by Expression Optimization (4 iterations). 2 instructions eliminated by If Expression Optimization (4 iterations). - 105 instructions eliminated by Data Flow Optimization (4 passes, 16 iterations). + 107 instructions eliminated by Data Flow Optimization (4 passes, 17 iterations). 2 instructions added by Loop Optimization (4 iterations). 3 loops improved by Loop Optimization. 157 instructions added by Loop Unrolling (7 iterations). @@ -15,18 +15,18 @@ 24 instructions updated by JumpThreading. 18 instructions eliminated by Unreachable Code Elimination. 75 instructions eliminated by Print Merging. - 865 instructions after optimizations. + 863 instructions after optimizations. -Pass 1: speed optimization selection (cost limit 207): +Pass 1: speed optimization selection (cost limit 209): * Replicate loop condition at line 44:1 cost 1, benefit 25.0, efficiency 25.0 (+1 instructions) Replicate loop condition at line 127:1 cost 1, benefit 25.0, efficiency 25.0 Unroll iteration loop at line 177:9 cost 205, benefit 375.0, efficiency 1.8 -Pass 1: speed optimization selection (cost limit 206): +Pass 1: speed optimization selection (cost limit 208): * Replicate loop condition at line 127:1 cost 1, benefit 25.0, efficiency 25.0 (+1 instructions) Unroll iteration loop at line 177:9 cost 205, benefit 375.0, efficiency 1.8 -Pass 1: speed optimization selection (cost limit 205): +Pass 1: speed optimization selection (cost limit 207): * Unroll iteration loop at line 177:9 cost 205, benefit 375.0, efficiency 1.8 (+153 instructions) Modifications by Initial phase, Dead Code Elimination, iteration 1 (-166 instructions): @@ -3117,7 +3117,94 @@ Modifications by Iterated phase, Single Step Elimination, pass 1, iteration 1 (- 1283 label *label299 1284 label *label134 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-15 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-9 instructions): + + 252 jump *label60 notEqual *tmp78 false + 253 label *label62 + 254 label *label57 +- * set :fn6:currentUnit .UNIT_S1 +- * set :fn7:currentUnit :fn6:currentUnit ++ 255 set :fn7:currentUnit .UNIT_S1 + 256 jump *label69 equal :fn7:currentUnit null + 257 ubind :fn7:currentUnit + 258 sensor *tmp83 @unit @dead + + 288 end + 289 label *label68 + 290 ucontrol flag 1 +- * set *tmp79 @unit ++ 291 set .UNIT_S1 @unit + 292 jump *label67 always + 293 set *tmp79 null + 294 label *label67 +- * set .UNIT_S1 *tmp79 +- * set :fn8:currentUnit .UNIT_P1 +- * set :fn9:currentUnit :fn8:currentUnit ++ 295 set :fn9:currentUnit .UNIT_P1 + 296 jump *label82 equal :fn9:currentUnit null + 297 ubind :fn9:currentUnit + 298 sensor *tmp103 @unit @dead + + 328 end + 329 label *label81 + 330 ucontrol flag 1 +- * set *tmp99 @unit ++ 331 set .UNIT_P1 @unit + 332 jump *label80 always + 333 set *tmp99 null + 334 label *label80 +- * set .UNIT_P1 *tmp99 + 335 sensor *tmp119 .UNIT_S1 @firstItem + 336 op equal *tmp120 *tmp119 @phase-fabric + 337 sensor *tmp121 .UNIT_P1 @firstItem + + 369 op mul *tmp143 2 *tmp142 + 370 sensor *tmp144 :fn10:unit @speed + 371 op div :fn10:travel_time *tmp143 *tmp144 +- * op greaterThanEq *tmp139 :fn10:travel_time 47 ++ 372 op greaterThanEq .FOUR_UNITS :fn10:travel_time 47 + 373 jump *label100 always + 374 set *tmp139 null + 375 label *label100 +- * set .FOUR_UNITS *tmp139 + 376 jump *label101 equal .FOUR_UNITS false +- * set :fn11:currentUnit .UNIT_S2 +- * set :fn12:currentUnit :fn11:currentUnit ++ 377 set :fn12:currentUnit .UNIT_S2 + 378 jump *label105 equal :fn12:currentUnit null + 379 ubind :fn12:currentUnit + 380 sensor *tmp152 @unit @dead + + 410 end + 411 label *label104 + 412 ucontrol flag 1 +- * set *tmp148 @unit ++ 413 set .UNIT_S2 @unit + 414 jump *label103 always + 415 set *tmp148 null + 416 label *label103 +- * set .UNIT_S2 *tmp148 +- * set :fn13:currentUnit .UNIT_P2 +- * set :fn14:currentUnit :fn13:currentUnit ++ 417 set :fn14:currentUnit .UNIT_P2 + 418 jump *label118 equal :fn14:currentUnit null + 419 ubind :fn14:currentUnit + 420 sensor *tmp172 @unit @dead + + 450 end + 451 label *label117 + 452 ucontrol flag 1 +- * set *tmp168 @unit ++ 453 set .UNIT_P2 @unit + 454 jump *label116 always + 455 set *tmp168 null + 456 label *label116 +- * set .UNIT_P2 *tmp168 + 457 sensor *tmp188 .UNIT_S1 @firstItem + 458 op equal *tmp189 *tmp188 @phase-fabric + 459 sensor *tmp190 .UNIT_P2 @firstItem + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-15 instructions): 2 set UNIT_TYPE @flare 3 remark "Do not modify anything below this line." @@ -3287,665 +3374,600 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 249 label *label62 250 label *label57 - 251 set :fn6:currentUnit .UNIT_S1 -- * set :fn7:currentUnit :fn6:currentUnit + 251 set :fn7:currentUnit .UNIT_S1 - * jump *label69 equal :fn7:currentUnit null - * ubind :fn7:currentUnit -+ 252 set :fn7:currentUnit .UNIT_S1 -+ 253 jump *label69 equal :fn6:currentUnit null -+ 254 ubind :fn6:currentUnit - 255 sensor *tmp83 @unit @dead - 256 op strictEqual *tmp84 *tmp83 0 - 257 sensor *tmp85 @unit @controller - - 263 label *label72 - 264 label *label69 - 265 label *label70 ++ 252 jump *label69 equal .UNIT_S1 null ++ 253 ubind .UNIT_S1 + 254 sensor *tmp83 @unit @dead + 255 op strictEqual *tmp84 *tmp83 0 + 256 sensor *tmp85 @unit @controller + + 262 label *label72 + 263 label *label69 + 264 label *label70 - * ubind .TYPE -+ 266 ubind *tmp3 - 267 set :fn7:firstUnit @unit - 268 jump *label73 equal :fn7:firstUnit null - 269 label *label75 - - 272 jump *label68 always - 273 label *label78 - 274 label *label79 ++ 265 ubind *tmp3 + 266 set :fn7:firstUnit @unit + 267 jump *label73 equal :fn7:firstUnit null + 268 label *label75 + + 271 jump *label68 always + 272 label *label78 + 273 label *label79 - * ubind .TYPE -+ 275 ubind *tmp3 - 276 label *label76 - 277 op notEqual *tmp95 @unit :fn7:firstUnit - 278 sensor *tmp96 :fn7:firstUnit @dead - - 287 ucontrol flag 1 - 288 set *tmp79 @unit - 289 jump *label67 always ++ 274 ubind *tmp3 + 275 label *label76 + 276 op notEqual *tmp95 @unit :fn7:firstUnit + 277 sensor *tmp96 :fn7:firstUnit @dead + + 286 ucontrol flag 1 + 287 set .UNIT_S1 @unit + 288 jump *label67 always - * set *tmp79 null - 290 label *label67 - 291 set .UNIT_S1 *tmp79 - 292 set :fn8:currentUnit .UNIT_P1 -- * set :fn9:currentUnit :fn8:currentUnit + 289 label *label67 + 290 set :fn9:currentUnit .UNIT_P1 - * jump *label82 equal :fn9:currentUnit null - * ubind :fn9:currentUnit -+ 293 set :fn9:currentUnit .UNIT_P1 -+ 294 jump *label82 equal :fn8:currentUnit null -+ 295 ubind :fn8:currentUnit - 296 sensor *tmp103 @unit @dead - 297 op strictEqual *tmp104 *tmp103 0 - 298 sensor *tmp105 @unit @controller - - 304 label *label85 - 305 label *label82 - 306 label *label83 ++ 291 jump *label82 equal .UNIT_P1 null ++ 292 ubind .UNIT_P1 + 293 sensor *tmp103 @unit @dead + 294 op strictEqual *tmp104 *tmp103 0 + 295 sensor *tmp105 @unit @controller + + 301 label *label85 + 302 label *label82 + 303 label *label83 - * ubind .TYPE -+ 307 ubind *tmp3 - 308 set :fn9:firstUnit @unit - 309 jump *label86 equal :fn9:firstUnit null - 310 label *label88 - - 313 jump *label81 always - 314 label *label91 - 315 label *label92 ++ 304 ubind *tmp3 + 305 set :fn9:firstUnit @unit + 306 jump *label86 equal :fn9:firstUnit null + 307 label *label88 + + 310 jump *label81 always + 311 label *label91 + 312 label *label92 - * ubind .TYPE -+ 316 ubind *tmp3 - 317 label *label89 - 318 op notEqual *tmp115 @unit :fn9:firstUnit - 319 sensor *tmp116 :fn9:firstUnit @dead - - 328 ucontrol flag 1 - 329 set *tmp99 @unit - 330 jump *label80 always ++ 313 ubind *tmp3 + 314 label *label89 + 315 op notEqual *tmp115 @unit :fn9:firstUnit + 316 sensor *tmp116 :fn9:firstUnit @dead + + 325 ucontrol flag 1 + 326 set .UNIT_P1 @unit + 327 jump *label80 always - * set *tmp99 null - 331 label *label80 - 332 set .UNIT_P1 *tmp99 -- * sensor *tmp119 .UNIT_S1 @firstItem -+ 333 sensor *tmp119 *tmp79 @firstItem - 334 op equal *tmp120 *tmp119 @phase-fabric -- * sensor *tmp121 .UNIT_P1 @firstItem -+ 335 sensor *tmp121 *tmp99 @firstItem - 336 op equal *tmp122 *tmp121 @silicon - 337 op or *tmp123 *tmp120 *tmp122 - 338 jump *label93 equal *tmp123 false -- * set :u .UNIT_S1 -- * set .UNIT_S1 .UNIT_P1 -+ 339 set :u *tmp79 -+ 340 set .UNIT_S1 *tmp99 - 341 set .UNIT_P1 :u - 342 label *label93 - 343 label *label94 - - 365 op sub *tmp141 .DOME_Y .CORE_Y - 366 op len *tmp142 *tmp140 *tmp141 - 367 op mul *tmp143 2 *tmp142 + 328 label *label80 + 329 sensor *tmp119 .UNIT_S1 @firstItem + 330 op equal *tmp120 *tmp119 @phase-fabric + + 361 op sub *tmp141 .DOME_Y .CORE_Y + 362 op len *tmp142 *tmp140 *tmp141 + 363 op mul *tmp143 2 *tmp142 - * sensor *tmp144 :fn10:unit @speed - * op div :fn10:travel_time *tmp143 *tmp144 -+ 368 sensor *tmp144 .UNIT_S1 @speed -+ 369 op div :fn10:travel_time *tmp143 .SPEED - 370 op greaterThanEq *tmp139 :fn10:travel_time 47 - 371 jump *label100 always ++ 364 sensor *tmp144 .UNIT_S1 @speed ++ 365 op div :fn10:travel_time *tmp143 .SPEED + 366 op greaterThanEq .FOUR_UNITS :fn10:travel_time 47 + 367 jump *label100 always - * set *tmp139 null - 372 label *label100 - 373 set .FOUR_UNITS *tmp139 -- * jump *label101 equal .FOUR_UNITS false -+ 374 jump *label101 equal *tmp139 false - 375 set :fn11:currentUnit .UNIT_S2 -- * set :fn12:currentUnit :fn11:currentUnit + 368 label *label100 + 369 jump *label101 equal .FOUR_UNITS false + 370 set :fn12:currentUnit .UNIT_S2 - * jump *label105 equal :fn12:currentUnit null - * ubind :fn12:currentUnit -+ 376 set :fn12:currentUnit .UNIT_S2 -+ 377 jump *label105 equal :fn11:currentUnit null -+ 378 ubind :fn11:currentUnit - 379 sensor *tmp152 @unit @dead - 380 op strictEqual *tmp153 *tmp152 0 - 381 sensor *tmp154 @unit @controller - - 387 label *label108 - 388 label *label105 - 389 label *label106 ++ 371 jump *label105 equal .UNIT_S2 null ++ 372 ubind .UNIT_S2 + 373 sensor *tmp152 @unit @dead + 374 op strictEqual *tmp153 *tmp152 0 + 375 sensor *tmp154 @unit @controller + + 381 label *label108 + 382 label *label105 + 383 label *label106 - * ubind .TYPE -+ 390 ubind *tmp3 - 391 set :fn12:firstUnit @unit - 392 jump *label109 equal :fn12:firstUnit null - 393 label *label111 - - 396 jump *label104 always - 397 label *label114 - 398 label *label115 ++ 384 ubind *tmp3 + 385 set :fn12:firstUnit @unit + 386 jump *label109 equal :fn12:firstUnit null + 387 label *label111 + + 390 jump *label104 always + 391 label *label114 + 392 label *label115 - * ubind .TYPE -+ 399 ubind *tmp3 - 400 label *label112 - 401 op notEqual *tmp164 @unit :fn12:firstUnit - 402 sensor *tmp165 :fn12:firstUnit @dead - - 411 ucontrol flag 1 - 412 set *tmp148 @unit - 413 jump *label103 always ++ 393 ubind *tmp3 + 394 label *label112 + 395 op notEqual *tmp164 @unit :fn12:firstUnit + 396 sensor *tmp165 :fn12:firstUnit @dead + + 405 ucontrol flag 1 + 406 set .UNIT_S2 @unit + 407 jump *label103 always - * set *tmp148 null - 414 label *label103 - 415 set .UNIT_S2 *tmp148 - 416 set :fn13:currentUnit .UNIT_P2 -- * set :fn14:currentUnit :fn13:currentUnit + 408 label *label103 + 409 set :fn14:currentUnit .UNIT_P2 - * jump *label118 equal :fn14:currentUnit null - * ubind :fn14:currentUnit -+ 417 set :fn14:currentUnit .UNIT_P2 -+ 418 jump *label118 equal :fn13:currentUnit null -+ 419 ubind :fn13:currentUnit - 420 sensor *tmp172 @unit @dead - 421 op strictEqual *tmp173 *tmp172 0 - 422 sensor *tmp174 @unit @controller - - 428 label *label121 - 429 label *label118 - 430 label *label119 ++ 410 jump *label118 equal .UNIT_P2 null ++ 411 ubind .UNIT_P2 + 412 sensor *tmp172 @unit @dead + 413 op strictEqual *tmp173 *tmp172 0 + 414 sensor *tmp174 @unit @controller + + 420 label *label121 + 421 label *label118 + 422 label *label119 - * ubind .TYPE -+ 431 ubind *tmp3 - 432 set :fn14:firstUnit @unit - 433 jump *label122 equal :fn14:firstUnit null - 434 label *label124 - - 437 jump *label117 always - 438 label *label127 - 439 label *label128 ++ 423 ubind *tmp3 + 424 set :fn14:firstUnit @unit + 425 jump *label122 equal :fn14:firstUnit null + 426 label *label124 + + 429 jump *label117 always + 430 label *label127 + 431 label *label128 - * ubind .TYPE -+ 440 ubind *tmp3 - 441 label *label125 - 442 op notEqual *tmp184 @unit :fn14:firstUnit - 443 sensor *tmp185 :fn14:firstUnit @dead - - 452 ucontrol flag 1 - 453 set *tmp168 @unit - 454 jump *label116 always ++ 432 ubind *tmp3 + 433 label *label125 + 434 op notEqual *tmp184 @unit :fn14:firstUnit + 435 sensor *tmp185 :fn14:firstUnit @dead + + 444 ucontrol flag 1 + 445 set .UNIT_P2 @unit + 446 jump *label116 always - * set *tmp168 null - 455 label *label116 - 456 set .UNIT_P2 *tmp168 - 457 sensor *tmp188 .UNIT_S1 @firstItem - 458 op equal *tmp189 *tmp188 @phase-fabric -- * sensor *tmp190 .UNIT_P2 @firstItem -+ 459 sensor *tmp190 *tmp168 @firstItem - 460 op notEqual *tmp191 *tmp190 @phase-fabric - 461 op land *tmp192 *tmp189 *tmp191 - 462 jump *label129 equal *tmp192 false - 463 set :u .UNIT_S1 -- * set .UNIT_S1 .UNIT_P2 -+ 464 set .UNIT_S1 *tmp168 - 465 set .UNIT_P2 :u - 466 label *label129 - 467 label *label130 -- * sensor *tmp194 .UNIT_S2 @firstItem -+ 468 sensor *tmp194 *tmp148 @firstItem - 469 op equal *tmp195 *tmp194 @phase-fabric - 470 sensor *tmp196 .UNIT_P2 @firstItem - 471 op equal *tmp197 *tmp196 @silicon - 472 op or *tmp198 *tmp195 *tmp197 - 473 jump *label131 equal *tmp198 false -- * set :u .UNIT_S2 -+ 474 set :u *tmp148 - 475 set .UNIT_S2 .UNIT_P2 - 476 set .UNIT_P2 :u - 477 label *label131 - - 489 set .GROUP1 "unit" - 490 set .GROUP2 "" - 491 label *label102 -- * op equal *tmp200 .FOUR_UNITS false -+ 492 op equal *tmp200 *tmp139 false - 493 sensor *tmp201 .UNIT_S1 @totalItems - 494 sensor *tmp202 .UNIT_S2 @totalItems - 495 op lessThan *tmp203 *tmp201 *tmp202 - 496 op or .SUPPLY_S_FIRST *tmp200 *tmp203 -- * op equal *tmp205 .FOUR_UNITS false -+ 497 op equal *tmp205 *tmp139 false - 498 sensor *tmp206 .UNIT_P1 @totalItems - 499 sensor *tmp207 .UNIT_P2 @totalItems - 500 op lessThan *tmp208 *tmp206 *tmp207 + 447 label *label116 + 448 sensor *tmp188 .UNIT_S1 @firstItem + 449 op equal *tmp189 *tmp188 @phase-fabric + + 489 sensor *tmp206 .UNIT_P1 @totalItems + 490 sensor *tmp207 .UNIT_P2 @totalItems + 491 op lessThan *tmp208 *tmp206 *tmp207 - * op or .SUPPLY_P_FIRST *tmp205 *tmp208 -+ 501 op or .SUPPLY_P_FIRST *tmp200 *tmp208 - 502 op add :unitCheck @time 5000 - 503 label *label133 - 504 sensor *tmp211 switch1 @enabled - - 508 print "\n" - 509 print "\n" - 510 print "Unit type: [green]" ++ 492 op or .SUPPLY_P_FIRST *tmp200 *tmp208 + 493 op add :unitCheck @time 5000 + 494 label *label133 + 495 sensor *tmp211 switch1 @enabled + + 499 print "\n" + 500 print "\n" + 501 print "Unit type: [green]" - * print .TYPE -+ 511 print *tmp3 - 512 print "[" - 513 print "]" - 514 print "\n" - 515 set :fn15:item @silicon - 516 set :fn15:text "\n[green]Silicon[] status:\n" ++ 502 print *tmp3 + 503 print "[" + 504 print "]" + 505 print "\n" + 506 set :fn15:item @silicon + 507 set :fn15:text "\n[green]Silicon[] status:\n" - * print :fn15:text - * sensor :fn15:level .DOME :fn15:item -+ 517 print "\n[green]Silicon[] status:\n" -+ 518 sensor :fn15:level .DOME @silicon - 519 jump *label137 lessThanEq :fn15:level 3 - 520 print " dome: [green]" - 521 print :fn15:level - - 535 set :fn16:item @silicon - 536 set :fn16:group .GROUP1 - 537 set :fn16:supply .SUPPLY_S_FIRST ++ 508 print "\n[green]Silicon[] status:\n" ++ 509 sensor :fn15:level .DOME @silicon + 510 jump *label137 lessThanEq :fn15:level 3 + 511 print " dome: [green]" + 512 print :fn15:level + + 526 set :fn16:item @silicon + 527 set :fn16:group .GROUP1 + 528 set :fn16:supply .SUPPLY_S_FIRST - * set :fn17:currentUnit :fn16:unit - * jump *label141 equal :fn17:currentUnit null - * ubind :fn17:currentUnit -+ 538 set :fn17:currentUnit .UNIT_S1 -+ 539 jump *label141 equal :fn16:unit null -+ 540 ubind :fn16:unit - 541 sensor *tmp221 @unit @dead - 542 op strictEqual *tmp222 *tmp221 0 - 543 sensor *tmp223 @unit @controller - - 549 label *label144 - 550 label *label141 - 551 label *label142 ++ 529 set :fn17:currentUnit .UNIT_S1 ++ 530 jump *label141 equal :fn16:unit null ++ 531 ubind :fn16:unit + 532 sensor *tmp221 @unit @dead + 533 op strictEqual *tmp222 *tmp221 0 + 534 sensor *tmp223 @unit @controller + + 540 label *label144 + 541 label *label141 + 542 label *label142 +- * ubind .TYPE ++ 543 ubind *tmp3 + 544 set :fn17:firstUnit @unit + 545 jump *label145 equal :fn17:firstUnit null + 546 label *label147 + + 549 jump *label140 always + 550 label *label150 + 551 label *label151 - * ubind .TYPE + 552 ubind *tmp3 - 553 set :fn17:firstUnit @unit - 554 jump *label145 equal :fn17:firstUnit null - 555 label *label147 + 553 label *label148 + 554 op notEqual *tmp233 @unit :fn17:firstUnit + 555 sensor *tmp234 :fn17:firstUnit @dead - 558 jump *label140 always - 559 label *label150 - 560 label *label151 -- * ubind .TYPE -+ 561 ubind *tmp3 - 562 label *label148 - 563 op notEqual *tmp233 @unit :fn17:firstUnit - 564 sensor *tmp234 :fn17:firstUnit @dead - - 579 op or *tmp240 *tmp238 *tmp239 - 580 jump *label152 equal *tmp240 false - 581 sensor *tmp242 @unit @firstItem + 570 op or *tmp240 *tmp238 *tmp239 + 571 jump *label152 equal *tmp240 false + 572 sensor *tmp242 @unit @firstItem - * jump *label154 notEqual *tmp242 :fn16:item -+ 582 jump *label154 notEqual *tmp242 @silicon - 583 set :fn16:state 3 - 584 jump *label155 always - 585 label *label154 - - 602 jump *label160 notEqual :fn16:state 2 - 603 ucontrol within .CORE_X .CORE_Y 8 *tmp252 - 604 jump *label162 equal *tmp252 false ++ 573 jump *label154 notEqual *tmp242 @silicon + 574 set :fn16:state 3 + 575 jump *label155 always + 576 label *label154 + + 593 jump *label160 notEqual :fn16:state 2 + 594 ucontrol within .CORE_X .CORE_Y 8 *tmp252 + 595 jump *label162 equal *tmp252 false - * ucontrol itemTake .CORE :fn16:item .UNIT_CAPACITY -+ 605 ucontrol itemTake .CORE @silicon .UNIT_CAPACITY - 606 sensor *tmp254 @unit @totalItems - 607 jump *label164 lessThan *tmp254 .UNIT_CAPACITY - 608 ucontrol approach .DOME_X .DOME_Y 6 - - 628 jump *label166 notEqual :fn16:state 3 - 629 ucontrol within .DOME_X .DOME_Y 8 *tmp266 - 630 jump *label168 equal *tmp266 false ++ 596 ucontrol itemTake .CORE @silicon .UNIT_CAPACITY + 597 sensor *tmp254 @unit @totalItems + 598 jump *label164 lessThan *tmp254 .UNIT_CAPACITY + 599 ucontrol approach .DOME_X .DOME_Y 6 + + 619 jump *label166 notEqual :fn16:state 3 + 620 ucontrol within .DOME_X .DOME_Y 8 *tmp266 + 621 jump *label168 equal *tmp266 false - * jump *label170 equal :fn16:supply false -+ 631 jump *label170 equal .SUPPLY_S_FIRST false - 632 ucontrol itemDrop .DOME .UNIT_CAPACITY - 633 set :fn16:msg ", supplying\n" - 634 jump *label171 always - - 659 ucontrol flag :fn16:state - 660 sensor *tmp279 @unit @totalItems - 661 print " " ++ 622 jump *label170 equal .SUPPLY_S_FIRST false + 623 ucontrol itemDrop .DOME .UNIT_CAPACITY + 624 set :fn16:msg ", supplying\n" + 625 jump *label171 always + + 650 ucontrol flag :fn16:state + 651 sensor *tmp279 @unit @totalItems + 652 print " " - * print :fn16:group -+ 662 print .GROUP1 - 663 print ":" - 664 print " [" ++ 653 print .GROUP1 + 654 print ":" + 655 print " [" - * print :fn16:color -+ 665 print "gold" - 666 print "]" - 667 print *tmp279 - 668 print "[" - - 679 label *label175 - 680 set *tmp217 @unit - 681 jump *label139 always ++ 656 print "gold" + 657 print "]" + 658 print *tmp279 + 659 print "[" + + 670 label *label175 + 671 set *tmp217 @unit + 672 jump *label139 always - * set *tmp217 null - 682 label *label139 - 683 set .UNIT_S1 *tmp217 -- * jump *label176 equal .FOUR_UNITS false -+ 684 jump *label176 equal *tmp139 false - 685 op equal *tmp283 .SUPPLY_S_FIRST false - 686 set :fn18:unit .UNIT_S2 - 687 set :fn18:item @silicon - 688 set :fn18:group .GROUP2 - 689 set :fn18:supply *tmp283 + 673 label *label139 + 674 set .UNIT_S1 *tmp217 + 675 jump *label176 equal .FOUR_UNITS false + + 678 set :fn18:item @silicon + 679 set :fn18:group .GROUP2 + 680 set :fn18:supply *tmp283 - * set :fn19:currentUnit :fn18:unit - * jump *label180 equal :fn19:currentUnit null - * ubind :fn19:currentUnit -+ 690 set :fn19:currentUnit .UNIT_S2 -+ 691 jump *label180 equal :fn18:unit null -+ 692 ubind :fn18:unit - 693 sensor *tmp288 @unit @dead - 694 op strictEqual *tmp289 *tmp288 0 - 695 sensor *tmp290 @unit @controller - - 701 label *label183 - 702 label *label180 - 703 label *label181 ++ 681 set :fn19:currentUnit .UNIT_S2 ++ 682 jump *label180 equal :fn18:unit null ++ 683 ubind :fn18:unit + 684 sensor *tmp288 @unit @dead + 685 op strictEqual *tmp289 *tmp288 0 + 686 sensor *tmp290 @unit @controller + + 692 label *label183 + 693 label *label180 + 694 label *label181 +- * ubind .TYPE ++ 695 ubind *tmp3 + 696 set :fn19:firstUnit @unit + 697 jump *label184 equal :fn19:firstUnit null + 698 label *label186 + + 701 jump *label179 always + 702 label *label189 + 703 label *label190 - * ubind .TYPE + 704 ubind *tmp3 - 705 set :fn19:firstUnit @unit - 706 jump *label184 equal :fn19:firstUnit null - 707 label *label186 + 705 label *label187 + 706 op notEqual *tmp300 @unit :fn19:firstUnit + 707 sensor *tmp301 :fn19:firstUnit @dead - 710 jump *label179 always - 711 label *label189 - 712 label *label190 -- * ubind .TYPE -+ 713 ubind *tmp3 - 714 label *label187 - 715 op notEqual *tmp300 @unit :fn19:firstUnit - 716 sensor *tmp301 :fn19:firstUnit @dead - - 731 op or *tmp307 *tmp305 *tmp306 - 732 jump *label191 equal *tmp307 false - 733 sensor *tmp309 @unit @firstItem + 722 op or *tmp307 *tmp305 *tmp306 + 723 jump *label191 equal *tmp307 false + 724 sensor *tmp309 @unit @firstItem - * jump *label193 notEqual *tmp309 :fn18:item -+ 734 jump *label193 notEqual *tmp309 @silicon - 735 set :fn18:state 3 - 736 jump *label194 always - 737 label *label193 - - 754 jump *label199 notEqual :fn18:state 2 - 755 ucontrol within .CORE_X .CORE_Y 8 *tmp319 - 756 jump *label201 equal *tmp319 false ++ 725 jump *label193 notEqual *tmp309 @silicon + 726 set :fn18:state 3 + 727 jump *label194 always + 728 label *label193 + + 745 jump *label199 notEqual :fn18:state 2 + 746 ucontrol within .CORE_X .CORE_Y 8 *tmp319 + 747 jump *label201 equal *tmp319 false - * ucontrol itemTake .CORE :fn18:item .UNIT_CAPACITY -+ 757 ucontrol itemTake .CORE @silicon .UNIT_CAPACITY - 758 sensor *tmp321 @unit @totalItems - 759 jump *label203 lessThan *tmp321 .UNIT_CAPACITY - 760 ucontrol approach .DOME_X .DOME_Y 6 - - 780 jump *label205 notEqual :fn18:state 3 - 781 ucontrol within .DOME_X .DOME_Y 8 *tmp333 - 782 jump *label207 equal *tmp333 false ++ 748 ucontrol itemTake .CORE @silicon .UNIT_CAPACITY + 749 sensor *tmp321 @unit @totalItems + 750 jump *label203 lessThan *tmp321 .UNIT_CAPACITY + 751 ucontrol approach .DOME_X .DOME_Y 6 + + 771 jump *label205 notEqual :fn18:state 3 + 772 ucontrol within .DOME_X .DOME_Y 8 *tmp333 + 773 jump *label207 equal *tmp333 false - * jump *label209 equal :fn18:supply false -+ 783 jump *label209 equal *tmp283 false - 784 ucontrol itemDrop .DOME .UNIT_CAPACITY - 785 set :fn18:msg ", supplying\n" - 786 jump *label210 always - - 811 ucontrol flag :fn18:state - 812 sensor *tmp346 @unit @totalItems - 813 print " " ++ 774 jump *label209 equal *tmp283 false + 775 ucontrol itemDrop .DOME .UNIT_CAPACITY + 776 set :fn18:msg ", supplying\n" + 777 jump *label210 always + + 802 ucontrol flag :fn18:state + 803 sensor *tmp346 @unit @totalItems + 804 print " " - * print :fn18:group -+ 814 print .GROUP2 - 815 print ":" - 816 print " [" ++ 805 print .GROUP2 + 806 print ":" + 807 print " [" - * print :fn18:color -+ 817 print "gold" - 818 print "]" - 819 print *tmp346 - 820 print "[" - - 831 label *label214 - 832 set *tmp284 @unit - 833 jump *label178 always ++ 808 print "gold" + 809 print "]" + 810 print *tmp346 + 811 print "[" + + 822 label *label214 + 823 set *tmp284 @unit + 824 jump *label178 always - * set *tmp284 null - 834 label *label178 - 835 set .UNIT_S2 *tmp284 - 836 jump *label215 equal .SUPPLY_S_FIRST false + 825 label *label178 + 826 set .UNIT_S2 *tmp284 + 827 jump *label215 equal .SUPPLY_S_FIRST false - * sensor *tmp350 .UNIT_S1 @totalItems -+ 837 sensor *tmp350 *tmp217 @totalItems - 838 op greaterThan *tmp349 *tmp350 0 - 839 jump *label216 always - 840 label *label215 ++ 828 sensor *tmp350 *tmp217 @totalItems + 829 op greaterThan *tmp349 *tmp350 0 + 830 jump *label216 always + 831 label *label215 - * sensor *tmp352 .UNIT_S2 @totalItems -+ 841 sensor *tmp352 *tmp284 @totalItems - 842 op equal *tmp349 *tmp352 0 - 843 label *label216 - 844 set .SUPPLY_S_FIRST *tmp349 - - 846 label *label177 - 847 set :fn20:item @phase-fabric - 848 set :fn20:text "\n[green]Phase fabric[] status:\n" ++ 832 sensor *tmp352 *tmp284 @totalItems + 833 op equal *tmp349 *tmp352 0 + 834 label *label216 + 835 set .SUPPLY_S_FIRST *tmp349 + + 837 label *label177 + 838 set :fn20:item @phase-fabric + 839 set :fn20:text "\n[green]Phase fabric[] status:\n" - * print :fn20:text - * sensor :fn20:level .DOME :fn20:item -+ 849 print "\n[green]Phase fabric[] status:\n" -+ 850 sensor :fn20:level .DOME @phase-fabric - 851 jump *label218 lessThanEq :fn20:level 3 - 852 print " dome: [green]" - 853 print :fn20:level - - 867 set :fn21:item @phase-fabric - 868 set :fn21:group .GROUP1 - 869 set :fn21:supply .SUPPLY_P_FIRST ++ 840 print "\n[green]Phase fabric[] status:\n" ++ 841 sensor :fn20:level .DOME @phase-fabric + 842 jump *label218 lessThanEq :fn20:level 3 + 843 print " dome: [green]" + 844 print :fn20:level + + 858 set :fn21:item @phase-fabric + 859 set :fn21:group .GROUP1 + 860 set :fn21:supply .SUPPLY_P_FIRST - * set :fn22:currentUnit :fn21:unit - * jump *label222 equal :fn22:currentUnit null - * ubind :fn22:currentUnit -+ 870 set :fn22:currentUnit .UNIT_P1 -+ 871 jump *label222 equal :fn21:unit null -+ 872 ubind :fn21:unit - 873 sensor *tmp362 @unit @dead - 874 op strictEqual *tmp363 *tmp362 0 - 875 sensor *tmp364 @unit @controller - - 881 label *label225 - 882 label *label222 - 883 label *label223 ++ 861 set :fn22:currentUnit .UNIT_P1 ++ 862 jump *label222 equal :fn21:unit null ++ 863 ubind :fn21:unit + 864 sensor *tmp362 @unit @dead + 865 op strictEqual *tmp363 *tmp362 0 + 866 sensor *tmp364 @unit @controller + + 872 label *label225 + 873 label *label222 + 874 label *label223 +- * ubind .TYPE ++ 875 ubind *tmp3 + 876 set :fn22:firstUnit @unit + 877 jump *label226 equal :fn22:firstUnit null + 878 label *label228 + + 881 jump *label221 always + 882 label *label231 + 883 label *label232 - * ubind .TYPE + 884 ubind *tmp3 - 885 set :fn22:firstUnit @unit - 886 jump *label226 equal :fn22:firstUnit null - 887 label *label228 + 885 label *label229 + 886 op notEqual *tmp374 @unit :fn22:firstUnit + 887 sensor *tmp375 :fn22:firstUnit @dead - 890 jump *label221 always - 891 label *label231 - 892 label *label232 -- * ubind .TYPE -+ 893 ubind *tmp3 - 894 label *label229 - 895 op notEqual *tmp374 @unit :fn22:firstUnit - 896 sensor *tmp375 :fn22:firstUnit @dead - - 911 op or *tmp381 *tmp379 *tmp380 - 912 jump *label233 equal *tmp381 false - 913 sensor *tmp383 @unit @firstItem + 902 op or *tmp381 *tmp379 *tmp380 + 903 jump *label233 equal *tmp381 false + 904 sensor *tmp383 @unit @firstItem - * jump *label235 notEqual *tmp383 :fn21:item -+ 914 jump *label235 notEqual *tmp383 @phase-fabric - 915 set :fn21:state 3 - 916 jump *label236 always - 917 label *label235 - - 934 jump *label241 notEqual :fn21:state 2 - 935 ucontrol within .CORE_X .CORE_Y 8 *tmp393 - 936 jump *label243 equal *tmp393 false ++ 905 jump *label235 notEqual *tmp383 @phase-fabric + 906 set :fn21:state 3 + 907 jump *label236 always + 908 label *label235 + + 925 jump *label241 notEqual :fn21:state 2 + 926 ucontrol within .CORE_X .CORE_Y 8 *tmp393 + 927 jump *label243 equal *tmp393 false - * ucontrol itemTake .CORE :fn21:item .UNIT_CAPACITY -+ 937 ucontrol itemTake .CORE @phase-fabric .UNIT_CAPACITY - 938 sensor *tmp395 @unit @totalItems - 939 jump *label245 lessThan *tmp395 .UNIT_CAPACITY - 940 ucontrol approach .DOME_X .DOME_Y 6 - - 960 jump *label247 notEqual :fn21:state 3 - 961 ucontrol within .DOME_X .DOME_Y 8 *tmp407 - 962 jump *label249 equal *tmp407 false ++ 928 ucontrol itemTake .CORE @phase-fabric .UNIT_CAPACITY + 929 sensor *tmp395 @unit @totalItems + 930 jump *label245 lessThan *tmp395 .UNIT_CAPACITY + 931 ucontrol approach .DOME_X .DOME_Y 6 + + 951 jump *label247 notEqual :fn21:state 3 + 952 ucontrol within .DOME_X .DOME_Y 8 *tmp407 + 953 jump *label249 equal *tmp407 false - * jump *label251 equal :fn21:supply false -+ 963 jump *label251 equal .SUPPLY_P_FIRST false - 964 ucontrol itemDrop .DOME .UNIT_CAPACITY - 965 set :fn21:msg ", supplying\n" - 966 jump *label252 always - - 991 ucontrol flag :fn21:state - 992 sensor *tmp420 @unit @totalItems - 993 print " " ++ 954 jump *label251 equal .SUPPLY_P_FIRST false + 955 ucontrol itemDrop .DOME .UNIT_CAPACITY + 956 set :fn21:msg ", supplying\n" + 957 jump *label252 always + + 982 ucontrol flag :fn21:state + 983 sensor *tmp420 @unit @totalItems + 984 print " " - * print :fn21:group -+ 994 print .GROUP1 - 995 print ":" - 996 print " [" ++ 985 print .GROUP1 + 986 print ":" + 987 print " [" - * print :fn21:color -+ 997 print "gold" - 998 print "]" - 999 print *tmp420 - 1000 print "[" - - 1011 label *label256 - 1012 set *tmp358 @unit - 1013 jump *label220 always ++ 988 print "gold" + 989 print "]" + 990 print *tmp420 + 991 print "[" + + 1002 label *label256 + 1003 set *tmp358 @unit + 1004 jump *label220 always - * set *tmp358 null - 1014 label *label220 - 1015 set .UNIT_P1 *tmp358 -- * jump *label257 equal .FOUR_UNITS false -+ 1016 jump *label257 equal *tmp139 false - 1017 op equal *tmp424 .SUPPLY_P_FIRST false - 1018 set :fn23:unit .UNIT_P2 - 1019 set :fn23:item @phase-fabric - 1020 set :fn23:group .GROUP2 - 1021 set :fn23:supply *tmp424 + 1005 label *label220 + 1006 set .UNIT_P1 *tmp358 + 1007 jump *label257 equal .FOUR_UNITS false + + 1010 set :fn23:item @phase-fabric + 1011 set :fn23:group .GROUP2 + 1012 set :fn23:supply *tmp424 - * set :fn24:currentUnit :fn23:unit - * jump *label261 equal :fn24:currentUnit null - * ubind :fn24:currentUnit -+ 1022 set :fn24:currentUnit .UNIT_P2 -+ 1023 jump *label261 equal :fn23:unit null -+ 1024 ubind :fn23:unit - 1025 sensor *tmp429 @unit @dead - 1026 op strictEqual *tmp430 *tmp429 0 - 1027 sensor *tmp431 @unit @controller - - 1033 label *label264 - 1034 label *label261 - 1035 label *label262 ++ 1013 set :fn24:currentUnit .UNIT_P2 ++ 1014 jump *label261 equal :fn23:unit null ++ 1015 ubind :fn23:unit + 1016 sensor *tmp429 @unit @dead + 1017 op strictEqual *tmp430 *tmp429 0 + 1018 sensor *tmp431 @unit @controller + + 1024 label *label264 + 1025 label *label261 + 1026 label *label262 +- * ubind .TYPE ++ 1027 ubind *tmp3 + 1028 set :fn24:firstUnit @unit + 1029 jump *label265 equal :fn24:firstUnit null + 1030 label *label267 + + 1033 jump *label260 always + 1034 label *label270 + 1035 label *label271 - * ubind .TYPE + 1036 ubind *tmp3 - 1037 set :fn24:firstUnit @unit - 1038 jump *label265 equal :fn24:firstUnit null - 1039 label *label267 + 1037 label *label268 + 1038 op notEqual *tmp441 @unit :fn24:firstUnit + 1039 sensor *tmp442 :fn24:firstUnit @dead - 1042 jump *label260 always - 1043 label *label270 - 1044 label *label271 -- * ubind .TYPE -+ 1045 ubind *tmp3 - 1046 label *label268 - 1047 op notEqual *tmp441 @unit :fn24:firstUnit - 1048 sensor *tmp442 :fn24:firstUnit @dead - - 1063 op or *tmp448 *tmp446 *tmp447 - 1064 jump *label272 equal *tmp448 false - 1065 sensor *tmp450 @unit @firstItem + 1054 op or *tmp448 *tmp446 *tmp447 + 1055 jump *label272 equal *tmp448 false + 1056 sensor *tmp450 @unit @firstItem - * jump *label274 notEqual *tmp450 :fn23:item -+ 1066 jump *label274 notEqual *tmp450 @phase-fabric - 1067 set :fn23:state 3 - 1068 jump *label275 always - 1069 label *label274 - - 1086 jump *label280 notEqual :fn23:state 2 - 1087 ucontrol within .CORE_X .CORE_Y 8 *tmp460 - 1088 jump *label282 equal *tmp460 false ++ 1057 jump *label274 notEqual *tmp450 @phase-fabric + 1058 set :fn23:state 3 + 1059 jump *label275 always + 1060 label *label274 + + 1077 jump *label280 notEqual :fn23:state 2 + 1078 ucontrol within .CORE_X .CORE_Y 8 *tmp460 + 1079 jump *label282 equal *tmp460 false - * ucontrol itemTake .CORE :fn23:item .UNIT_CAPACITY -+ 1089 ucontrol itemTake .CORE @phase-fabric .UNIT_CAPACITY - 1090 sensor *tmp462 @unit @totalItems - 1091 jump *label284 lessThan *tmp462 .UNIT_CAPACITY - 1092 ucontrol approach .DOME_X .DOME_Y 6 - - 1112 jump *label286 notEqual :fn23:state 3 - 1113 ucontrol within .DOME_X .DOME_Y 8 *tmp474 - 1114 jump *label288 equal *tmp474 false ++ 1080 ucontrol itemTake .CORE @phase-fabric .UNIT_CAPACITY + 1081 sensor *tmp462 @unit @totalItems + 1082 jump *label284 lessThan *tmp462 .UNIT_CAPACITY + 1083 ucontrol approach .DOME_X .DOME_Y 6 + + 1103 jump *label286 notEqual :fn23:state 3 + 1104 ucontrol within .DOME_X .DOME_Y 8 *tmp474 + 1105 jump *label288 equal *tmp474 false - * jump *label290 equal :fn23:supply false -+ 1115 jump *label290 equal *tmp424 false - 1116 ucontrol itemDrop .DOME .UNIT_CAPACITY - 1117 set :fn23:msg ", supplying\n" - 1118 jump *label291 always - - 1143 ucontrol flag :fn23:state - 1144 sensor *tmp487 @unit @totalItems - 1145 print " " ++ 1106 jump *label290 equal *tmp424 false + 1107 ucontrol itemDrop .DOME .UNIT_CAPACITY + 1108 set :fn23:msg ", supplying\n" + 1109 jump *label291 always + + 1134 ucontrol flag :fn23:state + 1135 sensor *tmp487 @unit @totalItems + 1136 print " " - * print :fn23:group -+ 1146 print .GROUP2 - 1147 print ":" - 1148 print " [" ++ 1137 print .GROUP2 + 1138 print ":" + 1139 print " [" - * print :fn23:color -+ 1149 print "gold" - 1150 print "]" - 1151 print *tmp487 - 1152 print "[" - - 1163 label *label295 - 1164 set *tmp425 @unit - 1165 jump *label259 always ++ 1140 print "gold" + 1141 print "]" + 1142 print *tmp487 + 1143 print "[" + + 1154 label *label295 + 1155 set *tmp425 @unit + 1156 jump *label259 always - * set *tmp425 null - 1166 label *label259 - 1167 set .UNIT_P2 *tmp425 - 1168 jump *label296 equal .SUPPLY_P_FIRST false + 1157 label *label259 + 1158 set .UNIT_P2 *tmp425 + 1159 jump *label296 equal .SUPPLY_P_FIRST false - * sensor *tmp491 .UNIT_P1 @totalItems -+ 1169 sensor *tmp491 *tmp358 @totalItems - 1170 op greaterThan *tmp490 *tmp491 0 - 1171 jump *label297 always - 1172 label *label296 ++ 1160 sensor *tmp491 *tmp358 @totalItems + 1161 op greaterThan *tmp490 *tmp491 0 + 1162 jump *label297 always + 1163 label *label296 - * sensor *tmp493 .UNIT_P2 @totalItems -+ 1173 sensor *tmp493 *tmp425 @totalItems - 1174 op equal *tmp490 *tmp493 0 - 1175 label *label297 - 1176 set .SUPPLY_P_FIRST *tmp490 - - 1184 print " " - 1185 print "ms" - 1186 printflush message1 ++ 1164 sensor *tmp493 *tmp425 @totalItems + 1165 op equal *tmp490 *tmp493 0 + 1166 label *label297 + 1167 set .SUPPLY_P_FIRST *tmp490 + + 1175 print " " + 1176 print "ms" + 1177 printflush message1 - * op notEqual *tmp497 .TYPE UNIT_TYPE -+ 1187 op notEqual *tmp497 *tmp3 UNIT_TYPE - 1188 op greaterThan *tmp498 :unitCheck @time - 1189 op land *tmp499 *tmp497 *tmp498 - 1190 jump *label298 equal *tmp499 false - 1191 set :fn25:type UNIT_TYPE - 1192 set :fn25:output false - 1193 set :fn25:needed 0 ++ 1178 op notEqual *tmp497 *tmp3 UNIT_TYPE + 1179 op greaterThan *tmp498 :unitCheck @time + 1180 op land *tmp499 *tmp497 *tmp498 + 1181 jump *label298 equal *tmp499 false + 1182 set :fn25:type UNIT_TYPE + 1183 set :fn25:output false + 1184 set :fn25:needed 0 - * set :fn25:occupied :fn25:needed - * set :fn25:free :fn25:occupied - * ubind :fn25:type -+ 1194 set :fn25:occupied 0 -+ 1195 set :fn25:free :fn25:needed -+ 1196 ubind UNIT_TYPE - 1197 set :fn25:firstUnit @unit - 1198 jump *label301 equal :fn25:firstUnit null - 1199 set :fn26:unit @unit - 1200 op sub *tmp506 .DOME_X .CORE_X - 1201 op sub *tmp507 .DOME_Y .CORE_Y ++ 1185 set :fn25:occupied 0 ++ 1186 set :fn25:free :fn25:needed ++ 1187 ubind UNIT_TYPE + 1188 set :fn25:firstUnit @unit + 1189 jump *label301 equal :fn25:firstUnit null + 1190 set :fn26:unit @unit + 1191 op sub *tmp506 .DOME_X .CORE_X + 1192 op sub *tmp507 .DOME_Y .CORE_Y - * op len *tmp508 *tmp506 *tmp507 - * op mul *tmp509 2 *tmp508 -+ 1202 op len *tmp508 *tmp140 *tmp141 -+ 1203 op mul *tmp509 2 *tmp142 - 1204 sensor *tmp510 :fn26:unit @speed ++ 1193 op len *tmp508 *tmp140 *tmp141 ++ 1194 op mul *tmp509 2 *tmp142 + 1195 sensor *tmp510 :fn26:unit @speed - * op div :fn26:travel_time *tmp509 *tmp510 -+ 1205 op div :fn26:travel_time *tmp143 *tmp510 - 1206 op greaterThanEq *tmp505 :fn26:travel_time 47 - 1207 jump *label303 always ++ 1196 op div :fn26:travel_time *tmp143 *tmp510 + 1197 op greaterThanEq *tmp505 :fn26:travel_time 47 + 1198 jump *label303 always - * set *tmp505 null - 1208 label *label303 - 1209 jump *label304 equal *tmp505 false - 1210 set *tmp513 4 + 1199 label *label303 + 1200 jump *label304 equal *tmp505 false + 1201 set *tmp513 4 - 1221 op or *tmp518 *tmp515 *tmp517 - 1222 jump *label309 equal *tmp518 false - 1223 op add :fn25:free :fn25:free 1 + 1212 op or *tmp518 *tmp515 *tmp517 + 1213 jump *label309 equal *tmp518 false + 1214 op add :fn25:free :fn25:free 1 - * jump *label311 lessThan :fn25:free :fn25:needed -+ 1224 jump *label311 lessThan :fn25:free *tmp513 - 1225 set *tmp501 true - 1226 jump *label300 always - 1227 label *label311 - - 1230 label *label309 - 1231 op add :fn25:occupied :fn25:occupied 1 - 1232 label *label310 ++ 1215 jump *label311 lessThan :fn25:free *tmp513 + 1216 set *tmp501 true + 1217 jump *label300 always + 1218 label *label311 + + 1221 label *label309 + 1222 op add :fn25:occupied :fn25:occupied 1 + 1223 label *label310 - * ubind :fn25:type -+ 1233 ubind UNIT_TYPE - 1234 label *label307 - 1235 op notEqual *tmp522 @unit :fn25:firstUnit - 1236 sensor *tmp523 :fn25:firstUnit @dead - - 1240 label *label308 - 1241 label *label301 - 1242 label *label302 ++ 1224 ubind UNIT_TYPE + 1225 label *label307 + 1226 op notEqual *tmp522 @unit :fn25:firstUnit + 1227 sensor *tmp523 :fn25:firstUnit @dead + + 1231 label *label308 + 1232 label *label301 + 1233 label *label302 - * jump *label313 equal :fn25:output false - * print :fn25:type -+ 1243 jump *label313 equal false false -+ 1244 print UNIT_TYPE - 1245 print ":" - 1246 print " occupied: " - 1247 print :fn25:occupied - - 1258 label *label314 - 1259 set *tmp501 false - 1260 jump *label300 always ++ 1234 jump *label313 equal false false ++ 1235 print UNIT_TYPE + 1236 print ":" + 1237 print " occupied: " + 1238 print :fn25:occupied + + 1249 label *label314 + 1250 set *tmp501 false + 1251 jump *label300 always - * set *tmp501 null - 1261 label *label300 - 1262 jump *label317 equal *tmp501 false - 1263 end + 1252 label *label300 + 1253 jump *label317 equal *tmp501 false + 1254 end -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-42 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-41 instructions): 3 remark "Do not modify anything below this line." 4 set .DOME_Y null @@ -4020,223 +4042,186 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 216 ubind *tmp3 217 set :fn5:firstUnit @unit + 243 jump *label60 notEqual *tmp78 false 244 label *label62 245 label *label57 - 246 set :fn6:currentUnit .UNIT_S1 - * set :fn7:currentUnit .UNIT_S1 -- * jump *label69 equal :fn6:currentUnit null -- * ubind :fn6:currentUnit -+ 247 jump *label69 equal .UNIT_S1 null -+ 248 ubind .UNIT_S1 - 249 sensor *tmp83 @unit @dead - 250 op strictEqual *tmp84 *tmp83 0 - 251 sensor *tmp85 @unit @controller - - 284 label *label67 - 285 set .UNIT_S1 *tmp79 - 286 set :fn8:currentUnit .UNIT_P1 + 246 jump *label69 equal .UNIT_S1 null + 247 ubind .UNIT_S1 + 248 sensor *tmp83 @unit @dead + + 281 set .UNIT_S1 @unit + 282 jump *label67 always + 283 label *label67 - * set :fn9:currentUnit .UNIT_P1 -- * jump *label82 equal :fn8:currentUnit null -- * ubind :fn8:currentUnit -+ 287 jump *label82 equal .UNIT_P1 null -+ 288 ubind .UNIT_P1 - 289 sensor *tmp103 @unit @dead - 290 op strictEqual *tmp104 *tmp103 0 - 291 sensor *tmp105 @unit @controller - - 331 jump *label93 equal *tmp123 false - 332 set :u *tmp79 - 333 set .UNIT_S1 *tmp99 -- * set .UNIT_P1 :u -+ 334 set .UNIT_P1 *tmp79 - 335 label *label93 - 336 label *label94 - 337 sensor .UNIT_CAPACITY .UNIT_S1 @itemCapacity - - 353 sensor .CORE_Y .CORE @y - 354 sensor .DOME_X .DOME @x - 355 sensor .DOME_Y .DOME @y + 284 jump *label82 equal .UNIT_P1 null + 285 ubind .UNIT_P1 + 286 sensor *tmp103 @unit @dead + + 349 sensor .CORE_Y .CORE @y + 350 sensor .DOME_X .DOME @x + 351 sensor .DOME_Y .DOME @y - * set :fn10:unit .UNIT_S1 - 356 op sub *tmp140 .DOME_X .CORE_X - 357 op sub *tmp141 .DOME_Y .CORE_Y - 358 op len *tmp142 *tmp140 *tmp141 + 352 op sub *tmp140 .DOME_X .CORE_X + 353 op sub *tmp141 .DOME_Y .CORE_Y + 354 op len *tmp142 *tmp140 *tmp141 - 362 op greaterThanEq *tmp139 :fn10:travel_time 47 - 363 jump *label100 always - 364 label *label100 -- * set .FOUR_UNITS *tmp139 - 365 jump *label101 equal *tmp139 false - 366 set :fn11:currentUnit .UNIT_S2 + 359 jump *label100 always + 360 label *label100 + 361 jump *label101 equal .FOUR_UNITS false - * set :fn12:currentUnit .UNIT_S2 -- * jump *label105 equal :fn11:currentUnit null -- * ubind :fn11:currentUnit -+ 367 jump *label105 equal .UNIT_S2 null -+ 368 ubind .UNIT_S2 - 369 sensor *tmp152 @unit @dead - 370 op strictEqual *tmp153 *tmp152 0 - 371 sensor *tmp154 @unit @controller - - 404 label *label103 - 405 set .UNIT_S2 *tmp148 - 406 set :fn13:currentUnit .UNIT_P2 + 362 jump *label105 equal .UNIT_S2 null + 363 ubind .UNIT_S2 + 364 sensor *tmp152 @unit @dead + + 397 set .UNIT_S2 @unit + 398 jump *label103 always + 399 label *label103 - * set :fn14:currentUnit .UNIT_P2 -- * jump *label118 equal :fn13:currentUnit null -- * ubind :fn13:currentUnit -+ 407 jump *label118 equal .UNIT_P2 null -+ 408 ubind .UNIT_P2 - 409 sensor *tmp172 @unit @dead - 410 op strictEqual *tmp173 *tmp172 0 - 411 sensor *tmp174 @unit @controller - - 462 jump *label131 equal *tmp198 false - 463 set :u *tmp148 - 464 set .UNIT_S2 .UNIT_P2 -- * set .UNIT_P2 :u -+ 465 set .UNIT_P2 *tmp148 - 466 label *label131 - 467 label *label132 - 468 set .GROUP1 "unit 1" - - 483 sensor *tmp202 .UNIT_S2 @totalItems - 484 op lessThan *tmp203 *tmp201 *tmp202 - 485 op or .SUPPLY_S_FIRST *tmp200 *tmp203 -- * op equal *tmp205 *tmp139 false - 486 sensor *tmp206 .UNIT_P1 @totalItems - 487 sensor *tmp207 .UNIT_P2 @totalItems - 488 op lessThan *tmp208 *tmp206 *tmp207 - - 500 print "[" - 501 print "]" - 502 print "\n" + 400 jump *label118 equal .UNIT_P2 null + 401 ubind .UNIT_P2 + 402 sensor *tmp172 @unit @dead + + 475 sensor *tmp202 .UNIT_S2 @totalItems + 476 op lessThan *tmp203 *tmp201 *tmp202 + 477 op or .SUPPLY_S_FIRST *tmp200 *tmp203 +- * op equal *tmp205 .FOUR_UNITS false + 478 sensor *tmp206 .UNIT_P1 @totalItems + 479 sensor *tmp207 .UNIT_P2 @totalItems + 480 op lessThan *tmp208 *tmp206 *tmp207 + + 492 print "[" + 493 print "]" + 494 print "\n" - * set :fn15:item @silicon - * set :fn15:text "\n[green]Silicon[] status:\n" - 503 print "\n[green]Silicon[] status:\n" - 504 sensor :fn15:level .DOME @silicon - 505 jump *label137 lessThanEq :fn15:level 3 + 495 print "\n[green]Silicon[] status:\n" + 496 sensor :fn15:level .DOME @silicon + 497 jump *label137 lessThanEq :fn15:level 3 - 518 label *label138 - 519 label *label136 - 520 set :fn16:unit .UNIT_S1 + 510 label *label138 + 511 label *label136 + 512 set :fn16:unit .UNIT_S1 - * set :fn16:item @silicon - * set :fn16:group .GROUP1 - * set :fn16:supply .SUPPLY_S_FIRST - * set :fn17:currentUnit .UNIT_S1 - * jump *label141 equal :fn16:unit null - * ubind :fn16:unit -+ 521 jump *label141 equal .UNIT_S1 null -+ 522 ubind .UNIT_S1 - 523 sensor *tmp221 @unit @dead - 524 op strictEqual *tmp222 *tmp221 0 - 525 sensor *tmp223 @unit @controller - - 555 set :fn16:msg "" - 556 sensor :fn16:state @unit @flag - 557 set :fn16:distance -1 ++ 513 jump *label141 equal .UNIT_S1 null ++ 514 ubind .UNIT_S1 + 515 sensor *tmp221 @unit @dead + 516 op strictEqual *tmp222 *tmp221 0 + 517 sensor *tmp223 @unit @controller + + 547 set :fn16:msg "" + 548 sensor :fn16:state @unit @flag + 549 set :fn16:distance -1 - * set :fn16:color "gold" - 558 op lessThan *tmp238 :fn16:state 2 - 559 op greaterThan *tmp239 :fn16:state 3 - 560 op or *tmp240 *tmp238 *tmp239 + 550 op lessThan *tmp238 :fn16:state 2 + 551 op greaterThan *tmp239 :fn16:state 3 + 552 op or *tmp240 *tmp238 *tmp239 - 665 jump *label176 equal *tmp139 false - 666 op equal *tmp283 .SUPPLY_S_FIRST false - 667 set :fn18:unit .UNIT_S2 + 657 jump *label176 equal .FOUR_UNITS false + 658 op equal *tmp283 .SUPPLY_S_FIRST false + 659 set :fn18:unit .UNIT_S2 - * set :fn18:item @silicon - * set :fn18:group .GROUP2 - * set :fn18:supply *tmp283 - * set :fn19:currentUnit .UNIT_S2 - * jump *label180 equal :fn18:unit null - * ubind :fn18:unit -+ 668 jump *label180 equal .UNIT_S2 null -+ 669 ubind .UNIT_S2 - 670 sensor *tmp288 @unit @dead - 671 op strictEqual *tmp289 *tmp288 0 - 672 sensor *tmp290 @unit @controller - - 702 set :fn18:msg "" - 703 sensor :fn18:state @unit @flag - 704 set :fn18:distance -1 ++ 660 jump *label180 equal .UNIT_S2 null ++ 661 ubind .UNIT_S2 + 662 sensor *tmp288 @unit @dead + 663 op strictEqual *tmp289 *tmp288 0 + 664 sensor *tmp290 @unit @controller + + 694 set :fn18:msg "" + 695 sensor :fn18:state @unit @flag + 696 set :fn18:distance -1 - * set :fn18:color "gold" - 705 op lessThan *tmp305 :fn18:state 2 - 706 op greaterThan *tmp306 :fn18:state 3 - 707 op or *tmp307 *tmp305 *tmp306 + 697 op lessThan *tmp305 :fn18:state 2 + 698 op greaterThan *tmp306 :fn18:state 3 + 699 op or *tmp307 *tmp305 *tmp306 - 820 set .SUPPLY_S_FIRST *tmp349 - 821 label *label176 - 822 label *label177 + 812 set .SUPPLY_S_FIRST *tmp349 + 813 label *label176 + 814 label *label177 - * set :fn20:item @phase-fabric - * set :fn20:text "\n[green]Phase fabric[] status:\n" - 823 print "\n[green]Phase fabric[] status:\n" - 824 sensor :fn20:level .DOME @phase-fabric - 825 jump *label218 lessThanEq :fn20:level 3 + 815 print "\n[green]Phase fabric[] status:\n" + 816 sensor :fn20:level .DOME @phase-fabric + 817 jump *label218 lessThanEq :fn20:level 3 - 838 label *label219 - 839 label *label217 - 840 set :fn21:unit .UNIT_P1 + 830 label *label219 + 831 label *label217 + 832 set :fn21:unit .UNIT_P1 - * set :fn21:item @phase-fabric - * set :fn21:group .GROUP1 - * set :fn21:supply .SUPPLY_P_FIRST - * set :fn22:currentUnit .UNIT_P1 - * jump *label222 equal :fn21:unit null - * ubind :fn21:unit -+ 841 jump *label222 equal .UNIT_P1 null -+ 842 ubind .UNIT_P1 - 843 sensor *tmp362 @unit @dead - 844 op strictEqual *tmp363 *tmp362 0 - 845 sensor *tmp364 @unit @controller - - 875 set :fn21:msg "" - 876 sensor :fn21:state @unit @flag - 877 set :fn21:distance -1 ++ 833 jump *label222 equal .UNIT_P1 null ++ 834 ubind .UNIT_P1 + 835 sensor *tmp362 @unit @dead + 836 op strictEqual *tmp363 *tmp362 0 + 837 sensor *tmp364 @unit @controller + + 867 set :fn21:msg "" + 868 sensor :fn21:state @unit @flag + 869 set :fn21:distance -1 - * set :fn21:color "gold" - 878 op lessThan *tmp379 :fn21:state 2 - 879 op greaterThan *tmp380 :fn21:state 3 - 880 op or *tmp381 *tmp379 *tmp380 + 870 op lessThan *tmp379 :fn21:state 2 + 871 op greaterThan *tmp380 :fn21:state 3 + 872 op or *tmp381 *tmp379 *tmp380 - 985 jump *label257 equal *tmp139 false - 986 op equal *tmp424 .SUPPLY_P_FIRST false - 987 set :fn23:unit .UNIT_P2 + 977 jump *label257 equal .FOUR_UNITS false + 978 op equal *tmp424 .SUPPLY_P_FIRST false + 979 set :fn23:unit .UNIT_P2 - * set :fn23:item @phase-fabric - * set :fn23:group .GROUP2 - * set :fn23:supply *tmp424 - * set :fn24:currentUnit .UNIT_P2 - * jump *label261 equal :fn23:unit null - * ubind :fn23:unit -+ 988 jump *label261 equal .UNIT_P2 null -+ 989 ubind .UNIT_P2 - 990 sensor *tmp429 @unit @dead - 991 op strictEqual *tmp430 *tmp429 0 - 992 sensor *tmp431 @unit @controller - - 1022 set :fn23:msg "" - 1023 sensor :fn23:state @unit @flag - 1024 set :fn23:distance -1 ++ 980 jump *label261 equal .UNIT_P2 null ++ 981 ubind .UNIT_P2 + 982 sensor *tmp429 @unit @dead + 983 op strictEqual *tmp430 *tmp429 0 + 984 sensor *tmp431 @unit @controller + + 1014 set :fn23:msg "" + 1015 sensor :fn23:state @unit @flag + 1016 set :fn23:distance -1 - * set :fn23:color "gold" - 1025 op lessThan *tmp446 :fn23:state 2 - 1026 op greaterThan *tmp447 :fn23:state 3 - 1027 op or *tmp448 *tmp446 *tmp447 + 1017 op lessThan *tmp446 :fn23:state 2 + 1018 op greaterThan *tmp447 :fn23:state 3 + 1019 op or *tmp448 *tmp446 *tmp447 - 1152 op greaterThan *tmp498 :unitCheck @time - 1153 op land *tmp499 *tmp497 *tmp498 - 1154 jump *label298 equal *tmp499 false + 1144 op greaterThan *tmp498 :unitCheck @time + 1145 op land *tmp499 *tmp497 *tmp498 + 1146 jump *label298 equal *tmp499 false - * set :fn25:type UNIT_TYPE - * set :fn25:output false - 1155 set :fn25:needed 0 - 1156 set :fn25:occupied 0 + 1147 set :fn25:needed 0 + 1148 set :fn25:occupied 0 - * set :fn25:free :fn25:needed -+ 1157 set :fn25:free 0 - 1158 ubind UNIT_TYPE - 1159 set :fn25:firstUnit @unit - 1160 jump *label301 equal :fn25:firstUnit null - 1161 set :fn26:unit @unit ++ 1149 set :fn25:free 0 + 1150 ubind UNIT_TYPE + 1151 set :fn25:firstUnit @unit + 1152 jump *label301 equal :fn25:firstUnit null + 1153 set :fn26:unit @unit - * op sub *tmp506 .DOME_X .CORE_X - * op sub *tmp507 .DOME_Y .CORE_Y - * op len *tmp508 *tmp140 *tmp141 - * op mul *tmp509 2 *tmp142 - 1162 sensor *tmp510 :fn26:unit @speed - 1163 op div :fn26:travel_time *tmp143 *tmp510 - 1164 op greaterThanEq *tmp505 :fn26:travel_time 47 + 1154 sensor *tmp510 :fn26:unit @speed + 1155 op div :fn26:travel_time *tmp143 *tmp510 + 1156 op greaterThanEq *tmp505 :fn26:travel_time 47 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-15 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-9 instructions): 2 set UNIT_TYPE @flare 3 remark "Do not modify anything below this line." @@ -4282,87 +4267,39 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-1 131 jump *label41 always 132 label *label41 - 238 jump *label60 notEqual *tmp78 false - 239 label *label62 - 240 label *label57 -- * set :fn6:currentUnit .UNIT_S1 - 241 jump *label69 equal .UNIT_S1 null - 242 ubind .UNIT_S1 - 243 sensor *tmp83 @unit @dead - - 277 jump *label67 always - 278 label *label67 - 279 set .UNIT_S1 *tmp79 -- * set :fn8:currentUnit .UNIT_P1 - 280 jump *label82 equal .UNIT_P1 null - 281 ubind .UNIT_P1 - 282 sensor *tmp103 @unit @dead - - 322 op equal *tmp122 *tmp121 @silicon - 323 op or *tmp123 *tmp120 *tmp122 - 324 jump *label93 equal *tmp123 false -- * set :u *tmp79 - 325 set .UNIT_S1 *tmp99 - 326 set .UNIT_P1 *tmp79 - 327 label *label93 - - 355 jump *label100 always - 356 label *label100 - 357 jump *label101 equal *tmp139 false -- * set :fn11:currentUnit .UNIT_S2 - 358 jump *label105 equal .UNIT_S2 null - 359 ubind .UNIT_S2 - 360 sensor *tmp152 @unit @dead - - 394 jump *label103 always - 395 label *label103 - 396 set .UNIT_S2 *tmp148 -- * set :fn13:currentUnit .UNIT_P2 - 397 jump *label118 equal .UNIT_P2 null - 398 ubind .UNIT_P2 - 399 sensor *tmp172 @unit @dead - - 450 op equal *tmp197 *tmp196 @silicon - 451 op or *tmp198 *tmp195 *tmp197 - 452 jump *label131 equal *tmp198 false -- * set :u *tmp148 - 453 set .UNIT_S2 .UNIT_P2 - 454 set .UNIT_P2 *tmp148 - 455 label *label131 - - 506 print "\n" - 507 label *label138 - 508 label *label136 + 504 print "\n" + 505 label *label138 + 506 label *label136 - * set :fn16:unit .UNIT_S1 - 509 jump *label141 equal .UNIT_S1 null - 510 ubind .UNIT_S1 - 511 sensor *tmp221 @unit @dead + 507 jump *label141 equal .UNIT_S1 null + 508 ubind .UNIT_S1 + 509 sensor *tmp221 @unit @dead - 652 set .UNIT_S1 *tmp217 - 653 jump *label176 equal *tmp139 false - 654 op equal *tmp283 .SUPPLY_S_FIRST false + 650 set .UNIT_S1 *tmp217 + 651 jump *label176 equal .FOUR_UNITS false + 652 op equal *tmp283 .SUPPLY_S_FIRST false - * set :fn18:unit .UNIT_S2 - 655 jump *label180 equal .UNIT_S2 null - 656 ubind .UNIT_S2 - 657 sensor *tmp288 @unit @dead + 653 jump *label180 equal .UNIT_S2 null + 654 ubind .UNIT_S2 + 655 sensor *tmp288 @unit @dead - 824 print "\n" - 825 label *label219 - 826 label *label217 + 822 print "\n" + 823 label *label219 + 824 label *label217 - * set :fn21:unit .UNIT_P1 - 827 jump *label222 equal .UNIT_P1 null - 828 ubind .UNIT_P1 - 829 sensor *tmp362 @unit @dead + 825 jump *label222 equal .UNIT_P1 null + 826 ubind .UNIT_P1 + 827 sensor *tmp362 @unit @dead - 970 set .UNIT_P1 *tmp358 - 971 jump *label257 equal *tmp139 false - 972 op equal *tmp424 .SUPPLY_P_FIRST false + 968 set .UNIT_P1 *tmp358 + 969 jump *label257 equal .FOUR_UNITS false + 970 op equal *tmp424 .SUPPLY_P_FIRST false - * set :fn23:unit .UNIT_P2 - 973 jump *label261 equal .UNIT_P2 null - 974 ubind .UNIT_P2 - 975 sensor *tmp429 @unit @dead + 971 jump *label261 equal .UNIT_P2 null + 972 ubind .UNIT_P2 + 973 sensor *tmp429 @unit @dead -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-7 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 5 (-7 instructions): 1 remark "If no units of this type exist, we'll try using other types." 2 set UNIT_TYPE @flare @@ -4450,57 +4387,57 @@ Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 131 set :fn3:needed *tmp48 132 label *label44 - 790 set .UNIT_S2 *tmp284 - 791 jump *label215 equal .SUPPLY_S_FIRST false - 792 sensor *tmp350 *tmp217 @totalItems + 788 set .UNIT_S2 *tmp284 + 789 jump *label215 equal .SUPPLY_S_FIRST false + 790 sensor *tmp350 *tmp217 @totalItems - * op greaterThan *tmp349 *tmp350 0 -+ 793 op greaterThan .SUPPLY_S_FIRST *tmp350 0 - 794 jump *label216 always - 795 label *label215 - 796 sensor *tmp352 *tmp284 @totalItems ++ 791 op greaterThan .SUPPLY_S_FIRST *tmp350 0 + 792 jump *label216 always + 793 label *label215 + 794 sensor *tmp352 *tmp284 @totalItems - * op equal *tmp349 *tmp352 0 -+ 797 op equal .SUPPLY_S_FIRST *tmp352 0 - 798 label *label216 ++ 795 op equal .SUPPLY_S_FIRST *tmp352 0 + 796 label *label216 - * set .SUPPLY_S_FIRST *tmp349 - 799 label *label176 - 800 label *label177 - 801 print "\n[green]Phase fabric[] status:\n" + 797 label *label176 + 798 label *label177 + 799 print "\n[green]Phase fabric[] status:\n" - 1107 set .UNIT_P2 *tmp425 - 1108 jump *label296 equal .SUPPLY_P_FIRST false - 1109 sensor *tmp491 *tmp358 @totalItems + 1105 set .UNIT_P2 *tmp425 + 1106 jump *label296 equal .SUPPLY_P_FIRST false + 1107 sensor *tmp491 *tmp358 @totalItems - * op greaterThan *tmp490 *tmp491 0 -+ 1110 op greaterThan .SUPPLY_P_FIRST *tmp491 0 - 1111 jump *label297 always - 1112 label *label296 - 1113 sensor *tmp493 *tmp425 @totalItems ++ 1108 op greaterThan .SUPPLY_P_FIRST *tmp491 0 + 1109 jump *label297 always + 1110 label *label296 + 1111 sensor *tmp493 *tmp425 @totalItems - * op equal *tmp490 *tmp493 0 -+ 1114 op equal .SUPPLY_P_FIRST *tmp493 0 - 1115 label *label297 ++ 1112 op equal .SUPPLY_P_FIRST *tmp493 0 + 1113 label *label297 - * set .SUPPLY_P_FIRST *tmp490 - 1116 label *label257 - 1117 label *label258 - 1118 op sub *tmp495 @time :start - - 1133 ubind UNIT_TYPE - 1134 set :fn25:firstUnit @unit - 1135 jump *label301 equal :fn25:firstUnit null -+ 1136 set *tmp513 2 - 1137 set :fn26:unit @unit - 1138 sensor *tmp510 :fn26:unit @speed - 1139 op div :fn26:travel_time *tmp143 *tmp510 - 1140 op greaterThanEq *tmp505 :fn26:travel_time 47 - 1141 jump *label303 always - 1142 label *label303 + 1114 label *label257 + 1115 label *label258 + 1116 op sub *tmp495 @time :start + + 1131 ubind UNIT_TYPE + 1132 set :fn25:firstUnit @unit + 1133 jump *label301 equal :fn25:firstUnit null ++ 1134 set *tmp513 2 + 1135 set :fn26:unit @unit + 1136 sensor *tmp510 :fn26:unit @speed + 1137 op div :fn26:travel_time *tmp143 *tmp510 + 1138 op greaterThanEq *tmp505 :fn26:travel_time 47 + 1139 jump *label303 always + 1140 label *label303 - * jump *label304 equal *tmp505 false -+ 1143 jump *label305 equal *tmp505 false - 1144 set *tmp513 4 - 1145 jump *label305 always ++ 1141 jump *label305 equal *tmp505 false + 1142 set *tmp513 4 + 1143 jump *label305 always - * label *label304 - * set *tmp513 2 - 1146 label *label305 - 1147 set :fn25:needed *tmp513 - 1148 label *label306 + 1144 label *label305 + 1145 set :fn25:needed *tmp513 + 1146 label *label306 Modifications by Replicate loop condition at line 44:1 (+1 instructions): @@ -4539,22 +4476,22 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: Modifications by Replicate loop condition at line 127:1 (+1 instructions): - 474 label *label133 - 475 sensor *tmp211 switch1 @enabled - 476 jump *label135 equal *tmp211 false -+ 477 label *label321 - 478 set :start @time - 479 print " === [gold]Supplying Overdrive Dome[] === " - 480 print "\n" - - 1202 label *label298 - 1203 label *label299 - 1204 label *label134 + 472 label *label133 + 473 sensor *tmp211 switch1 @enabled + 474 jump *label135 equal *tmp211 false ++ 475 label *label321 + 476 set :start @time + 477 print " === [gold]Supplying Overdrive Dome[] === " + 478 print "\n" + + 1200 label *label298 + 1201 label *label299 + 1202 label *label134 - * jump *label133 always -+ 1205 sensor *tmp211 switch1 @enabled -+ 1206 jump *label321 notEqual *tmp211 false - 1207 label *label135 - 1208 end ++ 1203 sensor *tmp211 switch1 @enabled ++ 1204 jump *label321 notEqual *tmp211 false + 1205 label *label135 + 1206 end Modifications by Unroll iteration loop at line 177:9 (+157 instructions): @@ -5213,14 +5150,14 @@ Modifications by Iterated phase, Jump Normalization, pass 2, iteration 1 (-5 ins 372 print ":" 373 print " occupied: " - 1382 label *label308 - 1383 label *label301 - 1384 label *label302 + 1380 label *label308 + 1381 label *label301 + 1382 label *label302 - * jump *label313 equal false false -+ 1385 jump *label313 always - 1386 print UNIT_TYPE - 1387 print ":" - 1388 print " occupied: " ++ 1383 jump *label313 always + 1384 print UNIT_TYPE + 1385 print ":" + 1386 print " occupied: " Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (-27 instructions): @@ -5326,95 +5263,95 @@ Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (- 460 label *label68 461 ucontrol flag 1 - 462 set *tmp79 @unit + 462 set .UNIT_S1 @unit - * jump *label67 always 463 label *label67 - 464 set .UNIT_S1 *tmp79 - 465 jump *label82 equal .UNIT_P1 null + 464 jump *label82 equal .UNIT_P1 null + 465 ubind .UNIT_P1 - 498 label *label81 - 499 ucontrol flag 1 - 500 set *tmp99 @unit + 497 label *label81 + 498 ucontrol flag 1 + 499 set .UNIT_P1 @unit - * jump *label80 always - 501 label *label80 - 502 set .UNIT_P1 *tmp99 - 503 sensor *tmp119 *tmp79 @firstItem + 500 label *label80 + 501 sensor *tmp119 .UNIT_S1 @firstItem + 502 op equal *tmp120 *tmp119 @phase-fabric - 536 sensor *tmp144 .UNIT_S1 @speed - 537 op div :fn10:travel_time *tmp143 .SPEED - 538 op greaterThanEq *tmp139 :fn10:travel_time 47 + 535 sensor *tmp144 .UNIT_S1 @speed + 536 op div :fn10:travel_time *tmp143 .SPEED + 537 op greaterThanEq .FOUR_UNITS :fn10:travel_time 47 - * jump *label100 always - 539 label *label100 - 540 jump *label101 equal *tmp139 false - 541 jump *label105 equal .UNIT_S2 null + 538 label *label100 + 539 jump *label101 equal .FOUR_UNITS false + 540 jump *label105 equal .UNIT_S2 null - 574 label *label104 - 575 ucontrol flag 1 - 576 set *tmp148 @unit + 573 label *label104 + 574 ucontrol flag 1 + 575 set .UNIT_S2 @unit - * jump *label103 always - 577 label *label103 - 578 set .UNIT_S2 *tmp148 - 579 jump *label118 equal .UNIT_P2 null + 576 label *label103 + 577 jump *label118 equal .UNIT_P2 null + 578 ubind .UNIT_P2 - 612 label *label117 - 613 ucontrol flag 1 - 614 set *tmp168 @unit + 610 label *label117 + 611 ucontrol flag 1 + 612 set .UNIT_P2 @unit - * jump *label116 always - 615 label *label116 - 616 set .UNIT_P2 *tmp168 - 617 sensor *tmp188 .UNIT_S1 @firstItem + 613 label *label116 + 614 sensor *tmp188 .UNIT_S1 @firstItem + 615 op equal *tmp189 *tmp188 @phase-fabric - 829 print :fn16:msg - 830 label *label175 - 831 set *tmp217 @unit + 827 print :fn16:msg + 828 label *label175 + 829 set *tmp217 @unit - * jump *label139 always - 832 label *label139 - 833 set .UNIT_S1 *tmp217 - 834 jump *label176 equal *tmp139 false + 830 label *label139 + 831 set .UNIT_S1 *tmp217 + 832 jump *label176 equal .FOUR_UNITS false - 974 print :fn18:msg - 975 label *label214 - 976 set *tmp284 @unit + 972 print :fn18:msg + 973 label *label214 + 974 set *tmp284 @unit - * jump *label178 always - 977 label *label178 - 978 set .UNIT_S2 *tmp284 - 979 jump *label215 equal .SUPPLY_S_FIRST false + 975 label *label178 + 976 set .UNIT_S2 *tmp284 + 977 jump *label215 equal .SUPPLY_S_FIRST false - 1144 print :fn21:msg - 1145 label *label256 - 1146 set *tmp358 @unit + 1142 print :fn21:msg + 1143 label *label256 + 1144 set *tmp358 @unit - * jump *label220 always - 1147 label *label220 - 1148 set .UNIT_P1 *tmp358 - 1149 jump *label257 equal *tmp139 false + 1145 label *label220 + 1146 set .UNIT_P1 *tmp358 + 1147 jump *label257 equal .FOUR_UNITS false - 1289 print :fn23:msg - 1290 label *label295 - 1291 set *tmp425 @unit + 1287 print :fn23:msg + 1288 label *label295 + 1289 set *tmp425 @unit - * jump *label259 always - 1292 label *label259 - 1293 set .UNIT_P2 *tmp425 - 1294 jump *label296 equal .SUPPLY_P_FIRST false + 1290 label *label259 + 1291 set .UNIT_P2 *tmp425 + 1292 jump *label296 equal .SUPPLY_P_FIRST false - 1324 sensor *tmp510 :fn26:unit @speed - 1325 op div :fn26:travel_time *tmp143 *tmp510 - 1326 op greaterThanEq *tmp505 :fn26:travel_time 47 + 1322 sensor *tmp510 :fn26:unit @speed + 1323 op div :fn26:travel_time *tmp143 *tmp510 + 1324 op greaterThanEq *tmp505 :fn26:travel_time 47 - * jump *label303 always - 1327 label *label303 - 1328 jump *label305 equal *tmp505 false - 1329 set *tmp513 4 + 1325 label *label303 + 1326 jump *label305 equal *tmp505 false + 1327 set *tmp513 4 - * jump *label305 always - 1330 label *label305 - 1331 set :fn25:needed *tmp513 - 1332 label *label306 + 1328 label *label305 + 1329 set :fn25:needed *tmp513 + 1330 label *label306 - 1373 label *label313 - 1374 label *label314 - 1375 set *tmp501 false + 1371 label *label313 + 1372 label *label314 + 1373 set *tmp501 false - * jump *label300 always - 1376 label *label300 - 1377 jump *label317 equal *tmp501 false - 1378 end + 1374 label *label300 + 1375 jump *label317 equal *tmp501 false + 1376 end Modifications by Iterated phase, Expression Optimization, pass 2, iteration 1: @@ -5590,21 +5527,21 @@ Modifications by Iterated phase, Data Flow Optimization, pass 2, iteration 1 (-2 340 jump *label410 always 341 label *label398 - 1313 op greaterThan *tmp498 :unitCheck @time - 1314 op land *tmp499 *tmp497 *tmp498 - 1315 jump *label298 equal *tmp499 false + 1311 op greaterThan *tmp498 :unitCheck @time + 1312 op land *tmp499 *tmp497 *tmp498 + 1313 jump *label298 equal *tmp499 false - * set :fn25:needed 0 - 1316 set :fn25:occupied 0 - 1317 set :fn25:free 0 - 1318 ubind UNIT_TYPE + 1314 set :fn25:occupied 0 + 1315 set :fn25:free 0 + 1316 ubind UNIT_TYPE - 1327 jump *label305 equal *tmp505 false - 1328 set *tmp513 4 - 1329 label *label305 + 1325 jump *label305 equal *tmp505 false + 1326 set *tmp513 4 + 1327 label *label305 - * set :fn25:needed *tmp513 - 1330 label *label306 - 1331 sensor *tmp514 @unit @controlled - 1332 op equal *tmp515 *tmp514 0 + 1328 label *label306 + 1329 sensor *tmp514 @unit @controlled + 1330 op equal *tmp515 *tmp514 0 Modifications by Iterated phase, Data Flow Optimization, pass 2, iteration 2 (-20 instructions): @@ -5732,16 +5669,16 @@ Modifications by Iterated phase, Jump Normalization, pass 3, iteration 1: Modifications by Iterated phase, Jump Optimization, pass 3, iteration 1 (-1 instructions): - 1302 set :fn26:unit @unit - 1303 sensor *tmp510 :fn26:unit @speed - 1304 op div :fn26:travel_time *tmp143 *tmp510 + 1300 set :fn26:unit @unit + 1301 sensor *tmp510 :fn26:unit @speed + 1302 op div :fn26:travel_time *tmp143 *tmp510 - * op greaterThanEq *tmp505 :fn26:travel_time 47 - 1305 label *label303 + 1303 label *label303 - * jump *label305 equal *tmp505 false -+ 1306 jump *label305 lessThan :fn26:travel_time 47 - 1307 set *tmp513 4 - 1308 label *label305 - 1309 label *label306 ++ 1304 jump *label305 lessThan :fn26:travel_time 47 + 1305 set *tmp513 4 + 1306 label *label305 + 1307 label *label306 Modifications by Iterated phase, Single Step Elimination, pass 3, iteration 1 (-5 instructions): @@ -5817,145 +5754,145 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-17 instructions) 420 label *label79 421 ubind *tmp3 - 441 sensor *tmp105 @unit @controller - 442 op equal *tmp106 *tmp105 @this - 443 op land *tmp107 *tmp104 *tmp106 + 440 sensor *tmp105 @unit @controller + 441 op equal *tmp106 *tmp105 @this + 442 op land *tmp107 *tmp104 *tmp106 - * jump *label84 equal *tmp107 false - * jump *label81 always -+ 444 jump *label81 notEqual *tmp107 false - 445 label *label84 - 446 label *label85 - 447 label *label82 - - 451 jump *label86 equal :fn9:firstUnit null - 452 label *label88 - 453 sensor *tmp112 @unit @controlled ++ 443 jump *label81 notEqual *tmp107 false + 444 label *label84 + 445 label *label85 + 446 label *label82 + + 450 jump *label86 equal :fn9:firstUnit null + 451 label *label88 + 452 sensor *tmp112 @unit @controlled - * jump *label91 notEqual *tmp112 0 - * jump *label81 always -+ 454 jump *label81 equal *tmp112 0 - 455 label *label91 - 456 label *label92 - 457 ubind *tmp3 - - 515 sensor *tmp154 @unit @controller - 516 op equal *tmp155 *tmp154 @this - 517 op land *tmp156 *tmp153 *tmp155 ++ 453 jump *label81 equal *tmp112 0 + 454 label *label91 + 455 label *label92 + 456 ubind *tmp3 + + 514 sensor *tmp154 @unit @controller + 515 op equal *tmp155 *tmp154 @this + 516 op land *tmp156 *tmp153 *tmp155 - * jump *label107 equal *tmp156 false - * jump *label104 always -+ 518 jump *label104 notEqual *tmp156 false - 519 label *label107 - 520 label *label108 - 521 label *label105 - - 525 jump *label109 equal :fn12:firstUnit null - 526 label *label111 - 527 sensor *tmp161 @unit @controlled ++ 517 jump *label104 notEqual *tmp156 false + 518 label *label107 + 519 label *label108 + 520 label *label105 + + 524 jump *label109 equal :fn12:firstUnit null + 525 label *label111 + 526 sensor *tmp161 @unit @controlled - * jump *label114 notEqual *tmp161 0 - * jump *label104 always -+ 528 jump *label104 equal *tmp161 0 - 529 label *label114 - 530 label *label115 - 531 ubind *tmp3 - - 551 sensor *tmp174 @unit @controller - 552 op equal *tmp175 *tmp174 @this - 553 op land *tmp176 *tmp173 *tmp175 ++ 527 jump *label104 equal *tmp161 0 + 528 label *label114 + 529 label *label115 + 530 ubind *tmp3 + + 549 sensor *tmp174 @unit @controller + 550 op equal *tmp175 *tmp174 @this + 551 op land *tmp176 *tmp173 *tmp175 - * jump *label120 equal *tmp176 false - * jump *label117 always -+ 554 jump *label117 notEqual *tmp176 false - 555 label *label120 - 556 label *label121 - 557 label *label118 - - 561 jump *label122 equal :fn14:firstUnit null - 562 label *label124 - 563 sensor *tmp181 @unit @controlled ++ 552 jump *label117 notEqual *tmp176 false + 553 label *label120 + 554 label *label121 + 555 label *label118 + + 559 jump *label122 equal :fn14:firstUnit null + 560 label *label124 + 561 sensor *tmp181 @unit @controlled - * jump *label127 notEqual *tmp181 0 - * jump *label117 always -+ 564 jump *label117 equal *tmp181 0 - 565 label *label127 - 566 label *label128 - 567 ubind *tmp3 - - 661 sensor *tmp223 @unit @controller - 662 op equal *tmp224 *tmp223 @this - 663 op land *tmp225 *tmp222 *tmp224 ++ 562 jump *label117 equal *tmp181 0 + 563 label *label127 + 564 label *label128 + 565 ubind *tmp3 + + 659 sensor *tmp223 @unit @controller + 660 op equal *tmp224 *tmp223 @this + 661 op land *tmp225 *tmp222 *tmp224 - * jump *label143 equal *tmp225 false - * jump *label140 always -+ 664 jump *label140 notEqual *tmp225 false - 665 label *label143 - 666 label *label144 - 667 label *label141 - - 671 jump *label145 equal :fn17:firstUnit null - 672 label *label147 - 673 sensor *tmp230 @unit @controlled ++ 662 jump *label140 notEqual *tmp225 false + 663 label *label143 + 664 label *label144 + 665 label *label141 + + 669 jump *label145 equal :fn17:firstUnit null + 670 label *label147 + 671 sensor *tmp230 @unit @controlled - * jump *label150 notEqual *tmp230 0 - * jump *label140 always -+ 674 jump *label140 equal *tmp230 0 - 675 label *label150 - 676 label *label151 - 677 ubind *tmp3 - - 804 sensor *tmp290 @unit @controller - 805 op equal *tmp291 *tmp290 @this - 806 op land *tmp292 *tmp289 *tmp291 ++ 672 jump *label140 equal *tmp230 0 + 673 label *label150 + 674 label *label151 + 675 ubind *tmp3 + + 802 sensor *tmp290 @unit @controller + 803 op equal *tmp291 *tmp290 @this + 804 op land *tmp292 *tmp289 *tmp291 - * jump *label182 equal *tmp292 false - * jump *label179 always -+ 807 jump *label179 notEqual *tmp292 false - 808 label *label182 - 809 label *label183 - 810 label *label180 - - 814 jump *label184 equal :fn19:firstUnit null - 815 label *label186 - 816 sensor *tmp297 @unit @controlled ++ 805 jump *label179 notEqual *tmp292 false + 806 label *label182 + 807 label *label183 + 808 label *label180 + + 812 jump *label184 equal :fn19:firstUnit null + 813 label *label186 + 814 sensor *tmp297 @unit @controlled - * jump *label189 notEqual *tmp297 0 - * jump *label179 always -+ 817 jump *label179 equal *tmp297 0 - 818 label *label189 - 819 label *label190 - 820 ubind *tmp3 - - 972 sensor *tmp364 @unit @controller - 973 op equal *tmp365 *tmp364 @this - 974 op land *tmp366 *tmp363 *tmp365 ++ 815 jump *label179 equal *tmp297 0 + 816 label *label189 + 817 label *label190 + 818 ubind *tmp3 + + 970 sensor *tmp364 @unit @controller + 971 op equal *tmp365 *tmp364 @this + 972 op land *tmp366 *tmp363 *tmp365 - * jump *label224 equal *tmp366 false - * jump *label221 always -+ 975 jump *label221 notEqual *tmp366 false - 976 label *label224 - 977 label *label225 - 978 label *label222 - - 982 jump *label226 equal :fn22:firstUnit null - 983 label *label228 - 984 sensor *tmp371 @unit @controlled ++ 973 jump *label221 notEqual *tmp366 false + 974 label *label224 + 975 label *label225 + 976 label *label222 + + 980 jump *label226 equal :fn22:firstUnit null + 981 label *label228 + 982 sensor *tmp371 @unit @controlled - * jump *label231 notEqual *tmp371 0 - * jump *label221 always -+ 985 jump *label221 equal *tmp371 0 - 986 label *label231 - 987 label *label232 - 988 ubind *tmp3 - - 1115 sensor *tmp431 @unit @controller - 1116 op equal *tmp432 *tmp431 @this - 1117 op land *tmp433 *tmp430 *tmp432 ++ 983 jump *label221 equal *tmp371 0 + 984 label *label231 + 985 label *label232 + 986 ubind *tmp3 + + 1113 sensor *tmp431 @unit @controller + 1114 op equal *tmp432 *tmp431 @this + 1115 op land *tmp433 *tmp430 *tmp432 - * jump *label263 equal *tmp433 false - * jump *label260 always -+ 1118 jump *label260 notEqual *tmp433 false - 1119 label *label263 - 1120 label *label264 - 1121 label *label261 - - 1125 jump *label265 equal :fn24:firstUnit null - 1126 label *label267 - 1127 sensor *tmp438 @unit @controlled ++ 1116 jump *label260 notEqual *tmp433 false + 1117 label *label263 + 1118 label *label264 + 1119 label *label261 + + 1123 jump *label265 equal :fn24:firstUnit null + 1124 label *label267 + 1125 sensor *tmp438 @unit @controlled - * jump *label270 notEqual *tmp438 0 - * jump *label260 always -+ 1128 jump *label260 equal *tmp438 0 - 1129 label *label270 - 1130 label *label271 - 1131 ubind *tmp3 ++ 1126 jump *label260 equal *tmp438 0 + 1127 label *label270 + 1128 label *label271 + 1129 ubind *tmp3 Modifications by Final phase, Jump Threading, iteration 1: + 0 label __start__ @@ -6017,167 +5954,167 @@ Modifications by Final phase, Jump Threading, iteration 1: 418 sensor *tmp92 @unit @controlled 419 jump *label68 equal *tmp92 0 - 449 label *label83 - 450 ubind *tmp3 - 451 set :fn9:firstUnit @unit + 448 label *label83 + 449 ubind *tmp3 + 450 set :fn9:firstUnit @unit - * jump *label86 equal :fn9:firstUnit null -+ 452 jump __start__ equal :fn9:firstUnit null - 453 label *label88 - 454 sensor *tmp112 @unit @controlled - 455 jump *label81 equal *tmp112 0 - - 523 label *label106 - 524 ubind *tmp3 - 525 set :fn12:firstUnit @unit ++ 451 jump __start__ equal :fn9:firstUnit null + 452 label *label88 + 453 sensor *tmp112 @unit @controlled + 454 jump *label81 equal *tmp112 0 + + 522 label *label106 + 523 ubind *tmp3 + 524 set :fn12:firstUnit @unit - * jump *label109 equal :fn12:firstUnit null -+ 526 jump __start__ equal :fn12:firstUnit null - 527 label *label111 - 528 sensor *tmp161 @unit @controlled - 529 jump *label104 equal *tmp161 0 - - 559 label *label119 - 560 ubind *tmp3 - 561 set :fn14:firstUnit @unit ++ 525 jump __start__ equal :fn12:firstUnit null + 526 label *label111 + 527 sensor *tmp161 @unit @controlled + 528 jump *label104 equal *tmp161 0 + + 557 label *label119 + 558 ubind *tmp3 + 559 set :fn14:firstUnit @unit - * jump *label122 equal :fn14:firstUnit null -+ 562 jump __start__ equal :fn14:firstUnit null - 563 label *label124 - 564 sensor *tmp181 @unit @controlled - 565 jump *label117 equal *tmp181 0 - - 627 op add :unitCheck @time 5000 - 628 label *label133 - 629 sensor *tmp211 switch1 @enabled ++ 560 jump __start__ equal :fn14:firstUnit null + 561 label *label124 + 562 sensor *tmp181 @unit @controlled + 563 jump *label117 equal *tmp181 0 + + 625 op add :unitCheck @time 5000 + 626 label *label133 + 627 sensor *tmp211 switch1 @enabled - * jump *label135 equal *tmp211 false -+ 630 jump __start__ equal *tmp211 false - 631 label *label321 - 632 set :start @time - 633 print " === [gold]Supplying Overdrive Dome[] === " - - 669 label *label142 - 670 ubind *tmp3 - 671 set :fn17:firstUnit @unit ++ 628 jump __start__ equal *tmp211 false + 629 label *label321 + 630 set :start @time + 631 print " === [gold]Supplying Overdrive Dome[] === " + + 667 label *label142 + 668 ubind *tmp3 + 669 set :fn17:firstUnit @unit - * jump *label145 equal :fn17:firstUnit null -+ 672 jump __start__ equal :fn17:firstUnit null - 673 label *label147 - 674 sensor *tmp230 @unit @controlled - 675 jump *label140 equal *tmp230 0 - - 723 jump *label164 lessThan *tmp254 .UNIT_CAPACITY - 724 ucontrol approach .DOME_X .DOME_Y 6 - 725 set :fn16:state 3 ++ 670 jump __start__ equal :fn17:firstUnit null + 671 label *label147 + 672 sensor *tmp230 @unit @controlled + 673 jump *label140 equal *tmp230 0 + + 721 jump *label164 lessThan *tmp254 .UNIT_CAPACITY + 722 ucontrol approach .DOME_X .DOME_Y 6 + 723 set :fn16:state 3 - * jump *label165 always -+ 726 jump *label163 always - 727 label *label164 - 728 set :fn16:msg ", loading\n" - 729 label *label165 - - 753 set :fn16:msg ", waiting\n" - 754 label *label171 - 755 sensor *tmp269 @unit @totalItems ++ 724 jump *label163 always + 725 label *label164 + 726 set :fn16:msg ", loading\n" + 727 label *label165 + + 751 set :fn16:msg ", waiting\n" + 752 label *label171 + 753 sensor *tmp269 @unit @totalItems - * jump *label172 greaterThan *tmp269 0 -+ 756 jump *label169 greaterThan *tmp269 0 - 757 ucontrol approach .CORE_X .CORE_Y 6 - 758 set :fn16:state 2 - 759 label *label172 - - 812 label *label181 - 813 ubind *tmp3 - 814 set :fn19:firstUnit @unit ++ 754 jump *label169 greaterThan *tmp269 0 + 755 ucontrol approach .CORE_X .CORE_Y 6 + 756 set :fn16:state 2 + 757 label *label172 + + 810 label *label181 + 811 ubind *tmp3 + 812 set :fn19:firstUnit @unit - * jump *label184 equal :fn19:firstUnit null -+ 815 jump __start__ equal :fn19:firstUnit null - 816 label *label186 - 817 sensor *tmp297 @unit @controlled - 818 jump *label179 equal *tmp297 0 - - 866 jump *label203 lessThan *tmp321 .UNIT_CAPACITY - 867 ucontrol approach .DOME_X .DOME_Y 6 - 868 set :fn18:state 3 ++ 813 jump __start__ equal :fn19:firstUnit null + 814 label *label186 + 815 sensor *tmp297 @unit @controlled + 816 jump *label179 equal *tmp297 0 + + 864 jump *label203 lessThan *tmp321 .UNIT_CAPACITY + 865 ucontrol approach .DOME_X .DOME_Y 6 + 866 set :fn18:state 3 - * jump *label204 always -+ 869 jump *label202 always - 870 label *label203 - 871 set :fn18:msg ", loading\n" - 872 label *label204 - - 896 set :fn18:msg ", waiting\n" - 897 label *label210 - 898 sensor *tmp336 @unit @totalItems ++ 867 jump *label202 always + 868 label *label203 + 869 set :fn18:msg ", loading\n" + 870 label *label204 + + 894 set :fn18:msg ", waiting\n" + 895 label *label210 + 896 sensor *tmp336 @unit @totalItems - * jump *label211 greaterThan *tmp336 0 -+ 899 jump *label208 greaterThan *tmp336 0 - 900 ucontrol approach .CORE_X .CORE_Y 6 - 901 set :fn18:state 2 - 902 label *label211 - - 980 label *label223 - 981 ubind *tmp3 - 982 set :fn22:firstUnit @unit ++ 897 jump *label208 greaterThan *tmp336 0 + 898 ucontrol approach .CORE_X .CORE_Y 6 + 899 set :fn18:state 2 + 900 label *label211 + + 978 label *label223 + 979 ubind *tmp3 + 980 set :fn22:firstUnit @unit - * jump *label226 equal :fn22:firstUnit null -+ 983 jump __start__ equal :fn22:firstUnit null - 984 label *label228 - 985 sensor *tmp371 @unit @controlled - 986 jump *label221 equal *tmp371 0 - - 1034 jump *label245 lessThan *tmp395 .UNIT_CAPACITY - 1035 ucontrol approach .DOME_X .DOME_Y 6 - 1036 set :fn21:state 3 ++ 981 jump __start__ equal :fn22:firstUnit null + 982 label *label228 + 983 sensor *tmp371 @unit @controlled + 984 jump *label221 equal *tmp371 0 + + 1032 jump *label245 lessThan *tmp395 .UNIT_CAPACITY + 1033 ucontrol approach .DOME_X .DOME_Y 6 + 1034 set :fn21:state 3 - * jump *label246 always -+ 1037 jump *label244 always - 1038 label *label245 - 1039 set :fn21:msg ", loading\n" - 1040 label *label246 - - 1064 set :fn21:msg ", waiting\n" - 1065 label *label252 - 1066 sensor *tmp410 @unit @totalItems ++ 1035 jump *label244 always + 1036 label *label245 + 1037 set :fn21:msg ", loading\n" + 1038 label *label246 + + 1062 set :fn21:msg ", waiting\n" + 1063 label *label252 + 1064 sensor *tmp410 @unit @totalItems - * jump *label253 greaterThan *tmp410 0 -+ 1067 jump *label250 greaterThan *tmp410 0 - 1068 ucontrol approach .CORE_X .CORE_Y 6 - 1069 set :fn21:state 2 - 1070 label *label253 - - 1123 label *label262 - 1124 ubind *tmp3 - 1125 set :fn24:firstUnit @unit ++ 1065 jump *label250 greaterThan *tmp410 0 + 1066 ucontrol approach .CORE_X .CORE_Y 6 + 1067 set :fn21:state 2 + 1068 label *label253 + + 1121 label *label262 + 1122 ubind *tmp3 + 1123 set :fn24:firstUnit @unit - * jump *label265 equal :fn24:firstUnit null -+ 1126 jump __start__ equal :fn24:firstUnit null - 1127 label *label267 - 1128 sensor *tmp438 @unit @controlled - 1129 jump *label260 equal *tmp438 0 - - 1177 jump *label284 lessThan *tmp462 .UNIT_CAPACITY - 1178 ucontrol approach .DOME_X .DOME_Y 6 - 1179 set :fn23:state 3 ++ 1124 jump __start__ equal :fn24:firstUnit null + 1125 label *label267 + 1126 sensor *tmp438 @unit @controlled + 1127 jump *label260 equal *tmp438 0 + + 1175 jump *label284 lessThan *tmp462 .UNIT_CAPACITY + 1176 ucontrol approach .DOME_X .DOME_Y 6 + 1177 set :fn23:state 3 - * jump *label285 always -+ 1180 jump *label283 always - 1181 label *label284 - 1182 set :fn23:msg ", loading\n" - 1183 label *label285 - - 1207 set :fn23:msg ", waiting\n" - 1208 label *label291 - 1209 sensor *tmp477 @unit @totalItems ++ 1178 jump *label283 always + 1179 label *label284 + 1180 set :fn23:msg ", loading\n" + 1181 label *label285 + + 1205 set :fn23:msg ", waiting\n" + 1206 label *label291 + 1207 sensor *tmp477 @unit @totalItems - * jump *label292 greaterThan *tmp477 0 -+ 1210 jump *label289 greaterThan *tmp477 0 - 1211 ucontrol approach .CORE_X .CORE_Y 6 - 1212 set :fn23:state 2 - 1213 label *label292 - - 1276 set :fn25:free 0 - 1277 ubind UNIT_TYPE - 1278 set :fn25:firstUnit @unit ++ 1208 jump *label289 greaterThan *tmp477 0 + 1209 ucontrol approach .CORE_X .CORE_Y 6 + 1210 set :fn23:state 2 + 1211 label *label292 + + 1274 set :fn25:free 0 + 1275 ubind UNIT_TYPE + 1276 set :fn25:firstUnit @unit - * jump *label301 equal :fn25:firstUnit null -+ 1279 jump *label313 equal :fn25:firstUnit null - 1280 set *tmp513 2 - 1281 set :fn26:unit @unit - 1282 sensor *tmp510 :fn26:unit @speed - - 1293 op or *tmp518 *tmp515 *tmp517 - 1294 jump *label309 equal *tmp518 false - 1295 op add :fn25:free :fn25:free 1 ++ 1277 jump *label313 equal :fn25:firstUnit null + 1278 set *tmp513 2 + 1279 set :fn26:unit @unit + 1280 sensor *tmp510 :fn26:unit @speed + + 1291 op or *tmp518 *tmp515 *tmp517 + 1292 jump *label309 equal *tmp518 false + 1293 op add :fn25:free :fn25:free 1 - * jump *label311 lessThan :fn25:free *tmp513 -+ 1296 jump *label310 lessThan :fn25:free *tmp513 - 1297 set *tmp501 true - 1298 jump *label300 always - 1299 label *label311 ++ 1294 jump *label310 lessThan :fn25:free *tmp513 + 1295 set *tmp501 true + 1296 jump *label300 always + 1297 label *label311 Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-18 instructions): @@ -6240,19 +6177,19 @@ Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-18 ins 349 print "[gold]Binding units..." 350 printflush message1 - 1279 jump *label310 lessThan :fn25:free *tmp513 - 1280 set *tmp501 true - 1281 jump *label300 always + 1277 jump *label310 lessThan :fn25:free *tmp513 + 1278 set *tmp501 true + 1279 jump *label300 always - * label *label311 - * label *label312 - * jump *label310 always - 1282 label *label309 - 1283 op add :fn25:occupied :fn25:occupied 1 - 1284 label *label310 + 1280 label *label309 + 1281 op add :fn25:occupied :fn25:occupied 1 + 1282 label *label310 - 1293 label *label301 - 1294 label *label302 - 1295 jump *label313 always + 1291 label *label301 + 1292 label *label302 + 1293 jump *label313 always - * print UNIT_TYPE - * print ":" - * print " occupied: " @@ -6266,9 +6203,9 @@ Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-18 ins - * label *label315 - * label *label316 - * print "\n" - 1296 label *label313 - 1297 label *label314 - 1298 set *tmp501 false + 1294 label *label313 + 1295 label *label314 + 1296 set *tmp501 false Modifications by Final phase, Dead Code Elimination, iteration 1 (-6 instructions): @@ -6312,13 +6249,13 @@ Modifications by Final phase, Dead Code Elimination, iteration 1 (-6 instruction 287 label *label396 288 set :fn3:needed 2 - 482 op sub *tmp141 .DOME_Y .CORE_Y - 483 op len *tmp142 *tmp140 *tmp141 - 484 op mul *tmp143 2 *tmp142 + 481 op sub *tmp141 .DOME_Y .CORE_Y + 482 op len *tmp142 *tmp140 *tmp141 + 483 op mul *tmp143 2 *tmp142 - * sensor *tmp144 .UNIT_S1 @speed - 485 op div :fn10:travel_time *tmp143 .SPEED - 486 op greaterThanEq *tmp139 :fn10:travel_time 47 - 487 label *label100 + 484 op div :fn10:travel_time *tmp143 .SPEED + 485 op greaterThanEq .FOUR_UNITS :fn10:travel_time 47 + 486 label *label100 Modifications by Final phase, Dead Code Elimination, iteration 2 (-5 instructions): @@ -6364,17 +6301,17 @@ Modifications by Final phase, Dead Code Elimination, iteration 2 (-5 instruction Modifications by Final phase, Single Step Elimination, iteration 1 (-2 instructions): - 1281 label *label308 - 1282 label *label301 - 1283 label *label302 + 1279 label *label308 + 1280 label *label301 + 1281 label *label302 - * jump *label313 always - 1284 label *label313 - 1285 label *label314 - 1286 set *tmp501 false + 1282 label *label313 + 1283 label *label314 + 1284 set *tmp501 false - 1296 sensor *tmp211 switch1 @enabled - 1297 jump *label321 notEqual *tmp211 false - 1298 label *label135 + 1294 sensor *tmp211 switch1 @enabled + 1295 jump *label321 notEqual *tmp211 false + 1296 label *label135 - * end Modifications by Final phase, Print Merging, iteration 1 (-75 instructions): @@ -6473,9 +6410,9 @@ Modifications by Final phase, Print Merging, iteration 1 (-75 instructions): 294 jump *label406 lessThanEq :fn3:needed 0 295 print ", needed: " - 581 jump __start__ equal *tmp211 false - 582 label *label321 - 583 set :start @time + 579 jump __start__ equal *tmp211 false + 580 label *label321 + 581 set :start @time - * print " === [gold]Supplying Overdrive Dome[] === " - * print "\n" - * print "\n" @@ -6485,33 +6422,33 @@ Modifications by Final phase, Print Merging, iteration 1 (-75 instructions): - * print "]" - * print "\n" - * print "\n[green]Silicon[] status:\n" -+ 584 print " === [gold]Supplying Overdrive Dome[] === \n\nUnit type: [green]{0}[]\n\n[green]Silicon[] status:\n" -+ 585 format *tmp3 - 586 sensor :fn15:level .DOME @silicon - 587 jump *label137 lessThanEq :fn15:level 3 ++ 582 print " === [gold]Supplying Overdrive Dome[] === \n\nUnit type: [green]{0}[]\n\n[green]Silicon[] status:\n" ++ 583 format *tmp3 + 584 sensor :fn15:level .DOME @silicon + 585 jump *label137 lessThanEq :fn15:level 3 - * print " dome: [green]" - * print :fn15:level - * print "[" - * print "]" - * print "\n" -+ 588 print " dome: [green]{0}[]\n" -+ 589 format :fn15:level - 590 jump *label138 always - 591 label *label137 ++ 586 print " dome: [green]{0}[]\n" ++ 587 format :fn15:level + 588 jump *label138 always + 589 label *label137 - * print " dome: [coral]" - * print :fn15:level - * print "[" - * print "]" - * print "\n" -+ 592 print " dome: [coral]{0}[]\n" -+ 593 format :fn15:level - 594 label *label138 - 595 label *label136 - 596 jump *label141 equal .UNIT_S1 null - - 712 label *label167 - 713 ucontrol flag :fn16:state - 714 sensor *tmp279 @unit @totalItems ++ 590 print " dome: [coral]{0}[]\n" ++ 591 format :fn15:level + 592 label *label138 + 593 label *label136 + 594 jump *label141 equal .UNIT_S1 null + + 710 label *label167 + 711 ucontrol flag :fn16:state + 712 sensor *tmp279 @unit @totalItems - * print " " - * print .GROUP1 - * print ":" @@ -6521,23 +6458,23 @@ Modifications by Final phase, Print Merging, iteration 1 (-75 instructions): - * print *tmp279 - * print "[" - * print "]" -+ 715 print " {0}: [gold]{0}[]" -+ 716 format .GROUP1 -+ 717 format *tmp279 - 718 jump *label174 lessThan :fn16:distance 0 - 719 print :fn16:msg - 720 print :fn16:distance ++ 713 print " {0}: [gold]{0}[]" ++ 714 format .GROUP1 ++ 715 format *tmp279 + 716 jump *label174 lessThan :fn16:distance 0 + 717 print :fn16:msg + 718 print :fn16:distance - * print "[" - * print "] sec" - * print "\n" -+ 721 print "[] sec\n" - 722 jump *label175 always - 723 label *label174 - 724 print :fn16:msg - - 847 label *label206 - 848 ucontrol flag :fn18:state - 849 sensor *tmp346 @unit @totalItems ++ 719 print "[] sec\n" + 720 jump *label175 always + 721 label *label174 + 722 print :fn16:msg + + 845 label *label206 + 846 ucontrol flag :fn18:state + 847 sensor *tmp346 @unit @totalItems - * print " " - * print .GROUP2 - * print ":" @@ -6547,46 +6484,46 @@ Modifications by Final phase, Print Merging, iteration 1 (-75 instructions): - * print *tmp346 - * print "[" - * print "]" -+ 850 print " {0}: [gold]{0}[]" -+ 851 format .GROUP2 -+ 852 format *tmp346 - 853 jump *label213 lessThan :fn18:distance 0 - 854 print :fn18:msg - 855 print :fn18:distance ++ 848 print " {0}: [gold]{0}[]" ++ 849 format .GROUP2 ++ 850 format *tmp346 + 851 jump *label213 lessThan :fn18:distance 0 + 852 print :fn18:msg + 853 print :fn18:distance - * print "[" - * print "] sec" - * print "\n" -+ 856 print "[] sec\n" - 857 jump *label214 always - 858 label *label213 - 859 print :fn18:msg - - 874 print "\n[green]Phase fabric[] status:\n" - 875 sensor :fn20:level .DOME @phase-fabric - 876 jump *label218 lessThanEq :fn20:level 3 ++ 854 print "[] sec\n" + 855 jump *label214 always + 856 label *label213 + 857 print :fn18:msg + + 872 print "\n[green]Phase fabric[] status:\n" + 873 sensor :fn20:level .DOME @phase-fabric + 874 jump *label218 lessThanEq :fn20:level 3 - * print " dome: [green]" - * print :fn20:level - * print "[" - * print "]" - * print "\n" -+ 877 print " dome: [green]{0}[]\n" -+ 878 format :fn20:level - 879 jump *label219 always - 880 label *label218 ++ 875 print " dome: [green]{0}[]\n" ++ 876 format :fn20:level + 877 jump *label219 always + 878 label *label218 - * print " dome: [coral]" - * print :fn20:level - * print "[" - * print "]" - * print "\n" -+ 881 print " dome: [coral]{0}[]\n" -+ 882 format :fn20:level - 883 label *label219 - 884 label *label217 - 885 jump *label222 equal .UNIT_P1 null - - 1001 label *label248 - 1002 ucontrol flag :fn21:state - 1003 sensor *tmp420 @unit @totalItems ++ 879 print " dome: [coral]{0}[]\n" ++ 880 format :fn20:level + 881 label *label219 + 882 label *label217 + 883 jump *label222 equal .UNIT_P1 null + + 999 label *label248 + 1000 ucontrol flag :fn21:state + 1001 sensor *tmp420 @unit @totalItems - * print " " - * print .GROUP1 - * print ":" @@ -6596,23 +6533,23 @@ Modifications by Final phase, Print Merging, iteration 1 (-75 instructions): - * print *tmp420 - * print "[" - * print "]" -+ 1004 print " {0}: [gold]{0}[]" -+ 1005 format .GROUP1 -+ 1006 format *tmp420 - 1007 jump *label255 lessThan :fn21:distance 0 - 1008 print :fn21:msg - 1009 print :fn21:distance ++ 1002 print " {0}: [gold]{0}[]" ++ 1003 format .GROUP1 ++ 1004 format *tmp420 + 1005 jump *label255 lessThan :fn21:distance 0 + 1006 print :fn21:msg + 1007 print :fn21:distance - * print "[" - * print "] sec" - * print "\n" -+ 1010 print "[] sec\n" - 1011 jump *label256 always - 1012 label *label255 - 1013 print :fn21:msg - - 1136 label *label287 - 1137 ucontrol flag :fn23:state - 1138 sensor *tmp487 @unit @totalItems ++ 1008 print "[] sec\n" + 1009 jump *label256 always + 1010 label *label255 + 1011 print :fn21:msg + + 1134 label *label287 + 1135 ucontrol flag :fn23:state + 1136 sensor *tmp487 @unit @totalItems - * print " " - * print .GROUP2 - * print ":" @@ -6622,33 +6559,33 @@ Modifications by Final phase, Print Merging, iteration 1 (-75 instructions): - * print *tmp487 - * print "[" - * print "]" -+ 1139 print " {0}: [gold]{0}[]" -+ 1140 format .GROUP2 -+ 1141 format *tmp487 - 1142 jump *label294 lessThan :fn23:distance 0 - 1143 print :fn23:msg - 1144 print :fn23:distance ++ 1137 print " {0}: [gold]{0}[]" ++ 1138 format .GROUP2 ++ 1139 format *tmp487 + 1140 jump *label294 lessThan :fn23:distance 0 + 1141 print :fn23:msg + 1142 print :fn23:distance - * print "[" - * print "] sec" - * print "\n" -+ 1145 print "[] sec\n" - 1146 jump *label295 always - 1147 label *label294 - 1148 print :fn23:msg - - 1162 label *label258 - 1163 op sub *tmp495 @time :start - 1164 op floor *tmp496 *tmp495 ++ 1143 print "[] sec\n" + 1144 jump *label295 always + 1145 label *label294 + 1146 print :fn23:msg + + 1160 label *label258 + 1161 op sub *tmp495 @time :start + 1162 op floor *tmp496 *tmp495 - * print "\n" - * print "[lightgray]Loop time: " - * print *tmp496 - * print " " - * print "ms" -+ 1165 print "\n[lightgray]Loop time: {0} ms" -+ 1166 format *tmp496 - 1167 printflush message1 - 1168 op notEqual *tmp497 *tmp3 UNIT_TYPE - 1169 op greaterThan *tmp498 :unitCheck @time ++ 1163 print "\n[lightgray]Loop time: {0} ms" ++ 1164 format *tmp496 + 1165 printflush message1 + 1166 op notEqual *tmp497 *tmp3 UNIT_TYPE + 1167 op greaterThan *tmp498 :unitCheck @time Final code before resolving virtual instructions: @@ -6961,8 +6898,7 @@ jump *label75 notEqual *tmp98 false end label *label68 ucontrol flag 1 0 0 0 0 -set *tmp79 @unit -set .UNIT_S1 *tmp79 +set .UNIT_S1 @unit jump *label82 equal .UNIT_P1 null ubind .UNIT_P1 sensor *tmp103 @unit @dead @@ -6987,16 +6923,16 @@ jump *label88 notEqual *tmp118 false end label *label81 ucontrol flag 1 0 0 0 0 -set *tmp99 @unit -set .UNIT_P1 *tmp99 -sensor *tmp119 *tmp79 @firstItem +set .UNIT_P1 @unit +sensor *tmp119 .UNIT_S1 @firstItem op equal *tmp120 *tmp119 @phase-fabric -sensor *tmp121 *tmp99 @firstItem +sensor *tmp121 .UNIT_P1 @firstItem op equal *tmp122 *tmp121 @silicon op or *tmp123 *tmp120 *tmp122 jump *label93 equal *tmp123 false -set .UNIT_S1 *tmp99 -set .UNIT_P1 *tmp79 +set :u .UNIT_S1 +set .UNIT_S1 .UNIT_P1 +set .UNIT_P1 :u label *label93 sensor .UNIT_CAPACITY .UNIT_S1 @itemCapacity sensor .SPEED .UNIT_S1 @speed @@ -7019,8 +6955,8 @@ op sub *tmp141 .DOME_Y .CORE_Y op len *tmp142 *tmp140 *tmp141 op mul *tmp143 2 *tmp142 op div :fn10:travel_time *tmp143 .SPEED -op greaterThanEq *tmp139 :fn10:travel_time 47 -jump *label101 equal *tmp139 false +op greaterThanEq .FOUR_UNITS :fn10:travel_time 47 +jump *label101 equal .FOUR_UNITS false jump *label105 equal .UNIT_S2 null ubind .UNIT_S2 sensor *tmp152 @unit @dead @@ -7045,8 +6981,7 @@ jump *label111 notEqual *tmp167 false end label *label104 ucontrol flag 1 0 0 0 0 -set *tmp148 @unit -set .UNIT_S2 *tmp148 +set .UNIT_S2 @unit jump *label118 equal .UNIT_P2 null ubind .UNIT_P2 sensor *tmp172 @unit @dead @@ -7071,26 +7006,26 @@ jump *label124 notEqual *tmp187 false end label *label117 ucontrol flag 1 0 0 0 0 -set *tmp168 @unit -set .UNIT_P2 *tmp168 +set .UNIT_P2 @unit sensor *tmp188 .UNIT_S1 @firstItem op equal *tmp189 *tmp188 @phase-fabric -sensor *tmp190 *tmp168 @firstItem +sensor *tmp190 .UNIT_P2 @firstItem op notEqual *tmp191 *tmp190 @phase-fabric op land *tmp192 *tmp189 *tmp191 jump *label129 equal *tmp192 false set :u .UNIT_S1 -set .UNIT_S1 *tmp168 +set .UNIT_S1 .UNIT_P2 set .UNIT_P2 :u label *label129 -sensor *tmp194 *tmp148 @firstItem +sensor *tmp194 .UNIT_S2 @firstItem op equal *tmp195 *tmp194 @phase-fabric sensor *tmp196 .UNIT_P2 @firstItem op equal *tmp197 *tmp196 @silicon op or *tmp198 *tmp195 *tmp197 jump *label131 equal *tmp198 false +set :u .UNIT_S2 set .UNIT_S2 .UNIT_P2 -set .UNIT_P2 *tmp148 +set .UNIT_P2 :u label *label131 set .GROUP1 "unit 1" set .GROUP2 "unit 2" @@ -7105,7 +7040,7 @@ set .UNIT_P2 null set .GROUP1 "unit" set .GROUP2 "" label *label102 -op equal *tmp200 *tmp139 false +op equal *tmp200 .FOUR_UNITS false sensor *tmp201 .UNIT_S1 @totalItems sensor *tmp202 .UNIT_S2 @totalItems op lessThan *tmp203 *tmp201 *tmp202 @@ -7246,7 +7181,7 @@ print :fn16:msg label *label175 set *tmp217 @unit set .UNIT_S1 *tmp217 -jump *label176 equal *tmp139 false +jump *label176 equal .FOUR_UNITS false op equal *tmp283 .SUPPLY_S_FIRST false jump *label180 equal .UNIT_S2 null ubind .UNIT_S2 @@ -7499,7 +7434,7 @@ print :fn21:msg label *label256 set *tmp358 @unit set .UNIT_P1 *tmp358 -jump *label257 equal *tmp139 false +jump *label257 equal .FOUR_UNITS false op equal *tmp424 .SUPPLY_P_FIRST false jump *label261 equal .UNIT_P2 null ubind .UNIT_P2 diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/item-counter-micro-00.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/item-counter-micro-00.log index 93f73eaa..9aa5e448 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/item-counter-micro-00.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/item-counter-micro-00.log @@ -6,7 +6,7 @@ 17 instructions eliminated by Jump Optimization (3 iterations). 22 instructions eliminated by Single Step Elimination (2 passes, 5 iterations). 2 instructions eliminated by Expression Optimization (2 iterations). - 9 instructions eliminated by Data Flow Optimization (7 iterations). + 9 instructions eliminated by Data Flow Optimization (9 iterations). 1 instructions added by Loop Optimization (2 iterations). 1 loops improved by Loop Optimization. 3 instructions eliminated by Jump Straightening (3 iterations). @@ -946,7 +946,34 @@ Modifications by Iterated phase, Expression Optimization, pass 1, iteration 1 (- 220 print *tmp87 221 print " " -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 instructions): + + 89 set :b3 :b4 + 90 set :b2 :b3 + 91 set :b1 :b2 +- * set :a4 :b1 +- * set :a3 :a4 +- * set :a2 :a3 +- * set :a1 :a2 ++ 92 set :a3 :b1 ++ 93 set :a1 :a3 + 94 set :ratePerMin 0 + 95 set :startTime @time + 96 label *label19 + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 instructions): + + 89 set :b3 :b4 + 90 set :b2 :b3 + 91 set :b1 :b2 +- * set :a3 :b1 +- * set :a1 :a3 ++ 92 set :a1 :b1 + 93 set :ratePerMin 0 + 94 set :startTime @time + 95 label *label19 + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3: 2 set :lastCell 0 3 label *label0 @@ -977,53 +1004,47 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * set :b3 :b4 - * set :b2 :b3 - * set :b1 :b2 -- * set :a4 :b1 -- * set :a3 :a4 -- * set :a2 :a3 -- * set :a1 :a2 +- * set :a1 :b1 + 89 set :b3 0 + 90 set :b2 :b4 + 91 set :b1 :b3 -+ 92 set :a4 :b2 -+ 93 set :a3 :b1 -+ 94 set :a2 :a4 -+ 95 set :a1 :a3 - 96 set :ratePerMin 0 - 97 set :startTime @time - 98 label *label19 - - 133 op div :rate .BATCH :duration - 134 set *tmp46 :lastCell - 135 op mul *tmp48 :rate 166.66666666666666 ++ 92 set :a1 :b2 + 93 set :ratePerMin 0 + 94 set :startTime @time + 95 label *label19 + + 130 op div :rate .BATCH :duration + 131 set *tmp46 :lastCell + 132 op mul *tmp48 :rate 166.66666666666666 - * write *tmp48 .MEMORY *tmp46 -+ 136 write *tmp48 .MEMORY :lastCell - 137 op idiv :ratePerMin :rate 0.0000016666666666666667 ++ 133 write *tmp48 .MEMORY :lastCell + 134 op idiv :ratePerMin :rate 0.0000016666666666666667 - * jump *label40 greaterThan :duration .BATCH_DURATION - * op add *tmp53 .BATCH .BATCH_STEP -+ 138 jump *label40 greaterThan :duration 2000 -+ 139 op add *tmp53 .BATCH 1 - 140 op min .BATCH *tmp53 .EFF_MAX_BATCH - 141 op mul .BATCH_TXT .BATCH 10 - 142 label *label40 ++ 135 jump *label40 greaterThan :duration 2000 ++ 136 op add *tmp53 .BATCH 1 + 137 op min .BATCH *tmp53 .EFF_MAX_BATCH + 138 op mul .BATCH_TXT .BATCH 10 + 139 label *label40 - 199 op mul .BATCH_TXT .BATCH 10 - 200 op add :limit :batches .BATCH - 201 set *tmp82 :lastCell + 196 op mul .BATCH_TXT .BATCH 10 + 197 op add :limit :batches .BATCH + 198 set *tmp82 :lastCell - * write 0 .MEMORY *tmp82 -+ 202 write 0 .MEMORY :lastCell - 203 set :ratePerMin 0 - 204 set :startTime @time - 205 label *label58 - - 230 label *label21 - 231 control enabled switch1 0 - 232 set *tmp91 :lastCell ++ 199 write 0 .MEMORY :lastCell + 200 set :ratePerMin 0 + 201 set :startTime @time + 202 label *label58 + + 227 label *label21 + 228 control enabled switch1 0 + 229 set *tmp91 :lastCell - * write 0 .MEMORY *tmp91 -+ 233 write 0 .MEMORY :lastCell - 234 write 0 .MEMORY 0 - 235 end ++ 230 write 0 .MEMORY :lastCell + 231 write 0 .MEMORY 0 + 232 end -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-5 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-5 instructions): 3 label *label0 4 set .CONV4 null @@ -1056,45 +1077,39 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-5 87 set :b3 0 - * set :b2 :b4 - * set :b1 :b3 -- * set :a4 :b2 -- * set :a3 :b1 -- * set :a2 :a4 -- * set :a1 :a3 +- * set :a1 :b2 + 88 set :b2 0 + 89 set :b1 0 -+ 90 set :a4 :b4 -+ 91 set :a3 :b3 -+ 92 set :a2 :b2 -+ 93 set :a1 :b1 - 94 set :ratePerMin 0 - 95 set :startTime @time - 96 label *label19 - - 129 op sub :duration @time :startTime - 130 set :startTime @time - 131 op div :rate .BATCH :duration ++ 90 set :a1 :b4 + 91 set :ratePerMin 0 + 92 set :startTime @time + 93 label *label19 + + 126 op sub :duration @time :startTime + 127 set :startTime @time + 128 op div :rate .BATCH :duration - * set *tmp46 :lastCell - 132 op mul *tmp48 :rate 166.66666666666666 - 133 write *tmp48 .MEMORY :lastCell - 134 op idiv :ratePerMin :rate 0.0000016666666666666667 + 129 op mul *tmp48 :rate 166.66666666666666 + 130 write *tmp48 .MEMORY :lastCell + 131 op idiv :ratePerMin :rate 0.0000016666666666666667 - 195 op max .BATCH *tmp78 .EFF_MIN_BATCH - 196 op mul .BATCH_TXT .BATCH 10 - 197 op add :limit :batches .BATCH + 192 op max .BATCH *tmp78 .EFF_MIN_BATCH + 193 op mul .BATCH_TXT .BATCH 10 + 194 op add :limit :batches .BATCH - * set *tmp82 :lastCell - 198 write 0 .MEMORY :lastCell - 199 set :ratePerMin 0 - 200 set :startTime @time + 195 write 0 .MEMORY :lastCell + 196 set :ratePerMin 0 + 197 set :startTime @time - 225 jump *label19 always - 226 label *label21 - 227 control enabled switch1 0 + 222 jump *label19 always + 223 label *label21 + 224 control enabled switch1 0 - * set *tmp91 :lastCell - 228 write 0 .MEMORY :lastCell - 229 write 0 .MEMORY 0 - 230 end + 225 write 0 .MEMORY :lastCell + 226 write 0 .MEMORY 0 + 227 end -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3: +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 5: 5 set .CONV3 null 6 set .CONV2 null @@ -1108,26 +1123,17 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3: 87 set :b3 0 88 set :b2 0 89 set :b1 0 -- * set :a4 :b4 -- * set :a3 :b3 -- * set :a2 :b2 -- * set :a1 :b1 -+ 90 set :a4 0 -+ 91 set :a3 0 -+ 92 set :a2 0 -+ 93 set :a1 0 - 94 set :ratePerMin 0 - 95 set :startTime @time - 96 label *label19 +- * set :a1 :b4 ++ 90 set :a1 0 + 91 set :ratePerMin 0 + 92 set :startTime @time + 93 label *label19 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-4 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 6 (-1 instructions): 87 set :b3 0 88 set :b2 0 89 set :b1 0 -- * set :a4 0 -- * set :a3 0 -- * set :a2 0 - * set :a1 0 90 set :ratePerMin 0 91 set :startTime @time diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/regulator-00.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/regulator-00.log index 0e87490b..20938522 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/regulator-00.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/regulator-00.log @@ -6,7 +6,7 @@ 10 instructions eliminated by Jump Optimization (4 iterations). 10 instructions eliminated by Single Step Elimination (3 passes, 7 iterations). 3 instructions eliminated by If Expression Optimization (3 iterations). - 9 instructions eliminated by Data Flow Optimization (2 passes, 9 iterations). + 9 instructions eliminated by Data Flow Optimization (2 passes, 11 iterations). 1 instructions added by Loop Optimization (3 iterations). 3 loops improved by Loop Optimization. 7 instructions eliminated by Jump Straightening (4 iterations). @@ -718,124 +718,140 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 223 print :block 224 op add :n :n 1 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 instructions): + + 5 set .STATE null + 6 set .START .SWITCH + 7 set .SENSOR .STATE +- * set .ON .START ++ 8 set .MAXIMUM .START + 9 set .MESSAGE .SENSOR +- * set .MAXIMUM .ON + 10 set .ACTIVE_TEXT .MESSAGE + 11 label *label0 + 12 print "Configuring regulator..." + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-2 instructions): 3 set .SORTER null 4 set .SWITCH null 5 set .STATE null - * set .START .SWITCH - * set .SENSOR .STATE -- * set .ON .START +- * set .MAXIMUM .START - * set .MESSAGE .SENSOR -- * set .MAXIMUM .ON - * set .ACTIVE_TEXT .MESSAGE + 6 set .START null + 7 set .SENSOR null -+ 8 set .ON .SWITCH ++ 8 set .MAXIMUM .SWITCH + 9 set .MESSAGE .STATE -+ 10 set .MAXIMUM .START -+ 11 set .ACTIVE_TEXT .SENSOR - 12 label *label0 - 13 print "Configuring regulator..." - 14 print "\n" - - 106 sensor *tmp14 .SORTER @type - 107 op strictEqual .INVERTED *tmp14 @inverted-sorter - 108 set :fn0:newState true ++ 10 set .ACTIVE_TEXT .SENSOR + 11 label *label0 + 12 print "Configuring regulator..." + 13 print "\n" + + 105 sensor *tmp14 .SORTER @type + 106 op strictEqual .INVERTED *tmp14 @inverted-sorter + 107 set :fn0:newState true - * jump *label24 equal .STATE true -+ 109 jump *label24 equal null true - 110 set .STATE true ++ 108 jump *label24 equal null true + 109 set .STATE true - * op xor .ON .INVERTED :fn0:newState -+ 111 op xor .ON .INVERTED true - 112 jump *label26 equal .ON false - 113 set *tmp20 "\nCurrently active:[green]" - 114 jump *label27 always - - 120 label *label25 - 121 label *label23 - 122 set .CYCLES 0 ++ 110 op xor .ON .INVERTED true + 111 jump *label26 equal .ON false + 112 set *tmp20 "\nCurrently active:[green]" + 113 jump *label27 always + + 119 label *label25 + 120 label *label23 + 121 set .CYCLES 0 - * set *tmp21 .SWITCH - 123 control enabled .SWITCH 0 - 124 label *label28 - 125 sensor *tmp23 .SWITCH @enabled + 122 control enabled .SWITCH 0 + 123 label *label28 + 124 sensor *tmp23 .SWITCH @enabled - 150 jump *label36 equal .STATE true - 151 set .STATE true - 152 op add .CYCLES .CYCLES 1 + 149 jump *label36 equal .STATE true + 150 set .STATE true + 151 op add .CYCLES .CYCLES 1 - * op xor .ON .INVERTED :fn1:newState -+ 153 op xor .ON .INVERTED true - 154 jump *label38 equal .ON false - 155 set *tmp41 "\nCurrently active:[green]" - 156 jump *label39 always - - 168 jump *label43 equal .STATE false - 169 set .STATE false - 170 op add .CYCLES .CYCLES 1 ++ 152 op xor .ON .INVERTED true + 153 jump *label38 equal .ON false + 154 set *tmp41 "\nCurrently active:[green]" + 155 jump *label39 always + + 167 jump *label43 equal .STATE false + 168 set .STATE false + 169 op add .CYCLES .CYCLES 1 - * op xor .ON .INVERTED :fn2:newState -+ 171 op xor .ON .INVERTED false - 172 jump *label45 equal .ON false - 173 set *tmp48 "\nCurrently active:[green]" - 174 jump *label46 always - - 216 label *label49 - 217 jump *label51 greaterThanEq :n @links - 218 getlink :block :n ++ 170 op xor .ON .INVERTED false + 171 jump *label45 equal .ON false + 172 set *tmp48 "\nCurrently active:[green]" + 173 jump *label46 always + + 215 label *label49 + 216 jump *label51 greaterThanEq :n @links + 217 getlink :block :n - * set *tmp52 :block - 219 control enabled :block .ON - 220 print "\n " - 221 print :block + 218 control enabled :block .ON + 219 print "\n " + 220 print :block -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-3 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-1 instructions): - 5 set .STATE null + 2 set .CONTAINER null + 3 set .SORTER null + 4 set .SWITCH null +- * set .STATE null ++ 5 set .MESSAGE null 6 set .START null 7 set .SENSOR null -- * set .ON .SWITCH + 8 set .MAXIMUM .SWITCH - * set .MESSAGE .STATE -- * set .MAXIMUM .START + 9 set .ACTIVE_TEXT .SENSOR + 10 label *label0 + 11 print "Configuring regulator..." + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 5 (-3 instructions): + + 5 set .MESSAGE null + 6 set .START null + 7 set .SENSOR null +- * set .MAXIMUM .SWITCH - * set .ACTIVE_TEXT .SENSOR -+ 8 set .ON null -+ 9 set .MESSAGE null -+ 10 set .MAXIMUM null -+ 11 set .ACTIVE_TEXT null - 12 label *label0 - 13 print "Configuring regulator..." - 14 print "\n" ++ 8 set .MAXIMUM null ++ 9 set .ACTIVE_TEXT null + 10 label *label0 + 11 print "Configuring regulator..." + 12 print "\n" - 105 label *label2 - 106 sensor *tmp14 .SORTER @type - 107 op strictEqual .INVERTED *tmp14 @inverted-sorter + 103 label *label2 + 104 sensor *tmp14 .SORTER @type + 105 op strictEqual .INVERTED *tmp14 @inverted-sorter - * set :fn0:newState true - 108 jump *label24 equal null true - 109 set .STATE true - 110 op xor .ON .INVERTED true + 106 jump *label24 equal null true + 107 set .STATE true + 108 op xor .ON .INVERTED true - 145 op mul *tmp33 100 :amount - 146 op idiv :pct *tmp33 :max - 147 jump *label33 greaterThan :pct PCT_LOW + 143 op mul *tmp33 100 :amount + 144 op idiv :pct *tmp33 :max + 145 jump *label33 greaterThan :pct PCT_LOW - * set :fn1:newState true - 148 jump *label36 equal .STATE true - 149 set .STATE true - 150 op add .CYCLES .CYCLES 1 + 146 jump *label36 equal .STATE true + 147 set .STATE true + 148 op add .CYCLES .CYCLES 1 - 162 jump *label34 always - 163 label *label33 - 164 jump *label40 lessThan :pct PCT_HIGH + 160 jump *label34 always + 161 label *label33 + 162 jump *label40 lessThan :pct PCT_HIGH - * set :fn2:newState false - 165 jump *label43 equal .STATE false - 166 set .STATE false - 167 op add .CYCLES .CYCLES 1 + 163 jump *label43 equal .STATE false + 164 set .STATE false + 165 op add .CYCLES .CYCLES 1 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-3 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 6 (-1 instructions): - 2 set .CONTAINER null - 3 set .SORTER null - 4 set .SWITCH null -- * set .STATE null - 5 set .START null - 6 set .SENSOR null -- * set .ON null - 7 set .MESSAGE null + 6 set .START null + 7 set .SENSOR null 8 set .MAXIMUM null - * set .ACTIVE_TEXT null 9 label *label0 @@ -1035,7 +1051,7 @@ Modifications by Final phase, Single Step Elimination, iteration 1 (-1 instructi Modifications by Final phase, Print Merging, iteration 1 (-35 instructions): - 8 set .MESSAGE null + 8 set .SENSOR null 9 set .MAXIMUM null 10 label *label0 - * print "Configuring regulator..." @@ -1169,9 +1185,9 @@ set PCT_HIGH 80 set .CONTAINER null set .SORTER null set .SWITCH null +set .MESSAGE null set .START null set .SENSOR null -set .MESSAGE null set .MAXIMUM null label *label0 print "Configuring regulator...\n" diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/unit-transport-flow-rate-00.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/unit-transport-flow-rate-00.log index e5e06c97..6fe6fe6a 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/unit-transport-flow-rate-00.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/optimizer/unit-transport-flow-rate-00.log @@ -4,18 +4,18 @@ 3 instructions eliminated by Jump Optimization (4 iterations). 2 instructions eliminated by Single Step Elimination (2 passes, 6 iterations). 1 instructions eliminated by Expression Optimization (2 passes, 3 iterations). - 19 instructions eliminated by Data Flow Optimization (3 passes, 11 iterations). + 20 instructions eliminated by Data Flow Optimization (3 passes, 12 iterations). 13 instructions added by Loop Optimization (3 iterations). 3 loops improved by Loop Optimization. 1 instructions updated by JumpThreading. 11 instructions eliminated by Print Merging. - 84 instructions after optimizations. + 83 instructions after optimizations. -Pass 1: speed optimization selection (cost limit 916): +Pass 1: speed optimization selection (cost limit 917): * Replicate loop condition at line 17:1 cost 5, benefit 25.0, efficiency 5.0 (+5 instructions) Replicate loop condition at line 38:1 cost 8, benefit 25.0, efficiency 3.1 -Pass 1: speed optimization selection (cost limit 911): +Pass 1: speed optimization selection (cost limit 912): * Replicate loop condition at line 38:1 cost 8, benefit 25.0, efficiency 3.1 (+8 instructions) Modifications by Initial phase, Dead Code Elimination, iteration 1 (-4 instructions): @@ -202,7 +202,32 @@ Modifications by Iterated phase, Expression Optimization, pass 1, iteration 1 (- 82 op sub :elapsed @time :start 83 print "Measured interval: " -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 instructions): + 0 set .DELAY 1000 + 1 set .SAMPLES 10 + 2 set .IND_SHIPPED 511 +- * set .IND_MULTIPLIER 510 ++ 3 set *tmp8 510 + 4 set .IND_SESSION_KEY 509 + 5 set .IND_TIME 508 + 6 set .IND_FLOW_RATE 507 + + 25 jump *label0 always + 26 label *label2 + 27 set *tmp6 .IND_SHIPPED +- * read :shipped .BANK *tmp6 +- * set *tmp8 .IND_MULTIPLIER ++ 28 read :last_total .BANK *tmp6 + 29 read .MULTIPLIER .BANK *tmp8 + 30 set *tmp10 .IND_SESSION_KEY + 31 read .SESSION_KEY .BANK *tmp10 + 32 sensor :item .SORTER @config +- * set :last_total :shipped + 33 set :index 0 + 34 set .MILLIS 0 + 35 set :level 0 + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2: 4 set .IND_SESSION_KEY 509 5 set .IND_TIME 508 @@ -217,166 +242,160 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 25 jump *label0 always 26 label *label2 - * set *tmp6 .IND_SHIPPED -- * read :shipped .BANK *tmp6 -- * set *tmp8 .IND_MULTIPLIER +- * read :last_total .BANK *tmp6 - * read .MULTIPLIER .BANK *tmp8 - * set *tmp10 .IND_SESSION_KEY - * read .SESSION_KEY .BANK *tmp10 + 27 set *tmp6 511 -+ 28 read :shipped .BANK .IND_SHIPPED -+ 29 set *tmp8 510 -+ 30 read .MULTIPLIER .BANK .IND_MULTIPLIER -+ 31 set *tmp10 509 -+ 32 read .SESSION_KEY .BANK .IND_SESSION_KEY - 33 sensor :item .SORTER @config - 34 set :last_total :shipped - 35 set :index 0 ++ 28 read :last_total .BANK .IND_SHIPPED ++ 29 read .MULTIPLIER .BANK 510 ++ 30 set *tmp10 509 ++ 31 read .SESSION_KEY .BANK .IND_SESSION_KEY + 32 sensor :item .SORTER @config + 33 set :index 0 + 34 set .MILLIS 0 - 42 sensor *tmp15 .VAULT @dead - 43 op strictEqual *tmp16 *tmp15 0 - 44 op land *tmp17 *tmp14 *tmp16 + 40 sensor *tmp15 .VAULT @dead + 41 op strictEqual *tmp16 *tmp15 0 + 42 op land *tmp17 *tmp14 *tmp16 - * set *tmp18 .IND_SESSION_KEY - * read *tmp19 .BANK *tmp18 -+ 45 set *tmp18 509 -+ 46 read *tmp19 .BANK .IND_SESSION_KEY - 47 op strictEqual *tmp20 .SESSION_KEY *tmp19 - 48 op land *tmp21 *tmp17 *tmp20 - 49 jump *label5 equal *tmp21 false - 50 set :start @time ++ 43 set *tmp18 509 ++ 44 read *tmp19 .BANK .IND_SESSION_KEY + 45 op strictEqual *tmp20 .SESSION_KEY *tmp19 + 46 op land *tmp21 *tmp17 *tmp20 + 47 jump *label5 equal *tmp21 false + 48 set :start @time - * op add :wait :wait .DELAY -+ 51 op add :wait :wait 1000 - 52 jump *label6 lessThanEq :start :wait - 53 print "Wait reset\n" ++ 49 op add :wait :wait 1000 + 50 jump *label6 lessThanEq :start :wait + 51 print "Wait reset\n" - * op add :wait :start .DELAY -+ 54 op add :wait :start 1000 - 55 label *label6 - 56 label *label7 ++ 52 op add :wait :start 1000 + 53 label *label6 + 54 label *label7 - * set *tmp27 .IND_SHIPPED - * read :shipped .BANK *tmp27 -+ 57 set *tmp27 511 -+ 58 read :shipped .BANK .IND_SHIPPED - 59 sensor :item .SORTER @config ++ 55 set *tmp27 511 ++ 56 read :shipped .BANK .IND_SHIPPED + 57 sensor :item .SORTER @config - * op add :total :level :shipped - * jump *label8 greaterThanEq .MILLIS .TOTAL_MILLIS - * op add .MILLIS .MILLIS .DELAY -+ 60 op add :total 0 :shipped -+ 61 jump *label8 greaterThanEq .MILLIS 10000 -+ 62 op add .MILLIS .MILLIS 1000 - 63 op mul .SIGN_MILLIS .MULTIPLIER .MILLIS - 64 jump *label9 always - 65 label *label8 - 66 set *tmp34 :index ++ 58 op add :total 0 :shipped ++ 59 jump *label8 greaterThanEq .MILLIS 10000 ++ 60 op add .MILLIS .MILLIS 1000 + 61 op mul .SIGN_MILLIS .MULTIPLIER .MILLIS + 62 jump *label9 always + 63 label *label8 + 64 set *tmp34 :index - * read :last_total .BANK *tmp34 -+ 67 read :last_total .BANK :index - 68 label *label9 - 69 set *tmp36 :index ++ 65 read :last_total .BANK :index + 66 label *label9 + 67 set *tmp36 :index - * write :total .BANK *tmp36 -+ 70 write :total .BANK :index - 71 op sub *tmp38 :total :last_total - 72 op div :flow_rate *tmp38 .SIGN_MILLIS ++ 68 write :total .BANK :index + 69 op sub *tmp38 :total :last_total + 70 op div :flow_rate *tmp38 .SIGN_MILLIS - * set *tmp40 .IND_FLOW_RATE - * write :flow_rate .BANK *tmp40 - * set *tmp42 .IND_TIME -+ 73 set *tmp40 507 -+ 74 write :flow_rate .BANK .IND_FLOW_RATE -+ 75 set *tmp42 508 - 76 set *tmp44 @time ++ 71 set *tmp40 507 ++ 72 write :flow_rate .BANK .IND_FLOW_RATE ++ 73 set *tmp42 508 + 74 set *tmp44 @time - * write *tmp44 .BANK *tmp42 -+ 77 write *tmp44 .BANK .IND_TIME - 78 op add *tmp45 :index 1 ++ 75 write *tmp44 .BANK .IND_TIME + 76 op add *tmp45 :index 1 - * op mod :index *tmp45 .SAMPLES -+ 79 op mod :index *tmp45 10 - 80 op idiv :flow_rate_str :flow_rate 0.000016666666666666667 - 81 op div :seconds .MILLIS 1000 - 82 op sub :elapsed @time :start ++ 77 op mod :index *tmp45 10 + 78 op idiv :flow_rate_str :flow_rate 0.000016666666666666667 + 79 op div :seconds .MILLIS 1000 + 80 op sub :elapsed @time :start - 88 print "\nItems shipped: " - 89 print :shipped - 90 print "\nContainer level: " + 86 print "\nItems shipped: " + 87 print :shipped + 88 print "\nContainer level: " - * print :level -+ 91 print 0 - 92 print "\nFlow rate: " - 93 print :flow_rate_str - 94 print "\nTotal: " ++ 89 print 0 + 90 print "\nFlow rate: " + 91 print :flow_rate_str + 92 print "\nTotal: " -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-13 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-13 instructions): - * set .DELAY 1000 - * set .SAMPLES 10 0 set .IND_SHIPPED 511 - 1 set .IND_MULTIPLIER 510 - 2 set .IND_SESSION_KEY 509 - 3 set .IND_TIME 508 - 4 set .IND_FLOW_RATE 507 +- * set *tmp8 510 + 1 set .IND_SESSION_KEY 509 + 2 set .IND_TIME 508 + 3 set .IND_FLOW_RATE 507 - * op mul .TOTAL_MILLIS 1000 10 - 5 set .SIGN_MILLIS null - 6 set .SORTER sorter1 - 7 set .VAULT vault1 + 4 set .SIGN_MILLIS null + 5 set .SORTER sorter1 + 6 set .VAULT vault1 - 21 label *label1 - 22 jump *label0 always - 23 label *label2 + 20 label *label1 + 21 jump *label0 always + 22 label *label2 - * set *tmp6 511 -- * read :shipped .BANK .IND_SHIPPED -- * set *tmp8 510 -- * read .MULTIPLIER .BANK .IND_MULTIPLIER +- * read :last_total .BANK .IND_SHIPPED ++ 23 read :last_total .BANK 511 + 24 read .MULTIPLIER .BANK 510 - * set *tmp10 509 - * read .SESSION_KEY .BANK .IND_SESSION_KEY -+ 24 read :shipped .BANK 511 -+ 25 read .MULTIPLIER .BANK 510 -+ 26 read .SESSION_KEY .BANK 509 - 27 sensor :item .SORTER @config - 28 set :last_total :shipped - 29 set :index 0 - 30 set .MILLIS 0 ++ 25 read .SESSION_KEY .BANK 509 + 26 sensor :item .SORTER @config + 27 set :index 0 + 28 set .MILLIS 0 - * set :level 0 - 31 set :wait 0 - 32 label *label3 - 33 sensor *tmp13 .SORTER @dead + 29 set :wait 0 + 30 label *label3 + 31 sensor *tmp13 .SORTER @dead - 35 sensor *tmp15 .VAULT @dead - 36 op strictEqual *tmp16 *tmp15 0 - 37 op land *tmp17 *tmp14 *tmp16 + 33 sensor *tmp15 .VAULT @dead + 34 op strictEqual *tmp16 *tmp15 0 + 35 op land *tmp17 *tmp14 *tmp16 - * set *tmp18 509 - * read *tmp19 .BANK .IND_SESSION_KEY -+ 38 read *tmp19 .BANK 509 - 39 op strictEqual *tmp20 .SESSION_KEY *tmp19 - 40 op land *tmp21 *tmp17 *tmp20 - 41 jump *label5 equal *tmp21 false ++ 36 read *tmp19 .BANK 509 + 37 op strictEqual *tmp20 .SESSION_KEY *tmp19 + 38 op land *tmp21 *tmp17 *tmp20 + 39 jump *label5 equal *tmp21 false - 46 op add :wait :start 1000 - 47 label *label6 - 48 label *label7 + 44 op add :wait :start 1000 + 45 label *label6 + 46 label *label7 - * set *tmp27 511 - * read :shipped .BANK .IND_SHIPPED -+ 49 read :shipped .BANK 511 - 50 sensor :item .SORTER @config - 51 op add :total 0 :shipped - 52 jump *label8 greaterThanEq .MILLIS 10000 ++ 47 read :shipped .BANK 511 + 48 sensor :item .SORTER @config + 49 op add :total 0 :shipped + 50 jump *label8 greaterThanEq .MILLIS 10000 - 54 op mul .SIGN_MILLIS .MULTIPLIER .MILLIS - 55 jump *label9 always - 56 label *label8 + 52 op mul .SIGN_MILLIS .MULTIPLIER .MILLIS + 53 jump *label9 always + 54 label *label8 - * set *tmp34 :index - 57 read :last_total .BANK :index - 58 label *label9 + 55 read :last_total .BANK :index + 56 label *label9 - * set *tmp36 :index - 59 write :total .BANK :index - 60 op sub *tmp38 :total :last_total - 61 op div :flow_rate *tmp38 .SIGN_MILLIS + 57 write :total .BANK :index + 58 op sub *tmp38 :total :last_total + 59 op div :flow_rate *tmp38 .SIGN_MILLIS - * set *tmp40 507 - * write :flow_rate .BANK .IND_FLOW_RATE - * set *tmp42 508 -+ 62 write :flow_rate .BANK 507 - 63 set *tmp44 @time ++ 60 write :flow_rate .BANK 507 + 61 set *tmp44 @time - * write *tmp44 .BANK .IND_TIME -+ 64 write *tmp44 .BANK 508 - 65 op add *tmp45 :index 1 - 66 op mod :index *tmp45 10 - 67 op idiv :flow_rate_str :flow_rate 0.000016666666666666667 ++ 62 write *tmp44 .BANK 508 + 63 op add *tmp45 :index 1 + 64 op mod :index *tmp45 10 + 65 op idiv :flow_rate_str :flow_rate 0.000016666666666666667 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-5 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-4 instructions): - * set .IND_SHIPPED 511 -- * set .IND_MULTIPLIER 510 - * set .IND_SESSION_KEY 509 - * set .IND_TIME 508 - * set .IND_FLOW_RATE 507 @@ -386,17 +405,17 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-5 Modifications by Iterated phase, Loop Optimization, pass 1, iteration 1: - 86 set :loops 0 - 87 label *label10 - 88 jump *label12 greaterThanEq @time :wait -+ 89 label *label13 - 90 op add :loops :loops 1 - 91 label *label11 + 85 set :loops 0 + 86 label *label10 + 87 jump *label12 greaterThanEq @time :wait ++ 88 label *label13 + 89 op add :loops :loops 1 + 90 label *label11 - * jump *label10 always -+ 92 jump *label13 lessThan @time :wait - 93 label *label12 - 94 label *label4 - 95 jump *label3 always ++ 91 jump *label13 lessThan @time :wait + 92 label *label12 + 93 label *label4 + 94 jump *label3 always Modifications by Replicate loop condition at line 17:1 (+5 instructions): @@ -418,7 +437,7 @@ Modifications by Replicate loop condition at line 17:1 (+5 instructions): + 22 op or *tmp5 *tmp3 *tmp4 + 23 jump *label14 notEqual *tmp5 false 24 label *label2 - 25 read :shipped .BANK 511 + 25 read :last_total .BANK 511 26 read .MULTIPLIER .BANK 510 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: @@ -453,72 +472,72 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: Modifications by Replicate loop condition at line 38:1 (+8 instructions): - 40 op strictEqual *tmp20 .SESSION_KEY *tmp19 - 41 op land *tmp21 *tmp17 *tmp20 - 42 jump *label5 equal *tmp21 false -+ 43 label *label15 - 44 set :start @time - 45 op add :wait :wait 1000 - 46 jump *label6 lessThanEq :start :wait + 39 op strictEqual *tmp20 .SESSION_KEY *tmp19 + 40 op land *tmp21 *tmp17 *tmp20 + 41 jump *label5 equal *tmp21 false ++ 42 label *label15 + 43 set :start @time + 44 op add :wait :wait 1000 + 45 jump *label6 lessThanEq :start :wait - 99 jump *label13 lessThan @time :wait - 100 label *label12 - 101 label *label4 + 98 jump *label13 lessThan @time :wait + 99 label *label12 + 100 label *label4 - * jump *label3 always -+ 102 sensor *tmp13 .SORTER @dead -+ 103 op strictEqual *tmp14 *tmp13 0 -+ 104 sensor *tmp15 .VAULT @dead -+ 105 op strictEqual *tmp16 *tmp15 0 -+ 106 op land *tmp17 *tmp14 *tmp16 -+ 107 read *tmp19 .BANK 509 -+ 108 op strictEqual *tmp20 .SESSION_KEY *tmp19 -+ 109 op land *tmp21 *tmp17 *tmp20 -+ 110 jump *label15 notEqual *tmp21 false - 111 label *label5 - 112 end ++ 101 sensor *tmp13 .SORTER @dead ++ 102 op strictEqual *tmp14 *tmp13 0 ++ 103 sensor *tmp15 .VAULT @dead ++ 104 op strictEqual *tmp16 *tmp15 0 ++ 105 op land *tmp17 *tmp14 *tmp16 ++ 106 read *tmp19 .BANK 509 ++ 107 op strictEqual *tmp20 .SESSION_KEY *tmp19 ++ 108 op land *tmp21 *tmp17 *tmp20 ++ 109 jump *label15 notEqual *tmp21 false + 110 label *label5 + 111 end Modifications by Iterated phase, Expression Optimization, pass 2, iteration 1: - 50 label *label7 - 51 read :shipped .BANK 511 - 52 sensor :item .SORTER @config + 49 label *label7 + 50 read :shipped .BANK 511 + 51 sensor :item .SORTER @config - * op add :total 0 :shipped -+ 53 set :total :shipped - 54 jump *label8 greaterThanEq .MILLIS 10000 - 55 op add .MILLIS .MILLIS 1000 - 56 op mul .SIGN_MILLIS .MULTIPLIER .MILLIS ++ 52 set :total :shipped + 53 jump *label8 greaterThanEq .MILLIS 10000 + 54 op add .MILLIS .MILLIS 1000 + 55 op mul .SIGN_MILLIS .MULTIPLIER .MILLIS Modifications by Iterated phase, Data Flow Optimization, pass 2, iteration 1: - 58 label *label8 - 59 read :last_total .BANK :index - 60 label *label9 + 57 label *label8 + 58 read :last_total .BANK :index + 59 label *label9 - * write :total .BANK :index - * op sub *tmp38 :total :last_total -+ 61 write :shipped .BANK :index -+ 62 op sub *tmp38 :shipped :last_total - 63 op div :flow_rate *tmp38 .SIGN_MILLIS - 64 write :flow_rate .BANK 507 - 65 set *tmp44 @time - - 81 print "\nFlow rate: " - 82 print :flow_rate_str - 83 print "\nTotal: " ++ 60 write :shipped .BANK :index ++ 61 op sub *tmp38 :shipped :last_total + 62 op div :flow_rate *tmp38 .SIGN_MILLIS + 63 write :flow_rate .BANK 507 + 64 set *tmp44 @time + + 80 print "\nFlow rate: " + 81 print :flow_rate_str + 82 print "\nTotal: " - * print :total -+ 84 print :shipped - 85 print "\nLast total: " - 86 print :last_total - 87 print "\nIndex: " ++ 83 print :shipped + 84 print "\nLast total: " + 85 print :last_total + 86 print "\nIndex: " Modifications by Iterated phase, Data Flow Optimization, pass 2, iteration 2 (-1 instructions): - 50 label *label7 - 51 read :shipped .BANK 511 - 52 sensor :item .SORTER @config + 49 label *label7 + 50 read :shipped .BANK 511 + 51 sensor :item .SORTER @config - * set :total :shipped - 53 jump *label8 greaterThanEq .MILLIS 10000 - 54 op add .MILLIS .MILLIS 1000 - 55 op mul .SIGN_MILLIS .MULTIPLIER .MILLIS + 52 jump *label8 greaterThanEq .MILLIS 10000 + 53 op add .MILLIS .MILLIS 1000 + 54 op mul .SIGN_MILLIS .MULTIPLIER .MILLIS Modifications by Final phase, Jump Threading, iteration 1: + 0 label __start__ @@ -526,27 +545,27 @@ Modifications by Final phase, Jump Threading, iteration 1: 2 set .SORTER sorter1 3 set .VAULT vault1 - 40 read *tmp19 .BANK 509 - 41 op strictEqual *tmp20 .SESSION_KEY *tmp19 - 42 op land *tmp21 *tmp17 *tmp20 + 39 read *tmp19 .BANK 509 + 40 op strictEqual *tmp20 .SESSION_KEY *tmp19 + 41 op land *tmp21 *tmp17 *tmp20 - * jump *label5 equal *tmp21 false -+ 43 jump __start__ equal *tmp21 false - 44 label *label15 - 45 set :start @time - 46 op add :wait :wait 1000 ++ 42 jump __start__ equal *tmp21 false + 43 label *label15 + 44 set :start @time + 45 op add :wait :wait 1000 Modifications by Final phase, Single Step Elimination, iteration 1 (-1 instructions): - 109 op land *tmp21 *tmp17 *tmp20 - 110 jump *label15 notEqual *tmp21 false - 111 label *label5 + 108 op land *tmp21 *tmp17 *tmp20 + 109 jump *label15 notEqual *tmp21 false + 110 label *label5 - * end Modifications by Final phase, Print Merging, iteration 1 (-11 instructions): - 69 op idiv :flow_rate_str :flow_rate 0.000016666666666666667 - 70 op div :seconds .MILLIS 1000 - 71 op sub :elapsed @time :start + 68 op idiv :flow_rate_str :flow_rate 0.000016666666666666667 + 69 op div :seconds .MILLIS 1000 + 70 op sub :elapsed @time :start - * print "Measured interval: " - * print :seconds - * print " sec" @@ -567,18 +586,18 @@ Modifications by Final phase, Print Merging, iteration 1 (-11 instructions): - * print "\nElapsed: " - * print :elapsed - * print " ms" -+ 72 print "Measured interval: {0} sec\nItem: {0}\nItems shipped: {0}\nContainer level: 0\nFlow rate: {0}\nTotal: {0}\nLast total: {0}\nIndex: {0}\nElapsed: {0} ms" -+ 73 format :seconds -+ 74 format :item -+ 75 format :shipped -+ 76 format :flow_rate_str -+ 77 format :shipped -+ 78 format :last_total -+ 79 format :index -+ 80 format :elapsed - 81 printflush message1 - 82 set :loops 0 - 83 label *label10 ++ 71 print "Measured interval: {0} sec\nItem: {0}\nItems shipped: {0}\nContainer level: 0\nFlow rate: {0}\nTotal: {0}\nLast total: {0}\nIndex: {0}\nElapsed: {0} ms" ++ 72 format :seconds ++ 73 format :item ++ 74 format :shipped ++ 75 format :flow_rate_str ++ 76 format :shipped ++ 77 format :last_total ++ 78 format :index ++ 79 format :elapsed + 80 printflush message1 + 81 set :loops 0 + 82 label *label10 Final code before resolving virtual instructions: @@ -606,11 +625,10 @@ op equal *tmp4 bank1 null op or *tmp5 *tmp3 *tmp4 jump *label14 notEqual *tmp5 false label *label2 -read :shipped .BANK 511 +read :last_total .BANK 511 read .MULTIPLIER .BANK 510 read .SESSION_KEY .BANK 509 sensor :item .SORTER @config -set :last_total :shipped set :index 0 set .MILLIS 0 set :wait 0 diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/ProcessorTest.txt b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/ProcessorTest.txt index 2a139269..421d9640 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/ProcessorTest.txt +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/ProcessorTest.txt @@ -1,8 +1,8 @@ Name Instructions Steps Coverage Source CRC Compiled CRC assignments-in-expressions.mnd: 13 13 100.0% 3E55A40DD17DEC43 6812D9B49C6FF4C0 -complex-case-expression.mnd: 52 299 98.0% E6AA465B5328A02F BEAD3682B2F8F09B +complex-case-expression.mnd: 51 298 98.0% E6AA465B5328A02F 2452C0A5210846C2 equality-comparisons.mnd: 85 81 95.2% 16DB5681427420C5 FC480DCAD4836261 -executes-sort-variables.mnd: 15 15 100.0% 4C7203D3E687BCFA 7FA41BCFCAB297D6 +executes-sort-variables.mnd: 12 12 100.0% 4C7203D3E687BCFA 781F92583EC4F064 expression-evaluation-compile-time.mnd: 71 71 100.0% AF03DAE2294C2967 E2B18324776278B7 expression-evaluation-runtime.mnd: 139 139 100.0% 735EEFE2E08AC90A BCD18BDB1C5C5837 fixed-bounds-ranged-for.mnd: 9 36 100.0% 6CB678A2E1E09678 F27824FD4C9C2F3F @@ -13,8 +13,8 @@ loops-in-conditions.mnd: 4 4 100.0% 25F7 prints-values.mnd: 42 42 100.0% EA633A3540E9449B C5E6438467DE4671 processesBasicCode2: 3 3 100.0% B406896E6E3CDCB7 8FE79E3E7140A46C processesBasicCode: 5 5 100.0% A4E4C088A4510A90 8B4165EC6B0E2D00 -ranged-for-loop-break-continue.mnd: 25 62 96.0% 0E564BDD58072C70 29624BAB50579BBE -recursive-calls.mnd: 98 267 98.9% 9CB0965E0E62F089 E6463B3ABF73C458 +ranged-for-loop-break-continue.mnd: 24 61 95.8% 0E564BDD58072C70 6A4D1A800F937BDD +recursive-calls.mnd: 98 267 98.9% 9CB0965E0E62F089 86A7BE3451EFB5CE recursive-function-condition.mnd: 18 22 94.4% DAC9B6344C947D52 E089552D9D066565 switched-case-expression.mnd: 61 2130 100.0% E65D739E41D00A45 0486837B774E2B82 testSuiteRecognizesUnexpectedWarnings: 1 1 100.0% 002B7E6873B65270 4A3761D7B5564792 diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/complex-case-expression.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/complex-case-expression.log index 796c80a9..a6f40363 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/complex-case-expression.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/complex-case-expression.log @@ -2,13 +2,13 @@ 1 instructions eliminated by Temp Variables Elimination. 1 instructions eliminated by Case Expression Optimization. 1 instructions eliminated by Dead Code Elimination (3 iterations). - 8 instructions eliminated by Data Flow Optimization (2 passes, 6 iterations). + 9 instructions eliminated by Data Flow Optimization (2 passes, 7 iterations). 1 instructions modified by Loop Optimization (3 iterations). 1 loops improved by Loop Optimization. 4 instructions eliminated by Jump Straightening (4 iterations). 1 instructions updated by JumpThreading. 3 instructions eliminated by Unreachable Code Elimination. - 52 instructions after optimizations. + 51 instructions after optimizations. Modifications by Initial phase, Case Expression Optimization, iteration 1 (-1 instructions): @@ -137,180 +137,197 @@ Modifications by Iterated phase, Jump Straightening, pass 1, iteration 1 (-4 ins 67 jump *label6 always 68 set *tmp4 null -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 instructions): - 16 call *label0 :fn0*retval - 17 label *label10 - 18 set *tmp6 :fn0*retval + 2 setaddr :fn0*retaddr *label2 + 3 call *label0 :fn0*retval + 4 label *label2 +- * set *tmp1 :fn0*retval ++ 5 set :fn1:i :fn0*retval + 6 set :fn0:n 10 + 7 setaddr :fn0*retaddr *label3 + 8 call *label0 :fn0*retval + 9 label *label3 + 10 set *tmp3 :fn0*retval +- * set :fn1:i *tmp1 + 11 label *label4 + 12 jump *label6 greaterThan :fn1:i *tmp3 + 13 set :fn0:n 1 + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 instructions): + + 15 call *label0 :fn0*retval + 16 label *label10 + 17 set *tmp6 :fn0*retval - * jump *label8 notEqual :fn1:i *tmp6 -+ 19 jump *label8 notEqual :fn1:i :fn0*retval - 20 label *label9 - 21 set *tmp4 "A" - 22 jump *label7 always ++ 18 jump *label8 notEqual :fn1:i :fn0*retval + 19 label *label9 + 20 set *tmp4 "A" + 21 jump *label7 always - 26 call *label0 :fn0*retval - 27 label *label13 - 28 set *tmp7 :fn0*retval + 25 call *label0 :fn0*retval + 26 label *label13 + 27 set *tmp7 :fn0*retval - * jump *label12 equal :fn1:i *tmp7 -+ 29 jump *label12 equal :fn1:i :fn0*retval - 30 set :fn0:n 3 - 31 setaddr :fn0*retaddr *label14 - 32 call *label0 :fn0*retval - 33 label *label14 - 34 set *tmp8 :fn0*retval ++ 28 jump *label12 equal :fn1:i :fn0*retval + 29 set :fn0:n 3 + 30 setaddr :fn0*retaddr *label14 + 31 call *label0 :fn0*retval + 32 label *label14 + 33 set *tmp8 :fn0*retval - * jump *label12 equal :fn1:i *tmp8 -+ 35 jump *label12 equal :fn1:i :fn0*retval - 36 jump *label11 notEqual :fn1:i 4 - 37 label *label12 - 38 set *tmp4 "B" ++ 34 jump *label12 equal :fn1:i :fn0*retval + 35 jump *label11 notEqual :fn1:i 4 + 36 label *label12 + 37 set *tmp4 "B" - 41 jump *label15 notEqual :fn1:i 5 - 42 label *label16 - 43 jump *label5 always + 40 jump *label15 notEqual :fn1:i 5 + 41 label *label16 + 42 jump *label5 always - * set *tmp4 null - 44 jump *label7 always - 45 label *label15 - 46 set :fn0:n 6 + 43 jump *label7 always + 44 label *label15 + 45 set :fn0:n 6 - 48 call *label0 :fn0*retval - 49 label *label20 - 50 set *tmp9 :fn0*retval + 47 call *label0 :fn0*retval + 48 label *label20 + 49 set *tmp9 :fn0*retval - * jump *label19 lessThan :fn1:i *tmp9 -+ 51 jump *label19 lessThan :fn1:i :fn0*retval - 52 set :fn0:n 8 - 53 setaddr :fn0*retaddr *label21 - 54 call *label0 :fn0*retval - 55 label *label21 - 56 set *tmp10 :fn0*retval ++ 50 jump *label19 lessThan :fn1:i :fn0*retval + 51 set :fn0:n 8 + 52 setaddr :fn0*retaddr *label21 + 53 call *label0 :fn0*retval + 54 label *label21 + 55 set *tmp10 :fn0*retval - * jump *label18 lessThanEq :fn1:i *tmp10 -+ 57 jump *label18 lessThanEq :fn1:i :fn0*retval - 58 label *label19 - 59 jump *label17 always - 60 label *label18 ++ 56 jump *label18 lessThanEq :fn1:i :fn0*retval + 57 label *label19 + 58 jump *label17 always + 59 label *label18 - 64 jump *label22 notEqual :fn1:i 10 - 65 label *label23 - 66 jump *label6 always + 63 jump *label22 notEqual :fn1:i 10 + 64 label *label23 + 65 jump *label6 always - * set *tmp4 null - 67 jump *label7 always - 68 label *label22 - 69 set *tmp4 "D" - 70 label *label7 - 71 set :fn1:str *tmp4 + 66 jump *label7 always + 67 label *label22 + 68 set *tmp4 "D" + 69 label *label7 + 70 set :fn1:str *tmp4 - * print :fn1:str -+ 72 print *tmp4 - 73 label *label5 - 74 op add :fn1:i :fn1:i 1 - 75 jump *label4 always ++ 71 print *tmp4 + 72 label *label5 + 73 op add :fn1:i :fn1:i 1 + 74 jump *label4 always -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-6 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-6 instructions): - 15 setaddr :fn0*retaddr *label10 - 16 call *label0 :fn0*retval - 17 label *label10 + 14 setaddr :fn0*retaddr *label10 + 15 call *label0 :fn0*retval + 16 label *label10 - * set *tmp6 :fn0*retval - 18 jump *label8 notEqual :fn1:i :fn0*retval - 19 label *label9 - 20 set *tmp4 "A" + 17 jump *label8 notEqual :fn1:i :fn0*retval + 18 label *label9 + 19 set *tmp4 "A" - 24 setaddr :fn0*retaddr *label13 - 25 call *label0 :fn0*retval - 26 label *label13 + 23 setaddr :fn0*retaddr *label13 + 24 call *label0 :fn0*retval + 25 label *label13 - * set *tmp7 :fn0*retval - 27 jump *label12 equal :fn1:i :fn0*retval - 28 set :fn0:n 3 - 29 setaddr :fn0*retaddr *label14 - 30 call *label0 :fn0*retval - 31 label *label14 + 26 jump *label12 equal :fn1:i :fn0*retval + 27 set :fn0:n 3 + 28 setaddr :fn0*retaddr *label14 + 29 call *label0 :fn0*retval + 30 label *label14 - * set *tmp8 :fn0*retval - 32 jump *label12 equal :fn1:i :fn0*retval - 33 jump *label11 notEqual :fn1:i 4 - 34 label *label12 + 31 jump *label12 equal :fn1:i :fn0*retval + 32 jump *label11 notEqual :fn1:i 4 + 33 label *label12 - 44 setaddr :fn0*retaddr *label20 - 45 call *label0 :fn0*retval - 46 label *label20 + 43 setaddr :fn0*retaddr *label20 + 44 call *label0 :fn0*retval + 45 label *label20 - * set *tmp9 :fn0*retval - 47 jump *label19 lessThan :fn1:i :fn0*retval - 48 set :fn0:n 8 - 49 setaddr :fn0*retaddr *label21 - 50 call *label0 :fn0*retval - 51 label *label21 + 46 jump *label19 lessThan :fn1:i :fn0*retval + 47 set :fn0:n 8 + 48 setaddr :fn0*retaddr *label21 + 49 call *label0 :fn0*retval + 50 label *label21 - * set *tmp10 :fn0*retval - 52 jump *label18 lessThanEq :fn1:i :fn0*retval - 53 label *label19 - 54 jump *label17 always + 51 jump *label18 lessThanEq :fn1:i :fn0*retval + 52 label *label19 + 53 jump *label17 always - 63 label *label22 - 64 set *tmp4 "D" - 65 label *label7 + 62 label *label22 + 63 set *tmp4 "D" + 64 label *label7 - * set :fn1:str *tmp4 - 66 print *tmp4 - 67 label *label5 - 68 op add :fn1:i :fn1:i 1 + 65 print *tmp4 + 66 label *label5 + 67 op add :fn1:i :fn1:i 1 Modifications by Iterated phase, Loop Optimization, pass 1, iteration 1: - 11 set :fn1:i *tmp1 - 12 label *label4 - 13 jump *label6 greaterThan :fn1:i *tmp3 -+ 14 label *label25 - 15 set :fn0:n 1 - 16 setaddr :fn0*retaddr *label10 - 17 call *label0 :fn0*retval + 10 set *tmp3 :fn0*retval + 11 label *label4 + 12 jump *label6 greaterThan :fn1:i *tmp3 ++ 13 label *label25 + 14 set :fn0:n 1 + 15 setaddr :fn0*retaddr *label10 + 16 call *label0 :fn0*retval - 67 print *tmp4 - 68 label *label5 - 69 op add :fn1:i :fn1:i 1 + 66 print *tmp4 + 67 label *label5 + 68 op add :fn1:i :fn1:i 1 - * jump *label4 always -+ 70 jump *label25 lessThanEq :fn1:i *tmp3 - 71 label *label6 - 72 label *label1 - 73 assertprints "ABBBCCCD" "complex-case-expression" ++ 69 jump *label25 lessThanEq :fn1:i *tmp3 + 70 label *label6 + 71 label *label1 + 72 assertprints "ABBBCCCD" "complex-case-expression" Modifications by Iterated phase, Data Flow Optimization, pass 2, iteration 1: + 9 label *label3 10 set *tmp3 :fn0*retval - 11 set :fn1:i *tmp1 - 12 label *label4 + 11 label *label4 - * jump *label6 greaterThan :fn1:i *tmp3 -+ 13 jump *label6 greaterThan *tmp1 :fn0*retval - 14 label *label25 - 15 set :fn0:n 1 - 16 setaddr :fn0*retaddr *label10 ++ 12 jump *label6 greaterThan :fn1:i :fn0*retval + 13 label *label25 + 14 set :fn0:n 1 + 15 setaddr :fn0*retaddr *label10 Modifications by Final phase, Jump Threading, iteration 1: - 45 setaddr :fn0*retaddr *label20 - 46 call *label0 :fn0*retval - 47 label *label20 + 44 setaddr :fn0*retaddr *label20 + 45 call *label0 :fn0*retval + 46 label *label20 - * jump *label19 lessThan :fn1:i :fn0*retval -+ 48 jump *label17 lessThan :fn1:i :fn0*retval - 49 set :fn0:n 8 - 50 setaddr :fn0*retaddr *label21 - 51 call *label0 :fn0*retval ++ 47 jump *label17 lessThan :fn1:i :fn0*retval + 48 set :fn0:n 8 + 49 setaddr :fn0*retaddr *label21 + 50 call *label0 :fn0*retval Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-3 instructions): - 39 jump *label15 notEqual :fn1:i 5 - 40 label *label16 - 41 jump *label5 always + 38 jump *label15 notEqual :fn1:i 5 + 39 label *label16 + 40 jump *label5 always - * jump *label7 always - 42 label *label15 - 43 set :fn0:n 6 - 44 setaddr :fn0*retaddr *label20 + 41 label *label15 + 42 set :fn0:n 6 + 43 setaddr :fn0*retaddr *label20 - 59 jump *label22 notEqual :fn1:i 10 - 60 label *label23 - 61 jump *label6 always + 58 jump *label22 notEqual :fn1:i 10 + 59 label *label23 + 60 jump *label6 always - * jump *label7 always - 62 label *label22 - 63 set *tmp4 "D" - 64 label *label7 + 61 label *label22 + 62 set *tmp4 "D" + 63 label *label7 - 75 set :fn0*retval :fn0:n - 76 label *label24 - 77 return :fn0*retaddr + 74 set :fn0*retval :fn0:n + 75 label *label24 + 76 return :fn0*retaddr - * end Final code before resolving virtual instructions: @@ -320,14 +337,13 @@ set :fn0:n 1 setaddr :fn0*retaddr *label2 call *label0 :fn0*retval label *label2 -set *tmp1 :fn0*retval +set :fn1:i :fn0*retval set :fn0:n 10 setaddr :fn0*retaddr *label3 call *label0 :fn0*retval label *label3 set *tmp3 :fn0*retval -set :fn1:i *tmp1 -jump *label6 greaterThan *tmp1 :fn0*retval +jump *label6 greaterThan :fn1:i :fn0*retval label *label25 set :fn0:n 1 setaddr :fn0*retaddr *label10 diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/equality-comparisons.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/equality-comparisons.log index 0ce00a58..604da15b 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/equality-comparisons.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/equality-comparisons.log @@ -5,7 +5,7 @@ 87 instructions eliminated by Single Step Elimination (3 passes, 9 iterations). 3 instructions modified by Expression Optimization (4 iterations). 12 instructions modified by If Expression Optimization (4 iterations). - 291 instructions eliminated by Data Flow Optimization (2 passes, 9 iterations). + 291 instructions eliminated by Data Flow Optimization (2 passes, 10 iterations). 39 instructions eliminated by Print Merging. 85 instructions after optimizations. @@ -735,6 +735,137 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-60 ins Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-12 instructions): + 5 assertflush + 6 op equal :fn1:b :fn0:a :fn0:b + 7 jump *label2 equal :fn1:b false +- * set *tmp3 "T" ++ 8 set *tmp2 "T" + 9 jump *label3 always + 10 label *label2 + 11 set *tmp3 "F" + 12 label *label3 +- * set *tmp2 *tmp3 + 13 label *label1 + 14 op notEqual :fn2:b :fn0:a :fn0:b + 15 jump *label5 equal :fn2:b false + 16 set *tmp6 "T" + 17 jump *label6 always + 18 label *label5 +- * set *tmp6 "F" ++ 19 set *tmp5 "F" + 20 label *label6 +- * set *tmp5 *tmp6 + 21 label *label4 + 22 op strictEqual :fn3:b :fn0:a :fn0:b + 23 jump *label8 equal :fn3:b false + 24 set *tmp9 "T" + 25 jump *label9 always + 26 label *label8 +- * set *tmp9 "F" ++ 27 set *tmp8 "F" + 28 label *label9 +- * set *tmp8 *tmp9 + 29 label *label7 + 30 op strictEqual *tmp11 :fn0:a :fn0:b + 31 op equal :fn4:b *tmp11 false + 32 jump *label11 equal :fn4:b false +- * set *tmp13 "T" ++ 33 set *tmp12 "T" + 34 jump *label12 always + 35 label *label11 + 36 set *tmp13 "F" + 37 label *label12 +- * set *tmp12 *tmp13 + 38 label *label10 + 39 print *tmp2 + 40 print *tmp5 + + 52 set *tmp17 "T" + 53 jump *label16 always + 54 label *label15 +- * set *tmp17 "F" ++ 55 set *tmp16 "F" + 56 label *label16 +- * set *tmp16 *tmp17 + 57 label *label14 + 58 op notEqual :fn7:b :fn5:a :fn5:b + 59 jump *label18 equal :fn7:b false +- * set *tmp20 "T" ++ 60 set *tmp19 "T" + 61 jump *label19 always + 62 label *label18 + 63 set *tmp20 "F" + 64 label *label19 +- * set *tmp19 *tmp20 + 65 label *label17 + 66 op strictEqual :fn8:b :fn5:a :fn5:b + 67 jump *label21 equal :fn8:b false + 68 set *tmp23 "T" + 69 jump *label22 always + 70 label *label21 +- * set *tmp23 "F" ++ 71 set *tmp22 "F" + 72 label *label22 +- * set *tmp22 *tmp23 + 73 label *label20 + 74 op strictEqual *tmp25 :fn5:a :fn5:b + 75 op equal :fn9:b *tmp25 false + 76 jump *label24 equal :fn9:b false +- * set *tmp27 "T" ++ 77 set *tmp26 "T" + 78 jump *label25 always + 79 label *label24 + 80 set *tmp27 "F" + 81 label *label25 +- * set *tmp26 *tmp27 + 82 label *label23 + 83 print *tmp16 + 84 print *tmp19 + + 96 set *tmp31 "T" + 97 jump *label29 always + 98 label *label28 +- * set *tmp31 "F" ++ 99 set *tmp30 "F" + 100 label *label29 +- * set *tmp30 *tmp31 + 101 label *label27 + 102 op notEqual :fn12:b :fn10:a :fn10:b + 103 jump *label31 equal :fn12:b false +- * set *tmp34 "T" ++ 104 set *tmp33 "T" + 105 jump *label32 always + 106 label *label31 + 107 set *tmp34 "F" + 108 label *label32 +- * set *tmp33 *tmp34 + 109 label *label30 + 110 op strictEqual :fn13:b :fn10:a :fn10:b + 111 jump *label34 equal :fn13:b false + 112 set *tmp37 "T" + 113 jump *label35 always + 114 label *label34 +- * set *tmp37 "F" ++ 115 set *tmp36 "F" + 116 label *label35 +- * set *tmp36 *tmp37 + 117 label *label33 + 118 op strictEqual *tmp39 :fn10:a :fn10:b + 119 op equal :fn14:b *tmp39 false + 120 jump *label37 equal :fn14:b false +- * set *tmp41 "T" ++ 121 set *tmp40 "T" + 122 jump *label38 always + 123 label *label37 + 124 set *tmp41 "F" + 125 label *label38 +- * set *tmp40 *tmp41 + 126 label *label36 + 127 print *tmp30 + 128 print *tmp33 + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-12 instructions): + 3 set :fn0:b 0 4 set :fn0:expected "TFFT" 5 assertflush @@ -742,847 +873,823 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 - * jump *label2 equal :fn1:b false + 6 op equal :fn1:b null 0 + 7 jump *label2 equal true false - 8 set *tmp3 "T" + 8 set *tmp2 "T" 9 jump *label3 always 10 label *label2 - * set *tmp3 "F" 11 label *label3 -- * set *tmp2 *tmp3 -+ 12 set *tmp2 "T" - 13 label *label1 + 12 label *label1 - * op notEqual :fn2:b :fn0:a :fn0:b - * jump *label5 equal :fn2:b false - * set *tmp6 "T" -+ 14 op notEqual :fn2:b null 0 -+ 15 jump *label5 equal false false - 16 jump *label6 always - 17 label *label5 - 18 set *tmp6 "F" - 19 label *label6 -- * set *tmp5 *tmp6 -+ 20 set *tmp5 "F" - 21 label *label4 ++ 13 op notEqual :fn2:b null 0 ++ 14 jump *label5 equal false false + 15 jump *label6 always + 16 label *label5 + 17 set *tmp5 "F" + 18 label *label6 + 19 label *label4 - * op strictEqual :fn3:b :fn0:a :fn0:b - * jump *label8 equal :fn3:b false - * set *tmp9 "T" -+ 22 op strictEqual :fn3:b null 0 -+ 23 jump *label8 equal false false - 24 jump *label9 always - 25 label *label8 - 26 set *tmp9 "F" - 27 label *label9 -- * set *tmp8 *tmp9 -+ 28 set *tmp8 "F" - 29 label *label7 ++ 20 op strictEqual :fn3:b null 0 ++ 21 jump *label8 equal false false + 22 jump *label9 always + 23 label *label8 + 24 set *tmp8 "F" + 25 label *label9 + 26 label *label7 - * op strictEqual *tmp11 :fn0:a :fn0:b - * op equal :fn4:b *tmp11 false - * jump *label11 equal :fn4:b false -+ 30 op strictEqual *tmp11 null 0 -+ 31 op equal :fn4:b false false -+ 32 jump *label11 equal true false - 33 set *tmp13 "T" - 34 jump *label12 always - 35 label *label11 ++ 27 op strictEqual *tmp11 null 0 ++ 28 op equal :fn4:b false false ++ 29 jump *label11 equal true false + 30 set *tmp12 "T" + 31 jump *label12 always + 32 label *label11 - * set *tmp13 "F" - 36 label *label12 -- * set *tmp12 *tmp13 -+ 37 set *tmp12 "T" - 38 label *label10 + 33 label *label12 + 34 label *label10 - * print *tmp2 - * print *tmp5 - * print *tmp8 - * print *tmp12 - * assertprints :fn0:expected :fn0:title -+ 39 print *tmp3 -+ 40 print *tmp6 -+ 41 print *tmp9 -+ 42 print *tmp13 -+ 43 assertprints "TFFT" "comparison 1" - 44 label *label0 - 45 set :fn5:title "comparison 2" - 46 set :fn5:a null - 47 set :fn5:b 1 - 48 set :fn5:expected "FTFT" - 49 assertflush ++ 35 print "T" ++ 36 print "F" ++ 37 print "F" ++ 38 print "T" ++ 39 assertprints "TFFT" "comparison 1" + 40 label *label0 + 41 set :fn5:title "comparison 2" + 42 set :fn5:a null + 43 set :fn5:b 1 + 44 set :fn5:expected "FTFT" + 45 assertflush - * op equal :fn6:b :fn5:a :fn5:b - * jump *label15 equal :fn6:b false - * set *tmp17 "T" -+ 50 op equal :fn6:b null 1 -+ 51 jump *label15 equal false false - 52 jump *label16 always - 53 label *label15 - 54 set *tmp17 "F" - 55 label *label16 -- * set *tmp16 *tmp17 -+ 56 set *tmp16 "F" - 57 label *label14 ++ 46 op equal :fn6:b null 1 ++ 47 jump *label15 equal false false + 48 jump *label16 always + 49 label *label15 + 50 set *tmp16 "F" + 51 label *label16 + 52 label *label14 - * op notEqual :fn7:b :fn5:a :fn5:b - * jump *label18 equal :fn7:b false -+ 58 op notEqual :fn7:b null 1 -+ 59 jump *label18 equal true false - 60 set *tmp20 "T" - 61 jump *label19 always - 62 label *label18 ++ 53 op notEqual :fn7:b null 1 ++ 54 jump *label18 equal true false + 55 set *tmp19 "T" + 56 jump *label19 always + 57 label *label18 - * set *tmp20 "F" - 63 label *label19 -- * set *tmp19 *tmp20 -+ 64 set *tmp19 "T" - 65 label *label17 + 58 label *label19 + 59 label *label17 - * op strictEqual :fn8:b :fn5:a :fn5:b - * jump *label21 equal :fn8:b false - * set *tmp23 "T" -+ 66 op strictEqual :fn8:b null 1 -+ 67 jump *label21 equal false false - 68 jump *label22 always - 69 label *label21 - 70 set *tmp23 "F" - 71 label *label22 -- * set *tmp22 *tmp23 -+ 72 set *tmp22 "F" - 73 label *label20 ++ 60 op strictEqual :fn8:b null 1 ++ 61 jump *label21 equal false false + 62 jump *label22 always + 63 label *label21 + 64 set *tmp22 "F" + 65 label *label22 + 66 label *label20 - * op strictEqual *tmp25 :fn5:a :fn5:b - * op equal :fn9:b *tmp25 false - * jump *label24 equal :fn9:b false -+ 74 op strictEqual *tmp25 null 1 -+ 75 op equal :fn9:b false false -+ 76 jump *label24 equal true false - 77 set *tmp27 "T" - 78 jump *label25 always - 79 label *label24 ++ 67 op strictEqual *tmp25 null 1 ++ 68 op equal :fn9:b false false ++ 69 jump *label24 equal true false + 70 set *tmp26 "T" + 71 jump *label25 always + 72 label *label24 - * set *tmp27 "F" - 80 label *label25 -- * set *tmp26 *tmp27 -+ 81 set *tmp26 "T" - 82 label *label23 + 73 label *label25 + 74 label *label23 - * print *tmp16 - * print *tmp19 - * print *tmp22 - * print *tmp26 - * assertprints :fn5:expected :fn5:title -+ 83 print *tmp17 -+ 84 print *tmp20 -+ 85 print *tmp23 -+ 86 print *tmp27 -+ 87 assertprints "FTFT" "comparison 2" - 88 label *label13 - 89 set :fn10:title "comparison 3" - 90 set :fn10:a null - 91 set :fn10:b 2 - 92 set :fn10:expected "FTFT" - 93 assertflush ++ 75 print "F" ++ 76 print "T" ++ 77 print "F" ++ 78 print "T" ++ 79 assertprints "FTFT" "comparison 2" + 80 label *label13 + 81 set :fn10:title "comparison 3" + 82 set :fn10:a null + 83 set :fn10:b 2 + 84 set :fn10:expected "FTFT" + 85 assertflush - * op equal :fn11:b :fn10:a :fn10:b - * jump *label28 equal :fn11:b false - * set *tmp31 "T" -+ 94 op equal :fn11:b null 2 -+ 95 jump *label28 equal false false - 96 jump *label29 always - 97 label *label28 - 98 set *tmp31 "F" - 99 label *label29 -- * set *tmp30 *tmp31 -+ 100 set *tmp30 "F" - 101 label *label27 ++ 86 op equal :fn11:b null 2 ++ 87 jump *label28 equal false false + 88 jump *label29 always + 89 label *label28 + 90 set *tmp30 "F" + 91 label *label29 + 92 label *label27 - * op notEqual :fn12:b :fn10:a :fn10:b - * jump *label31 equal :fn12:b false -+ 102 op notEqual :fn12:b null 2 -+ 103 jump *label31 equal true false - 104 set *tmp34 "T" - 105 jump *label32 always - 106 label *label31 ++ 93 op notEqual :fn12:b null 2 ++ 94 jump *label31 equal true false + 95 set *tmp33 "T" + 96 jump *label32 always + 97 label *label31 - * set *tmp34 "F" - 107 label *label32 -- * set *tmp33 *tmp34 -+ 108 set *tmp33 "T" - 109 label *label30 + 98 label *label32 + 99 label *label30 - * op strictEqual :fn13:b :fn10:a :fn10:b - * jump *label34 equal :fn13:b false - * set *tmp37 "T" -+ 110 op strictEqual :fn13:b null 2 -+ 111 jump *label34 equal false false - 112 jump *label35 always - 113 label *label34 - 114 set *tmp37 "F" - 115 label *label35 -- * set *tmp36 *tmp37 -+ 116 set *tmp36 "F" - 117 label *label33 ++ 100 op strictEqual :fn13:b null 2 ++ 101 jump *label34 equal false false + 102 jump *label35 always + 103 label *label34 + 104 set *tmp36 "F" + 105 label *label35 + 106 label *label33 - * op strictEqual *tmp39 :fn10:a :fn10:b - * op equal :fn14:b *tmp39 false - * jump *label37 equal :fn14:b false -+ 118 op strictEqual *tmp39 null 2 -+ 119 op equal :fn14:b false false -+ 120 jump *label37 equal true false - 121 set *tmp41 "T" - 122 jump *label38 always - 123 label *label37 ++ 107 op strictEqual *tmp39 null 2 ++ 108 op equal :fn14:b false false ++ 109 jump *label37 equal true false + 110 set *tmp40 "T" + 111 jump *label38 always + 112 label *label37 - * set *tmp41 "F" - 124 label *label38 -- * set *tmp40 *tmp41 -+ 125 set *tmp40 "T" - 126 label *label36 + 113 label *label38 + 114 label *label36 - * print *tmp30 - * print *tmp33 - * print *tmp36 - * print *tmp40 - * assertprints :fn10:expected :fn10:title -+ 127 print *tmp31 -+ 128 print *tmp34 -+ 129 print *tmp37 -+ 130 print *tmp41 -+ 131 assertprints "FTFT" "comparison 3" - 132 label *label26 - 133 set :fn15:title "comparison 4" - 134 set :fn15:a @coal - 135 set :fn15:b 0 - 136 set :fn15:expected "FTFT" - 137 assertflush ++ 115 print "F" ++ 116 print "T" ++ 117 print "F" ++ 118 print "T" ++ 119 assertprints "FTFT" "comparison 3" + 120 label *label26 + 121 set :fn15:title "comparison 4" + 122 set :fn15:a @coal + 123 set :fn15:b 0 + 124 set :fn15:expected "FTFT" + 125 assertflush - * op equal :fn16:b :fn15:a :fn15:b -+ 138 op equal :fn16:b @coal 0 - 139 jump *label41 equal :fn16:b false - 140 set *tmp45 "T" - 141 jump *label42 always - - 144 label *label42 - 145 set *tmp44 *tmp45 - 146 label *label40 ++ 126 op equal :fn16:b @coal 0 + 127 jump *label41 equal :fn16:b false + 128 set *tmp45 "T" + 129 jump *label42 always + + 132 label *label42 + 133 set *tmp44 *tmp45 + 134 label *label40 - * op notEqual :fn17:b :fn15:a :fn15:b -+ 147 op notEqual :fn17:b @coal 0 - 148 jump *label44 equal :fn17:b false - 149 set *tmp48 "T" - 150 jump *label45 always - - 153 label *label45 - 154 set *tmp47 *tmp48 - 155 label *label43 ++ 135 op notEqual :fn17:b @coal 0 + 136 jump *label44 equal :fn17:b false + 137 set *tmp48 "T" + 138 jump *label45 always + + 141 label *label45 + 142 set *tmp47 *tmp48 + 143 label *label43 - * op strictEqual :fn18:b :fn15:a :fn15:b -+ 156 op strictEqual :fn18:b @coal 0 - 157 jump *label47 equal :fn18:b false - 158 set *tmp51 "T" - 159 jump *label48 always - - 162 label *label48 - 163 set *tmp50 *tmp51 - 164 label *label46 ++ 144 op strictEqual :fn18:b @coal 0 + 145 jump *label47 equal :fn18:b false + 146 set *tmp51 "T" + 147 jump *label48 always + + 150 label *label48 + 151 set *tmp50 *tmp51 + 152 label *label46 - * op strictEqual *tmp53 :fn15:a :fn15:b - * op equal :fn19:b *tmp53 false -+ 165 op strictEqual *tmp53 @coal 0 -+ 166 op equal :fn19:b :fn18:b false - 167 jump *label50 equal :fn19:b false - 168 set *tmp55 "T" - 169 jump *label51 always - - 172 label *label51 - 173 set *tmp54 *tmp55 - 174 label *label49 ++ 153 op strictEqual *tmp53 @coal 0 ++ 154 op equal :fn19:b :fn18:b false + 155 jump *label50 equal :fn19:b false + 156 set *tmp55 "T" + 157 jump *label51 always + + 160 label *label51 + 161 set *tmp54 *tmp55 + 162 label *label49 - * print *tmp44 - * print *tmp47 - * print *tmp50 - * print *tmp54 - * assertprints :fn15:expected :fn15:title -+ 175 print *tmp45 -+ 176 print *tmp48 -+ 177 print *tmp51 -+ 178 print *tmp55 -+ 179 assertprints "FTFT" "comparison 4" - 180 label *label39 - 181 set :fn20:title "comparison 5" - 182 set :fn20:a @coal - 183 set :fn20:b 1 - 184 set :fn20:expected "TFFT" - 185 assertflush ++ 163 print *tmp45 ++ 164 print *tmp48 ++ 165 print *tmp51 ++ 166 print *tmp55 ++ 167 assertprints "FTFT" "comparison 4" + 168 label *label39 + 169 set :fn20:title "comparison 5" + 170 set :fn20:a @coal + 171 set :fn20:b 1 + 172 set :fn20:expected "TFFT" + 173 assertflush - * op equal :fn21:b :fn20:a :fn20:b -+ 186 op equal :fn21:b @coal 1 - 187 jump *label54 equal :fn21:b false - 188 set *tmp59 "T" - 189 jump *label55 always - - 192 label *label55 - 193 set *tmp58 *tmp59 - 194 label *label53 ++ 174 op equal :fn21:b @coal 1 + 175 jump *label54 equal :fn21:b false + 176 set *tmp59 "T" + 177 jump *label55 always + + 180 label *label55 + 181 set *tmp58 *tmp59 + 182 label *label53 - * op notEqual :fn22:b :fn20:a :fn20:b -+ 195 op notEqual :fn22:b @coal 1 - 196 jump *label57 equal :fn22:b false - 197 set *tmp62 "T" - 198 jump *label58 always - - 201 label *label58 - 202 set *tmp61 *tmp62 - 203 label *label56 ++ 183 op notEqual :fn22:b @coal 1 + 184 jump *label57 equal :fn22:b false + 185 set *tmp62 "T" + 186 jump *label58 always + + 189 label *label58 + 190 set *tmp61 *tmp62 + 191 label *label56 - * op strictEqual :fn23:b :fn20:a :fn20:b -+ 204 op strictEqual :fn23:b @coal 1 - 205 jump *label60 equal :fn23:b false - 206 set *tmp65 "T" - 207 jump *label61 always - - 210 label *label61 - 211 set *tmp64 *tmp65 - 212 label *label59 ++ 192 op strictEqual :fn23:b @coal 1 + 193 jump *label60 equal :fn23:b false + 194 set *tmp65 "T" + 195 jump *label61 always + + 198 label *label61 + 199 set *tmp64 *tmp65 + 200 label *label59 - * op strictEqual *tmp67 :fn20:a :fn20:b - * op equal :fn24:b *tmp67 false -+ 213 op strictEqual *tmp67 @coal 1 -+ 214 op equal :fn24:b :fn23:b false - 215 jump *label63 equal :fn24:b false - 216 set *tmp69 "T" - 217 jump *label64 always - - 220 label *label64 - 221 set *tmp68 *tmp69 - 222 label *label62 ++ 201 op strictEqual *tmp67 @coal 1 ++ 202 op equal :fn24:b :fn23:b false + 203 jump *label63 equal :fn24:b false + 204 set *tmp69 "T" + 205 jump *label64 always + + 208 label *label64 + 209 set *tmp68 *tmp69 + 210 label *label62 - * print *tmp58 - * print *tmp61 - * print *tmp64 - * print *tmp68 - * assertprints :fn20:expected :fn20:title -+ 223 print *tmp59 -+ 224 print *tmp62 -+ 225 print *tmp65 -+ 226 print *tmp69 -+ 227 assertprints "TFFT" "comparison 5" - 228 label *label52 - 229 set :fn25:title "comparison 6" - 230 set :fn25:a @coal - 231 set :fn25:b 2 - 232 set :fn25:expected "FTFT" - 233 assertflush ++ 211 print *tmp59 ++ 212 print *tmp62 ++ 213 print *tmp65 ++ 214 print *tmp69 ++ 215 assertprints "TFFT" "comparison 5" + 216 label *label52 + 217 set :fn25:title "comparison 6" + 218 set :fn25:a @coal + 219 set :fn25:b 2 + 220 set :fn25:expected "FTFT" + 221 assertflush - * op equal :fn26:b :fn25:a :fn25:b -+ 234 op equal :fn26:b @coal 2 - 235 jump *label67 equal :fn26:b false - 236 set *tmp73 "T" - 237 jump *label68 always - - 240 label *label68 - 241 set *tmp72 *tmp73 - 242 label *label66 ++ 222 op equal :fn26:b @coal 2 + 223 jump *label67 equal :fn26:b false + 224 set *tmp73 "T" + 225 jump *label68 always + + 228 label *label68 + 229 set *tmp72 *tmp73 + 230 label *label66 - * op notEqual :fn27:b :fn25:a :fn25:b -+ 243 op notEqual :fn27:b @coal 2 - 244 jump *label70 equal :fn27:b false - 245 set *tmp76 "T" - 246 jump *label71 always - - 249 label *label71 - 250 set *tmp75 *tmp76 - 251 label *label69 ++ 231 op notEqual :fn27:b @coal 2 + 232 jump *label70 equal :fn27:b false + 233 set *tmp76 "T" + 234 jump *label71 always + + 237 label *label71 + 238 set *tmp75 *tmp76 + 239 label *label69 - * op strictEqual :fn28:b :fn25:a :fn25:b -+ 252 op strictEqual :fn28:b @coal 2 - 253 jump *label73 equal :fn28:b false - 254 set *tmp79 "T" - 255 jump *label74 always - - 258 label *label74 - 259 set *tmp78 *tmp79 - 260 label *label72 ++ 240 op strictEqual :fn28:b @coal 2 + 241 jump *label73 equal :fn28:b false + 242 set *tmp79 "T" + 243 jump *label74 always + + 246 label *label74 + 247 set *tmp78 *tmp79 + 248 label *label72 - * op strictEqual *tmp81 :fn25:a :fn25:b - * op equal :fn29:b *tmp81 false -+ 261 op strictEqual *tmp81 @coal 2 -+ 262 op equal :fn29:b :fn28:b false - 263 jump *label76 equal :fn29:b false - 264 set *tmp83 "T" - 265 jump *label77 always - - 268 label *label77 - 269 set *tmp82 *tmp83 - 270 label *label75 ++ 249 op strictEqual *tmp81 @coal 2 ++ 250 op equal :fn29:b :fn28:b false + 251 jump *label76 equal :fn29:b false + 252 set *tmp83 "T" + 253 jump *label77 always + + 256 label *label77 + 257 set *tmp82 *tmp83 + 258 label *label75 - * print *tmp72 - * print *tmp75 - * print *tmp78 - * print *tmp82 - * assertprints :fn25:expected :fn25:title -+ 271 print *tmp73 -+ 272 print *tmp76 -+ 273 print *tmp79 -+ 274 print *tmp83 -+ 275 assertprints "FTFT" "comparison 6" - 276 label *label65 - 277 set :fn30:title "comparison 7" - 278 set :fn30:a @coal - 279 set :fn30:b @lead - 280 set :fn30:expected "FTFT" - 281 assertflush ++ 259 print *tmp73 ++ 260 print *tmp76 ++ 261 print *tmp79 ++ 262 print *tmp83 ++ 263 assertprints "FTFT" "comparison 6" + 264 label *label65 + 265 set :fn30:title "comparison 7" + 266 set :fn30:a @coal + 267 set :fn30:b @lead + 268 set :fn30:expected "FTFT" + 269 assertflush - * op equal :fn31:b :fn30:a :fn30:b -+ 282 op equal :fn31:b @coal @lead - 283 jump *label80 equal :fn31:b false - 284 set *tmp87 "T" - 285 jump *label81 always - - 288 label *label81 - 289 set *tmp86 *tmp87 - 290 label *label79 ++ 270 op equal :fn31:b @coal @lead + 271 jump *label80 equal :fn31:b false + 272 set *tmp87 "T" + 273 jump *label81 always + + 276 label *label81 + 277 set *tmp86 *tmp87 + 278 label *label79 - * op notEqual :fn32:b :fn30:a :fn30:b -+ 291 op notEqual :fn32:b @coal @lead - 292 jump *label83 equal :fn32:b false - 293 set *tmp90 "T" - 294 jump *label84 always - - 297 label *label84 - 298 set *tmp89 *tmp90 - 299 label *label82 ++ 279 op notEqual :fn32:b @coal @lead + 280 jump *label83 equal :fn32:b false + 281 set *tmp90 "T" + 282 jump *label84 always + + 285 label *label84 + 286 set *tmp89 *tmp90 + 287 label *label82 - * op strictEqual :fn33:b :fn30:a :fn30:b -+ 300 op strictEqual :fn33:b @coal @lead - 301 jump *label86 equal :fn33:b false - 302 set *tmp93 "T" - 303 jump *label87 always - - 306 label *label87 - 307 set *tmp92 *tmp93 - 308 label *label85 ++ 288 op strictEqual :fn33:b @coal @lead + 289 jump *label86 equal :fn33:b false + 290 set *tmp93 "T" + 291 jump *label87 always + + 294 label *label87 + 295 set *tmp92 *tmp93 + 296 label *label85 - * op strictEqual *tmp95 :fn30:a :fn30:b - * op equal :fn34:b *tmp95 false -+ 309 op strictEqual *tmp95 @coal @lead -+ 310 op equal :fn34:b :fn33:b false - 311 jump *label89 equal :fn34:b false - 312 set *tmp97 "T" - 313 jump *label90 always - - 316 label *label90 - 317 set *tmp96 *tmp97 - 318 label *label88 ++ 297 op strictEqual *tmp95 @coal @lead ++ 298 op equal :fn34:b :fn33:b false + 299 jump *label89 equal :fn34:b false + 300 set *tmp97 "T" + 301 jump *label90 always + + 304 label *label90 + 305 set *tmp96 *tmp97 + 306 label *label88 - * print *tmp86 - * print *tmp89 - * print *tmp92 - * print *tmp96 - * assertprints :fn30:expected :fn30:title -+ 319 print *tmp87 -+ 320 print *tmp90 -+ 321 print *tmp93 -+ 322 print *tmp97 -+ 323 assertprints "FTFT" "comparison 7" - 324 label *label78 - 325 set :fn35:title "comparison 8" - 326 set :fn35:a A - 327 set :fn35:b A - 328 set :fn35:expected "TFTF" - 329 assertflush ++ 307 print *tmp87 ++ 308 print *tmp90 ++ 309 print *tmp93 ++ 310 print *tmp97 ++ 311 assertprints "FTFT" "comparison 7" + 312 label *label78 + 313 set :fn35:title "comparison 8" + 314 set :fn35:a A + 315 set :fn35:b A + 316 set :fn35:expected "TFTF" + 317 assertflush - * op equal :fn36:b :fn35:a :fn35:b -+ 330 op equal :fn36:b A A - 331 jump *label93 equal :fn36:b false - 332 set *tmp101 "T" - 333 jump *label94 always - - 336 label *label94 - 337 set *tmp100 *tmp101 - 338 label *label92 ++ 318 op equal :fn36:b A A + 319 jump *label93 equal :fn36:b false + 320 set *tmp101 "T" + 321 jump *label94 always + + 324 label *label94 + 325 set *tmp100 *tmp101 + 326 label *label92 - * op notEqual :fn37:b :fn35:a :fn35:b -+ 339 op notEqual :fn37:b A A - 340 jump *label96 equal :fn37:b false - 341 set *tmp104 "T" - 342 jump *label97 always - - 345 label *label97 - 346 set *tmp103 *tmp104 - 347 label *label95 ++ 327 op notEqual :fn37:b A A + 328 jump *label96 equal :fn37:b false + 329 set *tmp104 "T" + 330 jump *label97 always + + 333 label *label97 + 334 set *tmp103 *tmp104 + 335 label *label95 - * op strictEqual :fn38:b :fn35:a :fn35:b -+ 348 op strictEqual :fn38:b A A - 349 jump *label99 equal :fn38:b false - 350 set *tmp107 "T" - 351 jump *label100 always - - 354 label *label100 - 355 set *tmp106 *tmp107 - 356 label *label98 ++ 336 op strictEqual :fn38:b A A + 337 jump *label99 equal :fn38:b false + 338 set *tmp107 "T" + 339 jump *label100 always + + 342 label *label100 + 343 set *tmp106 *tmp107 + 344 label *label98 - * op strictEqual *tmp109 :fn35:a :fn35:b - * op equal :fn39:b *tmp109 false -+ 357 op strictEqual *tmp109 A A -+ 358 op equal :fn39:b :fn38:b false - 359 jump *label102 equal :fn39:b false - 360 set *tmp111 "T" - 361 jump *label103 always - - 364 label *label103 - 365 set *tmp110 *tmp111 - 366 label *label101 ++ 345 op strictEqual *tmp109 A A ++ 346 op equal :fn39:b :fn38:b false + 347 jump *label102 equal :fn39:b false + 348 set *tmp111 "T" + 349 jump *label103 always + + 352 label *label103 + 353 set *tmp110 *tmp111 + 354 label *label101 - * print *tmp100 - * print *tmp103 - * print *tmp106 - * print *tmp110 - * assertprints :fn35:expected :fn35:title -+ 367 print *tmp101 -+ 368 print *tmp104 -+ 369 print *tmp107 -+ 370 print *tmp111 -+ 371 assertprints "TFTF" "comparison 8" - 372 label *label91 - 373 set :fn40:title "comparison 9" - 374 set :fn40:a A - 375 set :fn40:b 0 - 376 set :fn40:expected "TFTF" - 377 assertflush ++ 355 print *tmp101 ++ 356 print *tmp104 ++ 357 print *tmp107 ++ 358 print *tmp111 ++ 359 assertprints "TFTF" "comparison 8" + 360 label *label91 + 361 set :fn40:title "comparison 9" + 362 set :fn40:a A + 363 set :fn40:b 0 + 364 set :fn40:expected "TFTF" + 365 assertflush - * op equal :fn41:b :fn40:a :fn40:b -+ 378 op equal :fn41:b A 0 - 379 jump *label106 equal :fn41:b false - 380 set *tmp115 "T" - 381 jump *label107 always - - 384 label *label107 - 385 set *tmp114 *tmp115 - 386 label *label105 ++ 366 op equal :fn41:b A 0 + 367 jump *label106 equal :fn41:b false + 368 set *tmp115 "T" + 369 jump *label107 always + + 372 label *label107 + 373 set *tmp114 *tmp115 + 374 label *label105 - * op notEqual :fn42:b :fn40:a :fn40:b -+ 387 op notEqual :fn42:b A 0 - 388 jump *label109 equal :fn42:b false - 389 set *tmp118 "T" - 390 jump *label110 always - - 393 label *label110 - 394 set *tmp117 *tmp118 - 395 label *label108 ++ 375 op notEqual :fn42:b A 0 + 376 jump *label109 equal :fn42:b false + 377 set *tmp118 "T" + 378 jump *label110 always + + 381 label *label110 + 382 set *tmp117 *tmp118 + 383 label *label108 - * op strictEqual :fn43:b :fn40:a :fn40:b -+ 396 op strictEqual :fn43:b A 0 - 397 jump *label112 equal :fn43:b false - 398 set *tmp121 "T" - 399 jump *label113 always - - 402 label *label113 - 403 set *tmp120 *tmp121 - 404 label *label111 ++ 384 op strictEqual :fn43:b A 0 + 385 jump *label112 equal :fn43:b false + 386 set *tmp121 "T" + 387 jump *label113 always + + 390 label *label113 + 391 set *tmp120 *tmp121 + 392 label *label111 - * op strictEqual *tmp123 :fn40:a :fn40:b - * op equal :fn44:b *tmp123 false -+ 405 op strictEqual *tmp123 A 0 -+ 406 op equal :fn44:b :fn43:b false - 407 jump *label115 equal :fn44:b false - 408 set *tmp125 "T" - 409 jump *label116 always - - 412 label *label116 - 413 set *tmp124 *tmp125 - 414 label *label114 ++ 393 op strictEqual *tmp123 A 0 ++ 394 op equal :fn44:b :fn43:b false + 395 jump *label115 equal :fn44:b false + 396 set *tmp125 "T" + 397 jump *label116 always + + 400 label *label116 + 401 set *tmp124 *tmp125 + 402 label *label114 - * print *tmp114 - * print *tmp117 - * print *tmp120 - * print *tmp124 - * assertprints :fn40:expected :fn40:title -+ 415 print *tmp115 -+ 416 print *tmp118 -+ 417 print *tmp121 -+ 418 print *tmp125 -+ 419 assertprints "TFTF" "comparison 9" - 420 label *label104 - 421 set :fn45:title "comparison 10" - 422 set :fn45:a A - 423 set :fn45:b 1 - 424 set :fn45:expected "FTFT" - 425 assertflush ++ 403 print *tmp115 ++ 404 print *tmp118 ++ 405 print *tmp121 ++ 406 print *tmp125 ++ 407 assertprints "TFTF" "comparison 9" + 408 label *label104 + 409 set :fn45:title "comparison 10" + 410 set :fn45:a A + 411 set :fn45:b 1 + 412 set :fn45:expected "FTFT" + 413 assertflush - * op equal :fn46:b :fn45:a :fn45:b -+ 426 op equal :fn46:b A 1 - 427 jump *label119 equal :fn46:b false - 428 set *tmp129 "T" - 429 jump *label120 always - - 432 label *label120 - 433 set *tmp128 *tmp129 - 434 label *label118 ++ 414 op equal :fn46:b A 1 + 415 jump *label119 equal :fn46:b false + 416 set *tmp129 "T" + 417 jump *label120 always + + 420 label *label120 + 421 set *tmp128 *tmp129 + 422 label *label118 - * op notEqual :fn47:b :fn45:a :fn45:b -+ 435 op notEqual :fn47:b A 1 - 436 jump *label122 equal :fn47:b false - 437 set *tmp132 "T" - 438 jump *label123 always - - 441 label *label123 - 442 set *tmp131 *tmp132 - 443 label *label121 ++ 423 op notEqual :fn47:b A 1 + 424 jump *label122 equal :fn47:b false + 425 set *tmp132 "T" + 426 jump *label123 always + + 429 label *label123 + 430 set *tmp131 *tmp132 + 431 label *label121 - * op strictEqual :fn48:b :fn45:a :fn45:b -+ 444 op strictEqual :fn48:b A 1 - 445 jump *label125 equal :fn48:b false - 446 set *tmp135 "T" - 447 jump *label126 always - - 450 label *label126 - 451 set *tmp134 *tmp135 - 452 label *label124 ++ 432 op strictEqual :fn48:b A 1 + 433 jump *label125 equal :fn48:b false + 434 set *tmp135 "T" + 435 jump *label126 always + + 438 label *label126 + 439 set *tmp134 *tmp135 + 440 label *label124 - * op strictEqual *tmp137 :fn45:a :fn45:b - * op equal :fn49:b *tmp137 false -+ 453 op strictEqual *tmp137 A 1 -+ 454 op equal :fn49:b :fn48:b false - 455 jump *label128 equal :fn49:b false - 456 set *tmp139 "T" - 457 jump *label129 always - - 460 label *label129 - 461 set *tmp138 *tmp139 - 462 label *label127 ++ 441 op strictEqual *tmp137 A 1 ++ 442 op equal :fn49:b :fn48:b false + 443 jump *label128 equal :fn49:b false + 444 set *tmp139 "T" + 445 jump *label129 always + + 448 label *label129 + 449 set *tmp138 *tmp139 + 450 label *label127 - * print *tmp128 - * print *tmp131 - * print *tmp134 - * print *tmp138 - * assertprints :fn45:expected :fn45:title -+ 463 print *tmp129 -+ 464 print *tmp132 -+ 465 print *tmp135 -+ 466 print *tmp139 -+ 467 assertprints "FTFT" "comparison 10" - 468 label *label117 - 469 set :fn50:title "comparison 11" - 470 set :fn50:a "A" - 471 set :fn50:b 0 - 472 set :fn50:expected "FTFT" - 473 assertflush ++ 451 print *tmp129 ++ 452 print *tmp132 ++ 453 print *tmp135 ++ 454 print *tmp139 ++ 455 assertprints "FTFT" "comparison 10" + 456 label *label117 + 457 set :fn50:title "comparison 11" + 458 set :fn50:a "A" + 459 set :fn50:b 0 + 460 set :fn50:expected "FTFT" + 461 assertflush - * op equal :fn51:b :fn50:a :fn50:b -+ 474 op equal :fn51:b "A" 0 - 475 jump *label132 equal :fn51:b false - 476 set *tmp143 "T" - 477 jump *label133 always - - 480 label *label133 - 481 set *tmp142 *tmp143 - 482 label *label131 ++ 462 op equal :fn51:b "A" 0 + 463 jump *label132 equal :fn51:b false + 464 set *tmp143 "T" + 465 jump *label133 always + + 468 label *label133 + 469 set *tmp142 *tmp143 + 470 label *label131 - * op notEqual :fn52:b :fn50:a :fn50:b -+ 483 op notEqual :fn52:b "A" 0 - 484 jump *label135 equal :fn52:b false - 485 set *tmp146 "T" - 486 jump *label136 always - - 489 label *label136 - 490 set *tmp145 *tmp146 - 491 label *label134 ++ 471 op notEqual :fn52:b "A" 0 + 472 jump *label135 equal :fn52:b false + 473 set *tmp146 "T" + 474 jump *label136 always + + 477 label *label136 + 478 set *tmp145 *tmp146 + 479 label *label134 - * op strictEqual :fn53:b :fn50:a :fn50:b -+ 492 op strictEqual :fn53:b "A" 0 - 493 jump *label138 equal :fn53:b false - 494 set *tmp149 "T" - 495 jump *label139 always - - 498 label *label139 - 499 set *tmp148 *tmp149 - 500 label *label137 ++ 480 op strictEqual :fn53:b "A" 0 + 481 jump *label138 equal :fn53:b false + 482 set *tmp149 "T" + 483 jump *label139 always + + 486 label *label139 + 487 set *tmp148 *tmp149 + 488 label *label137 - * op strictEqual *tmp151 :fn50:a :fn50:b - * op equal :fn54:b *tmp151 false -+ 501 op strictEqual *tmp151 "A" 0 -+ 502 op equal :fn54:b :fn53:b false - 503 jump *label141 equal :fn54:b false - 504 set *tmp153 "T" - 505 jump *label142 always - - 508 label *label142 - 509 set *tmp152 *tmp153 - 510 label *label140 ++ 489 op strictEqual *tmp151 "A" 0 ++ 490 op equal :fn54:b :fn53:b false + 491 jump *label141 equal :fn54:b false + 492 set *tmp153 "T" + 493 jump *label142 always + + 496 label *label142 + 497 set *tmp152 *tmp153 + 498 label *label140 - * print *tmp142 - * print *tmp145 - * print *tmp148 - * print *tmp152 - * assertprints :fn50:expected :fn50:title -+ 511 print *tmp143 -+ 512 print *tmp146 -+ 513 print *tmp149 -+ 514 print *tmp153 -+ 515 assertprints "FTFT" "comparison 11" - 516 label *label130 - 517 set :fn55:title "comparison 12" - 518 set :fn55:a "A" - 519 set :fn55:b 1 - 520 set :fn55:expected "TFFT" - 521 assertflush ++ 499 print *tmp143 ++ 500 print *tmp146 ++ 501 print *tmp149 ++ 502 print *tmp153 ++ 503 assertprints "FTFT" "comparison 11" + 504 label *label130 + 505 set :fn55:title "comparison 12" + 506 set :fn55:a "A" + 507 set :fn55:b 1 + 508 set :fn55:expected "TFFT" + 509 assertflush - * op equal :fn56:b :fn55:a :fn55:b -+ 522 op equal :fn56:b "A" 1 - 523 jump *label145 equal :fn56:b false - 524 set *tmp157 "T" - 525 jump *label146 always - - 528 label *label146 - 529 set *tmp156 *tmp157 - 530 label *label144 ++ 510 op equal :fn56:b "A" 1 + 511 jump *label145 equal :fn56:b false + 512 set *tmp157 "T" + 513 jump *label146 always + + 516 label *label146 + 517 set *tmp156 *tmp157 + 518 label *label144 - * op notEqual :fn57:b :fn55:a :fn55:b -+ 531 op notEqual :fn57:b "A" 1 - 532 jump *label148 equal :fn57:b false - 533 set *tmp160 "T" - 534 jump *label149 always - - 537 label *label149 - 538 set *tmp159 *tmp160 - 539 label *label147 ++ 519 op notEqual :fn57:b "A" 1 + 520 jump *label148 equal :fn57:b false + 521 set *tmp160 "T" + 522 jump *label149 always + + 525 label *label149 + 526 set *tmp159 *tmp160 + 527 label *label147 - * op strictEqual :fn58:b :fn55:a :fn55:b -+ 540 op strictEqual :fn58:b "A" 1 - 541 jump *label151 equal :fn58:b false - 542 set *tmp163 "T" - 543 jump *label152 always - - 546 label *label152 - 547 set *tmp162 *tmp163 - 548 label *label150 ++ 528 op strictEqual :fn58:b "A" 1 + 529 jump *label151 equal :fn58:b false + 530 set *tmp163 "T" + 531 jump *label152 always + + 534 label *label152 + 535 set *tmp162 *tmp163 + 536 label *label150 - * op strictEqual *tmp165 :fn55:a :fn55:b - * op equal :fn59:b *tmp165 false -+ 549 op strictEqual *tmp165 "A" 1 -+ 550 op equal :fn59:b :fn58:b false - 551 jump *label154 equal :fn59:b false - 552 set *tmp167 "T" - 553 jump *label155 always - - 556 label *label155 - 557 set *tmp166 *tmp167 - 558 label *label153 ++ 537 op strictEqual *tmp165 "A" 1 ++ 538 op equal :fn59:b :fn58:b false + 539 jump *label154 equal :fn59:b false + 540 set *tmp167 "T" + 541 jump *label155 always + + 544 label *label155 + 545 set *tmp166 *tmp167 + 546 label *label153 - * print *tmp156 - * print *tmp159 - * print *tmp162 - * print *tmp166 - * assertprints :fn55:expected :fn55:title -+ 559 print *tmp157 -+ 560 print *tmp160 -+ 561 print *tmp163 -+ 562 print *tmp167 -+ 563 assertprints "TFFT" "comparison 12" - 564 label *label143 - 565 set :fn60:title "comparison 13" - 566 set :fn60:a "A" - 567 set :fn60:b 2 - 568 set :fn60:expected "FTFT" - 569 assertflush ++ 547 print *tmp157 ++ 548 print *tmp160 ++ 549 print *tmp163 ++ 550 print *tmp167 ++ 551 assertprints "TFFT" "comparison 12" + 552 label *label143 + 553 set :fn60:title "comparison 13" + 554 set :fn60:a "A" + 555 set :fn60:b 2 + 556 set :fn60:expected "FTFT" + 557 assertflush - * op equal :fn61:b :fn60:a :fn60:b -+ 570 op equal :fn61:b "A" 2 - 571 jump *label158 equal :fn61:b false - 572 set *tmp171 "T" - 573 jump *label159 always - - 576 label *label159 - 577 set *tmp170 *tmp171 - 578 label *label157 ++ 558 op equal :fn61:b "A" 2 + 559 jump *label158 equal :fn61:b false + 560 set *tmp171 "T" + 561 jump *label159 always + + 564 label *label159 + 565 set *tmp170 *tmp171 + 566 label *label157 - * op notEqual :fn62:b :fn60:a :fn60:b -+ 579 op notEqual :fn62:b "A" 2 - 580 jump *label161 equal :fn62:b false - 581 set *tmp174 "T" - 582 jump *label162 always - - 585 label *label162 - 586 set *tmp173 *tmp174 - 587 label *label160 ++ 567 op notEqual :fn62:b "A" 2 + 568 jump *label161 equal :fn62:b false + 569 set *tmp174 "T" + 570 jump *label162 always + + 573 label *label162 + 574 set *tmp173 *tmp174 + 575 label *label160 - * op strictEqual :fn63:b :fn60:a :fn60:b -+ 588 op strictEqual :fn63:b "A" 2 - 589 jump *label164 equal :fn63:b false - 590 set *tmp177 "T" - 591 jump *label165 always - - 594 label *label165 - 595 set *tmp176 *tmp177 - 596 label *label163 ++ 576 op strictEqual :fn63:b "A" 2 + 577 jump *label164 equal :fn63:b false + 578 set *tmp177 "T" + 579 jump *label165 always + + 582 label *label165 + 583 set *tmp176 *tmp177 + 584 label *label163 - * op strictEqual *tmp179 :fn60:a :fn60:b - * op equal :fn64:b *tmp179 false -+ 597 op strictEqual *tmp179 "A" 2 -+ 598 op equal :fn64:b :fn63:b false - 599 jump *label167 equal :fn64:b false - 600 set *tmp181 "T" - 601 jump *label168 always - - 604 label *label168 - 605 set *tmp180 *tmp181 - 606 label *label166 ++ 585 op strictEqual *tmp179 "A" 2 ++ 586 op equal :fn64:b :fn63:b false + 587 jump *label167 equal :fn64:b false + 588 set *tmp181 "T" + 589 jump *label168 always + + 592 label *label168 + 593 set *tmp180 *tmp181 + 594 label *label166 - * print *tmp170 - * print *tmp173 - * print *tmp176 - * print *tmp180 - * assertprints :fn60:expected :fn60:title -+ 607 print *tmp171 -+ 608 print *tmp174 -+ 609 print *tmp177 -+ 610 print *tmp181 -+ 611 assertprints "FTFT" "comparison 13" - 612 label *label156 - 613 set :fn65:title "comparison 14" - 614 set :fn65:a "A" - 615 set :fn65:b "B" - 616 set :fn65:expected "FTFT" - 617 assertflush ++ 595 print *tmp171 ++ 596 print *tmp174 ++ 597 print *tmp177 ++ 598 print *tmp181 ++ 599 assertprints "FTFT" "comparison 13" + 600 label *label156 + 601 set :fn65:title "comparison 14" + 602 set :fn65:a "A" + 603 set :fn65:b "B" + 604 set :fn65:expected "FTFT" + 605 assertflush - * op equal :fn66:b :fn65:a :fn65:b -+ 618 op equal :fn66:b "A" "B" - 619 jump *label171 equal :fn66:b false - 620 set *tmp185 "T" - 621 jump *label172 always - - 624 label *label172 - 625 set *tmp184 *tmp185 - 626 label *label170 ++ 606 op equal :fn66:b "A" "B" + 607 jump *label171 equal :fn66:b false + 608 set *tmp185 "T" + 609 jump *label172 always + + 612 label *label172 + 613 set *tmp184 *tmp185 + 614 label *label170 - * op notEqual :fn67:b :fn65:a :fn65:b -+ 627 op notEqual :fn67:b "A" "B" - 628 jump *label174 equal :fn67:b false - 629 set *tmp188 "T" - 630 jump *label175 always - - 633 label *label175 - 634 set *tmp187 *tmp188 - 635 label *label173 ++ 615 op notEqual :fn67:b "A" "B" + 616 jump *label174 equal :fn67:b false + 617 set *tmp188 "T" + 618 jump *label175 always + + 621 label *label175 + 622 set *tmp187 *tmp188 + 623 label *label173 - * op strictEqual :fn68:b :fn65:a :fn65:b -+ 636 op strictEqual :fn68:b "A" "B" - 637 jump *label177 equal :fn68:b false - 638 set *tmp191 "T" - 639 jump *label178 always - - 642 label *label178 - 643 set *tmp190 *tmp191 - 644 label *label176 ++ 624 op strictEqual :fn68:b "A" "B" + 625 jump *label177 equal :fn68:b false + 626 set *tmp191 "T" + 627 jump *label178 always + + 630 label *label178 + 631 set *tmp190 *tmp191 + 632 label *label176 - * op strictEqual *tmp193 :fn65:a :fn65:b - * op equal :fn69:b *tmp193 false -+ 645 op strictEqual *tmp193 "A" "B" -+ 646 op equal :fn69:b :fn68:b false - 647 jump *label180 equal :fn69:b false - 648 set *tmp195 "T" - 649 jump *label181 always - - 652 label *label181 - 653 set *tmp194 *tmp195 - 654 label *label179 ++ 633 op strictEqual *tmp193 "A" "B" ++ 634 op equal :fn69:b :fn68:b false + 635 jump *label180 equal :fn69:b false + 636 set *tmp195 "T" + 637 jump *label181 always + + 640 label *label181 + 641 set *tmp194 *tmp195 + 642 label *label179 - * print *tmp184 - * print *tmp187 - * print *tmp190 - * print *tmp194 - * assertprints :fn65:expected :fn65:title -+ 655 print *tmp185 -+ 656 print *tmp188 -+ 657 print *tmp191 -+ 658 print *tmp195 -+ 659 assertprints "FTFT" "comparison 14" - 660 label *label169 - 661 set :fn70:title "comparison 15" - 662 set :fn70:a "A" - 663 set :fn70:b "A" - 664 set :fn70:expected "TFTF" - 665 assertflush ++ 643 print *tmp185 ++ 644 print *tmp188 ++ 645 print *tmp191 ++ 646 print *tmp195 ++ 647 assertprints "FTFT" "comparison 14" + 648 label *label169 + 649 set :fn70:title "comparison 15" + 650 set :fn70:a "A" + 651 set :fn70:b "A" + 652 set :fn70:expected "TFTF" + 653 assertflush - * op equal :fn71:b :fn70:a :fn70:b -+ 666 op equal :fn71:b "A" "A" - 667 jump *label184 equal :fn71:b false - 668 set *tmp199 "T" - 669 jump *label185 always - - 672 label *label185 - 673 set *tmp198 *tmp199 - 674 label *label183 ++ 654 op equal :fn71:b "A" "A" + 655 jump *label184 equal :fn71:b false + 656 set *tmp199 "T" + 657 jump *label185 always + + 660 label *label185 + 661 set *tmp198 *tmp199 + 662 label *label183 - * op notEqual :fn72:b :fn70:a :fn70:b -+ 675 op notEqual :fn72:b "A" "A" - 676 jump *label187 equal :fn72:b false - 677 set *tmp202 "T" - 678 jump *label188 always - - 681 label *label188 - 682 set *tmp201 *tmp202 - 683 label *label186 ++ 663 op notEqual :fn72:b "A" "A" + 664 jump *label187 equal :fn72:b false + 665 set *tmp202 "T" + 666 jump *label188 always + + 669 label *label188 + 670 set *tmp201 *tmp202 + 671 label *label186 - * op strictEqual :fn73:b :fn70:a :fn70:b -+ 684 op strictEqual :fn73:b "A" "A" - 685 jump *label190 equal :fn73:b false - 686 set *tmp205 "T" - 687 jump *label191 always - - 690 label *label191 - 691 set *tmp204 *tmp205 - 692 label *label189 ++ 672 op strictEqual :fn73:b "A" "A" + 673 jump *label190 equal :fn73:b false + 674 set *tmp205 "T" + 675 jump *label191 always + + 678 label *label191 + 679 set *tmp204 *tmp205 + 680 label *label189 - * op strictEqual *tmp207 :fn70:a :fn70:b - * op equal :fn74:b *tmp207 false -+ 693 op strictEqual *tmp207 "A" "A" -+ 694 op equal :fn74:b :fn73:b false - 695 jump *label193 equal :fn74:b false - 696 set *tmp209 "T" - 697 jump *label194 always - - 700 label *label194 - 701 set *tmp208 *tmp209 - 702 label *label192 ++ 681 op strictEqual *tmp207 "A" "A" ++ 682 op equal :fn74:b :fn73:b false + 683 jump *label193 equal :fn74:b false + 684 set *tmp209 "T" + 685 jump *label194 always + + 688 label *label194 + 689 set *tmp208 *tmp209 + 690 label *label192 - * print *tmp198 - * print *tmp201 - * print *tmp204 - * print *tmp208 - * assertprints :fn70:expected :fn70:title -+ 703 print *tmp199 -+ 704 print *tmp202 -+ 705 print *tmp205 -+ 706 print *tmp209 -+ 707 assertprints "TFTF" "comparison 15" - 708 label *label182 - 709 stop - 710 end ++ 691 print *tmp199 ++ 692 print *tmp202 ++ 693 print *tmp205 ++ 694 print *tmp209 ++ 695 assertprints "TFTF" "comparison 15" + 696 label *label182 + 697 stop + 698 end -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-147 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-147 instructions): 0 set A 0 - * set :fn0:title "comparison 1" - * set :fn0:a null @@ -1591,903 +1698,797 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 1 assertflush - * op equal :fn1:b null 0 2 jump *label2 equal true false - 3 set *tmp3 "T" - 4 jump *label3 always - 5 label *label2 - 6 label *label3 - * set *tmp2 "T" - 7 label *label1 + 3 jump *label3 always + 4 label *label2 + 5 label *label3 + 6 label *label1 - * op notEqual :fn2:b null 0 - 8 jump *label5 equal false false - 9 jump *label6 always - 10 label *label5 - 11 set *tmp6 "F" - 12 label *label6 + 7 jump *label5 equal false false + 8 jump *label6 always + 9 label *label5 - * set *tmp5 "F" - 13 label *label4 + 10 label *label6 + 11 label *label4 - * op strictEqual :fn3:b null 0 - 14 jump *label8 equal false false - 15 jump *label9 always - 16 label *label8 - 17 set *tmp9 "F" - 18 label *label9 + 12 jump *label8 equal false false + 13 jump *label9 always + 14 label *label8 - * set *tmp8 "F" - 19 label *label7 + 15 label *label9 + 16 label *label7 - * op strictEqual *tmp11 null 0 - * op equal :fn4:b false false - 20 jump *label11 equal true false - 21 set *tmp13 "T" - 22 jump *label12 always - 23 label *label11 - 24 label *label12 + 17 jump *label11 equal true false - * set *tmp12 "T" - 25 label *label10 -- * print *tmp3 -- * print *tmp6 -- * print *tmp9 -- * print *tmp13 -+ 26 print "T" -+ 27 print "F" -+ 28 print "F" -+ 29 print "T" - 30 assertprints "TFFT" "comparison 1" - 31 label *label0 + 18 jump *label12 always + 19 label *label11 + 20 label *label12 + + 25 print "T" + 26 assertprints "TFFT" "comparison 1" + 27 label *label0 - * set :fn5:title "comparison 2" - * set :fn5:a null - * set :fn5:b 1 - * set :fn5:expected "FTFT" - 32 assertflush + 28 assertflush - * op equal :fn6:b null 1 - 33 jump *label15 equal false false - 34 jump *label16 always - 35 label *label15 - 36 set *tmp17 "F" - 37 label *label16 + 29 jump *label15 equal false false + 30 jump *label16 always + 31 label *label15 - * set *tmp16 "F" - 38 label *label14 + 32 label *label16 + 33 label *label14 - * op notEqual :fn7:b null 1 - 39 jump *label18 equal true false - 40 set *tmp20 "T" - 41 jump *label19 always - 42 label *label18 - 43 label *label19 + 34 jump *label18 equal true false - * set *tmp19 "T" - 44 label *label17 + 35 jump *label19 always + 36 label *label18 + 37 label *label19 + 38 label *label17 - * op strictEqual :fn8:b null 1 - 45 jump *label21 equal false false - 46 jump *label22 always - 47 label *label21 - 48 set *tmp23 "F" - 49 label *label22 + 39 jump *label21 equal false false + 40 jump *label22 always + 41 label *label21 - * set *tmp22 "F" - 50 label *label20 + 42 label *label22 + 43 label *label20 - * op strictEqual *tmp25 null 1 - * op equal :fn9:b false false - 51 jump *label24 equal true false - 52 set *tmp27 "T" - 53 jump *label25 always - 54 label *label24 - 55 label *label25 + 44 jump *label24 equal true false - * set *tmp26 "T" - 56 label *label23 -- * print *tmp17 -- * print *tmp20 -- * print *tmp23 -- * print *tmp27 -+ 57 print "F" -+ 58 print "T" -+ 59 print "F" -+ 60 print "T" - 61 assertprints "FTFT" "comparison 2" - 62 label *label13 + 45 jump *label25 always + 46 label *label24 + 47 label *label25 + + 52 print "T" + 53 assertprints "FTFT" "comparison 2" + 54 label *label13 - * set :fn10:title "comparison 3" - * set :fn10:a null - * set :fn10:b 2 - * set :fn10:expected "FTFT" - 63 assertflush + 55 assertflush - * op equal :fn11:b null 2 - 64 jump *label28 equal false false - 65 jump *label29 always - 66 label *label28 - 67 set *tmp31 "F" - 68 label *label29 + 56 jump *label28 equal false false + 57 jump *label29 always + 58 label *label28 - * set *tmp30 "F" - 69 label *label27 + 59 label *label29 + 60 label *label27 - * op notEqual :fn12:b null 2 - 70 jump *label31 equal true false - 71 set *tmp34 "T" - 72 jump *label32 always - 73 label *label31 - 74 label *label32 + 61 jump *label31 equal true false - * set *tmp33 "T" - 75 label *label30 + 62 jump *label32 always + 63 label *label31 + 64 label *label32 + 65 label *label30 - * op strictEqual :fn13:b null 2 - 76 jump *label34 equal false false - 77 jump *label35 always - 78 label *label34 - 79 set *tmp37 "F" - 80 label *label35 + 66 jump *label34 equal false false + 67 jump *label35 always + 68 label *label34 - * set *tmp36 "F" - 81 label *label33 + 69 label *label35 + 70 label *label33 - * op strictEqual *tmp39 null 2 - * op equal :fn14:b false false - 82 jump *label37 equal true false - 83 set *tmp41 "T" - 84 jump *label38 always - 85 label *label37 - 86 label *label38 + 71 jump *label37 equal true false - * set *tmp40 "T" - 87 label *label36 -- * print *tmp31 -- * print *tmp34 -- * print *tmp37 -- * print *tmp41 -+ 88 print "F" -+ 89 print "T" -+ 90 print "F" -+ 91 print "T" - 92 assertprints "FTFT" "comparison 3" - 93 label *label26 + 72 jump *label38 always + 73 label *label37 + 74 label *label38 + + 79 print "T" + 80 assertprints "FTFT" "comparison 3" + 81 label *label26 - * set :fn15:title "comparison 4" - * set :fn15:a @coal - * set :fn15:b 0 - * set :fn15:expected "FTFT" - 94 assertflush - 95 op equal :fn16:b @coal 0 + 82 assertflush + 83 op equal :fn16:b @coal 0 - * jump *label41 equal :fn16:b false - * set *tmp45 "T" -+ 96 jump *label41 equal false false - 97 jump *label42 always - 98 label *label41 - 99 set *tmp45 "F" - 100 label *label42 ++ 84 jump *label41 equal false false + 85 jump *label42 always + 86 label *label41 + 87 set *tmp45 "F" + 88 label *label42 - * set *tmp44 *tmp45 -+ 101 set *tmp44 "F" - 102 label *label40 - 103 op notEqual :fn17:b @coal 0 ++ 89 set *tmp44 "F" + 90 label *label40 + 91 op notEqual :fn17:b @coal 0 - * jump *label44 equal :fn17:b false -+ 104 jump *label44 equal true false - 105 set *tmp48 "T" - 106 jump *label45 always - 107 label *label44 ++ 92 jump *label44 equal true false + 93 set *tmp48 "T" + 94 jump *label45 always + 95 label *label44 - * set *tmp48 "F" - 108 label *label45 + 96 label *label45 - * set *tmp47 *tmp48 -+ 109 set *tmp47 "T" - 110 label *label43 - 111 op strictEqual :fn18:b @coal 0 ++ 97 set *tmp47 "T" + 98 label *label43 + 99 op strictEqual :fn18:b @coal 0 - * jump *label47 equal :fn18:b false - * set *tmp51 "T" -+ 112 jump *label47 equal false false - 113 jump *label48 always - 114 label *label47 - 115 set *tmp51 "F" - 116 label *label48 ++ 100 jump *label47 equal false false + 101 jump *label48 always + 102 label *label47 + 103 set *tmp51 "F" + 104 label *label48 - * set *tmp50 *tmp51 -+ 117 set *tmp50 "F" - 118 label *label46 ++ 105 set *tmp50 "F" + 106 label *label46 - * op strictEqual *tmp53 @coal 0 - * op equal :fn19:b :fn18:b false - * jump *label50 equal :fn19:b false -+ 119 op equal :fn19:b false false -+ 120 jump *label50 equal true false - 121 set *tmp55 "T" - 122 jump *label51 always - 123 label *label50 ++ 107 op equal :fn19:b false false ++ 108 jump *label50 equal true false + 109 set *tmp55 "T" + 110 jump *label51 always + 111 label *label50 - * set *tmp55 "F" - 124 label *label51 + 112 label *label51 - * set *tmp54 *tmp55 -+ 125 set *tmp54 "T" - 126 label *label49 ++ 113 set *tmp54 "T" + 114 label *label49 - * print *tmp45 - * print *tmp48 - * print *tmp51 - * print *tmp55 -+ 127 print "F" -+ 128 print "T" -+ 129 print "F" -+ 130 print "T" - 131 assertprints "FTFT" "comparison 4" - 132 label *label39 ++ 115 print "F" ++ 116 print "T" ++ 117 print "F" ++ 118 print "T" + 119 assertprints "FTFT" "comparison 4" + 120 label *label39 - * set :fn20:title "comparison 5" - * set :fn20:a @coal - * set :fn20:b 1 - * set :fn20:expected "TFFT" - 133 assertflush - 134 op equal :fn21:b @coal 1 + 121 assertflush + 122 op equal :fn21:b @coal 1 - * jump *label54 equal :fn21:b false -+ 135 jump *label54 equal true false - 136 set *tmp59 "T" - 137 jump *label55 always - 138 label *label54 ++ 123 jump *label54 equal true false + 124 set *tmp59 "T" + 125 jump *label55 always + 126 label *label54 - * set *tmp59 "F" - 139 label *label55 + 127 label *label55 - * set *tmp58 *tmp59 -+ 140 set *tmp58 "T" - 141 label *label53 - 142 op notEqual :fn22:b @coal 1 ++ 128 set *tmp58 "T" + 129 label *label53 + 130 op notEqual :fn22:b @coal 1 - * jump *label57 equal :fn22:b false - * set *tmp62 "T" -+ 143 jump *label57 equal false false - 144 jump *label58 always - 145 label *label57 - 146 set *tmp62 "F" - 147 label *label58 ++ 131 jump *label57 equal false false + 132 jump *label58 always + 133 label *label57 + 134 set *tmp62 "F" + 135 label *label58 - * set *tmp61 *tmp62 -+ 148 set *tmp61 "F" - 149 label *label56 - 150 op strictEqual :fn23:b @coal 1 ++ 136 set *tmp61 "F" + 137 label *label56 + 138 op strictEqual :fn23:b @coal 1 - * jump *label60 equal :fn23:b false - * set *tmp65 "T" -+ 151 jump *label60 equal false false - 152 jump *label61 always - 153 label *label60 - 154 set *tmp65 "F" - 155 label *label61 ++ 139 jump *label60 equal false false + 140 jump *label61 always + 141 label *label60 + 142 set *tmp65 "F" + 143 label *label61 - * set *tmp64 *tmp65 -+ 156 set *tmp64 "F" - 157 label *label59 ++ 144 set *tmp64 "F" + 145 label *label59 - * op strictEqual *tmp67 @coal 1 - * op equal :fn24:b :fn23:b false - * jump *label63 equal :fn24:b false -+ 158 op equal :fn24:b false false -+ 159 jump *label63 equal true false - 160 set *tmp69 "T" - 161 jump *label64 always - 162 label *label63 ++ 146 op equal :fn24:b false false ++ 147 jump *label63 equal true false + 148 set *tmp69 "T" + 149 jump *label64 always + 150 label *label63 - * set *tmp69 "F" - 163 label *label64 + 151 label *label64 - * set *tmp68 *tmp69 -+ 164 set *tmp68 "T" - 165 label *label62 ++ 152 set *tmp68 "T" + 153 label *label62 - * print *tmp59 - * print *tmp62 - * print *tmp65 - * print *tmp69 -+ 166 print "T" -+ 167 print "F" -+ 168 print "F" -+ 169 print "T" - 170 assertprints "TFFT" "comparison 5" - 171 label *label52 ++ 154 print "T" ++ 155 print "F" ++ 156 print "F" ++ 157 print "T" + 158 assertprints "TFFT" "comparison 5" + 159 label *label52 - * set :fn25:title "comparison 6" - * set :fn25:a @coal - * set :fn25:b 2 - * set :fn25:expected "FTFT" - 172 assertflush - 173 op equal :fn26:b @coal 2 + 160 assertflush + 161 op equal :fn26:b @coal 2 - * jump *label67 equal :fn26:b false - * set *tmp73 "T" -+ 174 jump *label67 equal false false - 175 jump *label68 always - 176 label *label67 - 177 set *tmp73 "F" - 178 label *label68 ++ 162 jump *label67 equal false false + 163 jump *label68 always + 164 label *label67 + 165 set *tmp73 "F" + 166 label *label68 - * set *tmp72 *tmp73 -+ 179 set *tmp72 "F" - 180 label *label66 - 181 op notEqual :fn27:b @coal 2 ++ 167 set *tmp72 "F" + 168 label *label66 + 169 op notEqual :fn27:b @coal 2 - * jump *label70 equal :fn27:b false -+ 182 jump *label70 equal true false - 183 set *tmp76 "T" - 184 jump *label71 always - 185 label *label70 ++ 170 jump *label70 equal true false + 171 set *tmp76 "T" + 172 jump *label71 always + 173 label *label70 - * set *tmp76 "F" - 186 label *label71 + 174 label *label71 - * set *tmp75 *tmp76 -+ 187 set *tmp75 "T" - 188 label *label69 - 189 op strictEqual :fn28:b @coal 2 ++ 175 set *tmp75 "T" + 176 label *label69 + 177 op strictEqual :fn28:b @coal 2 - * jump *label73 equal :fn28:b false - * set *tmp79 "T" -+ 190 jump *label73 equal false false - 191 jump *label74 always - 192 label *label73 - 193 set *tmp79 "F" - 194 label *label74 ++ 178 jump *label73 equal false false + 179 jump *label74 always + 180 label *label73 + 181 set *tmp79 "F" + 182 label *label74 - * set *tmp78 *tmp79 -+ 195 set *tmp78 "F" - 196 label *label72 ++ 183 set *tmp78 "F" + 184 label *label72 - * op strictEqual *tmp81 @coal 2 - * op equal :fn29:b :fn28:b false - * jump *label76 equal :fn29:b false -+ 197 op equal :fn29:b false false -+ 198 jump *label76 equal true false - 199 set *tmp83 "T" - 200 jump *label77 always - 201 label *label76 ++ 185 op equal :fn29:b false false ++ 186 jump *label76 equal true false + 187 set *tmp83 "T" + 188 jump *label77 always + 189 label *label76 - * set *tmp83 "F" - 202 label *label77 + 190 label *label77 - * set *tmp82 *tmp83 -+ 203 set *tmp82 "T" - 204 label *label75 ++ 191 set *tmp82 "T" + 192 label *label75 - * print *tmp73 - * print *tmp76 - * print *tmp79 - * print *tmp83 -+ 205 print "F" -+ 206 print "T" -+ 207 print "F" -+ 208 print "T" - 209 assertprints "FTFT" "comparison 6" - 210 label *label65 ++ 193 print "F" ++ 194 print "T" ++ 195 print "F" ++ 196 print "T" + 197 assertprints "FTFT" "comparison 6" + 198 label *label65 - * set :fn30:title "comparison 7" - * set :fn30:a @coal - * set :fn30:b @lead - * set :fn30:expected "FTFT" - 211 assertflush - 212 op equal :fn31:b @coal @lead + 199 assertflush + 200 op equal :fn31:b @coal @lead - * jump *label80 equal :fn31:b false - * set *tmp87 "T" -+ 213 jump *label80 equal false false - 214 jump *label81 always - 215 label *label80 - 216 set *tmp87 "F" - 217 label *label81 ++ 201 jump *label80 equal false false + 202 jump *label81 always + 203 label *label80 + 204 set *tmp87 "F" + 205 label *label81 - * set *tmp86 *tmp87 -+ 218 set *tmp86 "F" - 219 label *label79 - 220 op notEqual :fn32:b @coal @lead ++ 206 set *tmp86 "F" + 207 label *label79 + 208 op notEqual :fn32:b @coal @lead - * jump *label83 equal :fn32:b false -+ 221 jump *label83 equal true false - 222 set *tmp90 "T" - 223 jump *label84 always - 224 label *label83 ++ 209 jump *label83 equal true false + 210 set *tmp90 "T" + 211 jump *label84 always + 212 label *label83 - * set *tmp90 "F" - 225 label *label84 + 213 label *label84 - * set *tmp89 *tmp90 -+ 226 set *tmp89 "T" - 227 label *label82 - 228 op strictEqual :fn33:b @coal @lead ++ 214 set *tmp89 "T" + 215 label *label82 + 216 op strictEqual :fn33:b @coal @lead - * jump *label86 equal :fn33:b false - * set *tmp93 "T" -+ 229 jump *label86 equal false false - 230 jump *label87 always - 231 label *label86 - 232 set *tmp93 "F" - 233 label *label87 ++ 217 jump *label86 equal false false + 218 jump *label87 always + 219 label *label86 + 220 set *tmp93 "F" + 221 label *label87 - * set *tmp92 *tmp93 -+ 234 set *tmp92 "F" - 235 label *label85 ++ 222 set *tmp92 "F" + 223 label *label85 - * op strictEqual *tmp95 @coal @lead - * op equal :fn34:b :fn33:b false - * jump *label89 equal :fn34:b false -+ 236 op equal :fn34:b false false -+ 237 jump *label89 equal true false - 238 set *tmp97 "T" - 239 jump *label90 always - 240 label *label89 ++ 224 op equal :fn34:b false false ++ 225 jump *label89 equal true false + 226 set *tmp97 "T" + 227 jump *label90 always + 228 label *label89 - * set *tmp97 "F" - 241 label *label90 + 229 label *label90 - * set *tmp96 *tmp97 -+ 242 set *tmp96 "T" - 243 label *label88 ++ 230 set *tmp96 "T" + 231 label *label88 - * print *tmp87 - * print *tmp90 - * print *tmp93 - * print *tmp97 -+ 244 print "F" -+ 245 print "T" -+ 246 print "F" -+ 247 print "T" - 248 assertprints "FTFT" "comparison 7" - 249 label *label78 ++ 232 print "F" ++ 233 print "T" ++ 234 print "F" ++ 235 print "T" + 236 assertprints "FTFT" "comparison 7" + 237 label *label78 - * set :fn35:title "comparison 8" - * set :fn35:a A - * set :fn35:b A - * set :fn35:expected "TFTF" - 250 assertflush - 251 op equal :fn36:b A A - 252 jump *label93 equal :fn36:b false + 238 assertflush + 239 op equal :fn36:b A A + 240 jump *label93 equal :fn36:b false - 255 label *label93 - 256 set *tmp101 "F" - 257 label *label94 + 243 label *label93 + 244 set *tmp101 "F" + 245 label *label94 - * set *tmp100 *tmp101 - 258 label *label92 - 259 op notEqual :fn37:b A A - 260 jump *label96 equal :fn37:b false + 246 label *label92 + 247 op notEqual :fn37:b A A + 248 jump *label96 equal :fn37:b false - 263 label *label96 - 264 set *tmp104 "F" - 265 label *label97 + 251 label *label96 + 252 set *tmp104 "F" + 253 label *label97 - * set *tmp103 *tmp104 - 266 label *label95 - 267 op strictEqual :fn38:b A A - 268 jump *label99 equal :fn38:b false + 254 label *label95 + 255 op strictEqual :fn38:b A A + 256 jump *label99 equal :fn38:b false - 271 label *label99 - 272 set *tmp107 "F" - 273 label *label100 + 259 label *label99 + 260 set *tmp107 "F" + 261 label *label100 - * set *tmp106 *tmp107 - 274 label *label98 + 262 label *label98 - * op strictEqual *tmp109 A A - 275 op equal :fn39:b :fn38:b false - 276 jump *label102 equal :fn39:b false - 277 set *tmp111 "T" + 263 op equal :fn39:b :fn38:b false + 264 jump *label102 equal :fn39:b false + 265 set *tmp111 "T" - 279 label *label102 - 280 set *tmp111 "F" - 281 label *label103 + 267 label *label102 + 268 set *tmp111 "F" + 269 label *label103 - * set *tmp110 *tmp111 - 282 label *label101 - 283 print *tmp101 - 284 print *tmp104 + 270 label *label101 + 271 print *tmp101 + 272 print *tmp104 - 286 print *tmp111 - 287 assertprints "TFTF" "comparison 8" - 288 label *label91 + 274 print *tmp111 + 275 assertprints "TFTF" "comparison 8" + 276 label *label91 - * set :fn40:title "comparison 9" - * set :fn40:a A - * set :fn40:b 0 - * set :fn40:expected "TFTF" - 289 assertflush - 290 op equal :fn41:b A 0 - 291 jump *label106 equal :fn41:b false + 277 assertflush + 278 op equal :fn41:b A 0 + 279 jump *label106 equal :fn41:b false - 294 label *label106 - 295 set *tmp115 "F" - 296 label *label107 + 282 label *label106 + 283 set *tmp115 "F" + 284 label *label107 - * set *tmp114 *tmp115 - 297 label *label105 - 298 op notEqual :fn42:b A 0 - 299 jump *label109 equal :fn42:b false + 285 label *label105 + 286 op notEqual :fn42:b A 0 + 287 jump *label109 equal :fn42:b false - 302 label *label109 - 303 set *tmp118 "F" - 304 label *label110 + 290 label *label109 + 291 set *tmp118 "F" + 292 label *label110 - * set *tmp117 *tmp118 - 305 label *label108 - 306 op strictEqual :fn43:b A 0 - 307 jump *label112 equal :fn43:b false + 293 label *label108 + 294 op strictEqual :fn43:b A 0 + 295 jump *label112 equal :fn43:b false - 310 label *label112 - 311 set *tmp121 "F" - 312 label *label113 + 298 label *label112 + 299 set *tmp121 "F" + 300 label *label113 - * set *tmp120 *tmp121 - 313 label *label111 + 301 label *label111 - * op strictEqual *tmp123 A 0 - 314 op equal :fn44:b :fn43:b false - 315 jump *label115 equal :fn44:b false - 316 set *tmp125 "T" + 302 op equal :fn44:b :fn43:b false + 303 jump *label115 equal :fn44:b false + 304 set *tmp125 "T" - 318 label *label115 - 319 set *tmp125 "F" - 320 label *label116 + 306 label *label115 + 307 set *tmp125 "F" + 308 label *label116 - * set *tmp124 *tmp125 - 321 label *label114 - 322 print *tmp115 - 323 print *tmp118 + 309 label *label114 + 310 print *tmp115 + 311 print *tmp118 - 325 print *tmp125 - 326 assertprints "TFTF" "comparison 9" - 327 label *label104 + 313 print *tmp125 + 314 assertprints "TFTF" "comparison 9" + 315 label *label104 - * set :fn45:title "comparison 10" - * set :fn45:a A - * set :fn45:b 1 - * set :fn45:expected "FTFT" - 328 assertflush - 329 op equal :fn46:b A 1 - 330 jump *label119 equal :fn46:b false + 316 assertflush + 317 op equal :fn46:b A 1 + 318 jump *label119 equal :fn46:b false - 333 label *label119 - 334 set *tmp129 "F" - 335 label *label120 + 321 label *label119 + 322 set *tmp129 "F" + 323 label *label120 - * set *tmp128 *tmp129 - 336 label *label118 - 337 op notEqual :fn47:b A 1 - 338 jump *label122 equal :fn47:b false + 324 label *label118 + 325 op notEqual :fn47:b A 1 + 326 jump *label122 equal :fn47:b false - 341 label *label122 - 342 set *tmp132 "F" - 343 label *label123 + 329 label *label122 + 330 set *tmp132 "F" + 331 label *label123 - * set *tmp131 *tmp132 - 344 label *label121 - 345 op strictEqual :fn48:b A 1 - 346 jump *label125 equal :fn48:b false + 332 label *label121 + 333 op strictEqual :fn48:b A 1 + 334 jump *label125 equal :fn48:b false - 349 label *label125 - 350 set *tmp135 "F" - 351 label *label126 + 337 label *label125 + 338 set *tmp135 "F" + 339 label *label126 - * set *tmp134 *tmp135 - 352 label *label124 + 340 label *label124 - * op strictEqual *tmp137 A 1 - 353 op equal :fn49:b :fn48:b false - 354 jump *label128 equal :fn49:b false - 355 set *tmp139 "T" + 341 op equal :fn49:b :fn48:b false + 342 jump *label128 equal :fn49:b false + 343 set *tmp139 "T" - 357 label *label128 - 358 set *tmp139 "F" - 359 label *label129 + 345 label *label128 + 346 set *tmp139 "F" + 347 label *label129 - * set *tmp138 *tmp139 - 360 label *label127 - 361 print *tmp129 - 362 print *tmp132 + 348 label *label127 + 349 print *tmp129 + 350 print *tmp132 - 364 print *tmp139 - 365 assertprints "FTFT" "comparison 10" - 366 label *label117 + 352 print *tmp139 + 353 assertprints "FTFT" "comparison 10" + 354 label *label117 - * set :fn50:title "comparison 11" - * set :fn50:a "A" - * set :fn50:b 0 - * set :fn50:expected "FTFT" - 367 assertflush - 368 op equal :fn51:b "A" 0 + 355 assertflush + 356 op equal :fn51:b "A" 0 - * jump *label132 equal :fn51:b false - * set *tmp143 "T" -+ 369 jump *label132 equal false false - 370 jump *label133 always - 371 label *label132 - 372 set *tmp143 "F" - 373 label *label133 ++ 357 jump *label132 equal false false + 358 jump *label133 always + 359 label *label132 + 360 set *tmp143 "F" + 361 label *label133 - * set *tmp142 *tmp143 -+ 374 set *tmp142 "F" - 375 label *label131 - 376 op notEqual :fn52:b "A" 0 ++ 362 set *tmp142 "F" + 363 label *label131 + 364 op notEqual :fn52:b "A" 0 - * jump *label135 equal :fn52:b false -+ 377 jump *label135 equal true false - 378 set *tmp146 "T" - 379 jump *label136 always - 380 label *label135 ++ 365 jump *label135 equal true false + 366 set *tmp146 "T" + 367 jump *label136 always + 368 label *label135 - * set *tmp146 "F" - 381 label *label136 + 369 label *label136 - * set *tmp145 *tmp146 -+ 382 set *tmp145 "T" - 383 label *label134 - 384 op strictEqual :fn53:b "A" 0 ++ 370 set *tmp145 "T" + 371 label *label134 + 372 op strictEqual :fn53:b "A" 0 - * jump *label138 equal :fn53:b false - * set *tmp149 "T" -+ 385 jump *label138 equal false false - 386 jump *label139 always - 387 label *label138 - 388 set *tmp149 "F" - 389 label *label139 ++ 373 jump *label138 equal false false + 374 jump *label139 always + 375 label *label138 + 376 set *tmp149 "F" + 377 label *label139 - * set *tmp148 *tmp149 -+ 390 set *tmp148 "F" - 391 label *label137 ++ 378 set *tmp148 "F" + 379 label *label137 - * op strictEqual *tmp151 "A" 0 - * op equal :fn54:b :fn53:b false - * jump *label141 equal :fn54:b false -+ 392 op equal :fn54:b false false -+ 393 jump *label141 equal true false - 394 set *tmp153 "T" - 395 jump *label142 always - 396 label *label141 ++ 380 op equal :fn54:b false false ++ 381 jump *label141 equal true false + 382 set *tmp153 "T" + 383 jump *label142 always + 384 label *label141 - * set *tmp153 "F" - 397 label *label142 + 385 label *label142 - * set *tmp152 *tmp153 -+ 398 set *tmp152 "T" - 399 label *label140 ++ 386 set *tmp152 "T" + 387 label *label140 - * print *tmp143 - * print *tmp146 - * print *tmp149 - * print *tmp153 -+ 400 print "F" -+ 401 print "T" -+ 402 print "F" -+ 403 print "T" - 404 assertprints "FTFT" "comparison 11" - 405 label *label130 ++ 388 print "F" ++ 389 print "T" ++ 390 print "F" ++ 391 print "T" + 392 assertprints "FTFT" "comparison 11" + 393 label *label130 - * set :fn55:title "comparison 12" - * set :fn55:a "A" - * set :fn55:b 1 - * set :fn55:expected "TFFT" - 406 assertflush - 407 op equal :fn56:b "A" 1 + 394 assertflush + 395 op equal :fn56:b "A" 1 - * jump *label145 equal :fn56:b false -+ 408 jump *label145 equal true false - 409 set *tmp157 "T" - 410 jump *label146 always - 411 label *label145 ++ 396 jump *label145 equal true false + 397 set *tmp157 "T" + 398 jump *label146 always + 399 label *label145 - * set *tmp157 "F" - 412 label *label146 + 400 label *label146 - * set *tmp156 *tmp157 -+ 413 set *tmp156 "T" - 414 label *label144 - 415 op notEqual :fn57:b "A" 1 ++ 401 set *tmp156 "T" + 402 label *label144 + 403 op notEqual :fn57:b "A" 1 - * jump *label148 equal :fn57:b false - * set *tmp160 "T" -+ 416 jump *label148 equal false false - 417 jump *label149 always - 418 label *label148 - 419 set *tmp160 "F" - 420 label *label149 ++ 404 jump *label148 equal false false + 405 jump *label149 always + 406 label *label148 + 407 set *tmp160 "F" + 408 label *label149 - * set *tmp159 *tmp160 -+ 421 set *tmp159 "F" - 422 label *label147 - 423 op strictEqual :fn58:b "A" 1 ++ 409 set *tmp159 "F" + 410 label *label147 + 411 op strictEqual :fn58:b "A" 1 - * jump *label151 equal :fn58:b false - * set *tmp163 "T" -+ 424 jump *label151 equal false false - 425 jump *label152 always - 426 label *label151 - 427 set *tmp163 "F" - 428 label *label152 ++ 412 jump *label151 equal false false + 413 jump *label152 always + 414 label *label151 + 415 set *tmp163 "F" + 416 label *label152 - * set *tmp162 *tmp163 -+ 429 set *tmp162 "F" - 430 label *label150 ++ 417 set *tmp162 "F" + 418 label *label150 - * op strictEqual *tmp165 "A" 1 - * op equal :fn59:b :fn58:b false - * jump *label154 equal :fn59:b false -+ 431 op equal :fn59:b false false -+ 432 jump *label154 equal true false - 433 set *tmp167 "T" - 434 jump *label155 always - 435 label *label154 ++ 419 op equal :fn59:b false false ++ 420 jump *label154 equal true false + 421 set *tmp167 "T" + 422 jump *label155 always + 423 label *label154 - * set *tmp167 "F" - 436 label *label155 + 424 label *label155 - * set *tmp166 *tmp167 -+ 437 set *tmp166 "T" - 438 label *label153 ++ 425 set *tmp166 "T" + 426 label *label153 - * print *tmp157 - * print *tmp160 - * print *tmp163 - * print *tmp167 -+ 439 print "T" -+ 440 print "F" -+ 441 print "F" -+ 442 print "T" - 443 assertprints "TFFT" "comparison 12" - 444 label *label143 ++ 427 print "T" ++ 428 print "F" ++ 429 print "F" ++ 430 print "T" + 431 assertprints "TFFT" "comparison 12" + 432 label *label143 - * set :fn60:title "comparison 13" - * set :fn60:a "A" - * set :fn60:b 2 - * set :fn60:expected "FTFT" - 445 assertflush - 446 op equal :fn61:b "A" 2 + 433 assertflush + 434 op equal :fn61:b "A" 2 - * jump *label158 equal :fn61:b false - * set *tmp171 "T" -+ 447 jump *label158 equal false false - 448 jump *label159 always - 449 label *label158 - 450 set *tmp171 "F" - 451 label *label159 ++ 435 jump *label158 equal false false + 436 jump *label159 always + 437 label *label158 + 438 set *tmp171 "F" + 439 label *label159 - * set *tmp170 *tmp171 -+ 452 set *tmp170 "F" - 453 label *label157 - 454 op notEqual :fn62:b "A" 2 ++ 440 set *tmp170 "F" + 441 label *label157 + 442 op notEqual :fn62:b "A" 2 - * jump *label161 equal :fn62:b false -+ 455 jump *label161 equal true false - 456 set *tmp174 "T" - 457 jump *label162 always - 458 label *label161 ++ 443 jump *label161 equal true false + 444 set *tmp174 "T" + 445 jump *label162 always + 446 label *label161 - * set *tmp174 "F" - 459 label *label162 + 447 label *label162 - * set *tmp173 *tmp174 -+ 460 set *tmp173 "T" - 461 label *label160 - 462 op strictEqual :fn63:b "A" 2 ++ 448 set *tmp173 "T" + 449 label *label160 + 450 op strictEqual :fn63:b "A" 2 - * jump *label164 equal :fn63:b false - * set *tmp177 "T" -+ 463 jump *label164 equal false false - 464 jump *label165 always - 465 label *label164 - 466 set *tmp177 "F" - 467 label *label165 ++ 451 jump *label164 equal false false + 452 jump *label165 always + 453 label *label164 + 454 set *tmp177 "F" + 455 label *label165 - * set *tmp176 *tmp177 -+ 468 set *tmp176 "F" - 469 label *label163 ++ 456 set *tmp176 "F" + 457 label *label163 - * op strictEqual *tmp179 "A" 2 - * op equal :fn64:b :fn63:b false - * jump *label167 equal :fn64:b false -+ 470 op equal :fn64:b false false -+ 471 jump *label167 equal true false - 472 set *tmp181 "T" - 473 jump *label168 always - 474 label *label167 ++ 458 op equal :fn64:b false false ++ 459 jump *label167 equal true false + 460 set *tmp181 "T" + 461 jump *label168 always + 462 label *label167 - * set *tmp181 "F" - 475 label *label168 + 463 label *label168 - * set *tmp180 *tmp181 -+ 476 set *tmp180 "T" - 477 label *label166 ++ 464 set *tmp180 "T" + 465 label *label166 - * print *tmp171 - * print *tmp174 - * print *tmp177 - * print *tmp181 -+ 478 print "F" -+ 479 print "T" -+ 480 print "F" -+ 481 print "T" - 482 assertprints "FTFT" "comparison 13" - 483 label *label156 ++ 466 print "F" ++ 467 print "T" ++ 468 print "F" ++ 469 print "T" + 470 assertprints "FTFT" "comparison 13" + 471 label *label156 - * set :fn65:title "comparison 14" - * set :fn65:a "A" - * set :fn65:b "B" - * set :fn65:expected "FTFT" - 484 assertflush - 485 op equal :fn66:b "A" "B" + 472 assertflush + 473 op equal :fn66:b "A" "B" - * jump *label171 equal :fn66:b false - * set *tmp185 "T" -+ 486 jump *label171 equal false false - 487 jump *label172 always - 488 label *label171 - 489 set *tmp185 "F" - 490 label *label172 ++ 474 jump *label171 equal false false + 475 jump *label172 always + 476 label *label171 + 477 set *tmp185 "F" + 478 label *label172 - * set *tmp184 *tmp185 -+ 491 set *tmp184 "F" - 492 label *label170 - 493 op notEqual :fn67:b "A" "B" ++ 479 set *tmp184 "F" + 480 label *label170 + 481 op notEqual :fn67:b "A" "B" - * jump *label174 equal :fn67:b false -+ 494 jump *label174 equal true false - 495 set *tmp188 "T" - 496 jump *label175 always - 497 label *label174 ++ 482 jump *label174 equal true false + 483 set *tmp188 "T" + 484 jump *label175 always + 485 label *label174 - * set *tmp188 "F" - 498 label *label175 + 486 label *label175 - * set *tmp187 *tmp188 -+ 499 set *tmp187 "T" - 500 label *label173 - 501 op strictEqual :fn68:b "A" "B" ++ 487 set *tmp187 "T" + 488 label *label173 + 489 op strictEqual :fn68:b "A" "B" - * jump *label177 equal :fn68:b false - * set *tmp191 "T" -+ 502 jump *label177 equal false false - 503 jump *label178 always - 504 label *label177 - 505 set *tmp191 "F" - 506 label *label178 ++ 490 jump *label177 equal false false + 491 jump *label178 always + 492 label *label177 + 493 set *tmp191 "F" + 494 label *label178 - * set *tmp190 *tmp191 -+ 507 set *tmp190 "F" - 508 label *label176 ++ 495 set *tmp190 "F" + 496 label *label176 - * op strictEqual *tmp193 "A" "B" - * op equal :fn69:b :fn68:b false - * jump *label180 equal :fn69:b false -+ 509 op equal :fn69:b false false -+ 510 jump *label180 equal true false - 511 set *tmp195 "T" - 512 jump *label181 always - 513 label *label180 ++ 497 op equal :fn69:b false false ++ 498 jump *label180 equal true false + 499 set *tmp195 "T" + 500 jump *label181 always + 501 label *label180 - * set *tmp195 "F" - 514 label *label181 + 502 label *label181 - * set *tmp194 *tmp195 -+ 515 set *tmp194 "T" - 516 label *label179 ++ 503 set *tmp194 "T" + 504 label *label179 - * print *tmp185 - * print *tmp188 - * print *tmp191 - * print *tmp195 -+ 517 print "F" -+ 518 print "T" -+ 519 print "F" -+ 520 print "T" - 521 assertprints "FTFT" "comparison 14" - 522 label *label169 ++ 505 print "F" ++ 506 print "T" ++ 507 print "F" ++ 508 print "T" + 509 assertprints "FTFT" "comparison 14" + 510 label *label169 - * set :fn70:title "comparison 15" - * set :fn70:a "A" - * set :fn70:b "A" - * set :fn70:expected "TFTF" - 523 assertflush - 524 op equal :fn71:b "A" "A" + 511 assertflush + 512 op equal :fn71:b "A" "A" - * jump *label184 equal :fn71:b false -+ 525 jump *label184 equal true false - 526 set *tmp199 "T" - 527 jump *label185 always - 528 label *label184 ++ 513 jump *label184 equal true false + 514 set *tmp199 "T" + 515 jump *label185 always + 516 label *label184 - * set *tmp199 "F" - 529 label *label185 + 517 label *label185 - * set *tmp198 *tmp199 -+ 530 set *tmp198 "T" - 531 label *label183 - 532 op notEqual :fn72:b "A" "A" ++ 518 set *tmp198 "T" + 519 label *label183 + 520 op notEqual :fn72:b "A" "A" - * jump *label187 equal :fn72:b false - * set *tmp202 "T" -+ 533 jump *label187 equal false false - 534 jump *label188 always - 535 label *label187 - 536 set *tmp202 "F" - 537 label *label188 ++ 521 jump *label187 equal false false + 522 jump *label188 always + 523 label *label187 + 524 set *tmp202 "F" + 525 label *label188 - * set *tmp201 *tmp202 -+ 538 set *tmp201 "F" - 539 label *label186 - 540 op strictEqual :fn73:b "A" "A" ++ 526 set *tmp201 "F" + 527 label *label186 + 528 op strictEqual :fn73:b "A" "A" - * jump *label190 equal :fn73:b false -+ 541 jump *label190 equal true false - 542 set *tmp205 "T" - 543 jump *label191 always - 544 label *label190 ++ 529 jump *label190 equal true false + 530 set *tmp205 "T" + 531 jump *label191 always + 532 label *label190 - * set *tmp205 "F" - 545 label *label191 + 533 label *label191 - * set *tmp204 *tmp205 -+ 546 set *tmp204 "T" - 547 label *label189 ++ 534 set *tmp204 "T" + 535 label *label189 - * op strictEqual *tmp207 "A" "A" - * op equal :fn74:b :fn73:b false - * jump *label193 equal :fn74:b false - * set *tmp209 "T" -+ 548 op equal :fn74:b true false -+ 549 jump *label193 equal false false - 550 jump *label194 always - 551 label *label193 - 552 set *tmp209 "F" - 553 label *label194 ++ 536 op equal :fn74:b true false ++ 537 jump *label193 equal false false + 538 jump *label194 always + 539 label *label193 + 540 set *tmp209 "F" + 541 label *label194 - * set *tmp208 *tmp209 -+ 554 set *tmp208 "F" - 555 label *label192 ++ 542 set *tmp208 "F" + 543 label *label192 - * print *tmp199 - * print *tmp202 - * print *tmp205 - * print *tmp209 -+ 556 print "T" -+ 557 print "F" -+ 558 print "T" -+ 559 print "F" - 560 assertprints "TFTF" "comparison 15" - 561 label *label182 - 562 stop ++ 544 print "T" ++ 545 print "F" ++ 546 print "T" ++ 547 print "F" + 548 assertprints "TFTF" "comparison 15" + 549 label *label182 + 550 stop -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-120 instructions): - 0 set A 0 - 1 assertflush - 2 jump *label2 equal true false -- * set *tmp3 "T" - 3 jump *label3 always - 4 label *label2 - 5 label *label3 - - 7 jump *label5 equal false false - 8 jump *label6 always - 9 label *label5 -- * set *tmp6 "F" - 10 label *label6 - 11 label *label4 - 12 jump *label8 equal false false - 13 jump *label9 always - 14 label *label8 -- * set *tmp9 "F" - 15 label *label9 - 16 label *label7 - 17 jump *label11 equal true false -- * set *tmp13 "T" - 18 jump *label12 always - 19 label *label11 - 20 label *label12 - - 29 jump *label15 equal false false - 30 jump *label16 always - 31 label *label15 -- * set *tmp17 "F" - 32 label *label16 - 33 label *label14 - 34 jump *label18 equal true false -- * set *tmp20 "T" - 35 jump *label19 always - 36 label *label18 - 37 label *label19 - - 39 jump *label21 equal false false - 40 jump *label22 always - 41 label *label21 -- * set *tmp23 "F" - 42 label *label22 - 43 label *label20 - 44 jump *label24 equal true false -- * set *tmp27 "T" - 45 jump *label25 always - 46 label *label24 - 47 label *label25 - - 56 jump *label28 equal false false - 57 jump *label29 always - 58 label *label28 -- * set *tmp31 "F" - 59 label *label29 - 60 label *label27 - 61 jump *label31 equal true false -- * set *tmp34 "T" - 62 jump *label32 always - 63 label *label31 - 64 label *label32 - - 66 jump *label34 equal false false - 67 jump *label35 always - 68 label *label34 -- * set *tmp37 "F" - 69 label *label35 - 70 label *label33 - 71 jump *label37 equal true false -- * set *tmp41 "T" - 72 jump *label38 always - 73 label *label37 - 74 label *label38 +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-108 instructions): 80 assertprints "FTFT" "comparison 3" 81 label *label26 diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/executes-sort-variables.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/executes-sort-variables.log index ac9920da..7a75694c 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/executes-sort-variables.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/executes-sort-variables.log @@ -1,13 +1,13 @@ 29 instructions before optimizations. 1 instructions eliminated by Dead Code Elimination (3 iterations). 1 instructions eliminated by Single Step Elimination (4 iterations). - 11 instructions eliminated by Data Flow Optimization (2 passes, 9 iterations). + 14 instructions eliminated by Data Flow Optimization (2 passes, 10 iterations). 2 instructions eliminated by Loop Unrolling (3 iterations). 1 loops unrolled by Loop Unrolling. - 14 instructions after optimizations. + 11 instructions after optimizations. Pass 1: speed optimization selection (cost limit 976): - * Unroll iteration loop at line 6:5 cost 0, benefit 19.0, efficiency Infinity (-9 instructions) + * Unroll iteration loop at line 6:5 cost 0, benefit 19.0, efficiency Infinity (-12 instructions) Modifications by Initial phase, Dead Code Elimination, iteration 1 (-1 instructions): @@ -94,144 +94,154 @@ Modifications by Unroll iteration loop at line 6:5 (-2 instructions): 25 print :fn0:b 26 print :fn0:c -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-4 instructions): 1 assertflush 2 set :fn0:step p 3 label *label8 - * set :fn0:i :fn0:step ++ 4 set :fn0:a :fn0:step + 5 op mul :fn0:step :fn0:step 2 + 6 label *label9 +- * set :fn0:a :fn0:i + 7 label *label12 +- * set :fn0:i :fn0:step ++ 8 set :fn0:b :fn0:step + 9 op mul :fn0:step :fn0:step 2 + 10 label *label13 +- * set :fn0:b :fn0:i + 11 label *label16 +- * set :fn0:i :fn0:step ++ 12 set :fn0:c :fn0:step + 13 op mul :fn0:step :fn0:step 2 + 14 label *label17 +- * set :fn0:c :fn0:i + 15 label *label20 +- * set :fn0:i :fn0:step ++ 16 set :fn0:d :fn0:step + 17 op mul :fn0:step :fn0:step 2 + 18 label *label21 +- * set :fn0:d :fn0:i + 19 label *label3 + 20 print :fn0:a + 21 print :fn0:b + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 instructions): + + 1 assertflush + 2 set :fn0:step p + 3 label *label8 +- * set :fn0:a :fn0:step - * op mul :fn0:step :fn0:step 2 -+ 4 set :fn0:i p ++ 4 set :fn0:a p + 5 op mul :fn0:step p 2 6 label *label9 - 7 set :fn0:a :fn0:i - 8 label *label12 + 7 label *label12 + 8 set :fn0:b :fn0:step - 17 set :fn0:c :fn0:i - 18 label *label20 - 19 set :fn0:i :fn0:step + 14 label *label17 + 15 label *label20 + 16 set :fn0:d :fn0:step - * op mul :fn0:step :fn0:step 2 - 20 label *label21 - 21 set :fn0:d :fn0:i - 22 label *label3 - 23 print :fn0:a - 24 print :fn0:b - 25 print :fn0:c -- * print :fn0:d -+ 26 print :fn0:i - 27 label *label0 - 28 assertprints "1248" "sort variables" - 29 stop + 17 label *label21 + 18 label *label3 + 19 print :fn0:a -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-1 instructions): 0 set p 1 1 assertflush - * set :fn0:step p 2 label *label8 - 3 set :fn0:i p + 3 set :fn0:a p 4 op mul :fn0:step p 2 5 label *label9 -- * set :fn0:a :fn0:i -+ 6 set :fn0:a p - 7 label *label12 - 8 set :fn0:i :fn0:step + 6 label *label12 + 7 set :fn0:b :fn0:step - * op mul :fn0:step :fn0:step 2 -+ 9 op mul :fn0:step p 4 - 10 label *label13 - 11 set :fn0:b :fn0:i - 12 label *label16 ++ 8 op mul :fn0:step p 4 + 9 label *label13 + 10 label *label16 + 11 set :fn0:c :fn0:step - 17 label *label20 - 18 set :fn0:i :fn0:step - 19 label *label21 -- * set :fn0:d :fn0:i -+ 20 set :fn0:d :fn0:step - 21 label *label3 - 22 print :fn0:a - 23 print :fn0:b - 24 print :fn0:c -- * print :fn0:i -+ 25 print :fn0:step - 26 label *label0 - 27 assertprints "1248" "sort variables" - 28 stop + 15 set :fn0:d :fn0:step + 16 label *label21 + 17 label *label3 +- * print :fn0:a ++ 18 print p + 19 print :fn0:b + 20 print :fn0:c +- * print :fn0:d ++ 21 print :fn0:step + 22 label *label0 + 23 assertprints "1248" "sort variables" + 24 stop + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-1 instructions): + + 1 assertflush + 2 label *label8 + 3 set :fn0:a p +- * op mul :fn0:step p 2 ++ 4 op mul :fn0:b p 2 + 5 label *label9 + 6 label *label12 +- * set :fn0:b :fn0:step + 7 op mul :fn0:step p 4 + 8 label *label13 + 9 label *label16 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-3 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 5 (-2 instructions): 0 set p 1 1 assertflush 2 label *label8 -- * set :fn0:i p - 3 op mul :fn0:step p 2 +- * set :fn0:a p + 3 op mul :fn0:b p 2 4 label *label9 - 5 set :fn0:a p + 5 label *label12 - 10 set :fn0:b :fn0:i - 11 label *label16 - 12 set :fn0:i :fn0:step + 7 label *label13 + 8 label *label16 + 9 set :fn0:c :fn0:step - * op mul :fn0:step :fn0:step 2 -+ 13 op mul :fn0:step p 8 - 14 label *label17 - 15 set :fn0:c :fn0:i - 16 label *label20 -- * set :fn0:i :fn0:step - 17 label *label21 ++ 10 op mul :fn0:step p 8 + 11 label *label17 + 12 label *label20 - * set :fn0:d :fn0:step - 18 label *label3 -- * print :fn0:a -+ 19 print p - 20 print :fn0:b - 21 print :fn0:c - 22 print :fn0:step + 13 label *label21 + 14 label *label3 + 15 print p -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-1 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 6 (-1 instructions): - 2 label *label8 - 3 op mul :fn0:step p 2 + 3 op mul :fn0:b p 2 4 label *label9 -- * set :fn0:a p 5 label *label12 - 6 set :fn0:i :fn0:step - 7 op mul :fn0:step p 4 - - 17 label *label3 - 18 print p - 19 print :fn0:b -- * print :fn0:c -+ 20 print :fn0:i - 21 print :fn0:step - 22 label *label0 - 23 assertprints "1248" "sort variables" - -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 5 (-1 instructions): - - 11 set :fn0:i :fn0:step - 12 op mul :fn0:step p 8 - 13 label *label17 -- * set :fn0:c :fn0:i - 14 label *label20 - 15 label *label21 - 16 label *label3 +- * op mul :fn0:step p 4 ++ 6 op mul :fn0:c p 4 + 7 label *label13 + 8 label *label16 +- * set :fn0:c :fn0:step + 9 op mul :fn0:step p 8 + 10 label *label17 + 11 label *label20 Modifications by Final phase, Single Step Elimination, iteration 1 (-1 instructions): - 21 label *label0 - 22 assertprints "1248" "sort variables" - 23 stop + 18 label *label0 + 19 assertprints "1248" "sort variables" + 20 stop - * end Final code before resolving virtual instructions: set p 1 assertflush -op mul :fn0:step p 2 -set :fn0:i :fn0:step -op mul :fn0:step p 4 -set :fn0:b :fn0:i -set :fn0:i :fn0:step +op mul :fn0:b p 2 +op mul :fn0:c p 4 op mul :fn0:step p 8 print p print :fn0:b -print :fn0:i +print :fn0:c print :fn0:step assertprints "1248" "sort variables" stop diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/loops-in-conditions.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/loops-in-conditions.log index 98e84224..da142ba2 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/loops-in-conditions.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/loops-in-conditions.log @@ -43,115 +43,104 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-1 inst Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 instructions): 0 assertflush - 1 set :fn1:n 4 +- * set :fn1:n 4 ++ 1 set *tmp2 4 2 set :fn1:c 0 - * set *tmp2 :fn1:n -+ 3 set *tmp2 4 - 4 set :fn1:i 0 - 5 label *label2 -- * jump *label4 greaterThanEq :fn1:i *tmp2 -+ 6 jump *label4 greaterThanEq :fn1:i :fn1:n - 7 op add :fn1:c :fn1:c :fn1:i - 8 label *label3 - 9 op add :fn1:i :fn1:i 1 + 3 set :fn1:i 0 + 4 label *label2 + 5 jump *label4 greaterThanEq :fn1:i *tmp2 - 13 print "|" - 14 set *tmp1 :fn1:c - 15 jump *label1 always -- * set *tmp1 null + 14 jump *label1 always + 15 set *tmp1 null 16 label *label1 - 17 set :fn2:n 8 +- * set :fn2:n 8 ++ 17 set *tmp4 8 18 set :fn2:c 0 - * set *tmp4 :fn2:n -+ 19 set *tmp4 8 - 20 set :fn2:i 0 - 21 label *label6 -- * jump *label8 greaterThanEq :fn2:i *tmp4 -+ 22 jump *label8 greaterThanEq :fn2:i :fn2:n - 23 op add :fn2:c :fn2:c :fn2:i - 24 label *label7 - 25 op add :fn2:i :fn2:i 1 - - 29 print "|" - 30 set *tmp3 :fn2:c - 31 jump *label5 always -- * set *tmp3 null - 32 label *label5 -- * jump *label9 greaterThanEq *tmp1 *tmp3 -+ 33 jump *label9 greaterThanEq :fn1:c :fn2:c - 34 print "Less" - 35 set *tmp6 0 - 36 jump *label10 always - - 39 label *label10 - 40 set :fn0:result *tmp6 - 41 print "|" -- * print :fn0:result -+ 42 print *tmp6 - 43 label *label0 - 44 assertprints "6|28|Less|0" "loops in conditions" - 45 stop + 19 set :fn2:i 0 + 20 label *label6 + 21 jump *label8 greaterThanEq :fn2:i *tmp4 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-5 instructions): - 0 assertflush - 1 set :fn1:n 4 +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 instructions): + 2 set :fn1:c 0 -- * set *tmp2 4 3 set :fn1:i 0 4 label *label2 -- * jump *label4 greaterThanEq :fn1:i :fn1:n +- * jump *label4 greaterThanEq :fn1:i *tmp2 + 5 jump *label4 greaterThanEq :fn1:i 4 6 op add :fn1:c :fn1:c :fn1:i 7 label *label3 8 op add :fn1:i :fn1:i 1 - 10 label *label4 - 11 print :fn1:c 12 print "|" -- * set *tmp1 :fn1:c - 13 jump *label1 always - 14 label *label1 - 15 set :fn2:n 8 - 16 set :fn2:c 0 -- * set *tmp4 8 - 17 set :fn2:i 0 - 18 label *label6 -- * jump *label8 greaterThanEq :fn2:i :fn2:n -+ 19 jump *label8 greaterThanEq :fn2:i 8 - 20 op add :fn2:c :fn2:c :fn2:i - 21 label *label7 - 22 op add :fn2:i :fn2:i 1 + 13 set *tmp1 :fn1:c + 14 jump *label1 always +- * set *tmp1 null + 15 label *label1 + 16 set *tmp4 8 + 17 set :fn2:c 0 + 18 set :fn2:i 0 + 19 label *label6 +- * jump *label8 greaterThanEq :fn2:i *tmp4 ++ 20 jump *label8 greaterThanEq :fn2:i 8 + 21 op add :fn2:c :fn2:c :fn2:i + 22 label *label7 + 23 op add :fn2:i :fn2:i 1 - 24 label *label8 - 25 print :fn2:c - 26 print "|" -- * set *tmp3 :fn2:c - 27 jump *label5 always - 28 label *label5 - 29 jump *label9 greaterThanEq :fn1:c :fn2:c + 27 print "|" + 28 set *tmp3 :fn2:c + 29 jump *label5 always +- * set *tmp3 null + 30 label *label5 +- * jump *label9 greaterThanEq *tmp1 *tmp3 ++ 31 jump *label9 greaterThanEq :fn1:c :fn2:c + 32 print "Less" + 33 set *tmp6 0 + 34 jump *label10 always - 33 label *label9 - 34 set *tmp6 1 - 35 label *label10 -- * set :fn0:result *tmp6 - 36 print "|" - 37 print *tmp6 - 38 label *label0 + 37 label *label10 + 38 set :fn0:result *tmp6 + 39 print "|" +- * print :fn0:result ++ 40 print *tmp6 + 41 label *label0 + 42 assertprints "6|28|Less|0" "loops in conditions" + 43 stop -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-2 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-5 instructions): 0 assertflush -- * set :fn1:n 4 +- * set *tmp2 4 1 set :fn1:c 0 2 set :fn1:i 0 3 label *label2 + 9 label *label4 + 10 print :fn1:c 11 print "|" +- * set *tmp1 :fn1:c 12 jump *label1 always 13 label *label1 -- * set :fn2:n 8 +- * set *tmp4 8 14 set :fn2:c 0 15 set :fn2:i 0 16 label *label6 + + 22 label *label8 + 23 print :fn2:c + 24 print "|" +- * set *tmp3 :fn2:c + 25 jump *label5 always + 26 label *label5 + 27 jump *label9 greaterThanEq :fn1:c :fn2:c + + 31 label *label9 + 32 set *tmp6 1 + 33 label *label10 +- * set :fn0:result *tmp6 + 34 print "|" + 35 print *tmp6 + 36 label *label0 Modifications by Iterated phase, Loop Optimization, pass 1, iteration 1 (-2 instructions): diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/ranged-for-loop-break-continue.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/ranged-for-loop-break-continue.log index bc15dcd7..a8c3f627 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/ranged-for-loop-break-continue.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/ranged-for-loop-break-continue.log @@ -3,12 +3,12 @@ 5 instructions eliminated by Dead Code Elimination (3 iterations). 2 instructions eliminated by Jump Optimization (4 iterations). 2 instructions eliminated by Single Step Elimination (5 iterations). - 1 instructions eliminated by Data Flow Optimization (2 passes, 6 iterations). + 2 instructions eliminated by Data Flow Optimization (2 passes, 7 iterations). 1 instructions modified by Loop Optimization (3 iterations). 1 loops improved by Loop Optimization. 2 instructions eliminated by Jump Straightening (4 iterations). 1 instructions eliminated by Unreachable Code Elimination. - 25 instructions after optimizations. + 24 instructions after optimizations. Modifications by Initial phase, Dead Code Elimination, iteration 1 (-5 instructions): @@ -92,84 +92,101 @@ Modifications by Iterated phase, Single Step Elimination, pass 1, iteration 1 (- 28 label *label11 29 label *label5 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 instructions): - 22 call *label0 :fn0*retval - 23 label *label9 - 24 set *tmp6 :fn0*retval -- * jump *label10 notEqual :fn1:i *tmp6 -+ 25 jump *label10 notEqual :fn1:i :fn0*retval - 26 jump *label6 always - 27 label *label10 - 28 label *label11 + 2 setaddr :fn0*retaddr *label2 + 3 call *label0 :fn0*retval + 4 label *label2 +- * set *tmp1 :fn0*retval ++ 5 set :fn1:i :fn0*retval + 6 set :fn0:n 10 + 7 setaddr :fn0*retaddr *label3 + 8 call *label0 :fn0*retval + 9 label *label3 + 10 set *tmp3 :fn0*retval +- * set :fn1:i *tmp1 + 11 label *label4 + 12 jump *label6 greaterThanEq :fn1:i *tmp3 + 13 jump *label7 notEqual :fn1:i 3 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2: - 21 setaddr :fn0*retaddr *label9 - 22 call *label0 :fn0*retval - 23 label *label9 -- * set *tmp6 :fn0*retval - 24 jump *label10 notEqual :fn1:i :fn0*retval + 21 call *label0 :fn0*retval + 22 label *label9 + 23 set *tmp6 :fn0*retval +- * jump *label10 notEqual :fn1:i *tmp6 ++ 24 jump *label10 notEqual :fn1:i :fn0*retval 25 jump *label6 always 26 label *label10 + 27 label *label11 + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-1 instructions): + + 20 setaddr :fn0*retaddr *label9 + 21 call *label0 :fn0*retval + 22 label *label9 +- * set *tmp6 :fn0*retval + 23 jump *label10 notEqual :fn1:i :fn0*retval + 24 jump *label6 always + 25 label *label10 Modifications by Iterated phase, Loop Optimization, pass 1, iteration 1: - 11 set :fn1:i *tmp1 - 12 label *label4 - 13 jump *label6 greaterThanEq :fn1:i *tmp3 -+ 14 label *label13 - 15 jump *label7 notEqual :fn1:i 3 - 16 jump *label5 always - 17 label *label7 + 10 set *tmp3 :fn0*retval + 11 label *label4 + 12 jump *label6 greaterThanEq :fn1:i *tmp3 ++ 13 label *label13 + 14 jump *label7 notEqual :fn1:i 3 + 15 jump *label5 always + 16 label *label7 - 28 label *label11 - 29 label *label5 - 30 op add :fn1:i :fn1:i 1 + 27 label *label11 + 28 label *label5 + 29 op add :fn1:i :fn1:i 1 - * jump *label4 always -+ 31 jump *label13 lessThan :fn1:i *tmp3 - 32 label *label6 - 33 label *label1 - 34 assertprints "1|2|4|5|" "iterated-for-loop-break-continue" ++ 30 jump *label13 lessThan :fn1:i *tmp3 + 31 label *label6 + 32 label *label1 + 33 assertprints "1|2|4|5|" "iterated-for-loop-break-continue" Modifications by Iterated phase, Data Flow Optimization, pass 2, iteration 1: + 9 label *label3 10 set *tmp3 :fn0*retval - 11 set :fn1:i *tmp1 - 12 label *label4 + 11 label *label4 - * jump *label6 greaterThanEq :fn1:i *tmp3 -+ 13 jump *label6 greaterThanEq *tmp1 :fn0*retval - 14 label *label13 - 15 jump *label7 notEqual :fn1:i 3 - 16 jump *label5 always ++ 12 jump *label6 greaterThanEq :fn1:i :fn0*retval + 13 label *label13 + 14 jump *label7 notEqual :fn1:i 3 + 15 jump *label5 always Modifications by Final phase, Jump Straightening, iteration 1 (-2 instructions): - 12 label *label4 - 13 jump *label6 greaterThanEq *tmp1 :fn0*retval - 14 label *label13 + 11 label *label4 + 12 jump *label6 greaterThanEq :fn1:i :fn0*retval + 13 label *label13 - * jump *label7 notEqual :fn1:i 3 - * jump *label5 always -+ 15 jump *label5 equal :fn1:i 3 - 16 label *label7 - 17 label *label8 - 18 print :fn1:i ++ 14 jump *label5 equal :fn1:i 3 + 15 label *label7 + 16 label *label8 + 17 print :fn1:i - 21 setaddr :fn0*retaddr *label9 - 22 call *label0 :fn0*retval - 23 label *label9 + 20 setaddr :fn0*retaddr *label9 + 21 call *label0 :fn0*retval + 22 label *label9 - * jump *label10 notEqual :fn1:i :fn0*retval - * jump *label6 always -+ 24 jump *label6 equal :fn1:i :fn0*retval - 25 label *label10 - 26 label *label11 - 27 label *label5 ++ 23 jump *label6 equal :fn1:i :fn0*retval + 24 label *label10 + 25 label *label11 + 26 label *label5 Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-1 instructions): - 36 set :fn0*retval :fn0:n - 37 label *label12 - 38 return :fn0*retaddr + 35 set :fn0*retval :fn0:n + 36 label *label12 + 37 return :fn0*retaddr - * end Final code before resolving virtual instructions: @@ -179,14 +196,13 @@ set :fn0:n 1 setaddr :fn0*retaddr *label2 call *label0 :fn0*retval label *label2 -set *tmp1 :fn0*retval +set :fn1:i :fn0*retval set :fn0:n 10 setaddr :fn0*retaddr *label3 call *label0 :fn0*retval label *label3 set *tmp3 :fn0*retval -set :fn1:i *tmp1 -jump *label6 greaterThanEq *tmp1 :fn0*retval +jump *label6 greaterThanEq :fn1:i :fn0*retval label *label13 jump *label5 equal :fn1:i 3 print :fn1:i diff --git a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/recursive-calls.log b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/recursive-calls.log index af86d5ff..04dd5a39 100644 --- a/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/recursive-calls.log +++ b/compiler/src/test/resources/info/teksol/mc/mindcode/tests/processor/recursive-calls.log @@ -3,7 +3,7 @@ 15 instructions eliminated by Dead Code Elimination (5 iterations). 3 instructions eliminated by Jump Optimization (3 iterations). 3 instructions eliminated by Single Step Elimination (4 iterations). - 7 instructions eliminated by Data Flow Optimization (4 iterations). + 7 instructions eliminated by Data Flow Optimization (5 iterations). 3 instructions eliminated by Unreachable Code Elimination. 12 instructions eliminated by Stack Optimization. 98 instructions after optimizations. @@ -239,7 +239,20 @@ Modifications by Iterated phase, Single Step Elimination, pass 1, iteration 1 (- 100 label *label17 101 op add :fn2:b :fn2:b 1 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 instructions): + + 65 callrec bank1 *label1 *label14 :fn1*retval + 66 label *label14 + 67 set *tmp17 :fn1:a +- * set *tmp18 :fn1:b ++ 68 set :fn1:a :fn1:b + 69 set :fn1:b *tmp17 +- * set :fn1:a *tmp18 + 70 pop bank1 :fn1:n + 71 label *label12 + 72 label *label13 + +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2: 34 push bank1 :fn0:b 35 set *tmp7 :fn0:b @@ -262,26 +275,19 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 64 set :fn1:b *tmp16 65 callrec bank1 *label1 *label14 :fn1*retval 66 label *label14 - 67 set *tmp17 :fn1:a - 68 set *tmp18 :fn1:b -- * set :fn1:b *tmp17 -+ 69 set :fn1:b :fn1:a - 70 set :fn1:a *tmp18 - 71 pop bank1 :fn1:n - 72 label *label12 - 88 push bank1 :fn2:a - 89 set *tmp25 :fn2:b - 90 set *tmp26 :fn2:a + 87 push bank1 :fn2:a + 88 set *tmp25 :fn2:b + 89 set *tmp26 :fn2:a - * set :fn2:n *tmp24 - * set :fn2:a *tmp25 -+ 91 op sub :fn2:n :fn2:n 1 -+ 92 set :fn2:a :fn2:b - 93 set :fn2:b *tmp26 - 94 callrec bank1 *label2 *label18 :fn2*retval - 95 label *label18 ++ 90 op sub :fn2:n :fn2:n 1 ++ 91 set :fn2:a :fn2:b + 92 set :fn2:b *tmp26 + 93 callrec bank1 *label2 *label18 :fn2*retval + 94 label *label18 -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-7 instructions): +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-6 instructions): 28 print :fn0:b 29 op add :fn0:a :fn0:a 1 @@ -304,13 +310,6 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-7 57 set *tmp16 :fn1:a 58 op sub :fn1:n :fn1:n 1 59 set :fn1:a :fn1:b - 60 set :fn1:b *tmp16 - 61 callrec bank1 *label1 *label14 :fn1*retval - 62 label *label14 -- * set *tmp17 :fn1:a - 63 set *tmp18 :fn1:b - 64 set :fn1:b :fn1:a - 65 set :fn1:a *tmp18 77 print :fn2:b 78 op add :fn2:a :fn2:a 1 @@ -373,9 +372,9 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-12 instructions) 54 op sub :fn1:n :fn1:n 1 55 set :fn1:a :fn1:b - 59 set *tmp18 :fn1:b - 60 set :fn1:b :fn1:a - 61 set :fn1:a *tmp18 + 59 set *tmp17 :fn1:a + 60 set :fn1:a :fn1:b + 61 set :fn1:b *tmp17 - * pop bank1 :fn1:n 62 label *label12 63 label *label13 @@ -456,9 +455,9 @@ set :fn1:a :fn1:b set :fn1:b *tmp16 callrec bank1 *label1 *label14 :fn1*retval label *label14 -set *tmp18 :fn1:b -set :fn1:b :fn1:a -set :fn1:a *tmp18 +set *tmp17 :fn1:a +set :fn1:a :fn1:b +set :fn1:b *tmp17 label *label12 op add :fn1:b :fn1:b 1 print :fn1:a diff --git a/compiler/src/test/resources/library/outputs/math-experimental.log b/compiler/src/test/resources/library/outputs/math-experimental.log index d597cfa8..ed01d20d 100644 --- a/compiler/src/test/resources/library/outputs/math-experimental.log +++ b/compiler/src/test/resources/library/outputs/math-experimental.log @@ -6,7 +6,7 @@ 92 instructions eliminated by Single Step Elimination (3 passes, 10 iterations). 4 instructions modified by Expression Optimization (4 iterations). 8 instructions eliminated by If Expression Optimization (4 iterations). - 336 instructions eliminated by Data Flow Optimization (6 passes, 24 iterations). + 336 instructions eliminated by Data Flow Optimization (6 passes, 27 iterations). 35 instructions added by Loop Unrolling (10 iterations). 6 loops unrolled by Loop Unrolling. 34 instructions updated by JumpThreading. @@ -490,21 +490,21 @@ Final code before resolving virtual instructions: 29: assertequals false false "isZero(1e-50)" 30: assertequals false false "isZero(-1e-50)" 31: assertequals false false "isZero(0.01,0.01)" - 32: op add :fn19:result null 0 - 33: assertequals 0 :fn19:result "nullToZero(null)" - 34: op add :fn20:result 1 0 - 35: assertequals 1 :fn20:result "nullToZero(1)" + 32: op add *tmp55 null 0 + 33: assertequals 0 *tmp55 "nullToZero(null)" + 34: op add *tmp56 1 0 + 35: assertequals 1 *tmp56 "nullToZero(1)" 36: assertequals 0 false "boolean(0)" 37: assertequals 1 true "boolean(100)" 38: assertequals 1 true "boolean(-100)" 39: assertequals 1 true "boolean(-0.001)" 40: assertequals 0 false "boolean(0.0000001)" - 41: op or :fn26:result 0.9 0 - 42: assertequals 0 :fn26:result "integer(0.9)" - 43: op or :fn27:result -5.9 0 - 44: assertequals -5 :fn27:result "integer(-5.9)" - 45: op or :fn28:result 100 0 - 46: assertequals 100 :fn28:result "integer(100)" + 41: op or *tmp67 0.9 0 + 42: assertequals 0 *tmp67 "integer(0.9)" + 43: op or *tmp68 -5.9 0 + 44: assertequals -5 *tmp68 "integer(-5.9)" + 45: op or *tmp69 100 0 + 46: assertequals 100 *tmp69 "integer(100)" 47: assertequals 1 1 "sum(1)" 48: assertequals 10 10 "sum(1,2,3,4)" 49: assertequals 1 1 "avg(1)" @@ -1826,12 +1826,16 @@ stop instruction encountered, dumping variable values: *tmp418: 4.0 *tmp419: 6.0 *tmp420: 10.0 +*tmp55: 0.0 +*tmp56: 1.0 +*tmp67: 0.0 +*tmp68: -5.0 +*tmp69: 100.0 :fn0*retaddr: 24.0 :fn0*retval: -1.0 :fn0:x: -5.0 :fn1*retaddr: 96.0 :fn1*retval: 5.0 -:fn19:result: 0.0 :fn1:x1: 6.0 :fn1:x2: 2.0 :fn1:x3: 8.0 @@ -1842,10 +1846,6 @@ stop instruction encountered, dumping variable values: :fn1:y4: 8.0 :fn2*retaddr: 138.0 :fn2*retval: 5.0 -:fn20:result: 1.0 -:fn26:result: 0.0 -:fn27:result: -5.0 -:fn28:result: 100.0 :fn2:x1: 5.0 :fn2:x2: 5.0 :fn2:x3: 5.0 diff --git a/compiler/src/test/resources/library/outputs/math-experimental.mlog b/compiler/src/test/resources/library/outputs/math-experimental.mlog index ab76cfbd..3ea83b3e 100644 --- a/compiler/src/test/resources/library/outputs/math-experimental.mlog +++ b/compiler/src/test/resources/library/outputs/math-experimental.mlog @@ -30,21 +30,21 @@ assertequals true true "isZero(0)" assertequals false false "isZero(1e-50)" assertequals false false "isZero(-1e-50)" assertequals false false "isZero(0.01,0.01)" -op add :fn19:result null 0 -assertequals 0 :fn19:result "nullToZero(null)" -op add :fn20:result 1 0 -assertequals 1 :fn20:result "nullToZero(1)" +op add *tmp55 null 0 +assertequals 0 *tmp55 "nullToZero(null)" +op add *tmp56 1 0 +assertequals 1 *tmp56 "nullToZero(1)" assertequals 0 false "boolean(0)" assertequals 1 true "boolean(100)" assertequals 1 true "boolean(-100)" assertequals 1 true "boolean(-0.001)" assertequals 0 false "boolean(0.0000001)" -op or :fn26:result 0.9 0 -assertequals 0 :fn26:result "integer(0.9)" -op or :fn27:result -5.9 0 -assertequals -5 :fn27:result "integer(-5.9)" -op or :fn28:result 100 0 -assertequals 100 :fn28:result "integer(100)" +op or *tmp67 0.9 0 +assertequals 0 *tmp67 "integer(0.9)" +op or *tmp68 -5.9 0 +assertequals -5 *tmp68 "integer(-5.9)" +op or *tmp69 100 0 +assertequals 100 *tmp69 "integer(100)" assertequals 1 1 "sum(1)" assertequals 10 10 "sum(1,2,3,4)" assertequals 1 1 "avg(1)" diff --git a/compiler/src/test/resources/library/outputs/printing-experimental.log b/compiler/src/test/resources/library/outputs/printing-experimental.log index d02f9673..d1da1bc3 100644 --- a/compiler/src/test/resources/library/outputs/printing-experimental.log +++ b/compiler/src/test/resources/library/outputs/printing-experimental.log @@ -6,7 +6,7 @@ 20 instructions eliminated by Jump Optimization (5 iterations). 45 instructions eliminated by Single Step Elimination (2 passes, 7 iterations). 2 instructions eliminated by If Expression Optimization (4 iterations). - 199 instructions eliminated by Data Flow Optimization (18 passes, 55 iterations). + 199 instructions eliminated by Data Flow Optimization (18 passes, 57 iterations). 2 instructions eliminated by Loop Optimization (4 iterations). 5 loops improved by Loop Optimization. 643 instructions added by Loop Unrolling (20 iterations). diff --git a/compiler/src/test/resources/library/outputs/units-experimental.log b/compiler/src/test/resources/library/outputs/units-experimental.log index ca8f3d89..d4bbf102 100644 --- a/compiler/src/test/resources/library/outputs/units-experimental.log +++ b/compiler/src/test/resources/library/outputs/units-experimental.log @@ -4,7 +4,7 @@ 3 instructions eliminated by Jump Normalization (4 iterations). 15 instructions eliminated by Jump Optimization (4 iterations). 14 instructions eliminated by Single Step Elimination (3 passes, 7 iterations). - 19 instructions eliminated by Data Flow Optimization (6 iterations). + 19 instructions eliminated by Data Flow Optimization (7 iterations). 6 instructions updated by JumpThreading. 7 instructions eliminated by Unreachable Code Elimination. 8 instructions eliminated by Print Merging. diff --git a/doc/syntax/SYNTAX-6-OPTIMIZATIONS.markdown b/doc/syntax/SYNTAX-6-OPTIMIZATIONS.markdown index 9b9c6a5a..0ce1c9d0 100644 --- a/doc/syntax/SYNTAX-6-OPTIMIZATIONS.markdown +++ b/doc/syntax/SYNTAX-6-OPTIMIZATIONS.markdown @@ -539,6 +539,35 @@ print :x print :y ``` +### Backpropagation + +Backpropagation is a separate optimization which allows to modify instructions prior to the one being inspected: when a set instruction assigning a source variable to a target variable is encountered, the original instruction producing ("defining") the source variable is found. If the target variable's value is not needed between the assignments, and the source variable is not needed elsewhere, the set is dropped and the source variable is replaced with the target variable in the defining instruction. + +The results of this optimization can be demonstrated on this code: + +``` +#set optimization = experimental; +i = rand(10); +a = i; +i = rand(20); +b = i; +print(a, b); +``` + +which compiles to + +``` +op rand :a 10 0 +op rand :b 20 0 +print :a +print :b +printflush message1 +``` + +Of course, the source code typically doesn't contain such constructs, but this essentially is what some other optimizations, such as inlining function calls or unrolling a list iteration loop with modification may produce. + +The backpropagation optimization is available on the `experimental` level. + ### Function call optimizations Variables and expressions passed as arguments to inline functions, as well as return values of inline functions, are processed in the same way as other local variables. Using an inlined function therefore doesn't incur any overhead at all in Mindcode.