Jump on 'continue' to condition entry points for all loops
This commit is contained in:
@@ -461,10 +461,10 @@ L0:
|
||||
call(1..a, rangeTo|<v1>, <v2>) -> <v3>
|
||||
v(i)
|
||||
L3 ['for' loop condition entry point]:
|
||||
jmp?(L2 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>]
|
||||
jmp?(L2 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>] PREV:[v(i), jmp(L3 ['for' loop condition entry point])]
|
||||
L4 [loop entry point]:
|
||||
L5 [body entry point]:
|
||||
magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4> PREV:[jmp?(L2 ['for' loop exit point]), jmp(L4 [loop entry point]), jmp?(L4 [loop entry point])]
|
||||
magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4> PREV:[jmp?(L2 ['for' loop exit point]), jmp?(L4 [loop entry point])]
|
||||
w(i|<v4>)
|
||||
mark(for (i in 1..a) { try { 1 if (2 > 3) { continue @l } } finally { 2 } })
|
||||
4 mark({ try { 1 if (2 > 3) { continue @l } } finally { 2 } })
|
||||
@@ -483,7 +483,7 @@ L8 [start finally]:
|
||||
7 mark({ 2 })
|
||||
r(2) -> <v9>
|
||||
L9 [finish finally]:
|
||||
6 jmp(L4 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>]
|
||||
6 jmp(L3 ['for' loop condition entry point]) NEXT:[jmp?(L2 ['for' loop exit point])]
|
||||
- 5 jmp(L10 ['if' expression result]) NEXT:[merge(if (2 > 3) { continue @l }|!<v10>) -> <v11>] PREV:[]
|
||||
L7 [else branch]:
|
||||
read (Unit) PREV:[jf(L7 [else branch]|<v8>)]
|
||||
@@ -539,10 +539,10 @@ L0:
|
||||
call(1..a, rangeTo|<v1>, <v2>) -> <v3>
|
||||
v(i)
|
||||
L4 ['for' loop condition entry point]:
|
||||
jmp?(L3 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>]
|
||||
jmp?(L3 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>] PREV:[v(i), jmp(L4 ['for' loop condition entry point])]
|
||||
L5 [loop entry point]:
|
||||
L6 [body entry point]:
|
||||
magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4> PREV:[jmp?(L3 ['for' loop exit point]), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])]
|
||||
magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4> PREV:[jmp?(L3 ['for' loop exit point]), jmp?(L5 [loop entry point])]
|
||||
w(i|<v4>)
|
||||
mark(for (i in 1..a) { 1 if (2 > 3) { continue @l } })
|
||||
5 mark({ 1 if (2 > 3) { continue @l } })
|
||||
@@ -554,7 +554,7 @@ L6 [body entry point]:
|
||||
call(2 > 3, compareTo|<v6>, <v7>) -> <v8>
|
||||
jf(L7 [else branch]|<v8>) NEXT:[read (Unit), mark({ continue @l })]
|
||||
6 mark({ continue @l })
|
||||
jmp(L5 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>]
|
||||
jmp(L4 ['for' loop condition entry point]) NEXT:[jmp?(L3 ['for' loop exit point])]
|
||||
- 5 jmp(L8 ['if' expression result]) NEXT:[merge(if (2 > 3) { continue @l }|!<v9>) -> <v10>] PREV:[]
|
||||
L7 [else branch]:
|
||||
read (Unit) PREV:[jf(L7 [else branch]|<v8>)]
|
||||
@@ -612,10 +612,10 @@ L0:
|
||||
call(1..a, rangeTo|<v1>, <v2>) -> <v3>
|
||||
v(i)
|
||||
L4 ['for' loop condition entry point]:
|
||||
jmp?(L3 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>]
|
||||
jmp?(L3 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>] PREV:[v(i), jmp(L4 ['for' loop condition entry point])]
|
||||
L5 [loop entry point]:
|
||||
L6 [body entry point]:
|
||||
magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4> PREV:[jmp?(L3 ['for' loop exit point]), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])]
|
||||
magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4> PREV:[jmp?(L3 ['for' loop exit point]), jmp?(L5 [loop entry point])]
|
||||
w(i|<v4>)
|
||||
mark(for (i in 1..a) { 1 if (2 > 3) { continue @l } })
|
||||
5 mark({ 1 if (2 > 3) { continue @l } })
|
||||
@@ -627,7 +627,7 @@ L6 [body entry point]:
|
||||
call(2 > 3, compareTo|<v6>, <v7>) -> <v8>
|
||||
jf(L7 [else branch]|<v8>) NEXT:[read (Unit), mark({ continue @l })]
|
||||
6 mark({ continue @l })
|
||||
jmp(L5 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>]
|
||||
jmp(L4 ['for' loop condition entry point]) NEXT:[jmp?(L3 ['for' loop exit point])]
|
||||
- 5 jmp(L8 ['if' expression result]) NEXT:[merge(if (2 > 3) { continue @l }|!<v9>) -> <v10>] PREV:[]
|
||||
L7 [else branch]:
|
||||
read (Unit) PREV:[jf(L7 [else branch]|<v8>)]
|
||||
|
||||
@@ -142,7 +142,7 @@ L0:
|
||||
2 mark({ while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } } })
|
||||
L2 [loop entry point]:
|
||||
L5 [condition entry point]:
|
||||
mark(cond()) PREV:[mark({ while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } } }), jmp(L2 [loop entry point]), jmp(L2 [loop entry point])]
|
||||
mark(cond()) PREV:[mark({ while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } } }), jmp(L5 [condition entry point]), jmp(L5 [condition entry point])]
|
||||
call(cond(), cond) -> <v0>
|
||||
mark(while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } })
|
||||
jf(L3 [loop exit point]|<v0>) NEXT:[read (Unit), mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } })]
|
||||
@@ -180,11 +180,11 @@ L11 [start finally]:
|
||||
mark(if (cond()) return else continue)
|
||||
mark(cond())
|
||||
call(cond(), cond) -> <v6>
|
||||
jf(L12 [else branch]|<v6>) NEXT:[jmp(L2 [loop entry point]), ret L1]
|
||||
jf(L12 [else branch]|<v6>) NEXT:[jmp(L5 [condition entry point]), ret L1]
|
||||
ret L1 NEXT:[<END>]
|
||||
- jmp(L13 ['if' expression result]) NEXT:[merge(if (cond()) return else continue|!<v7>, !<v8>) -> <v9>] PREV:[]
|
||||
L12 [else branch]:
|
||||
jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(L12 [else branch]|<v6>)]
|
||||
jmp(L5 [condition entry point]) NEXT:[mark(cond())] PREV:[jf(L12 [else branch]|<v6>)]
|
||||
L13 ['if' expression result]:
|
||||
- merge(if (cond()) return else continue|!<v7>, !<v8>) -> <v9> PREV:[]
|
||||
L14 [finish finally]:
|
||||
@@ -194,10 +194,10 @@ L10 [skipFinallyToErrorBlock]:
|
||||
mark(if (cond()) return else continue)
|
||||
mark(cond())
|
||||
call(cond(), cond) -> <v6>
|
||||
jf(copy L12 [else branch]|<v6>) NEXT:[jmp(L2 [loop entry point]), ret L1]
|
||||
jf(copy L12 [else branch]|<v6>) NEXT:[jmp(L5 [condition entry point]), ret L1]
|
||||
ret L1 NEXT:[<END>]
|
||||
- jmp(copy L13 ['if' expression result]) NEXT:[merge(if (cond()) return else continue|!<v7>, !<v8>) -> <v9>] PREV:[]
|
||||
jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(copy L12 [else branch]|<v6>)]
|
||||
jmp(L5 [condition entry point]) NEXT:[mark(cond())] PREV:[jf(copy L12 [else branch]|<v6>)]
|
||||
- merge(if (cond()) return else continue|!<v7>, !<v8>) -> <v9> PREV:[]
|
||||
- 3 merge(try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue }|<v1>, <v3>, <v5>) -> <v10> PREV:[]
|
||||
- 2 jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[]
|
||||
@@ -347,4 +347,4 @@ error:
|
||||
<ERROR> PREV:[jmp(error)]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
=====================
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
== test ==
|
||||
fun test(b: Boolean) {
|
||||
do {
|
||||
if (b) break;
|
||||
continue;
|
||||
} while (true);
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
v(b: Boolean)
|
||||
magic[FAKE_INITIALIZER](b: Boolean) -> <v0>
|
||||
w(b|<v0>)
|
||||
2 mark({ do { if (b) break; continue; } while (true); })
|
||||
3 mark(do { if (b) break; continue; } while (true))
|
||||
L2 [loop entry point]:
|
||||
L4 [body entry point]:
|
||||
mark({ if (b) break; continue; }) PREV:[mark(do { if (b) break; continue; } while (true)), jt(L2 [loop entry point]|<v5>)]
|
||||
mark(if (b) break)
|
||||
r(b) -> <v1>
|
||||
jf(L6 [else branch]|<v1>) NEXT:[read (Unit), jmp(L3 [loop exit point])]
|
||||
jmp(L3 [loop exit point]) NEXT:[read (Unit)]
|
||||
- jmp(L7 ['if' expression result]) NEXT:[merge(if (b) break|!<v2>) -> <v3>] PREV:[]
|
||||
L6 [else branch]:
|
||||
read (Unit) PREV:[jf(L6 [else branch]|<v1>)]
|
||||
L7 ['if' expression result]:
|
||||
merge(if (b) break|!<v2>) -> <v3>
|
||||
jmp(L5 [condition entry point])
|
||||
L5 [condition entry point]:
|
||||
r(true) -> <v5>
|
||||
jt(L2 [loop entry point]|<v5>) NEXT:[read (Unit), mark({ if (b) break; continue; })]
|
||||
L3 [loop exit point]:
|
||||
read (Unit) PREV:[jmp(L3 [loop exit point]), jt(L2 [loop entry point]|<v5>)]
|
||||
L1:
|
||||
1 <END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test(b: Boolean) {
|
||||
do {
|
||||
if (b) break;
|
||||
continue;
|
||||
} while (true);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
== test ==
|
||||
fun test(b: Boolean) {
|
||||
do {
|
||||
if (b) break;
|
||||
continue;
|
||||
} while (true);
|
||||
}
|
||||
---------------------
|
||||
<v0>: Boolean NEW: magic[FAKE_INITIALIZER](b: Boolean) -> <v0>
|
||||
b <v1>: Boolean NEW: r(b) -> <v1>
|
||||
break !<v2>: *
|
||||
if (b) break <v3>: * NEW: merge(if (b) break|!<v2>) -> <v3>
|
||||
continue !<v4>: *
|
||||
{ if (b) break; continue; } !<v4>: * COPY
|
||||
true <v5>: Boolean NEW: r(true) -> <v5>
|
||||
do { if (b) break; continue; } while (true) !<v6>: *
|
||||
{ do { if (b) break; continue; } while (true); } !<v6>: * COPY
|
||||
=====================
|
||||
@@ -0,0 +1,47 @@
|
||||
== test ==
|
||||
fun test(b: Boolean) {
|
||||
for (i in 1..10) {
|
||||
if (b) break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
v(b: Boolean)
|
||||
magic[FAKE_INITIALIZER](b: Boolean) -> <v0>
|
||||
w(b|<v0>)
|
||||
2 mark({ for (i in 1..10) { if (b) break; continue; } })
|
||||
3 r(1) -> <v1>
|
||||
r(10) -> <v2>
|
||||
mark(1..10)
|
||||
call(1..10, rangeTo|<v1>, <v2>) -> <v3>
|
||||
v(i)
|
||||
L3 ['for' loop condition entry point]:
|
||||
jmp?(L2 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..10|<v3>) -> <v4>] PREV:[v(i), jmp(L3 ['for' loop condition entry point])]
|
||||
L4 [loop entry point]:
|
||||
L5 [body entry point]:
|
||||
magic[LOOP_RANGE_ITERATION](1..10|<v3>) -> <v4>
|
||||
w(i|<v4>)
|
||||
mark(for (i in 1..10) { if (b) break; continue; })
|
||||
4 mark({ if (b) break; continue; })
|
||||
mark(if (b) break)
|
||||
r(b) -> <v5>
|
||||
jf(L6 [else branch]|<v5>) NEXT:[read (Unit), jmp(L2 ['for' loop exit point])]
|
||||
jmp(L2 ['for' loop exit point]) NEXT:[read (Unit)]
|
||||
- jmp(L7 ['if' expression result]) NEXT:[merge(if (b) break|!<v6>) -> <v7>] PREV:[]
|
||||
L6 [else branch]:
|
||||
read (Unit) PREV:[jf(L6 [else branch]|<v5>)]
|
||||
L7 ['if' expression result]:
|
||||
merge(if (b) break|!<v6>) -> <v7>
|
||||
jmp(L3 ['for' loop condition entry point]) NEXT:[jmp?(L2 ['for' loop exit point])]
|
||||
- 3 jmp?(L4 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..10|<v3>) -> <v4>, read (Unit)] PREV:[]
|
||||
L2 ['for' loop exit point]:
|
||||
read (Unit) PREV:[jmp?(L2 ['for' loop exit point]), jmp(L2 ['for' loop exit point])]
|
||||
L1:
|
||||
1 <END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test(b: Boolean) {
|
||||
for (i in 1..10) {
|
||||
if (b) break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
== test ==
|
||||
fun test(b: Boolean) {
|
||||
for (i in 1..10) {
|
||||
if (b) break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
<v0>: Boolean NEW: magic[FAKE_INITIALIZER](b: Boolean) -> <v0>
|
||||
<v4>: Int NEW: magic[LOOP_RANGE_ITERATION](1..10|<v3>) -> <v4>
|
||||
1 <v1>: Int NEW: r(1) -> <v1>
|
||||
10 <v2>: Int NEW: r(10) -> <v2>
|
||||
1..10 <v3>: {<: Iterable<Int>} NEW: call(1..10, rangeTo|<v1>, <v2>) -> <v3>
|
||||
b <v5>: Boolean NEW: r(b) -> <v5>
|
||||
break !<v6>: *
|
||||
if (b) break <v7>: * NEW: merge(if (b) break|!<v6>) -> <v7>
|
||||
continue !<v8>: *
|
||||
{ if (b) break; continue; } !<v8>: * COPY
|
||||
for (i in 1..10) { if (b) break; continue; } !<v9>: *
|
||||
{ for (i in 1..10) { if (b) break; continue; } } !<v9>: * COPY
|
||||
=====================
|
||||
@@ -0,0 +1,41 @@
|
||||
== test ==
|
||||
fun test(b: Boolean) {
|
||||
while (true) {
|
||||
if (b) break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
v(b: Boolean)
|
||||
magic[FAKE_INITIALIZER](b: Boolean) -> <v0>
|
||||
w(b|<v0>)
|
||||
2 mark({ while (true) { if (b) break; continue; } })
|
||||
L2 [loop entry point]:
|
||||
L5 [condition entry point]:
|
||||
r(true) -> <v1> PREV:[mark({ while (true) { if (b) break; continue; } }), jmp(L5 [condition entry point])]
|
||||
mark(while (true) { if (b) break; continue; })
|
||||
magic[VALUE_CONSUMER](true|<v1>) -> <v2>
|
||||
L4 [body entry point]:
|
||||
3 mark({ if (b) break; continue; })
|
||||
mark(if (b) break)
|
||||
r(b) -> <v3>
|
||||
jf(L6 [else branch]|<v3>) NEXT:[read (Unit), jmp(L3 [loop exit point])]
|
||||
jmp(L3 [loop exit point]) NEXT:[read (Unit)]
|
||||
- jmp(L7 ['if' expression result]) NEXT:[merge(if (b) break|!<v4>) -> <v5>] PREV:[]
|
||||
L6 [else branch]:
|
||||
read (Unit) PREV:[jf(L6 [else branch]|<v3>)]
|
||||
L7 ['if' expression result]:
|
||||
merge(if (b) break|!<v4>) -> <v5>
|
||||
jmp(L5 [condition entry point]) NEXT:[r(true) -> <v1>]
|
||||
- 2 jmp(L2 [loop entry point]) NEXT:[r(true) -> <v1>] PREV:[]
|
||||
L3 [loop exit point]:
|
||||
read (Unit) PREV:[jmp(L3 [loop exit point])]
|
||||
L1:
|
||||
1 <END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test(b: Boolean) {
|
||||
while (true) {
|
||||
if (b) break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
== test ==
|
||||
fun test(b: Boolean) {
|
||||
while (true) {
|
||||
if (b) break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
<v0>: Boolean NEW: magic[FAKE_INITIALIZER](b: Boolean) -> <v0>
|
||||
<v2>: * NEW: magic[VALUE_CONSUMER](true|<v1>) -> <v2>
|
||||
true <v1>: Boolean NEW: r(true) -> <v1>
|
||||
b <v3>: Boolean NEW: r(b) -> <v3>
|
||||
break !<v4>: *
|
||||
if (b) break <v5>: * NEW: merge(if (b) break|!<v4>) -> <v5>
|
||||
continue !<v6>: *
|
||||
{ if (b) break; continue; } !<v6>: * COPY
|
||||
while (true) { if (b) break; continue; } !<v7>: *
|
||||
{ while (true) { if (b) break; continue; } } !<v7>: * COPY
|
||||
=====================
|
||||
Reference in New Issue
Block a user