Replace return with nop to avoid merging line instructions (KT-18949)

Dex ignores subsequent line numbers for same instructions and interprets
instruction after inline as if they were inlined. This makes debugger
behaves as if there's nowhere to stop on line with breakpoint.

This also makes stepping through inline function consistent with
non-inline analog. In both context debugger now stops on '}'.

 #KT-18949 Fixed
 #KT-17120 Fixed
This commit is contained in:
Nikolay Krasko
2017-07-10 15:41:57 +03:00
parent fc685aa03f
commit ce4f923ba0
30 changed files with 76 additions and 15 deletions
@@ -24,10 +24,23 @@ final class InlineWithoutStateMachineKt$complexSuspend$1 {
synthetic final method setLabel(p0: int): void
}
@kotlin.Metadata
final class InlineWithoutStateMachineKt$suspendHere$1 {
field L$0: java.lang.Object
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
inner class InlineWithoutStateMachineKt$suspendHere$1
method <init>(p0: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
}
@kotlin.Metadata
public final class InlineWithoutStateMachineKt {
inner class InlineWithoutStateMachineKt$box$1
inner class InlineWithoutStateMachineKt$complexSuspend$1
inner class InlineWithoutStateMachineKt$suspendHere$1
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method builder(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void
public final static @org.jetbrains.annotations.Nullable method complexSuspend(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
@@ -23,4 +23,4 @@ fun simpleFunVoid(f: () -> Unit): Unit {
return f()
}
// 5 NOP
// 7 NOP
@@ -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 L6 0
// 1 LOCALVARIABLE c C L3 L7 0
@@ -9,4 +9,4 @@ inline fun lookAtMe(f: (String) -> Unit) {
f(a) // Should be no unneeded nops on this line, that might be generated for zero-parameters lambda
}
// 2 NOP
// 4 NOP
@@ -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 L6 0\s+LOCALVARIABLE \$super_call_param\$1 Ljava/lang/String; L0 L6 1
// 1 LOCALVARIABLE this LInlinedConstuctorWithSuperCallParamsKt\$main\$\$inlined\$test\$1; L0 L7 0\s+LOCALVARIABLE \$super_call_param\$1 Ljava/lang/String; L0 L7 1