mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
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.
15 lines
190 B
Kotlin
Vendored
15 lines
190 B
Kotlin
Vendored
|
|
inline fun bar(x: Int) : Int {
|
|
return x
|
|
}
|
|
|
|
fun foobar(x: Int, y: Int, z: Int) = x + y + z
|
|
|
|
fun foo() : Int {
|
|
return foobar(1, bar(2), 3)
|
|
}
|
|
|
|
// 1 ISTORE
|
|
// 5 ILOAD
|
|
// 0 InlineMarker
|