It is actually more meaningful than just "coercion to unit elision":
it removes instructions without side effects with results that are
unused (popped from the stack).
- Turn some const conditions into non-const conditions
- Make sure inlined const values are used where required
(otherwise they are eliminated by POP backward propagation)
Using basic constant propagation (only integer constants, no arithmetic
calculations), rewrite conditional jump instructions with constant
arguments.
This covers problem description in KT-17007.
Note that it also works transparently with inline functions.
Partial evaluation is required to cover more "advanced" cases.
As a side effect, this also covers KT-3098:
rewrite IF_ICMP<cmp_op>(x, 0) to IF<cmp0_op>(x).
In code like 'a?.b == 42', we can immediately generate equality
comparison result when receiver is null (false for '==', true for '!='),
since the primitive value is definitely non-null.
Otherwise unnecessary boxing/unboxing is generated to handle possibly
null result of 'a?.b'.
- suspendCoroutine is not public anymore, since all of the
inline functions are generated as private
- `label` is public to allow update it from the named functions
The problem was that the resume call (from doResume) for open members
was based on common INVOKEVIRTUAL to the original function
that lead to the invocation of the override when it was expected
to be the overridden (after super-call being suspended)
The solution is to generate method bodies for open members into
the special $suspendImpl synthetic function that may be called
from the doResume implementation
#KT-17587 Fixed
Do not mix references to label nodes and common ASM labels
as it may lead to different LabelNode instance (not defaultLabel)
being inserted into insns list
It's been working before because there was no `resetLabels` call
on insnList, and label/label nodes were bound to each other
Appears that plugin classpath can contain not only `File.separatorChar`, but also '/' on Windows. Without the proper handling of this case, Gradle importer may import the plugin JAR made for Gradle with shaded 'com.intellij' and cause an exception during the JPS build.
- use nullable type "T?" instead of HandleResult consisting of the found
value and the "should continue" flag
- inline all local functions because they don't add any value now