Commit Graph

7 Commits

Author SHA1 Message Date
Dmitry Petrov
d5e02f069a Fast version for POP backward propagation (without SourceInterpreter) 2017-06-27 14:28:42 +03:00
Dmitry Petrov
84e54124a2 More aggressive DCE should honor debugger invariants
- A LINENUMEBER node is "dead" if the corresponding instruction interval
 contains at least one "dead" bytecode instruction
 and no live bytecode instructions

- Observable local variable lifetimes should be taken into account
 when determining if a NOP is required for debugger.
2017-05-16 17:28:43 +03:00
Dmitry Petrov
4dd100122b Explicitly remove NOPs inserted for bytecode analysis in post-conditional loops.
Remove redundant NOPs during bytecode optimization.

NOP instruction is required iff one of the following is true:
(a) it is a first bytecode instruction in a try-catch block (JVM BE assumption);
(b) it is a sole bytecode instruction in a source code line (breakpoints on that line will not work).
All other NOP instructions can be removed.

Note that it doesn't really affect the performance for mature JVM implementations.
However, the perceived quality of the generated code is somewhat improved :).

Related: KT-15609
2017-01-13 10:31:07 +03:00
Dmitry Petrov
a5d6559056 KT-14360 Microoptimizations in RedundantCoercionToUnitTransformer 2016-10-17 10:13:03 +03:00
Nikolay Krasko
87b628a3f7 Generate 'nop' instruction on lambda call when everything on line is going to be eliminated by inliner (KT-6477)
(cherry picked from commit 462bdb2)

 #KT-6477 Fixed
2016-10-14 14:52:06 +03:00
Ilya Gorbunov
17e7c269ad Minor: make tryInlined test not depend on 'Closeable.use' implementation. 2016-07-01 04:42:38 +03:00
Dmitry Petrov
f1b061d662 Optimize coercion to Unit.
POP operations are backward-propagated.

Operation can't be transformed if its result is moved within stack
(by DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, or SWAP).

Unnecessary operations are replaced with NOPs (for debugger).
Unnecessary NOPs are removed.

KT-9922 Suboptimal generation for simple safe call with unused return value
KT-11116 Optimize methods returning Unit
2016-04-07 11:40:58 +03:00