JVM_IR more compact safe call chains (almost as old BE)

This commit is contained in:
Dmitry Petrov
2021-09-23 16:51:57 +03:00
committed by teamcityserver
parent f4eaf611c8
commit 0a67ab54fe
19 changed files with 699 additions and 123 deletions
@@ -9,13 +9,13 @@
fun box(): String {
for (i in (4 .. 1).reversed()) {
throw AssertionError("Loop should not be executed")
throw AssertionError("Loop over empty Int range should not be executed")
}
for (i in (4L .. 1L).reversed()) {
throw AssertionError("Loop should not be executed")
throw AssertionError("Loop over empty Long range should not be executed")
}
for (i in ('D' .. 'A').reversed()) {
throw AssertionError("Loop should not be executed")
throw AssertionError("Loop over empty Char range should not be executed")
}
return "OK"
}
@@ -29,8 +29,14 @@ fun box(): String {
// 0 getStep
// JVM_IR_TEMPLATES
// Int- and Char-based loops are completely elimiated
// 0 ILOAD
// 2 ISTORE
// 0 ISTORE
// 0 IADD
// 0 ISUB
// 0 IINC
// 0 IINC
// 3 LLOAD
// 2 LSTORE
// 1 LADD
// 0 LSUB
// 4 LDC
@@ -33,8 +33,8 @@ fun f(a: UInt): Int {
// JVM_IR_TEMPLATES
// 6 ILOAD
// 4 ISTORE
// 5 ILOAD
// 3 ISTORE
// 0 IADD
// 0 ISUB
// 2 IINC