`println` is an inline-function which calls `Syste...
# compiler
m
println
is an inline-function which calls
System.out.println
internally. That's how Kotlin function inlining look like.
m
Wait why does it create useless boolean to inline?
m
Hmm, I can't reproduce this.
println("str")
does not create an extra var for me.
i
I've tested and it seems to introduc into the 1.3.30
Capture d’écran 2019-05-15 à 16.03.04.png
u
@Ilmir Usmanov [JB]
i
These booleans are used by debugger to determine whether we are inside inline function/lambda or not. Unfortunately,
println
is
@InlineOnly
, so, you would not see the names of the variables (
@InlineOnly
functions do not have local variables table and linenumber info, although this is going to change @yan). However, if you create your own inline function and then use it, you will variables like
$i$f$<functionName>
and
$i$a$<functionName>
in LVT (to see the LVT, pass
-l
flag to javap). The value of these variables is not important (always false, although it can be changed in the future), but range of these variables is what the debugger is looking at. If we are inside
$i$f...
range, we are inside inline function, if we are inside
$i$a...
range, we are inside inline lambda.
👍 6
i
thanks for the answer, it's help me to learn more about the bytecode
m
Does this also happen on release builds?
👌 1
I guess there is no release/debug mode in kotlin at all though
f
Really? So all compiler optimizations are applied on debug builds?
i
Yes, we optimize the cases where hotspot could not optimize it for us. For example, tail-call optimization for suspend functions.