Added edges check to control flow graph test

This commit is contained in:
svtk
2011-10-18 16:52:16 +04:00
parent 181835b0ee
commit 5a9c23e8de
19 changed files with 729 additions and 731 deletions
@@ -22,8 +22,6 @@ import static org.jetbrains.jet.lang.diagnostics.Errors.*;
*/ */
public class JetControlFlowProcessor { public class JetControlFlowProcessor {
// private final Map<String, Stack<JetElement>> labeledElements = new HashMap<String, Stack<JetElement>>();
private final JetControlFlowBuilder builder; private final JetControlFlowBuilder builder;
private final BindingTrace trace; private final BindingTrace trace;
@@ -37,10 +35,6 @@ public class JetControlFlowProcessor {
} }
public void generateSubroutineControlFlow(@NotNull JetElement subroutineElement, @NotNull List<? extends JetElement> body) { public void generateSubroutineControlFlow(@NotNull JetElement subroutineElement, @NotNull List<? extends JetElement> body) {
// if (subroutineElement instanceof JetNamedDeclaration) {
// JetNamedDeclaration namedDeclaration = (JetNamedDeclaration) subroutineElement;
// enterLabeledElement(JetPsiUtil.safeName(namedDeclaration.getName()), namedDeclaration);
// }
boolean functionLiteral = subroutineElement instanceof JetFunctionLiteralExpression; boolean functionLiteral = subroutineElement instanceof JetFunctionLiteralExpression;
builder.enterSubroutine(subroutineElement, functionLiteral); builder.enterSubroutine(subroutineElement, functionLiteral);
for (JetElement statement : body) { for (JetElement statement : body) {
@@ -49,51 +43,6 @@ public class JetControlFlowProcessor {
builder.exitSubroutine(subroutineElement, functionLiteral); builder.exitSubroutine(subroutineElement, functionLiteral);
} }
// private void enterLabeledElement(@NotNull String labelName, @NotNull JetElement labeledElement) {
// Stack<JetElement> stack = labeledElements.get(labelName);
// if (stack == null) {
// stack = new Stack<JetElement>();
// labeledElements.put(labelName, stack);
// }
// stack.push(labeledElement);
// }
//
// private void exitElement(JetElement element) {
// // TODO : really suboptimal
// for (Iterator<Map.Entry<String, Stack<JetElement>>> mapIter = labeledElements.entrySet().iterator(); mapIter.hasNext(); ) {
// Map.Entry<String, Stack<JetElement>> entry = mapIter.next();
// Stack<JetElement> stack = entry.getValue();
// for (Iterator<JetElement> stackIter = stack.iterator(); stackIter.hasNext(); ) {
// JetElement recorded = stackIter.next();
// if (recorded == element) {
// stackIter.remove();
// }
// }
// if (stack.isEmpty()) {
// mapIter.remove();
// }
// }
// }
// @Nullable
// private JetElement resolveLabel(@NotNull String labelName, @NotNull JetSimpleNameExpression labelExpression, boolean reportUnresolved) {
// Stack<JetElement> stack = labeledElements.get(labelName);
// if (stack == null || stack.isEmpty()) {
// if (reportUnresolved) {
//// trace.report(UNRESOLVED_REFERENCE.on(labelExpression));
// }
// return null;
// }
// else if (stack.size() > 1) {
//// trace.getErrorHandler().genericWarning(labelExpression.getNode(), "There is more than one label with such a name in this scope");
//// trace.report(LABEL_NAME_CLASH.on(labelExpression));
// }
//
// JetElement result = stack.peek();
//// trace.record(BindingContext.LABEL_TARGET, labelExpression, result);
// return result;
// }
private class CFPVisitor extends JetVisitorVoid { private class CFPVisitor extends JetVisitorVoid {
private final boolean inCondition; private final boolean inCondition;
@@ -111,7 +60,6 @@ public class JetControlFlowProcessor {
visitor = new CFPVisitor(inCondition); visitor = new CFPVisitor(inCondition);
} }
element.accept(visitor); element.accept(visitor);
// exitElement(element);
} }
@Override @Override
@@ -124,12 +72,6 @@ public class JetControlFlowProcessor {
@Override @Override
public void visitThisExpression(JetThisExpression expression) { public void visitThisExpression(JetThisExpression expression) {
// JetSimpleNameExpression targetLabel = expression.getTargetLabel();
// if (targetLabel != null) {
// String labelName = expression.getLabelName();
// assert labelName != null;
// resolveLabel(labelName, targetLabel, false);
// }
builder.read(expression); builder.read(expression);
} }
@@ -161,7 +103,6 @@ public class JetControlFlowProcessor {
private void visitLabeledExpression(@NotNull String labelName, @NotNull JetExpression labeledExpression) { private void visitLabeledExpression(@NotNull String labelName, @NotNull JetExpression labeledExpression) {
JetExpression deparenthesized = JetPsiUtil.deparenthesize(labeledExpression); JetExpression deparenthesized = JetPsiUtil.deparenthesize(labeledExpression);
if (deparenthesized != null) { if (deparenthesized != null) {
// enterLabeledElement(labelName, deparenthesized);
value(labeledExpression, inCondition); value(labeledExpression, inCondition);
} }
} }
@@ -453,29 +394,16 @@ public class JetControlFlowProcessor {
trace.report(NOT_A_LOOP_LABEL.on(expression, targetLabel.getText())); trace.report(NOT_A_LOOP_LABEL.on(expression, targetLabel.getText()));
loop = null; loop = null;
} }
// loop = resolveLabel(labelName, targetLabel, true);
// if (!isLoop(loop)) {
//// trace.getErrorHandler().genericError(expression.getNode(), "The label '" + targetLabel.getText() + "' does not denote a loop");
// trace.report(NOT_A_LOOP_LABEL.on(expression, targetLabel.getText()));
// loop = null;
// }
} }
else { else {
loop = builder.getCurrentLoop(); loop = builder.getCurrentLoop();
if (loop == null) { if (loop == null) {
// trace.getErrorHandler().genericError(expression.getNode(), "'break' and 'continue' are only allowed inside a loop");
trace.report(BREAK_OR_CONTINUE_OUTSIDE_A_LOOP.on(expression)); trace.report(BREAK_OR_CONTINUE_OUTSIDE_A_LOOP.on(expression));
} }
} }
return loop; return loop;
} }
// private boolean isLoop(JetElement loop) {
// return loop instanceof JetWhileExpression ||
// loop instanceof JetDoWhileExpression ||
// loop instanceof JetForExpression;
// }
@Override @Override
public void visitReturnExpression(JetReturnExpression expression) { public void visitReturnExpression(JetReturnExpression expression) {
JetExpression returnedExpression = expression.getReturnedExpression(); JetExpression returnedExpression = expression.getReturnedExpression();
@@ -495,7 +423,6 @@ public class JetControlFlowProcessor {
else { else {
subroutine = null; subroutine = null;
} }
//subroutine = resolveLabel(labelName, labelElement, true);
} }
else { else {
subroutine = builder.getCurrentSubroutine(); subroutine = builder.getCurrentSubroutine();
@@ -672,7 +599,6 @@ public class JetControlFlowProcessor {
if (whenEntry.isElse()) { if (whenEntry.isElse()) {
if (iterator.hasNext()) { if (iterator.hasNext()) {
// trace.getErrorHandler().genericError(whenEntry.getNode(), "'else' entry must be the last one in a when-expression");
trace.report(ELSE_MISPLACED_IN_WHEN.on(whenEntry)); trace.report(ELSE_MISPLACED_IN_WHEN.on(whenEntry));
} }
} }
@@ -769,16 +695,6 @@ public class JetControlFlowProcessor {
@Override @Override
public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) { public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) {
// List<JetDelegationSpecifier> delegationSpecifiers = expression.getObjectDeclaration().getDelegationSpecifiers();
// for (JetDelegationSpecifier delegationSpecifier : delegationSpecifiers) {
// if (delegationSpecifier instanceof JetDelegatorByExpressionSpecifier) {
// JetDelegatorByExpressionSpecifier specifier = (JetDelegatorByExpressionSpecifier) delegationSpecifier;
// JetExpression delegateExpression = specifier.getDelegateExpression();
// if (delegateExpression != null) {
// value(delegateExpression, false, false);
// }
// }
// }
value(expression.getObjectDeclaration(), inCondition); value(expression.getObjectDeclaration(), inCondition);
builder.read(expression); builder.read(expression);
} }
@@ -13,6 +13,7 @@ public interface Instruction {
void setOwner(@NotNull Pseudocode owner); void setOwner(@NotNull Pseudocode owner);
@NotNull
Collection<Instruction> getPreviousInstructions(); Collection<Instruction> getPreviousInstructions();
@NotNull @NotNull
@@ -28,6 +28,7 @@ public abstract class InstructionImpl implements Instruction {
this.owner = owner; this.owner = owner;
} }
@NotNull
@Override @Override
public Collection<Instruction> getPreviousInstructions() { public Collection<Instruction> getPreviousInstructions() {
return previousInstructions; return previousInstructions;
@@ -27,7 +27,7 @@ public class NondeterministicJumpInstruction extends AbstractJumpInstruction {
} }
public void setNext(Instruction next) { public void setNext(Instruction next) {
this.next = next; this.next = outgoingEdgeTo(next);
} }
@NotNull @NotNull
@@ -75,9 +75,13 @@ public class Pseudocode {
} }
@NotNull @NotNull
public Collection<Instruction> getInstructions() { public List<Instruction> getInstructions() {
return instructions; return instructions;
} }
public List<PseudocodeLabel> getLabels() {
return labels;
}
public void addExitInstruction(SubroutineExitInstruction exitInstruction) { public void addExitInstruction(SubroutineExitInstruction exitInstruction) {
addInstruction(exitInstruction); addInstruction(exitInstruction);
@@ -163,170 +167,30 @@ public class Pseudocode {
@NotNull @NotNull
private Instruction getJumpTarget(@NotNull Label targetLabel) { private Instruction getJumpTarget(@NotNull Label targetLabel) {
return getTargetInstruction(((PseudocodeLabel) targetLabel).resolve()); return ((PseudocodeLabel)targetLabel).resolveToInstruction();
//return getTargetInstruction(((PseudocodeLabel) targetLabel).resolve());
} }
@NotNull // @NotNull
private Instruction getTargetInstruction(@NotNull List<Instruction> instructions) { // private Instruction getTargetInstruction(@NotNull List<Instruction> instructions) {
while (true) { // while (true) {
assert instructions != null; // assert instructions != null;
Instruction targetInstruction = instructions.get(0); // Instruction targetInstruction = instructions.get(0);
//
if (false == targetInstruction instanceof UnconditionalJumpInstruction) { // //if (false == targetInstruction instanceof UnconditionalJumpInstruction) {
return targetInstruction; // return targetInstruction;
} // //}
//
Label label = ((UnconditionalJumpInstruction) targetInstruction).getTargetLabel(); //// Label label = ((UnconditionalJumpInstruction) targetInstruction).getTargetLabel();
instructions = ((PseudocodeLabel)label).resolve(); //// instructions = ((PseudocodeLabel)label).resolve();
} // }
} // }
@NotNull @NotNull
private Instruction getNextPosition(int currentPosition) { private Instruction getNextPosition(int currentPosition) {
int targetPosition = currentPosition + 1; int targetPosition = currentPosition + 1;
assert targetPosition < instructions.size() : currentPosition; assert targetPosition < instructions.size() : currentPosition;
return getTargetInstruction(instructions.subList(targetPosition, instructions.size())); return instructions.get(targetPosition);
//return getTargetInstruction(instructions.subList(targetPosition, instructions.size()));
} }
public void dfsDump(StringBuilder nodes, StringBuilder edges, Map<Instruction, String> nodeNames) {
dfsDump(nodes, edges, instructions.get(0), nodeNames);
}
private void dfsDump(StringBuilder nodes, StringBuilder edges, Instruction instruction, Map<Instruction, String> nodeNames) {
if (nodeNames.containsKey(instruction)) return;
String name = "n" + nodeNames.size();
nodeNames.put(instruction, name);
nodes.append(name).append(" := ").append(renderName(instruction));
}
private String renderName(Instruction instruction) {
throw new UnsupportedOperationException(); // TODO
}
public void dumpInstructions(@NotNull StringBuilder out) {
List<Pseudocode> locals = new ArrayList<Pseudocode>();
for (int i = 0, instructionsSize = instructions.size(); i < instructionsSize; i++) {
Instruction instruction = instructions.get(i);
if (instruction instanceof FunctionLiteralValueInstruction) {
FunctionLiteralValueInstruction functionLiteralValueInstruction = (FunctionLiteralValueInstruction) instruction;
locals.add(functionLiteralValueInstruction.getBody());
}
for (PseudocodeLabel label: labels) {
if (label.getTargetInstructionIndex() == i) {
out.append(label.getName()).append(":\n");
}
}
out.append(" ").append(instruction).append("\n");
}
for (Pseudocode local : locals) {
local.dumpInstructions(out);
}
}
public void dumpEdges(final PrintStream out, final int[] count, final Map<Instruction, String> nodeToName) {
for (final Instruction fromInst : instructions) {
fromInst.accept(new InstructionVisitor() {
@Override
public void visitFunctionLiteralValue(FunctionLiteralValueInstruction instruction) {
int index = count[0];
// instruction.getBody().dumpSubgraph(out, "subgraph cluster_" + index, count, "color=blue;\nlabel = \"f" + index + "\";", nodeToName);
printEdge(out, nodeToName.get(instruction), nodeToName.get(instruction.getBody().instructions.get(0)), null);
visitInstructionWithNext(instruction);
}
@Override
public void visitUnconditionalJump(UnconditionalJumpInstruction instruction) {
// Nothing
}
@Override
public void visitJump(AbstractJumpInstruction instruction) {
printEdge(out, nodeToName.get(instruction), nodeToName.get(instruction.getResolvedTarget()), null);
}
@Override
public void visitNondeterministicJump(NondeterministicJumpInstruction instruction) {
visitJump(instruction);
printEdge(out, nodeToName.get(instruction), nodeToName.get(instruction.getNext()), null);
}
@Override
public void visitReturnValue(ReturnValueInstruction instruction) {
super.visitReturnValue(instruction);
}
@Override
public void visitReturnNoValue(ReturnNoValueInstruction instruction) {
super.visitReturnNoValue(instruction);
}
@Override
public void visitConditionalJump(ConditionalJumpInstruction instruction) {
String from = nodeToName.get(instruction);
printEdge(out, from, nodeToName.get(instruction.getNextOnFalse()), "no");
printEdge(out, from, nodeToName.get(instruction.getNextOnTrue()), "yes");
}
@Override
public void visitInstructionWithNext(InstructionWithNext instruction) {
printEdge(out, nodeToName.get(instruction), nodeToName.get(instruction.getNext()), null);
}
@Override
public void visitSubroutineExit(SubroutineExitInstruction instruction) {
// Nothing
}
@Override
public void visitInstruction(Instruction instruction) {
throw new UnsupportedOperationException(instruction.toString());
}
});
}
}
public void dumpNodes(PrintStream out, int[] count, Map<Instruction, String> nodeToName) {
for (Instruction node : instructions) {
if (node instanceof UnconditionalJumpInstruction) {
continue;
}
String name = "n" + count[0]++;
nodeToName.put(node, name);
String text = node.toString();
int newline = text.indexOf("\n");
if (newline >= 0) {
text = text.substring(0, newline);
}
String shape = "box";
if (node instanceof ConditionalJumpInstruction) {
shape = "diamond";
}
else if (node instanceof NondeterministicJumpInstruction) {
shape = "Mdiamond";
}
else if (node instanceof UnsupportedElementInstruction) {
shape = "box, fillcolor=red, style=filled";
}
else if (node instanceof FunctionLiteralValueInstruction) {
shape = "Mcircle";
}
else if (node instanceof SubroutineEnterInstruction || node instanceof SubroutineExitInstruction) {
shape = "roundrect, style=rounded";
}
out.println(name + "[label=\"" + text + "\", shape=" + shape + "];");
}
}
private void printEdge(PrintStream out, String from, String to, String label) {
if (label != null) {
label = "[label=\"" + label + "\"]";
}
else {
label = "";
}
out.println(from + " -> " + to + label + ";");
}
} }
+23 -23
View File
@@ -10,29 +10,29 @@ fun foo() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(Array)] PREV:[]
r(Array) r(Array) NEXT:[r(Array<Int>)] PREV:[<START>]
r(Array<Int>) r(Array<Int>) NEXT:[w(a)] PREV:[r(Array)]
w(a) w(a) NEXT:[r(3)] PREV:[r(Array<Int>)]
r(3) r(3) NEXT:[r(4)] PREV:[w(a)]
r(4) r(4) NEXT:[r(10)] PREV:[r(3)]
r(10) r(10) NEXT:[r(a)] PREV:[r(4)]
r(a) r(a) NEXT:[r(=)] PREV:[r(10)]
r(=) r(=) NEXT:[w(a[10])] PREV:[r(a)]
w(a[10]) w(a[10]) NEXT:[r(2)] PREV:[r(=)]
r(2) r(2) NEXT:[r(10)] PREV:[w(a[10])]
r(10) r(10) NEXT:[r(a)] PREV:[r(2)]
r(a) r(a) NEXT:[r(a[10])] PREV:[r(10)]
r(a[10]) r(a[10]) NEXT:[r(100)] PREV:[r(a)]
r(100) r(100) NEXT:[r(10)] PREV:[r(a[10])]
r(10) r(10) NEXT:[r(a)] PREV:[r(100)]
r(a) r(a) NEXT:[r(a[10])] PREV:[r(10)]
r(a[10]) r(a[10]) NEXT:[r(1)] PREV:[r(a)]
r(1) r(1) NEXT:[r(+=)] PREV:[r(a[10])]
r(+=) r(+=) NEXT:[w(a[10])] PREV:[r(1)]
w(a[10]) w(a[10]) NEXT:[<END>] PREV:[r(+=)]
l1: l1:
<END> <END> NEXT:[] PREV:[w(a[10])]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
+34 -34
View File
@@ -14,44 +14,44 @@ fun assignments() : Unit {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(1)] PREV:[]
r(1) r(1) NEXT:[w(x)] PREV:[<START>]
w(x) w(x) NEXT:[r(2)] PREV:[r(1)]
r(2) r(2) NEXT:[w(x)] PREV:[w(x)]
w(x) w(x) NEXT:[r(x)] PREV:[r(2)]
r(x) r(x) NEXT:[r(2)] PREV:[w(x)]
r(2) r(2) NEXT:[r(+=)] PREV:[r(x)]
r(+=) r(+=) NEXT:[w(x)] PREV:[r(2)]
w(x) w(x) NEXT:[r(true)] PREV:[r(+=)]
r(true) r(true) NEXT:[jf(l2)] PREV:[w(x)]
jf(l2) jf(l2) NEXT:[r(2), r(1)] PREV:[r(true)]
r(1) r(1) NEXT:[jmp(l3)] PREV:[jf(l2)]
jmp(l3) jmp(l3) NEXT:[w(x)] PREV:[r(1)]
l2: l2:
r(2) r(2) NEXT:[w(x)] PREV:[jf(l2)]
l3: l3:
w(x) w(x) NEXT:[r(true)] PREV:[jmp(l3), r(2)]
r(true) r(true) NEXT:[jf(l4)] PREV:[w(x)]
jf(l4) jf(l4) NEXT:[r(true && false), r(false)] PREV:[r(true)]
r(false) r(false) NEXT:[r(true && false)] PREV:[jf(l4)]
l4: l4:
r(true && false) r(true && false) NEXT:[w(y)] PREV:[jf(l4), r(false)]
w(y) w(y) NEXT:[r(false)] PREV:[r(true && false)]
r(false) r(false) NEXT:[jf(l5)] PREV:[w(y)]
jf(l5) jf(l5) NEXT:[r(false && true), r(true)] PREV:[r(false)]
r(true) r(true) NEXT:[r(false && true)] PREV:[jf(l5)]
l5: l5:
r(false && true) r(false && true) NEXT:[w(z)] PREV:[jf(l5), r(true)]
w(z) w(z) NEXT:[r(Test)] PREV:[r(false && true)]
r(Test) r(Test) NEXT:[r(Test())] PREV:[w(z)]
r(Test()) r(Test()) NEXT:[w(t)] PREV:[r(Test)]
w(t) w(t) NEXT:[r(1)] PREV:[r(Test())]
r(1) r(1) NEXT:[r(t)] PREV:[w(t)]
r(t) r(t) NEXT:[r(=)] PREV:[r(1)]
r(=) r(=) NEXT:[w(t.x)] PREV:[r(t)]
w(t.x) w(t.x) NEXT:[<END>] PREV:[r(=)]
l1: l1:
<END> <END> NEXT:[] PREV:[w(t.x)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
+58 -58
View File
@@ -2,12 +2,12 @@
{1} {1}
--------------------- ---------------------
l2: l2:
<START> <START> NEXT:[r(1)] PREV:[]
r(1) r(1) NEXT:[<END>] PREV:[<START>]
l3: l3:
<END> <END> NEXT:[] PREV:[r(1)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== f == == f ==
fun f(a : Boolean) : Unit { fun f(a : Boolean) : Unit {
@@ -29,86 +29,86 @@ fun f(a : Boolean) : Unit {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(1)] PREV:[]
r(1) r(1) NEXT:[r(a)] PREV:[<START>]
r(a) r(a) NEXT:[r(2)] PREV:[r(1)]
r(2) r(2) NEXT:[r(lng)] PREV:[r(a)]
r(lng) r(lng) NEXT:[r(2.lng)] PREV:[r(2)]
r(2.lng) r(2.lng) NEXT:[r(a)] PREV:[r(lng)]
r(a) r(a) NEXT:[r(3)] PREV:[r(2.lng)]
r(3) r(3) NEXT:[r(foo)] PREV:[r(a)]
r(foo) r(foo) NEXT:[r(foo(a, 3))] PREV:[r(3)]
r(foo(a, 3)) r(foo(a, 3)) NEXT:[r(genfun)] PREV:[r(foo)]
r(genfun) r(genfun) NEXT:[r(genfun<Any>())] PREV:[r(foo(a, 3))]
r(genfun<Any>()) r(genfun<Any>()) NEXT:[rf({1})] PREV:[r(genfun)]
rf({1}) rf({1}) NEXT:[r(flfun)] PREV:[r(genfun<Any>())]
r(flfun) r(flfun) NEXT:[r(flfun {1})] PREV:[rf({1})]
r(flfun {1}) r(flfun {1}) NEXT:[r(3)] PREV:[r(flfun)]
r(3) r(3) NEXT:[r(4)] PREV:[r(flfun {1})]
r(4) r(4) NEXT:[r(equals)] PREV:[r(3)]
r(equals) r(equals) NEXT:[r(equals(4))] PREV:[r(4)]
r(equals(4)) r(equals(4)) NEXT:[r(3.equals(4))] PREV:[r(equals)]
r(3.equals(4)) r(3.equals(4)) NEXT:[r(3)] PREV:[r(equals(4))]
r(3) r(3) NEXT:[r(4)] PREV:[r(3.equals(4))]
r(4) r(4) NEXT:[r(equals)] PREV:[r(3)]
r(equals) r(equals) NEXT:[r(3 equals 4)] PREV:[r(4)]
r(3 equals 4) r(3 equals 4) NEXT:[r(1)] PREV:[r(equals)]
r(1) r(1) NEXT:[r(2)] PREV:[r(3 equals 4)]
r(2) r(2) NEXT:[r(+)] PREV:[r(1)]
r(+) r(+) NEXT:[r(1 + 2)] PREV:[r(2)]
r(1 + 2) r(1 + 2) NEXT:[r(a)] PREV:[r(+)]
r(a) r(a) NEXT:[jf(l4)] PREV:[r(1 + 2)]
jf(l4) jf(l4) NEXT:[r(a && true), r(true)] PREV:[r(a)]
r(true) r(true) NEXT:[r(a && true)] PREV:[jf(l4)]
l4: l4:
r(a && true) r(a && true) NEXT:[r(a)] PREV:[jf(l4), r(true)]
r(a) r(a) NEXT:[jt(l5)] PREV:[r(a && true)]
jt(l5) jt(l5) NEXT:[r(false), r(a || false)] PREV:[r(a)]
r(false) r(false) NEXT:[r(a || false)] PREV:[jt(l5)]
l5: l5:
r(a || false) r(a || false) NEXT:[<END>] PREV:[jt(l5), r(false)]
l1: l1:
<END> <END> NEXT:[] PREV:[r(a || false)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
l2: l2:
<START> <START> NEXT:[r(1)] PREV:[]
r(1) r(1) NEXT:[<END>] PREV:[<START>]
l3: l3:
<END> <END> NEXT:[] PREV:[r(1)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== foo == == foo ==
fun foo(a : Boolean, b : Int) : Unit {} fun foo(a : Boolean, b : Int) : Unit {}
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[read (Unit)] PREV:[]
read (Unit) read (Unit) NEXT:[<END>] PREV:[<START>]
l1: l1:
<END> <END> NEXT:[] PREV:[read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== genfun == == genfun ==
fun genfun<T>() : Unit {} fun genfun<T>() : Unit {}
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[read (Unit)] PREV:[]
read (Unit) read (Unit) NEXT:[<END>] PREV:[<START>]
l1: l1:
<END> <END> NEXT:[] PREV:[read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== flfun == == flfun ==
fun flfun(f : fun () : Any) : Unit {} fun flfun(f : fun () : Any) : Unit {}
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[read (Unit)] PREV:[]
read (Unit) read (Unit) NEXT:[<END>] PREV:[<START>]
l1: l1:
<END> <END> NEXT:[] PREV:[read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
+4 -4
View File
@@ -2,10 +2,10 @@
fun empty() {} fun empty() {}
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[read (Unit)] PREV:[]
read (Unit) read (Unit) NEXT:[<END>] PREV:[<START>]
l1: l1:
<END> <END> NEXT:[] PREV:[read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
+10 -10
View File
@@ -4,16 +4,16 @@ fun fail() : Nothing {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(java)] PREV:[]
r(java) r(java) NEXT:[r(lang)] PREV:[<START>]
r(lang) r(lang) NEXT:[r(java.lang)] PREV:[r(java)]
r(java.lang) r(java.lang) NEXT:[r(RuntimeException)] PREV:[r(lang)]
r(RuntimeException) r(RuntimeException) NEXT:[r(RuntimeException())] PREV:[r(java.lang)]
r(RuntimeException()) r(RuntimeException()) NEXT:[r(java.lang.RuntimeException())] PREV:[r(RuntimeException)]
r(java.lang.RuntimeException()) r(java.lang.RuntimeException()) NEXT:[jmp(error)] PREV:[r(RuntimeException())]
jmp(error) jmp(error) NEXT:[<ERROR>] PREV:[r(java.lang.RuntimeException())]
l1: l1:
<END> <END> NEXT:[] PREV:[]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[jmp(error)]
===================== =====================
+228 -228
View File
@@ -8,15 +8,15 @@ fun t3() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[jmp?(l2)] PREV:[]
jmp?(l2) jmp?(l2) NEXT:[r(2), r(1)] PREV:[<START>]
r(1) r(1) NEXT:[r(2)] PREV:[jmp?(l2)]
l2: l2:
r(2) r(2) NEXT:[<END>] PREV:[jmp?(l2), r(1)]
l1: l1:
<END> <END> NEXT:[] PREV:[r(2)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== t3 == == t3 ==
fun t3() { fun t3() {
@@ -31,26 +31,26 @@ fun t3() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[jmp?(l2)] PREV:[]
jmp?(l2) jmp?(l2) NEXT:[r(2), r(1)] PREV:[<START>]
r(1) r(1) NEXT:[r(2)] PREV:[jmp?(l2)]
r(2) r(2) NEXT:[r(3)] PREV:[r(1)]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l3)] PREV:[r(>)]
jf(l3) jf(l3) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
r(2) r(2) NEXT:[ret l1] PREV:[jf(l3)]
ret l1 ret l1 NEXT:[<END>] PREV:[r(2)]
jmp(l4) jmp(l4) NEXT:[r(2)] PREV:[]
l3: l3:
read (Unit) read (Unit) NEXT:[r(2)] PREV:[jf(l3)]
l2: l2:
l4: l4:
r(2) r(2) NEXT:[<END>] PREV:[jmp?(l2), jmp(l4), read (Unit)]
l1: l1:
<END> <END> NEXT:[] PREV:[ret l1, r(2)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== anonymous_0 == == anonymous_0 ==
{ () => { () =>
@@ -60,21 +60,21 @@ error:
} }
--------------------- ---------------------
l3: l3:
<START> <START> NEXT:[r(2)] PREV:[]
r(2) r(2) NEXT:[r(3)] PREV:[<START>]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l5)] PREV:[r(>)]
jf(l5) jf(l5) NEXT:[read (Unit), ret l4] PREV:[r(2 > 3)]
ret l4 ret l4 NEXT:[<END>] PREV:[jf(l5)]
jmp(l6) jmp(l6) NEXT:[<END>] PREV:[]
l5: l5:
read (Unit) read (Unit) NEXT:[<END>] PREV:[jf(l5)]
l4: l4:
l6: l6:
<END> <END> NEXT:[] PREV:[ret l4, jmp(l6), read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== t3 == == t3 ==
fun t3() { fun t3() {
@@ -91,36 +91,36 @@ fun t3() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[jmp?(l2)] PREV:[]
jmp?(l2) jmp?(l2) NEXT:[r(2), r(1)] PREV:[<START>]
r(1) r(1) NEXT:[rf({ () => if (2 > 3) { retu..)] PREV:[jmp?(l2)]
rf({ () => rf({ () =>
if (2 > 3) { if (2 > 3) {
return@ return@
} }
}) }) NEXT:[r(2)] PREV:[r(1)]
l2: l2:
r(2) r(2) NEXT:[<END>] PREV:[jmp?(l2), rf({ () => if (2 > 3) { retu..)]
l1: l1:
<END> <END> NEXT:[] PREV:[r(2)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
l3: l3:
<START> <START> NEXT:[r(2)] PREV:[]
r(2) r(2) NEXT:[r(3)] PREV:[<START>]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l5)] PREV:[r(>)]
jf(l5) jf(l5) NEXT:[read (Unit), ret l4] PREV:[r(2 > 3)]
ret l4 ret l4 NEXT:[<END>] PREV:[jf(l5)]
jmp(l6) jmp(l6) NEXT:[<END>] PREV:[]
l5: l5:
read (Unit) read (Unit) NEXT:[<END>] PREV:[jf(l5)]
l4: l4:
l6: l6:
<END> <END> NEXT:[] PREV:[ret l4, jmp(l6), read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== anonymous_1 == == anonymous_1 ==
{ () => { () =>
@@ -135,26 +135,26 @@ error:
} }
--------------------- ---------------------
l2: l2:
<START> <START> NEXT:[jmp?(l4)] PREV:[]
jmp?(l4) jmp?(l4) NEXT:[r(2), r(1)] PREV:[<START>]
r(1) r(1) NEXT:[r(2)] PREV:[jmp?(l4)]
r(2) r(2) NEXT:[r(3)] PREV:[r(1)]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l5)] PREV:[r(>)]
jf(l5) jf(l5) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
r(2) r(2) NEXT:[ret l3] PREV:[jf(l5)]
ret l3 ret l3 NEXT:[<END>] PREV:[r(2)]
jmp(l6) jmp(l6) NEXT:[r(2)] PREV:[]
l5: l5:
read (Unit) read (Unit) NEXT:[r(2)] PREV:[jf(l5)]
l4: l4:
l6: l6:
r(2) r(2) NEXT:[<END>] PREV:[jmp?(l4), jmp(l6), read (Unit)]
l3: l3:
<END> <END> NEXT:[] PREV:[ret l3, r(2)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== t3 == == t3 ==
fun t3() { fun t3() {
@@ -171,42 +171,42 @@ fun t3() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[rf({ () => try { 1 if (2 > 3..)] PREV:[]
rf({ () => rf({ () =>
try { try {
1 1
if (2 > 3) { if (2 > 3) {
return@ return@
} }
} finally { } finally {
2 2
} }
}) }) NEXT:[<END>] PREV:[<START>]
l1: l1:
<END> <END> NEXT:[] PREV:[rf({ () => try { 1 if (2 > 3..)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
l2: l2:
<START> <START> NEXT:[jmp?(l4)] PREV:[]
jmp?(l4) jmp?(l4) NEXT:[r(2), r(1)] PREV:[<START>]
r(1) r(1) NEXT:[r(2)] PREV:[jmp?(l4)]
r(2) r(2) NEXT:[r(3)] PREV:[r(1)]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l5)] PREV:[r(>)]
jf(l5) jf(l5) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
r(2) r(2) NEXT:[ret l3] PREV:[jf(l5)]
ret l3 ret l3 NEXT:[<END>] PREV:[r(2)]
jmp(l6) jmp(l6) NEXT:[r(2)] PREV:[]
l5: l5:
read (Unit) read (Unit) NEXT:[r(2)] PREV:[jf(l5)]
l4: l4:
l6: l6:
r(2) r(2) NEXT:[<END>] PREV:[jmp?(l4), jmp(l6), read (Unit)]
l3: l3:
<END> <END> NEXT:[] PREV:[ret l3, r(2)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== t3 == == t3 ==
fun t3() { fun t3() {
@@ -223,34 +223,34 @@ fun t3() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(true)] PREV:[]
l2: l2:
l5: l5:
r(true) r(true) NEXT:[jf(l3)] PREV:[<START>, jmp(l2)]
jf(l3) jf(l3) NEXT:[read (Unit), jmp?(l6)] PREV:[r(true)]
l4: l4:
jmp?(l6) jmp?(l6) NEXT:[r(2), r(1)] PREV:[jf(l3)]
r(1) r(1) NEXT:[r(2)] PREV:[jmp?(l6)]
r(2) r(2) NEXT:[r(3)] PREV:[r(1)]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l7)] PREV:[r(>)]
jf(l7) jf(l7) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
r(2) r(2) NEXT:[jmp(l3)] PREV:[jf(l7)]
jmp(l3) jmp(l3) NEXT:[read (Unit)] PREV:[r(2)]
jmp(l8) jmp(l8) NEXT:[r(2)] PREV:[]
l7: l7:
read (Unit) read (Unit) NEXT:[r(2)] PREV:[jf(l7)]
l6: l6:
l8: l8:
r(2) r(2) NEXT:[jmp(l2)] PREV:[jmp?(l6), jmp(l8), read (Unit)]
jmp(l2) jmp(l2) NEXT:[r(true)] PREV:[r(2)]
l3: l3:
read (Unit) read (Unit) NEXT:[<END>] PREV:[jf(l3), jmp(l3)]
l1: l1:
<END> <END> NEXT:[] PREV:[read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== t3 == == t3 ==
fun t3() { fun t3() {
@@ -268,34 +268,34 @@ fun t3() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[jmp?(l2)] PREV:[]
jmp?(l2) jmp?(l2) NEXT:[r(2), r(true)] PREV:[<START>]
l3: l3:
l6: l6:
r(true) r(true) NEXT:[jf(l4)] PREV:[jmp?(l2), jmp(l3)]
jf(l4) jf(l4) NEXT:[read (Unit), r(1)] PREV:[r(true)]
l5: l5:
r(1) r(1) NEXT:[r(2)] PREV:[jf(l4)]
r(2) r(2) NEXT:[r(3)] PREV:[r(1)]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l7)] PREV:[r(>)]
jf(l7) jf(l7) NEXT:[read (Unit), jmp(l4)] PREV:[r(2 > 3)]
jmp(l4) jmp(l4) NEXT:[read (Unit)] PREV:[jf(l7)]
jmp(l8) jmp(l8) NEXT:[jmp(l3)] PREV:[]
l7: l7:
read (Unit) read (Unit) NEXT:[jmp(l3)] PREV:[jf(l7)]
l8: l8:
jmp(l3) jmp(l3) NEXT:[r(true)] PREV:[jmp(l8), read (Unit)]
l4: l4:
read (Unit) read (Unit) NEXT:[r(5)] PREV:[jf(l4), jmp(l4)]
r(5) r(5) NEXT:[r(2)] PREV:[read (Unit)]
l2: l2:
r(2) r(2) NEXT:[<END>] PREV:[jmp?(l2), r(5)]
l1: l1:
<END> <END> NEXT:[] PREV:[r(2)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== t3 == == t3 ==
fun t3() { fun t3() {
@@ -312,33 +312,33 @@ fun t3() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[jmp?(l2)] PREV:[]
jmp?(l2) jmp?(l2) NEXT:[r(2), r(true)] PREV:[<START>]
l3: l3:
l6: l6:
r(true) r(true) NEXT:[jf(l4)] PREV:[jmp?(l2), jmp(l3)]
jf(l4) jf(l4) NEXT:[read (Unit), r(1)] PREV:[r(true)]
l5: l5:
r(1) r(1) NEXT:[r(2)] PREV:[jf(l4)]
r(2) r(2) NEXT:[r(3)] PREV:[r(1)]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l7)] PREV:[r(>)]
jf(l7) jf(l7) NEXT:[read (Unit), jmp(l4)] PREV:[r(2 > 3)]
jmp(l4) jmp(l4) NEXT:[read (Unit)] PREV:[jf(l7)]
jmp(l8) jmp(l8) NEXT:[jmp(l3)] PREV:[]
l7: l7:
read (Unit) read (Unit) NEXT:[jmp(l3)] PREV:[jf(l7)]
l8: l8:
jmp(l3) jmp(l3) NEXT:[r(true)] PREV:[jmp(l8), read (Unit)]
l4: l4:
read (Unit) read (Unit) NEXT:[r(2)] PREV:[jf(l4), jmp(l4)]
l2: l2:
r(2) r(2) NEXT:[<END>] PREV:[jmp?(l2), read (Unit)]
l1: l1:
<END> <END> NEXT:[] PREV:[r(2)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== t3 == == t3 ==
fun t3(a : Int) { fun t3(a : Int) {
@@ -355,37 +355,37 @@ fun t3(a : Int) {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(1)] PREV:[]
r(1) r(1) NEXT:[r(a)] PREV:[<START>]
r(a) r(a) NEXT:[r(..)] PREV:[r(1)]
r(..) r(..) NEXT:[r(1..a)] PREV:[r(a)]
r(1..a) r(1..a) NEXT:[jmp?(l2)] PREV:[r(..)]
l3: l3:
jmp?(l2) jmp?(l2) NEXT:[read (Unit), jmp?(l6)] PREV:[r(1..a)]
l4: l4:
l5: l5:
jmp?(l6) jmp?(l6) NEXT:[r(2), r(1)] PREV:[jmp?(l2), jmp(l4), jmp?(l4)]
r(1) r(1) NEXT:[r(2)] PREV:[jmp?(l6)]
r(2) r(2) NEXT:[r(3)] PREV:[r(1)]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l7)] PREV:[r(>)]
jf(l7) jf(l7) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
r(2) r(2) NEXT:[jmp(l4)] PREV:[jf(l7)]
jmp(l4) jmp(l4) NEXT:[jmp?(l6)] PREV:[r(2)]
jmp(l8) jmp(l8) NEXT:[r(2)] PREV:[]
l7: l7:
read (Unit) read (Unit) NEXT:[r(2)] PREV:[jf(l7)]
l6: l6:
l8: l8:
r(2) r(2) NEXT:[jmp?(l4)] PREV:[jmp?(l6), jmp(l8), read (Unit)]
jmp?(l4) jmp?(l4) NEXT:[jmp?(l6), read (Unit)] PREV:[r(2)]
l2: l2:
read (Unit) read (Unit) NEXT:[<END>] PREV:[jmp?(l2), jmp?(l4)]
l1: l1:
<END> <END> NEXT:[] PREV:[read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== t3 == == t3 ==
fun t3(a : Int) { fun t3(a : Int) {
@@ -403,37 +403,37 @@ fun t3(a : Int) {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[jmp?(l2)] PREV:[]
jmp?(l2) jmp?(l2) NEXT:[r(2), r(1)] PREV:[<START>]
r(1) r(1) NEXT:[r(a)] PREV:[jmp?(l2)]
r(a) r(a) NEXT:[r(..)] PREV:[r(1)]
r(..) r(..) NEXT:[r(1..a)] PREV:[r(a)]
r(1..a) r(1..a) NEXT:[jmp?(l3)] PREV:[r(..)]
l4: l4:
jmp?(l3) jmp?(l3) NEXT:[read (Unit), r(1)] PREV:[r(1..a)]
l5: l5:
l6: l6:
r(1) r(1) NEXT:[r(2)] PREV:[jmp?(l3), jmp(l5), jmp?(l5)]
r(2) r(2) NEXT:[r(3)] PREV:[r(1)]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l7)] PREV:[r(>)]
jf(l7) jf(l7) NEXT:[read (Unit), jmp(l5)] PREV:[r(2 > 3)]
jmp(l5) jmp(l5) NEXT:[r(1)] PREV:[jf(l7)]
jmp(l8) jmp(l8) NEXT:[jmp?(l5)] PREV:[]
l7: l7:
read (Unit) read (Unit) NEXT:[jmp?(l5)] PREV:[jf(l7)]
l8: l8:
jmp?(l5) jmp?(l5) NEXT:[r(1), read (Unit)] PREV:[jmp(l8), read (Unit)]
l3: l3:
read (Unit) read (Unit) NEXT:[r(5)] PREV:[jmp?(l3), jmp?(l5)]
r(5) r(5) NEXT:[r(2)] PREV:[read (Unit)]
l2: l2:
r(2) r(2) NEXT:[<END>] PREV:[jmp?(l2), r(5)]
l1: l1:
<END> <END> NEXT:[] PREV:[r(2)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== t3 == == t3 ==
fun t3(a : Int) { fun t3(a : Int) {
@@ -450,36 +450,36 @@ fun t3(a : Int) {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[jmp?(l2)] PREV:[]
jmp?(l2) jmp?(l2) NEXT:[r(2), r(1)] PREV:[<START>]
r(1) r(1) NEXT:[r(a)] PREV:[jmp?(l2)]
r(a) r(a) NEXT:[r(..)] PREV:[r(1)]
r(..) r(..) NEXT:[r(1..a)] PREV:[r(a)]
r(1..a) r(1..a) NEXT:[jmp?(l3)] PREV:[r(..)]
l4: l4:
jmp?(l3) jmp?(l3) NEXT:[read (Unit), r(1)] PREV:[r(1..a)]
l5: l5:
l6: l6:
r(1) r(1) NEXT:[r(2)] PREV:[jmp?(l3), jmp(l5), jmp?(l5)]
r(2) r(2) NEXT:[r(3)] PREV:[r(1)]
r(3) r(3) NEXT:[r(>)] PREV:[r(2)]
r(>) r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
r(2 > 3) r(2 > 3) NEXT:[jf(l7)] PREV:[r(>)]
jf(l7) jf(l7) NEXT:[read (Unit), jmp(l5)] PREV:[r(2 > 3)]
jmp(l5) jmp(l5) NEXT:[r(1)] PREV:[jf(l7)]
jmp(l8) jmp(l8) NEXT:[jmp?(l5)] PREV:[]
l7: l7:
read (Unit) read (Unit) NEXT:[jmp?(l5)] PREV:[jf(l7)]
l8: l8:
jmp?(l5) jmp?(l5) NEXT:[r(1), read (Unit)] PREV:[jmp(l8), read (Unit)]
l3: l3:
read (Unit) read (Unit) NEXT:[r(2)] PREV:[jmp?(l3), jmp?(l5)]
l2: l2:
r(2) r(2) NEXT:[<END>] PREV:[jmp?(l2), read (Unit)]
l1: l1:
<END> <END> NEXT:[] PREV:[r(2)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== tf == == tf ==
fun tf() { fun tf() {
@@ -492,17 +492,17 @@ fun tf() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[jmp?(l2)] PREV:[]
jmp?(l2) jmp?(l2) NEXT:[r(2), r(1)] PREV:[<START>]
r(1) r(1) NEXT:[r(2)] PREV:[jmp?(l2)]
r(2) r(2) NEXT:[ret(*) l1] PREV:[r(1)]
ret(*) l1 ret(*) l1 NEXT:[<END>] PREV:[r(2)]
ret(*) l1 ret(*) l1 NEXT:[<END>] PREV:[]
l2: l2:
r(2) r(2) NEXT:[ret(*) l1] PREV:[jmp?(l2)]
ret(*) l1 ret(*) l1 NEXT:[<END>] PREV:[r(2)]
l1: l1:
<END> <END> NEXT:[] PREV:[ret(*) l1, ret(*) l1, ret(*) l1]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
+37 -37
View File
@@ -18,55 +18,55 @@ fun lazyBooleans(a : Boolean, b : Boolean) : Unit {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(a)] PREV:[]
r(a) r(a) NEXT:[jf(l2)] PREV:[<START>]
jf(l2) jf(l2) NEXT:[r(2), r(1)] PREV:[r(a)]
r(1) r(1) NEXT:[jmp(l3)] PREV:[jf(l2)]
jmp(l3) jmp(l3) NEXT:[r(3)] PREV:[r(1)]
l2: l2:
r(2) r(2) NEXT:[r(3)] PREV:[jf(l2)]
l3: l3:
r(3) r(3) NEXT:[r(a)] PREV:[jmp(l3), r(2)]
r(a) r(a) NEXT:[jf(l4)] PREV:[r(3)]
jf(l4) jf(l4) NEXT:[jf(l5), r(b)] PREV:[r(a)]
r(b) r(b) NEXT:[jf(l5)] PREV:[jf(l4)]
l4: l4:
jf(l5) jf(l5) NEXT:[r(6), r(5)] PREV:[jf(l4), r(b)]
r(5) r(5) NEXT:[jmp(l6)] PREV:[jf(l5)]
jmp(l6) jmp(l6) NEXT:[r(7)] PREV:[r(5)]
l5: l5:
r(6) r(6) NEXT:[r(7)] PREV:[jf(l5)]
l6: l6:
r(7) r(7) NEXT:[r(a)] PREV:[jmp(l6), r(6)]
r(a) r(a) NEXT:[jt(l7)] PREV:[r(7)]
jt(l7) jt(l7) NEXT:[r(b), jf(l8)] PREV:[r(a)]
r(b) r(b) NEXT:[jf(l8)] PREV:[jt(l7)]
l7: l7:
jf(l8) jf(l8) NEXT:[r(9), r(8)] PREV:[jt(l7), r(b)]
r(8) r(8) NEXT:[jmp(l9)] PREV:[jf(l8)]
jmp(l9) jmp(l9) NEXT:[r(10)] PREV:[r(8)]
l8: l8:
r(9) r(9) NEXT:[r(10)] PREV:[jf(l8)]
l9: l9:
r(10) r(10) NEXT:[r(a)] PREV:[jmp(l9), r(9)]
r(a) r(a) NEXT:[jf(l10)] PREV:[r(10)]
jf(l10) jf(l10) NEXT:[read (Unit), r(11)] PREV:[r(a)]
r(11) r(11) NEXT:[jmp(l11)] PREV:[jf(l10)]
jmp(l11) jmp(l11) NEXT:[r(12)] PREV:[r(11)]
l10: l10:
read (Unit) read (Unit) NEXT:[r(12)] PREV:[jf(l10)]
l11: l11:
r(12) r(12) NEXT:[r(a)] PREV:[jmp(l11), read (Unit)]
r(a) r(a) NEXT:[jf(l12)] PREV:[r(12)]
jf(l12) jf(l12) NEXT:[r(13), read (Unit)] PREV:[r(a)]
read (Unit) read (Unit) NEXT:[jmp(l13)] PREV:[jf(l12)]
jmp(l13) jmp(l13) NEXT:[r(14)] PREV:[read (Unit)]
l12: l12:
r(13) r(13) NEXT:[r(14)] PREV:[jf(l12)]
l13: l13:
r(14) r(14) NEXT:[<END>] PREV:[jmp(l13), r(13)]
l1: l1:
<END> <END> NEXT:[] PREV:[r(14)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
+43 -43
View File
@@ -5,19 +5,19 @@ fun foo() {
} }
--------------------- ---------------------
l6: l6:
<START> <START> NEXT:[r(b)] PREV:[]
r(b) r(b) NEXT:[jf(l8)] PREV:[<START>]
jf(l8) jf(l8) NEXT:[read (Unit), r(1)] PREV:[r(b)]
r(1) r(1) NEXT:[ret(*) l5] PREV:[jf(l8)]
ret(*) l5 ret(*) l5 NEXT:[<END>] PREV:[r(1)]
jmp(l9) jmp(l9) NEXT:[<END>] PREV:[]
l8: l8:
read (Unit) read (Unit) NEXT:[<END>] PREV:[jf(l8)]
l7: l7:
l9: l9:
<END> <END> NEXT:[] PREV:[jmp(l9), read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== anonymous_0 == == anonymous_0 ==
{a => {a =>
@@ -31,14 +31,14 @@ error:
} }
--------------------- ---------------------
l4: l4:
<START> <START> NEXT:[r(2)] PREV:[]
r(2) r(2) NEXT:[r(5)] PREV:[<START>]
r(5) r(5) NEXT:[ret(*) l5] PREV:[r(2)]
ret(*) l5 ret(*) l5 NEXT:[<END>] PREV:[r(5)]
l5: l5:
<END> <END> NEXT:[] PREV:[ret(*) l5, ret(*) l5]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== nonlocals1 == == nonlocals1 ==
fun nonlocals1(a : Boolean, b : Boolean) : Any? { fun nonlocals1(a : Boolean, b : Boolean) : Any? {
@@ -60,39 +60,39 @@ fun nonlocals1(a : Boolean, b : Boolean) : Any? {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(a)] PREV:[]
r(a) r(a) NEXT:[jf(l2)] PREV:[<START>]
jf(l2) jf(l2) NEXT:[read (Unit), r(1)] PREV:[r(a)]
r(1) r(1) NEXT:[ret(*) l1] PREV:[jf(l2)]
ret(*) l1 ret(*) l1 NEXT:[<END>] PREV:[r(1)]
jmp(l3) jmp(l3) NEXT:[r(1)] PREV:[]
l2: l2:
read (Unit) read (Unit) NEXT:[r(1)] PREV:[jf(l2)]
l3: l3:
r(1) r(1) NEXT:[rf({a => 2 fun foo() { if (b..)] PREV:[jmp(l3), read (Unit)]
rf({a => rf({a =>
2 2
fun foo() { fun foo() {
if (b) if (b)
return@a 1 return@a 1
} }
return@a 5; return@a 5;
}) }) NEXT:[r(1)] PREV:[r(1)]
r(1) r(1) NEXT:[r(lng)] PREV:[rf({a => 2 fun foo() { if (b..)]
r(lng) r(lng) NEXT:[r(1.lng)] PREV:[r(1)]
r(1.lng) r(1.lng) NEXT:[<END>] PREV:[r(lng)]
l1: l1:
<END> <END> NEXT:[] PREV:[ret(*) l1, r(1.lng)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
l4: l4:
<START> <START> NEXT:[r(2)] PREV:[]
r(2) r(2) NEXT:[r(5)] PREV:[<START>]
r(5) r(5) NEXT:[ret(*) l5] PREV:[r(2)]
ret(*) l5 ret(*) l5 NEXT:[<END>] PREV:[r(5)]
l5: l5:
<END> <END> NEXT:[] PREV:[ret(*) l5, ret(*) l5]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
@@ -6,23 +6,23 @@ fun main() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(1)] PREV:[]
l2: l2:
l5: l5:
r(1) r(1) NEXT:[r(0)] PREV:[<START>, jmp(l2)]
r(0) r(0) NEXT:[r(>)] PREV:[r(1)]
r(>) r(>) NEXT:[r(1 > 0)] PREV:[r(0)]
r(1 > 0) r(1 > 0) NEXT:[jf(l3)] PREV:[r(>)]
jf(l3) jf(l3) NEXT:[read (Unit), r(2)] PREV:[r(1 > 0)]
l4: l4:
r(2) r(2) NEXT:[jmp(l2)] PREV:[jf(l3)]
jmp(l2) jmp(l2) NEXT:[r(1)] PREV:[r(2)]
l3: l3:
read (Unit) read (Unit) NEXT:[<END>] PREV:[jf(l3)]
l1: l1:
<END> <END> NEXT:[] PREV:[read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
== dowhile == == dowhile ==
fun dowhile() { fun dowhile() {
@@ -31,20 +31,20 @@ fun dowhile() {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[ret l1] PREV:[]
l2: l2:
l4: l4:
ret l1 ret l1 NEXT:[<END>] PREV:[<START>, jt(l2)]
l5: l5:
r(1) r(1) NEXT:[r(0)] PREV:[]
r(0) r(0) NEXT:[r(>)] PREV:[r(1)]
r(>) r(>) NEXT:[r(1 > 0)] PREV:[r(0)]
r(1 > 0) r(1 > 0) NEXT:[jt(l2)] PREV:[r(>)]
jt(l2) jt(l2) NEXT:[read (Unit), ret l1] PREV:[r(1 > 0)]
l3: l3:
read (Unit) read (Unit) NEXT:[<END>] PREV:[jt(l2)]
l1: l1:
<END> <END> NEXT:[] PREV:[ret l1, read (Unit)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
@@ -4,15 +4,15 @@ fun blockAndAndMismatch() : Boolean {
} }
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(false)] PREV:[]
r(false) r(false) NEXT:[jt(l2)] PREV:[<START>]
jt(l2) jt(l2) NEXT:[r(false), r(false || (return false))] PREV:[r(false)]
r(false) r(false) NEXT:[ret(*) l1] PREV:[jt(l2)]
ret(*) l1 ret(*) l1 NEXT:[<END>] PREV:[r(false)]
l2: l2:
r(false || (return false)) r(false || (return false)) NEXT:[<END>] PREV:[jt(l2)]
l1: l1:
<END> <END> NEXT:[] PREV:[ret(*) l1, r(false || (return false))]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
+4 -4
View File
@@ -2,10 +2,10 @@
fun short() = 1 fun short() = 1
--------------------- ---------------------
l0: l0:
<START> <START> NEXT:[r(1)] PREV:[]
r(1) r(1) NEXT:[<END>] PREV:[<START>]
l1: l1:
<END> <END> NEXT:[] PREV:[r(1)]
error: error:
<ERROR> <ERROR> NEXT:[] PREV:[]
===================== =====================
@@ -6,8 +6,8 @@ class B() : A() {
fun bar() {} fun bar() {}
} }
fun f9() { fun f9(init : A?) {
val a : A? val a : A? = init
a?.foo() a?.foo()
a?.<!UNRESOLVED_REFERENCE!>bar<!>() a?.<!UNRESOLVED_REFERENCE!>bar<!>()
if (a is B) { if (a is B) {
@@ -30,8 +30,8 @@ fun f9() {
a.foo() a.foo()
} }
fun f10() { fun f10(init : A?) {
val a : A? val a : A? = init
if (!(a is B)) { if (!(a is B)) {
return; return;
} }
@@ -1,5 +1,5 @@
fun box() { fun box(c : C) {
val a : C val a : C = c
a.foo() a.foo()
} }
@@ -10,10 +10,7 @@ import junit.framework.TestSuite;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.JetTestCaseBase; import org.jetbrains.jet.JetTestCaseBase;
import org.jetbrains.jet.lang.cfg.LoopInfo; import org.jetbrains.jet.lang.cfg.LoopInfo;
import org.jetbrains.jet.lang.cfg.pseudocode.Instruction; import org.jetbrains.jet.lang.cfg.pseudocode.*;
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
import org.jetbrains.jet.lang.cfg.pseudocode.JetPseudocodeTrace;
import org.jetbrains.jet.lang.cfg.pseudocode.Pseudocode;
import org.jetbrains.jet.lang.psi.JetElement; import org.jetbrains.jet.lang.psi.JetElement;
import org.jetbrains.jet.lang.psi.JetExpression; import org.jetbrains.jet.lang.psi.JetExpression;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
@@ -24,10 +21,7 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public class JetControlFlowTest extends JetTestCaseBase { public class JetControlFlowTest extends JetTestCaseBase {
static { static {
@@ -109,8 +103,19 @@ public class JetControlFlowTest extends JetTestCaseBase {
instructionDump.append(correspondingElement.getText()); instructionDump.append(correspondingElement.getText());
instructionDump.append("\n---------------------\n"); instructionDump.append("\n---------------------\n");
pseudocode.dumpInstructions(instructionDump); dumpInstructions(pseudocode, instructionDump);
instructionDump.append("=====================\n"); instructionDump.append("=====================\n");
//check edges directions
Collection<Instruction> instructions = pseudocode.getInstructions();
for (Instruction instruction : instructions) {
for (Instruction nextInstruction : instruction.getNextInstructions()) {
assertTrue("instruction: " + instruction + " next: " + nextInstruction, nextInstruction.getPreviousInstructions().contains(instruction));
}
for (Instruction prevInstruction : instruction.getPreviousInstructions()) {
assertTrue("instruction: " + instruction + " prev: " + prevInstruction, prevInstruction.getNextInstructions().contains(instruction));
}
}
} }
String expectedInstructionsFileName = getTestDataPath() + "/" + getTestFilePath().replace(".jet", ".instructions"); String expectedInstructionsFileName = getTestDataPath() + "/" + getTestFilePath().replace(".jet", ".instructions");
@@ -129,6 +134,217 @@ public class JetControlFlowTest extends JetTestCaseBase {
// } // }
} }
public void dfsDump(Pseudocode pseudocode, StringBuilder nodes, StringBuilder edges, Map<Instruction, String> nodeNames) {
dfsDump(nodes, edges, pseudocode.getInstructions().get(0), nodeNames);
}
private void dfsDump(StringBuilder nodes, StringBuilder edges, Instruction instruction, Map<Instruction, String> nodeNames) {
if (nodeNames.containsKey(instruction)) return;
String name = "n" + nodeNames.size();
nodeNames.put(instruction, name);
nodes.append(name).append(" := ").append(renderName(instruction));
}
private String renderName(Instruction instruction) {
throw new UnsupportedOperationException(); // TODO
}
private static String formatInstruction(Instruction instruction, int maxLength) {
String[] parts = instruction.toString().split("\n");
if (parts.length == 1) {
return " " + String.format("%1$-" + maxLength + "s", instruction);
}
StringBuilder sb = new StringBuilder();
for (int i = 0, partsLength = parts.length; i < partsLength; i++) {
String part = parts[i];
sb.append(" ").append(String.format("%1$-" + maxLength + "s", part));
if (i < partsLength - 1) sb.append("\n");
}
return sb.toString();
}
private static String formatInstructionList(Collection<Instruction> instructions) {
StringBuilder sb = new StringBuilder();
sb.append('[');
for (Iterator<Instruction> iterator = instructions.iterator(); iterator.hasNext(); ) {
Instruction instruction = iterator.next();
String instructionText = instruction.toString();
String[] parts = instructionText.split("\n");
if (parts.length > 1) {
StringBuilder instructionSb = new StringBuilder();
for (String part : parts) {
instructionSb.append(part.trim()).append(' ');
}
if (instructionSb.toString().length() > 30) {
sb.append(instructionSb.substring(0, 28)).append("..)");
}
else {
sb.append(instructionSb);
}
}
else {
sb.append(instruction);
}
if (iterator.hasNext()) {
sb.append(", ");
}
}
sb.append(']');
return sb.toString();
}
public void dumpInstructions(Pseudocode pseudocode, @NotNull StringBuilder out) {
List<Instruction> instructions = pseudocode.getInstructions();
List<Pseudocode.PseudocodeLabel> labels = pseudocode.getLabels();
List<Pseudocode> locals = new ArrayList<Pseudocode>();
int maxLength = 0;
int maxNextLength = 0;
for (Instruction instruction : instructions) {
String instuctionText = instruction.toString();
if (instuctionText.length() > maxLength) {
String[] parts = instuctionText.split("\n");
if (parts.length > 1) {
for (String part : parts) {
if (part.length() > maxLength) {
maxLength = part.length();
}
}
}
else {
maxLength = instuctionText.length();
}
}
String instructionListText = formatInstructionList(instruction.getNextInstructions());
if (instructionListText.length() > maxNextLength) {
maxNextLength = instructionListText.length();
}
}
for (int i = 0, instructionsSize = instructions.size(); i < instructionsSize; i++) {
Instruction instruction = instructions.get(i);
if (instruction instanceof FunctionLiteralValueInstruction) {
FunctionLiteralValueInstruction functionLiteralValueInstruction = (FunctionLiteralValueInstruction) instruction;
locals.add(functionLiteralValueInstruction.getBody());
}
for (Pseudocode.PseudocodeLabel label: labels) {
if (label.getTargetInstructionIndex() == i) {
out.append(label.getName()).append(":\n");
}
}
out.append(formatInstruction(instruction, maxLength)).
append(" NEXT:").append(String.format("%1$-" + maxNextLength + "s", formatInstructionList(instruction.getNextInstructions()))).
append(" PREV:").append(formatInstructionList(instruction.getPreviousInstructions())).append("\n");
}
for (Pseudocode local : locals) {
dumpInstructions(local, out);
}
}
public void dumpEdges(List<Instruction> instructions, final PrintStream out, final int[] count, final Map<Instruction, String> nodeToName) {
for (final Instruction fromInst : instructions) {
fromInst.accept(new InstructionVisitor() {
@Override
public void visitFunctionLiteralValue(FunctionLiteralValueInstruction instruction) {
int index = count[0];
// instruction.getBody().dumpSubgraph(out, "subgraph cluster_" + index, count, "color=blue;\nlabel = \"f" + index + "\";", nodeToName);
printEdge(out, nodeToName.get(instruction), nodeToName.get(instruction.getBody().getInstructions().get(0)), null);
visitInstructionWithNext(instruction);
}
@Override
public void visitUnconditionalJump(UnconditionalJumpInstruction instruction) {
// Nothing
}
@Override
public void visitJump(AbstractJumpInstruction instruction) {
printEdge(out, nodeToName.get(instruction), nodeToName.get(instruction.getResolvedTarget()), null);
}
@Override
public void visitNondeterministicJump(NondeterministicJumpInstruction instruction) {
visitJump(instruction);
printEdge(out, nodeToName.get(instruction), nodeToName.get(instruction.getNext()), null);
}
@Override
public void visitReturnValue(ReturnValueInstruction instruction) {
super.visitReturnValue(instruction);
}
@Override
public void visitReturnNoValue(ReturnNoValueInstruction instruction) {
super.visitReturnNoValue(instruction);
}
@Override
public void visitConditionalJump(ConditionalJumpInstruction instruction) {
String from = nodeToName.get(instruction);
printEdge(out, from, nodeToName.get(instruction.getNextOnFalse()), "no");
printEdge(out, from, nodeToName.get(instruction.getNextOnTrue()), "yes");
}
@Override
public void visitInstructionWithNext(InstructionWithNext instruction) {
printEdge(out, nodeToName.get(instruction), nodeToName.get(instruction.getNext()), null);
}
@Override
public void visitSubroutineExit(SubroutineExitInstruction instruction) {
// Nothing
}
@Override
public void visitInstruction(Instruction instruction) {
throw new UnsupportedOperationException(instruction.toString());
}
});
}
}
public void dumpNodes(List<Instruction> instructions, PrintStream out, int[] count, Map<Instruction, String> nodeToName) {
for (Instruction node : instructions) {
if (node instanceof UnconditionalJumpInstruction) {
continue;
}
String name = "n" + count[0]++;
nodeToName.put(node, name);
String text = node.toString();
int newline = text.indexOf("\n");
if (newline >= 0) {
text = text.substring(0, newline);
}
String shape = "box";
if (node instanceof ConditionalJumpInstruction) {
shape = "diamond";
}
else if (node instanceof NondeterministicJumpInstruction) {
shape = "Mdiamond";
}
else if (node instanceof UnsupportedElementInstruction) {
shape = "box, fillcolor=red, style=filled";
}
else if (node instanceof FunctionLiteralValueInstruction) {
shape = "Mcircle";
}
else if (node instanceof SubroutineEnterInstruction || node instanceof SubroutineExitInstruction) {
shape = "roundrect, style=rounded";
}
out.println(name + "[label=\"" + text + "\", shape=" + shape + "];");
}
}
private void printEdge(PrintStream out, String from, String to, String label) {
if (label != null) {
label = "[label=\"" + label + "\"]";
}
else {
label = "";
}
out.println(from + " -> " + to + label + ";");
}
private void dumpDot(String name, Collection<Pseudocode> pseudocodes) throws FileNotFoundException { private void dumpDot(String name, Collection<Pseudocode> pseudocodes) throws FileNotFoundException {
String graphFileName = getTestDataPath() + "/" + getTestFilePath().replace(".jet", ".dot"); String graphFileName = getTestDataPath() + "/" + getTestFilePath().replace(".jet", ".dot");
File target = new File(graphFileName); File target = new File(graphFileName);
@@ -139,7 +355,7 @@ public class JetControlFlowTest extends JetTestCaseBase {
int[] count = new int[1]; int[] count = new int[1];
Map<Instruction, String> nodeToName = new HashMap<Instruction, String>(); Map<Instruction, String> nodeToName = new HashMap<Instruction, String>();
for (Pseudocode pseudocode : pseudocodes) { for (Pseudocode pseudocode : pseudocodes) {
pseudocode.dumpNodes(out, count, nodeToName); dumpNodes(pseudocode.getInstructions(), out, count, nodeToName);
} }
int i = 0; int i = 0;
for (Pseudocode pseudocode : pseudocodes) { for (Pseudocode pseudocode : pseudocodes) {
@@ -155,7 +371,7 @@ public class JetControlFlowTest extends JetTestCaseBase {
out.println("subgraph cluster_" + i + " {\n" + out.println("subgraph cluster_" + i + " {\n" +
"label=\"" + label + "\";\n" + "label=\"" + label + "\";\n" +
"color=blue;\n"); "color=blue;\n");
pseudocode.dumpEdges(out, count, nodeToName); dumpEdges(pseudocode.getInstructions(), out, count, nodeToName);
out.println("}"); out.println("}");
i++; i++;
} }