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.
This commit is contained in:
Dmitry Petrov
2017-05-15 14:59:50 +03:00
parent 65799a5cb4
commit 84e54124a2
8 changed files with 121 additions and 44 deletions
@@ -23,4 +23,4 @@ fun simpleFunVoid(f: () -> Unit): Unit {
return f()
}
// 4 NOP
// 5 NOP
@@ -0,0 +1,20 @@
package inlineInIfFalseDex
fun inlineIfFalse() {
val bar = ""
//Breakpoint!
if (inlineCall { true }) {
foo()
}
foo()
}
fun foo() {}
inline fun inlineCall(predicate: (String?) -> Boolean): Boolean {
return false
}
// 0 LINENUMBER 7
// 0 LINENUMBER 8
// 1 LINENUMBER 9
@@ -6,4 +6,4 @@ fun f() {
// 1 ISTORE 0\s+L3
// 1 ILOAD 0\s+INVOKEVIRTUAL java/io/PrintStream.print \(C\)V
// 1 LOCALVARIABLE c C L3 L8 0
// 1 LOCALVARIABLE c C L3 L6 0
@@ -14,4 +14,4 @@ fun main(args: Array<String>) {
}
/*Threre are two constuctors so we should be sure that we check LOCALVARIABLEs from same method*/
// 1 LOCALVARIABLE this LInlinedConstuctorWithSuperCallParamsKt\$main\$\$inlined\$test\$1; L0 L7 0\s+LOCALVARIABLE \$super_call_param\$1 Ljava/lang/String; L0 L7 1
// 1 LOCALVARIABLE this LInlinedConstuctorWithSuperCallParamsKt\$main\$\$inlined\$test\$1; L0 L6 0\s+LOCALVARIABLE \$super_call_param\$1 Ljava/lang/String; L0 L6 1