[JVM_IR] Use iinc for incrementing Int variables.

Fix line number generation for assignments where the right-hand
side of the assignment is not on the same line.

Fix line number generation for intrinsics functions where the
function is not on the same line as the last argument.

Be careful to not break stepping behavior with the iinc
optimizations.
This commit is contained in:
Mads Ager
2020-03-26 15:03:49 +01:00
committed by Dmitry Petrov
parent 58685be4e2
commit 5570a5fe74
13 changed files with 205 additions and 19 deletions
@@ -0,0 +1,41 @@
fun main(args: Array<String>) {
var i = 10
// -- 4 of these fit in iinc instructions
i += 1
i += 127
i += 128
i += -1
i += -128
i += -129
// -- 4 of these fit in iinc instructions
i -= 1
i -= 128
i -= 129
i -= -1
i -= -127
i -= -128
// -- 4 of these fit in iinc instructions
i = i + 1
i = i + 127
i = i + 128
i = i + -1
i = i + -128
i = i + -129
// -- 4 of these fit in iinc instructions
i = i - 1
i = i - 128
i = i - 129
i = i - -1
i = i - -127
i = i - -128
}
// JVM_IR_TEMPLATES
// 16 IINC
// JVM_TEMPLATES
// 0 IINC
@@ -1,6 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// KT-36641 TODO Generate IINC instruction for prefix increment in JVM_IR
fun main(args: Array<String>) {
var i = 10
++i