Spill stack for inline functions only if it's required

Stack should be spilled before inline function call and restored after
call only if one of the following conditions is met:
- inline function is a suspend function
- inline function has try-catch blocks
- inline function has loops (backward jumps)

Note that there're quite some "simple" inline functions in Kotlin stdlib
besides run/let/with/apply. For example, many string operations are
implemented as inline wrappers over Java method calls.
This commit is contained in:
Dmitry Petrov
2017-10-06 14:26:54 +03:00
parent 1845a87813
commit e71090ae4c
6 changed files with 92 additions and 20 deletions
@@ -9,6 +9,6 @@ fun foo() : Int {
return foobar(1, bar(2), 3)
}
// 3 ISTORE
// 7 ILOAD
// 1 ISTORE
// 5 ILOAD
// 0 InlineMarker