JVM_IR: Generate $$forInline companion for transformed crossroutines

This commit is contained in:
Ilmir Usmanov
2019-12-24 14:33:09 +01:00
parent 33c0bfb4c2
commit 7167d5f75c
12 changed files with 18 additions and 17 deletions
@@ -437,6 +437,6 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
} }
} }
private fun DeclarationDescriptor.isInlineOrInsideInline(): Boolean = fun DeclarationDescriptor.isInlineOrInsideInline(): Boolean =
if (this is FunctionDescriptor && isInline) true if (this is FunctionDescriptor && isInline) true
else containingDeclaration?.isInlineOrInsideInline() == true else containingDeclaration?.isInlineOrInsideInline() == true
@@ -260,7 +260,7 @@ internal fun generateFakeContinuationConstructorCall(
load(continuationIndex, Type.getObjectType("kotlin/coroutines/Continuation")) load(continuationIndex, Type.getObjectType("kotlin/coroutines/Continuation"))
invokespecial(continuationType.internalName, "<init>", "(Lkotlin/coroutines/Continuation;)V", false) invokespecial(continuationType.internalName, "<init>", "(Lkotlin/coroutines/Continuation;)V", false)
} }
pop()
addFakeContinuationConstructorCallMarker(this, false) addFakeContinuationConstructorCallMarker(this, false)
pop()
} }
} }
@@ -68,8 +68,7 @@ class IrSourceCompilerForInline(
root.classCodegen.type.internalName, root.classCodegen.type.internalName,
root.signature.asmMethod.name, root.signature.asmMethod.name,
root.signature.asmMethod.descriptor, root.signature.asmMethod.descriptor,
//compilationContextFunctionDescriptor.isInlineOrInsideInline() compilationContextFunctionDescriptor.isInlineOrInsideInline(),
false,
compilationContextFunctionDescriptor.isSuspend, compilationContextFunctionDescriptor.isSuspend,
findElement()?.let { CodegenUtil.getLineNumberForElement(it, false) } ?: 0 findElement()?.let { CodegenUtil.getLineNumberForElement(it, false) } ?: 0
) )
@@ -1,5 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// COMMON_COROUTINES_TEST // COMMON_COROUTINES_TEST
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,5 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// COMMON_COROUTINES_TEST // COMMON_COROUTINES_TEST
// WITH_RUNTIME // WITH_RUNTIME
@@ -19,10 +19,20 @@ final class flow/InnerObjectRetransformationKt$box$1 {
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
} }
@kotlin.Metadata
final class flow/InnerObjectRetransformationKt$check$$inlined$collect$1$1 {
field label: int
@org.jetbrains.annotations.NotNull field result: java.lang.Object
synthetic final field this$0: flow.InnerObjectRetransformationKt$check$$inlined$collect$1
public method <init>(p0: flow.InnerObjectRetransformationKt$check$$inlined$collect$1, p1: kotlin.coroutines.Continuation): void
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata @kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$collect$1 { public final class flow/InnerObjectRetransformationKt$check$$inlined$collect$1 {
inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1 inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1
public method <init>(): void public method <init>(): void
public @org.jetbrains.annotations.Nullable method emit$$forInline(@org.jetbrains.annotations.NotNull p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method emit(@org.jetbrains.annotations.NotNull p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method emit(@org.jetbrains.annotations.NotNull p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@@ -43,10 +53,12 @@ final class flow/InnerObjectRetransformationKt$check$$inlined$flow$1$1 {
public final class flow/InnerObjectRetransformationKt$check$$inlined$flow$1 { public final class flow/InnerObjectRetransformationKt$check$$inlined$flow$1 {
inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1 inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1
public method <init>(): void public method <init>(): void
public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@kotlin.Metadata @kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata
final class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1$1 { final class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1$1 {
field L$0: java.lang.Object field L$0: java.lang.Object
field L$1: java.lang.Object field L$1: java.lang.Object
@@ -63,6 +75,7 @@ public final class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1
synthetic final field $this$inlined: flow.Flow synthetic final field $this$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1 inner class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1
public method <init>(p0: flow.Flow): void public method <init>(p0: flow.Flow): void
public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@@ -139,6 +152,7 @@ public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1 {
synthetic final field $this$inlined: flow.Flow synthetic final field $this$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1 inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1
public method <init>(p0: kotlin.jvm.functions.Function2, p1: flow.Flow): void public method <init>(p0: kotlin.jvm.functions.Function2, p1: flow.Flow): void
public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@@ -161,6 +175,7 @@ public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2 {
synthetic final field $this$inlined: flow.Flow synthetic final field $this$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2 inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2
public method <init>(p0: kotlin.jvm.functions.Function2, p1: flow.Flow): void public method <init>(p0: kotlin.jvm.functions.Function2, p1: flow.Flow): void
public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: inlined.kt // FILE: inlined.kt
// COMMON_COROUTINES_TEST // COMMON_COROUTINES_TEST
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// COMMON_COROUTINES_TEST // COMMON_COROUTINES_TEST
// WITH_RUNTIME // WITH_RUNTIME
// WITH_COROUTINES // WITH_COROUTINES
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: inlined.kt // FILE: inlined.kt
// COMMON_COROUTINES_TEST // COMMON_COROUTINES_TEST
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// COMMON_COROUTINES_TEST // COMMON_COROUTINES_TEST
// WITH_RUNTIME // WITH_RUNTIME
// WITH_COROUTINES // WITH_COROUTINES
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// COMMON_COROUTINES_TEST // COMMON_COROUTINES_TEST
// WITH_RUNTIME // WITH_RUNTIME
// WITH_COROUTINES // WITH_COROUTINES
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// COMMON_COROUTINES_TEST // COMMON_COROUTINES_TEST
// WITH_RUNTIME // WITH_RUNTIME
// WITH_COROUTINES // WITH_COROUTINES