removed duplication of pseudocode in tests
for local functions
This commit is contained in:
@@ -70,16 +70,6 @@ error:
|
|||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d({1})]
|
<SINK> PREV:[<ERROR>, <END>, d({1})]
|
||||||
L3:
|
|
||||||
<START>
|
|
||||||
mark(1)
|
|
||||||
r(1)
|
|
||||||
L4:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== anonymous_0 ==
|
== anonymous_0 ==
|
||||||
{1}
|
{1}
|
||||||
|
|||||||
@@ -124,27 +124,6 @@ error:
|
|||||||
<ERROR> PREV:[jmp(error)]
|
<ERROR> PREV:[jmp(error)]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d({ () -> if (2 > 3) { return@ } })]
|
<SINK> PREV:[<ERROR>, <END>, d({ () -> if (2 > 3) { return@ } })]
|
||||||
L4:
|
|
||||||
<START>
|
|
||||||
mark(if (2 > 3) { return@ })
|
|
||||||
mark(if (2 > 3) { return@ })
|
|
||||||
mark(2 > 3)
|
|
||||||
r(2)
|
|
||||||
r(3)
|
|
||||||
call(>, compareTo)
|
|
||||||
jf(L6) NEXT:[read (Unit), mark({ return@ })]
|
|
||||||
mark({ return@ })
|
|
||||||
ret L5 NEXT:[<END>]
|
|
||||||
- jmp(L7) NEXT:[<END>] PREV:[]
|
|
||||||
L6:
|
|
||||||
read (Unit) PREV:[jf(L6)]
|
|
||||||
L5:
|
|
||||||
L7:
|
|
||||||
<END> NEXT:[<SINK>] PREV:[ret L5, read (Unit)]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== anonymous_0 ==
|
== anonymous_0 ==
|
||||||
{ () ->
|
{ () ->
|
||||||
@@ -204,43 +183,6 @@ error:
|
|||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } })]
|
<SINK> PREV:[<ERROR>, <END>, d({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } })]
|
||||||
L3:
|
|
||||||
<START>
|
|
||||||
mark(try { 1 if (2 > 3) { return@ } } finally { 2 })
|
|
||||||
mark(try { 1 if (2 > 3) { return@ } } finally { 2 })
|
|
||||||
jmp?(L5 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ 1 if (2 > 3) { return@ } })]
|
|
||||||
mark({ 1 if (2 > 3) { return@ } })
|
|
||||||
r(1)
|
|
||||||
mark(if (2 > 3) { return@ })
|
|
||||||
mark(2 > 3)
|
|
||||||
r(2)
|
|
||||||
r(3)
|
|
||||||
call(>, compareTo)
|
|
||||||
jf(L6) NEXT:[read (Unit), mark({ return@ })]
|
|
||||||
mark({ return@ })
|
|
||||||
L7 [start finally]:
|
|
||||||
mark({ 2 })
|
|
||||||
r(2)
|
|
||||||
L8 [finish finally]:
|
|
||||||
ret L4 NEXT:[<END>]
|
|
||||||
- jmp(L9) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] PREV:[]
|
|
||||||
L6:
|
|
||||||
read (Unit) PREV:[jf(L6)]
|
|
||||||
L9:
|
|
||||||
jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })]
|
|
||||||
L5 [onExceptionToFinallyBlock]:
|
|
||||||
mark({ 2 }) PREV:[jmp?(L5 [onExceptionToFinallyBlock])]
|
|
||||||
r(2)
|
|
||||||
jmp(error) NEXT:[<ERROR>]
|
|
||||||
L10 [skipFinallyToErrorBlock]:
|
|
||||||
mark({ 2 }) PREV:[jmp(L10 [skipFinallyToErrorBlock])]
|
|
||||||
r(2)
|
|
||||||
L4:
|
|
||||||
<END> NEXT:[<SINK>] PREV:[ret L4, r(2)]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[jmp(error)]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== anonymous_1 ==
|
== anonymous_1 ==
|
||||||
{ () ->
|
{ () ->
|
||||||
|
|||||||
-10
@@ -17,16 +17,6 @@ error:
|
|||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d({})]
|
<SINK> PREV:[<ERROR>, <END>, d({})]
|
||||||
L3:
|
|
||||||
<START>
|
|
||||||
mark()
|
|
||||||
read (Unit)
|
|
||||||
L4:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== anonymous_0 ==
|
== anonymous_0 ==
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -149,17 +149,6 @@ error:
|
|||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d(fun inner_bar() { y = 10 })]
|
<SINK> PREV:[<ERROR>, <END>, d(fun inner_bar() { y = 10 })]
|
||||||
L3:
|
|
||||||
<START>
|
|
||||||
mark({ y = 10 })
|
|
||||||
r(10)
|
|
||||||
w(y)
|
|
||||||
L4:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== inner_bar ==
|
== inner_bar ==
|
||||||
fun inner_bar() {
|
fun inner_bar() {
|
||||||
@@ -213,17 +202,6 @@ error:
|
|||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d(fun ggg() { y = 10 })]
|
<SINK> PREV:[<ERROR>, <END>, d(fun ggg() { y = 10 })]
|
||||||
L3:
|
|
||||||
<START>
|
|
||||||
mark({ y = 10 })
|
|
||||||
r(10)
|
|
||||||
w(y)
|
|
||||||
L4:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== ggg ==
|
== ggg ==
|
||||||
fun ggg() {
|
fun ggg() {
|
||||||
@@ -283,28 +261,6 @@ error:
|
|||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d(fun foo() { x = 3 }), d(fun bar() { x = 4 })]
|
<SINK> PREV:[<ERROR>, <END>, d(fun foo() { x = 3 }), d(fun bar() { x = 4 })]
|
||||||
L3:
|
|
||||||
<START>
|
|
||||||
mark({ x = 3 })
|
|
||||||
r(3)
|
|
||||||
w(x)
|
|
||||||
L4:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
L6:
|
|
||||||
<START>
|
|
||||||
mark({ x = 4 })
|
|
||||||
r(4)
|
|
||||||
w(x)
|
|
||||||
L7:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== foo ==
|
== foo ==
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
@@ -23,35 +23,6 @@ error:
|
|||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d(fun f() { val x = "" fun loc() { val x3 = "" } })]
|
<SINK> PREV:[<ERROR>, <END>, d(fun f() { val x = "" fun loc() { val x3 = "" } })]
|
||||||
L3:
|
|
||||||
<START>
|
|
||||||
mark({ val x = "" fun loc() { val x3 = "" } })
|
|
||||||
v(val x = "")
|
|
||||||
mark("")
|
|
||||||
r("")
|
|
||||||
w(x)
|
|
||||||
jmp?(L5) NEXT:[<END>, d(fun loc() { val x3 = "" })]
|
|
||||||
d(fun loc() { val x3 = "" }) NEXT:[<SINK>]
|
|
||||||
L4:
|
|
||||||
L5:
|
|
||||||
<END> NEXT:[<SINK>] PREV:[jmp?(L5)]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>, d(fun loc() { val x3 = "" })]
|
|
||||||
L6:
|
|
||||||
<START>
|
|
||||||
mark({ val x3 = "" })
|
|
||||||
v(val x3 = "")
|
|
||||||
mark("")
|
|
||||||
r("")
|
|
||||||
w(x3)
|
|
||||||
L7:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== f ==
|
== f ==
|
||||||
fun f() {
|
fun f() {
|
||||||
@@ -78,19 +49,6 @@ error:
|
|||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d(fun loc() { val x3 = "" })]
|
<SINK> PREV:[<ERROR>, <END>, d(fun loc() { val x3 = "" })]
|
||||||
L6:
|
|
||||||
<START>
|
|
||||||
mark({ val x3 = "" })
|
|
||||||
v(val x3 = "")
|
|
||||||
mark("")
|
|
||||||
r("")
|
|
||||||
w(x3)
|
|
||||||
L7:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== loc ==
|
== loc ==
|
||||||
fun loc() {
|
fun loc() {
|
||||||
|
|||||||
@@ -22,18 +22,6 @@ error:
|
|||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d(get() { val b: Int return b })]
|
<SINK> PREV:[<ERROR>, <END>, d(get() { val b: Int return b })]
|
||||||
L3:
|
|
||||||
<START>
|
|
||||||
mark({ val b: Int return b })
|
|
||||||
v(val b: Int)
|
|
||||||
r(b)
|
|
||||||
ret(*) L4
|
|
||||||
L4:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
=====================
|
||||||
== get_a ==
|
== get_a ==
|
||||||
get() {
|
get() {
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ public abstract class AbstractControlFlowTest extends KotlinTestWithEnvironment
|
|||||||
List<Instruction> instructions = pseudocode.getAllInstructions();
|
List<Instruction> instructions = pseudocode.getAllInstructions();
|
||||||
Set<Instruction> remainedAfterPostProcessInstructions = Sets.newHashSet(pseudocode.getInstructions());
|
Set<Instruction> remainedAfterPostProcessInstructions = Sets.newHashSet(pseudocode.getInstructions());
|
||||||
List<PseudocodeImpl.PseudocodeLabel> labels = pseudocode.getLabels();
|
List<PseudocodeImpl.PseudocodeLabel> labels = pseudocode.getLabels();
|
||||||
List<PseudocodeImpl> locals = new ArrayList<PseudocodeImpl>();
|
|
||||||
int maxLength = 0;
|
int maxLength = 0;
|
||||||
int maxNextLength = 0;
|
int maxNextLength = 0;
|
||||||
for (Instruction instruction : instructions) {
|
for (Instruction instruction : instructions) {
|
||||||
@@ -238,10 +237,6 @@ public abstract class AbstractControlFlowTest extends KotlinTestWithEnvironment
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < instructions.size(); i++) {
|
for (int i = 0; i < instructions.size(); i++) {
|
||||||
Instruction instruction = instructions.get(i);
|
Instruction instruction = instructions.get(i);
|
||||||
if (instruction instanceof LocalFunctionDeclarationInstruction) {
|
|
||||||
LocalFunctionDeclarationInstruction localFunctionDeclarationInstruction = (LocalFunctionDeclarationInstruction) instruction;
|
|
||||||
locals.add((PseudocodeImpl) localFunctionDeclarationInstruction.getBody());
|
|
||||||
}
|
|
||||||
for (PseudocodeImpl.PseudocodeLabel label: labels) {
|
for (PseudocodeImpl.PseudocodeLabel label: labels) {
|
||||||
if (label.getTargetInstructionIndex() == i) {
|
if (label.getTargetInstructionIndex() == i) {
|
||||||
out.append(label.getName()).append(":\n");
|
out.append(label.getName()).append(":\n");
|
||||||
@@ -267,9 +262,6 @@ public abstract class AbstractControlFlowTest extends KotlinTestWithEnvironment
|
|||||||
out.append(StringUtil.trimTrailing(line.toString()));
|
out.append(StringUtil.trimTrailing(line.toString()));
|
||||||
out.append("\n");
|
out.append("\n");
|
||||||
}
|
}
|
||||||
for (PseudocodeImpl local : locals) {
|
|
||||||
dumpInstructions(local, out);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean sameContents(@Nullable Instruction natural, Collection<Instruction> actual) {
|
private static boolean sameContents(@Nullable Instruction natural, Collection<Instruction> actual) {
|
||||||
|
|||||||
Reference in New Issue
Block a user