JVM_IR: reuse MethodNodes for inline functions in same module

This fixes the weird cases when a class gets overwritten by an imperfect
copy, reduces the number of classes in the output if an inline function
contains an inline call that causes it to have regenerated anonymous
objects, and makes inlining of same module functions a bit faster in
general. On the other hand, this may increase memory footprint a bit
because classes cannot be flushed to the output jar, as the inliner
would not be able to locate classes for anonymous objects if they have
already been unloaded from memory.
This commit is contained in:
pyos
2020-02-03 16:01:26 +01:00
committed by max-kammerer
parent 97be5617ca
commit 82899e6243
26 changed files with 170 additions and 450 deletions
@@ -10712,6 +10712,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/finally/notChainCatch.kt"); runTest("compiler/testData/codegen/box/finally/notChainCatch.kt");
} }
@TestMetadata("objectInFinally.kt")
public void testObjectInFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/objectInFinally.kt");
}
@TestMetadata("tryFinally.kt") @TestMetadata("tryFinally.kt")
public void testTryFinally() throws Exception { public void testTryFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/tryFinally.kt"); runTest("compiler/testData/codegen/box/finally/tryFinally.kt");
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.backend.common.Mapping
import org.jetbrains.kotlin.backend.common.ir.Ir import org.jetbrains.kotlin.backend.common.ir.Ir
import org.jetbrains.kotlin.backend.common.lower.irThrow import org.jetbrains.kotlin.backend.common.lower.irThrow
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
import org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen
import org.jetbrains.kotlin.backend.jvm.codegen.IrTypeMapper import org.jetbrains.kotlin.backend.jvm.codegen.IrTypeMapper
import org.jetbrains.kotlin.backend.jvm.codegen.MethodSignatureMapper import org.jetbrains.kotlin.backend.jvm.codegen.MethodSignatureMapper
import org.jetbrains.kotlin.backend.jvm.codegen.createFakeContinuation import org.jetbrains.kotlin.backend.jvm.codegen.createFakeContinuation
@@ -20,7 +21,6 @@ import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods
import org.jetbrains.kotlin.backend.jvm.lower.CollectionStubComputer import org.jetbrains.kotlin.backend.jvm.lower.CollectionStubComputer
import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.InlineClassAbi import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.InlineClassAbi
import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.MemoizedInlineClassReplacements import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.MemoizedInlineClassReplacements
import org.jetbrains.kotlin.codegen.inline.NameGenerator
import org.jetbrains.kotlin.codegen.state.GenerationState import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor
@@ -90,12 +90,7 @@ class JvmBackendContext(
internal val customEnclosingFunction = mutableMapOf<IrAttributeContainer, IrFunction>() internal val customEnclosingFunction = mutableMapOf<IrAttributeContainer, IrFunction>()
// TODO cache these at ClassCodegen level. Currently, sharing this map between classes in a module is required internal val classCodegens = mutableMapOf<IrClass, ClassCodegen>()
// because IrSourceCompilerForInline constructs a new (Fake)ClassCodegen for every call to
// an inline function in the same module. Thus, if two inline functions happen to have the same name
// and call a third inline function that has an anonymous object, the one which is called last
// will overwrite the other's regenerated copy. (Or don't recompile the inline function for every call.)
internal val regeneratedObjectNameGenerators = mutableMapOf<Pair<IrClass, String>, NameGenerator>()
internal val localDelegatedProperties = mutableMapOf<IrClass, List<IrLocalDelegatedPropertySymbol>>() internal val localDelegatedProperties = mutableMapOf<IrClass, List<IrLocalDelegatedPropertySymbol>>()
@@ -112,14 +112,15 @@ object JvmBackendFacade {
if (loweredClass !is IrClass) { if (loweredClass !is IrClass) {
throw AssertionError("File-level declaration should be IrClass after JvmLower, got: " + loweredClass.render()) throw AssertionError("File-level declaration should be IrClass after JvmLower, got: " + loweredClass.render())
} }
ClassCodegen.getOrCreate(loweredClass, context).generate()
ClassCodegen.generate(loweredClass, context)
} }
state.afterIndependentPart()
} catch (e: Throwable) { } catch (e: Throwable) {
CodegenUtil.reportBackendException(e, "code generation", irFile.fileEntry.name) CodegenUtil.reportBackendException(e, "code generation", irFile.fileEntry.name)
} }
} }
} }
// TODO: split classes into groups connected by inline calls; call this after every group
// and clear `JvmBackendContext.classCodegens`
state.afterIndependentPart()
} }
} }
@@ -44,15 +44,15 @@ import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.utils.addToStdlib.safeAs import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import org.jetbrains.org.objectweb.asm.* import org.jetbrains.org.objectweb.asm.*
import org.jetbrains.org.objectweb.asm.commons.Method import org.jetbrains.org.objectweb.asm.commons.Method
import org.jetbrains.org.objectweb.asm.tree.MethodNode
import java.io.File import java.io.File
open class ClassCodegen protected constructor( class ClassCodegen private constructor(
internal val irClass: IrClass, internal val irClass: IrClass,
val context: JvmBackendContext, val context: JvmBackendContext,
private val parentClassCodegen: ClassCodegen? = null,
private val parentFunction: IrFunction? = null private val parentFunction: IrFunction? = null
) : InnerClassConsumer { ) : InnerClassConsumer {
private val innerClasses = mutableListOf<IrClass>() private val parentClassCodegen = (parentFunction?.parentAsClass ?: irClass.parent as? IrClass)?.let { getOrCreate(it, context) }
private val withinInline: Boolean = parentClassCodegen?.withinInline == true || parentFunction?.isInline == true private val withinInline: Boolean = parentClassCodegen?.withinInline == true || parentFunction?.isInline == true
private val state get() = context.state private val state get() = context.state
@@ -79,10 +79,21 @@ open class ClassCodegen protected constructor(
} }
} }
val visitor: ClassBuilder = createClassBuilder() private val visitor = state.factory.newVisitor(classOrigin, type, irClass.fileParent.loadSourceFilesInfo()).apply {
val signature = getSignature(irClass, type, irClass.getSuperClassInfo(typeMapper), typeMapper)
open fun createClassBuilder(): ClassBuilder { // Ensure that the backend only produces class names that would be valid in the frontend for JVM.
return state.factory.newVisitor(classOrigin, type, irClass.fileParent.loadSourceFilesInfo()) if (context.state.classBuilderMode.generateBodies && signature.hasInvalidName()) {
throw IllegalStateException("Generating class with invalid name '${type.className}': ${irClass.dump()}")
}
defineClass(
irClass.descriptor.psiElement,
state.classFileVersion,
irClass.flags,
signature.name,
signature.javaGenericSignature,
signature.superclassName,
signature.interfaces.toTypedArray()
)
} }
private var sourceMapper: DefaultSourceMapper? = null private var sourceMapper: DefaultSourceMapper? = null
@@ -103,9 +114,11 @@ open class ClassCodegen protected constructor(
else -> null else -> null
} }
private var regeneratedObjectNameGenerators = mutableMapOf<String, NameGenerator>()
fun getRegeneratedObjectNameGenerator(function: IrFunction): NameGenerator { fun getRegeneratedObjectNameGenerator(function: IrFunction): NameGenerator {
val name = if (function.name.isSpecial) "special" else function.name.asString() val name = if (function.name.isSpecial) "special" else function.name.asString()
return context.regeneratedObjectNameGenerators.getOrPut(irClass to name) { return regeneratedObjectNameGenerators.getOrPut(name) {
NameGenerator("${type.internalName}\$$name\$\$inlined") NameGenerator("${type.internalName}\$$name\$\$inlined")
} }
} }
@@ -113,27 +126,13 @@ open class ClassCodegen protected constructor(
private var hasAssertField = irClass.hasAssertionsDisabledField(context) private var hasAssertField = irClass.hasAssertionsDisabledField(context)
private var classInitializer = irClass.functions.singleOrNull { it.name.asString() == "<clinit>" } private var classInitializer = irClass.functions.singleOrNull { it.name.asString() == "<clinit>" }
private var generatingClInit = false private var generatingClInit = false
private var generated = false
fun generate(): ReifiedTypeParametersUsages { fun generate(): ReifiedTypeParametersUsages {
if (withinInline) { // TODO: reject repeated generate() calls; currently, these can happen for objects in finally
getOrCreateSourceMapper() //initialize default mapping that would be later written in class file // blocks since they are `accept`ed once per each CFG edge out of the try-finally.
} if (generated) return reifiedTypeParametersUsages
generated = true
val signature = getSignature(irClass, type, irClass.getSuperClassInfo(typeMapper), typeMapper)
// Ensure that the backend only produces class names that would be valid in the frontend for JVM.
if (context.state.classBuilderMode.generateBodies && signature.hasInvalidName()) {
throw IllegalStateException("Generating class with invalid name '${type.className}': ${irClass.dump()}")
}
visitor.defineClass(
irClass.descriptor.psiElement,
state.classFileVersion,
irClass.flags,
signature.name,
signature.javaGenericSignature,
signature.superclassName,
signature.interfaces.toTypedArray()
)
for (declaration in irClass.declarations) { for (declaration in irClass.declarations) {
when (declaration) { when (declaration) {
@@ -155,7 +154,7 @@ open class ClassCodegen protected constructor(
// everything moved to the outer class has already been recorded in `globalSerializationBindings`. // everything moved to the outer class has already been recorded in `globalSerializationBindings`.
for (declaration in irClass.declarations) { for (declaration in irClass.declarations) {
if (declaration is IrClass) { if (declaration is IrClass) {
ClassCodegen(declaration, context, this).generate() getOrCreate(declaration, context).generate()
} }
} }
@@ -173,21 +172,16 @@ open class ClassCodegen protected constructor(
visitor.visitSource(shortName, null) visitor.visitSource(shortName, null)
} }
if (irClass.origin != JvmLoweredDeclarationOrigin.CONTINUATION_CLASS) {
done()
}
return reifiedTypeParametersUsages
}
fun done() {
generateInnerAndOuterClasses() generateInnerAndOuterClasses()
sourceMapper?.let { if (withinInline || sourceMapper != null) {
visitor.visitSMAP(it, !context.state.languageVersionSettings.supportsFeature(LanguageFeature.CorrectSourceMappingSyntax)) val smap = getOrCreateSourceMapper()
visitor.visitSMAP(smap, !context.state.languageVersionSettings.supportsFeature(LanguageFeature.CorrectSourceMappingSyntax))
} }
visitor.done() visitor.done()
jvmSignatureClashDetector.reportErrors(classOrigin) jvmSignatureClashDetector.reportErrors(classOrigin)
return reifiedTypeParametersUsages
} }
fun generateAssertFieldIfNeeded(): IrExpression? { fun generateAssertFieldIfNeeded(): IrExpression? {
@@ -301,17 +295,21 @@ open class ClassCodegen protected constructor(
} }
companion object { companion object {
fun generate(irClass: IrClass, context: JvmBackendContext) { fun getOrCreate(irClass: IrClass, context: JvmBackendContext, parentFunction: IrFunction? = null): ClassCodegen =
ClassCodegen(irClass, context).generate() context.classCodegens.getOrPut(irClass) {
} ClassCodegen(irClass, context, parentFunction)
}.also {
assert(parentFunction == null || it.parentFunction == parentFunction) {
"inconsistent parent function for ${irClass.render()}:\n" +
"New: ${parentFunction!!.render()}\n" +
"Old: ${it.parentFunction?.render()}"
}
}
private fun JvmClassSignature.hasInvalidName() = private fun JvmClassSignature.hasInvalidName() =
name.splitToSequence('/').any { identifier -> identifier.any { it in JvmSimpleNameBacktickChecker.INVALID_CHARS } } name.splitToSequence('/').any { identifier -> identifier.any { it in JvmSimpleNameBacktickChecker.INVALID_CHARS } }
} }
fun createLocalClassCodegen(klass: IrClass, parentFunction: IrFunction): ClassCodegen =
ClassCodegen(klass, context, this, parentFunction)
private fun generateField(field: IrField) { private fun generateField(field: IrField) {
if (field.isFakeOverride) return if (field.isFakeOverride) return
@@ -345,13 +343,29 @@ open class ClassCodegen protected constructor(
} }
} }
private val generatedInlineMethods = mutableMapOf<IrFunction, MethodNode>()
fun generateMethodNode(method: IrFunction): MethodNode {
if (!method.isInline && !method.isSuspend) {
// Inline methods can be used multiple times by `IrSourceCompilerForInline`, suspend methods
// could be used twice if they capture crossinline lambdas, and everything else is only
// generated by `generateMethod` below so does not need caching.
return FunctionCodegen(method, this).generate()
}
val node = generatedInlineMethods.getOrPut(method) { FunctionCodegen(method, this).generate() }
val copy = with(node) { MethodNode(Opcodes.API_VERSION, access, name, desc, signature, exceptions.toTypedArray()) }
node.instructions.resetLabels()
node.accept(copy)
return copy
}
private fun generateMethod(method: IrFunction) { private fun generateMethod(method: IrFunction) {
if (method.isFakeOverride) { if (method.isFakeOverride) {
jvmSignatureClashDetector.trackFakeOverrideMethod(method) jvmSignatureClashDetector.trackFakeOverrideMethod(method)
return return
} }
val node = FunctionCodegen(method, this).generate() val node = generateMethodNode(method)
node.preprocessSuspendMarkers( node.preprocessSuspendMarkers(
method.origin == JvmLoweredDeclarationOrigin.FOR_INLINE_STATE_MACHINE_TEMPLATE, method.origin == JvmLoweredDeclarationOrigin.FOR_INLINE_STATE_MACHINE_TEMPLATE,
method.origin == JvmLoweredDeclarationOrigin.FOR_INLINE_STATE_MACHINE_TEMPLATE_CAPTURES_CROSSINLINE method.origin == JvmLoweredDeclarationOrigin.FOR_INLINE_STATE_MACHINE_TEMPLATE_CAPTURES_CROSSINLINE
@@ -360,14 +374,12 @@ open class ClassCodegen protected constructor(
if (method.hasContinuation() || method.isInvokeSuspendOfLambda()) { if (method.hasContinuation() || method.isInvokeSuspendOfLambda()) {
// Generate a state machine within this method. The continuation class for it should be generated // Generate a state machine within this method. The continuation class for it should be generated
// lazily so that if tail call optimization kicks in, the unused class will not be written to the output. // lazily so that if tail call optimization kicks in, the unused class will not be written to the output.
val continuationClassCodegen = lazy { val continuationClassCodegen = lazy { getOrCreate(method.continuationClass()!!, context, method) }
createLocalClassCodegen(method.continuationClass()!!, method).also { it.generate() }
}
node.acceptWithStateMachine(method, this, mv) { node.acceptWithStateMachine(method, this, mv) {
if (method.isSuspend) continuationClassCodegen.value.visitor else visitor if (method.isSuspend) continuationClassCodegen.value.visitor else visitor
} }
if (continuationClassCodegen.isInitialized() || method.alwaysNeedsContinuation()) { if (continuationClassCodegen.isInitialized() || method.alwaysNeedsContinuation()) {
continuationClassCodegen.value.done() continuationClassCodegen.value.generate()
} }
} else { } else {
node.accept(mv) node.accept(mv)
@@ -398,10 +410,7 @@ open class ClassCodegen protected constructor(
private fun generateInnerAndOuterClasses() { private fun generateInnerAndOuterClasses() {
// JVMS7 (4.7.6): a nested class or interface member will have InnerClasses information // JVMS7 (4.7.6): a nested class or interface member will have InnerClasses information
// for each enclosing class and for each immediate member // for each enclosing class and for each immediate member
parentClassCodegen?.innerClasses?.add(irClass) parentClassCodegen?.let { writeInnerClass(irClass, typeMapper, context, it.visitor) }
for (innerClass in innerClasses) {
writeInnerClass(innerClass, typeMapper, context, visitor)
}
for (codegen in generateSequence(this) { it.parentClassCodegen }.takeWhile { it.parentClassCodegen != null }) { for (codegen in generateSequence(this) { it.parentClassCodegen }.takeWhile { it.parentClassCodegen != null }) {
writeInnerClass(codegen.irClass, typeMapper, context, visitor) writeInnerClass(codegen.irClass, typeMapper, context, visitor)
} }
@@ -55,11 +55,11 @@ internal fun MethodNode.acceptWithStateMachine(
sourceFile = classCodegen.irClass.file.name, sourceFile = classCodegen.irClass.file.name,
languageVersionSettings = languageVersionSettings, languageVersionSettings = languageVersionSettings,
shouldPreserveClassInitialization = state.constructorCallNormalizationMode.shouldPreserveClassInitialization, shouldPreserveClassInitialization = state.constructorCallNormalizationMode.shouldPreserveClassInitialization,
containingClassInternalName = classCodegen.visitor.thisName, containingClassInternalName = classCodegen.type.internalName,
isForNamedFunction = irFunction.isSuspend, // SuspendLambda.invokeSuspend is not suspend isForNamedFunction = irFunction.isSuspend, // SuspendLambda.invokeSuspend is not suspend
needDispatchReceiver = irFunction.isSuspend && (irFunction.dispatchReceiverParameter != null needDispatchReceiver = irFunction.isSuspend && (irFunction.dispatchReceiverParameter != null
|| irFunction.origin == JvmLoweredDeclarationOrigin.SUSPEND_IMPL_STATIC_FUNCTION), || irFunction.origin == JvmLoweredDeclarationOrigin.SUSPEND_IMPL_STATIC_FUNCTION),
internalNameForDispatchReceiver = classCodegen.visitor.thisName, internalNameForDispatchReceiver = classCodegen.type.internalName,
putContinuationParameterToLvt = false, putContinuationParameterToLvt = false,
disableTailCallOptimizationForFunctionReturningUnit = irFunction.isSuspend && irFunction.suspendFunctionOriginal().let { disableTailCallOptimizationForFunctionReturningUnit = irFunction.isSuspend && irFunction.suspendFunctionOriginal().let {
it.returnType.isUnit() && it.anyOfOverriddenFunctionsReturnsNonUnit() it.returnType.isUnit() && it.anyOfOverriddenFunctionsReturnsNonUnit()
@@ -697,7 +697,7 @@ class ExpressionCodegen(
override fun visitClass(declaration: IrClass, data: BlockInfo): PromisedValue { override fun visitClass(declaration: IrClass, data: BlockInfo): PromisedValue {
if (declaration.origin != JvmLoweredDeclarationOrigin.CONTINUATION_CLASS) { if (declaration.origin != JvmLoweredDeclarationOrigin.CONTINUATION_CLASS) {
closureReifiedMarkers[declaration] = closureReifiedMarkers[declaration] =
classCodegen.createLocalClassCodegen(declaration, generateSequence(this) { it.inlinedInto }.last().irFunction).generate() ClassCodegen.getOrCreate(declaration, context, generateSequence(this) { it.inlinedInto }.last().irFunction).generate()
} }
return unitValue return unitValue
} }
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.backend.jvm.lower.suspendFunctionOriginal import org.jetbrains.kotlin.backend.jvm.lower.suspendFunctionOriginal
import org.jetbrains.kotlin.codegen.AsmUtil import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.inline.DefaultSourceMapper import org.jetbrains.kotlin.codegen.inline.DefaultSourceMapper
import org.jetbrains.kotlin.codegen.inline.MethodBodyVisitor
import org.jetbrains.kotlin.codegen.inline.wrapWithMaxLocalCalc import org.jetbrains.kotlin.codegen.inline.wrapWithMaxLocalCalc
import org.jetbrains.kotlin.codegen.mangleNameIfNeeded import org.jetbrains.kotlin.codegen.mangleNameIfNeeded
import org.jetbrains.kotlin.codegen.state.GenerationState import org.jetbrains.kotlin.codegen.state.GenerationState
@@ -86,17 +87,19 @@ class FunctionCodegen(
} }
} }
// `$$forInline` versions of suspend functions have the same bodies as the originals, but with different
// name/flags/annotations and with no state machine.
val notForInline = irFunction.suspendForInlineToOriginal()
if (!context.state.classBuilderMode.generateBodies || flags.and(Opcodes.ACC_ABSTRACT) != 0 || irFunction.isExternal) { if (!context.state.classBuilderMode.generateBodies || flags.and(Opcodes.ACC_ABSTRACT) != 0 || irFunction.isExternal) {
generateAnnotationDefaultValueIfNeeded(methodVisitor) generateAnnotationDefaultValueIfNeeded(methodVisitor)
} else if (notForInline != null) {
classCodegen.generateMethodNode(notForInline).accept(MethodBodyVisitor(methodVisitor))
} else { } else {
// `$$forInline` versions of suspend functions have the same bodies are the originals, but with different val frameMap = irFunction.createFrameMapWithReceivers()
// name/flags/annotations and with no state machine.
val notForInline = irFunction.suspendForInlineToOriginal() ?: irFunction
val frameMap = notForInline.createFrameMapWithReceivers()
context.state.globalInlineContext.enterDeclaration(irFunction.suspendFunctionOriginal().descriptor) context.state.globalInlineContext.enterDeclaration(irFunction.suspendFunctionOriginal().descriptor)
try { try {
val adapter = InstructionAdapter(methodVisitor) val adapter = InstructionAdapter(methodVisitor)
ExpressionCodegen(notForInline, signature, frameMap, adapter, classCodegen, inlinedInto, smapOverride).generate() ExpressionCodegen(irFunction, signature, frameMap, adapter, classCodegen, inlinedInto, smapOverride).generate()
} finally { } finally {
context.state.globalInlineContext.exitDeclaration() context.state.globalInlineContext.exitDeclaration()
} }
@@ -46,12 +46,10 @@ class IrInlineCodegen(
IrCallGenerator { IrCallGenerator {
override fun generateAssertFieldIfNeeded(info: RootInliningContext) { override fun generateAssertFieldIfNeeded(info: RootInliningContext) {
if (info.generateAssertField && (sourceCompiler as IrSourceCompilerForInline).isPrimaryCopy) { if (info.generateAssertField) {
codegen.classCodegen.generateAssertFieldIfNeeded()?.run { // May be inlining code into `<clinit>`, in which case it's too late to modify the IR and
// Generating <clinit> right now, so no longer can insert the initializer into it. // `generateAssertFieldIfNeeded` will return a statement for which we need to emit bytecode.
// Instead, ask ExpressionCodegen to generate the code for it directly. codegen.classCodegen.generateAssertFieldIfNeeded()?.accept(codegen, BlockInfo())?.discard()
accept(codegen, BlockInfo()).discard()
}
} }
} }
@@ -6,15 +6,12 @@
package org.jetbrains.kotlin.backend.jvm.codegen package org.jetbrains.kotlin.backend.jvm.codegen
import com.intellij.openapi.util.TextRange import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.backend.common.CodegenUtil import org.jetbrains.kotlin.backend.common.CodegenUtil
import org.jetbrains.kotlin.backend.common.ir.ir2string import org.jetbrains.kotlin.backend.common.ir.ir2string
import org.jetbrains.kotlin.codegen.BaseExpressionCodegen import org.jetbrains.kotlin.codegen.BaseExpressionCodegen
import org.jetbrains.kotlin.codegen.ClassBuilder
import org.jetbrains.kotlin.codegen.OwnerKind import org.jetbrains.kotlin.codegen.OwnerKind
import org.jetbrains.kotlin.codegen.inline.* import org.jetbrains.kotlin.codegen.inline.*
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings
import org.jetbrains.kotlin.codegen.state.GenerationState import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource
@@ -23,16 +20,15 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
import org.jetbrains.kotlin.incremental.components.LocationInfo import org.jetbrains.kotlin.incremental.components.LocationInfo
import org.jetbrains.kotlin.incremental.components.LookupLocation import org.jetbrains.kotlin.incremental.components.LookupLocation
import org.jetbrains.kotlin.incremental.components.Position import org.jetbrains.kotlin.incremental.components.Position
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclaration import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression
import org.jetbrains.kotlin.ir.util.isSuspend import org.jetbrains.kotlin.ir.util.isSuspend
import org.jetbrains.kotlin.ir.util.parentAsClass
import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.doNotAnalyze import org.jetbrains.kotlin.psi.doNotAnalyze
import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.SUSPENSION_POINT_INSIDE_MONITOR import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.SUSPENSION_POINT_INSIDE_MONITOR
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.resolve.source.getPsi import org.jetbrains.kotlin.resolve.source.getPsi
import org.jetbrains.org.objectweb.asm.* import org.jetbrains.org.objectweb.asm.*
@@ -105,8 +101,8 @@ class IrSourceCompilerForInline(
asmMethod: Method asmMethod: Method
): SMAPAndMethodNode { ): SMAPAndMethodNode {
assert(callableDescriptor == callee.symbol.descriptor.original) { "Expected $callableDescriptor got ${callee.descriptor.original}" } assert(callableDescriptor == callee.symbol.descriptor.original) { "Expected $callableDescriptor got ${callee.descriptor.original}" }
val classCodegen = FakeClassCodegen(callee, codegen.classCodegen) val classCodegen = ClassCodegen.getOrCreate(callee.parentAsClass, codegen.context)
val node = FunctionCodegen(callee, classCodegen).generate() val node = classCodegen.generateMethodNode(callee)
return SMAPAndMethodNode(node, SMAP(classCodegen.getOrCreateSourceMapper().resultMappings)) return SMAPAndMethodNode(node, SMAP(classCodegen.getOrCreateSourceMapper().resultMappings))
} }
@@ -153,89 +149,4 @@ class IrSourceCompilerForInline(
} }
private fun findElement() = (callElement.symbol.descriptor.original as? DeclarationDescriptorWithSource)?.source?.getPsi() as? KtElement private fun findElement() = (callElement.symbol.descriptor.original as? DeclarationDescriptorWithSource)?.source?.getPsi() as? KtElement
internal val isPrimaryCopy: Boolean
get() = codegen.classCodegen !is FakeClassCodegen
private class FakeClassCodegen(irFunction: IrFunction, codegen: ClassCodegen) :
ClassCodegen(irFunction.parent as IrClass, codegen.context) {
override fun createClassBuilder(): ClassBuilder {
return FakeBuilder
}
companion object {
val FakeBuilder = object : ClassBuilder {
override fun newField(
origin: JvmDeclarationOrigin,
access: Int,
name: String,
desc: String,
signature: String?,
value: Any?
): FieldVisitor {
TODO("not implemented")
}
override fun newMethod(
origin: JvmDeclarationOrigin,
access: Int,
name: String,
desc: String,
signature: String?,
exceptions: Array<out String>?
): MethodVisitor {
TODO("not implemented")
}
override fun getSerializationBindings(): JvmSerializationBindings {
return JvmSerializationBindings()
}
override fun newAnnotation(desc: String, visible: Boolean): AnnotationVisitor {
TODO("not implemented")
}
override fun done() {
TODO("not implemented")
}
override fun getVisitor(): ClassVisitor {
TODO("not implemented")
}
override fun defineClass(
origin: PsiElement?,
version: Int,
access: Int,
name: String,
signature: String?,
superName: String,
interfaces: Array<out String>
) {
TODO("not implemented")
}
override fun visitSource(name: String, debug: String?) {
TODO("not implemented")
}
override fun visitOuterClass(owner: String, name: String?, desc: String?) {
TODO("not implemented")
}
override fun visitSMAP(smap: SourceMapper, backwardsCompatibleSyntax: Boolean) {
TODO("not implemented")
}
override fun visitInnerClass(name: String, outerName: String?, innerName: String?, access: Int) {
TODO("not implemented")
}
override fun getThisName(): String {
TODO("not implemented")
}
}
}
}
} }
@@ -127,35 +127,6 @@ public final class CrossinlineKt$filter$$inlined$source$1 {
public @org.jetbrains.annotations.Nullable method consume(@org.jetbrains.annotations.NotNull p0: Sink, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method consume(@org.jetbrains.annotations.NotNull p0: Sink, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata
public final class CrossinlineKt$filter$$inlined$source$2$1 {
field L$0: java.lang.Object
field L$1: java.lang.Object
field L$2: java.lang.Object
field L$3: java.lang.Object
field L$4: java.lang.Object
field L$5: java.lang.Object
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: CrossinlineKt$filter$$inlined$source$2
inner class CrossinlineKt$filter$$inlined$source$2
inner class CrossinlineKt$filter$$inlined$source$2$1
public method <init>(p0: CrossinlineKt$filter$$inlined$source$2, 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
public final class CrossinlineKt$filter$$inlined$source$2 {
synthetic final field $predicate$inlined: kotlin.jvm.functions.Function1
synthetic final field $this$inlined: SourceCrossinline
inner class CrossinlineKt$filter$$inlined$source$2
inner class CrossinlineKt$filter$$inlined$source$2$1
public method <init>(p0: SourceCrossinline, p1: kotlin.jvm.functions.Function1): void
public @org.jetbrains.annotations.Nullable method consume$$forInline(@org.jetbrains.annotations.NotNull p0: Sink, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method consume(@org.jetbrains.annotations.NotNull p0: Sink, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata @kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata @kotlin.coroutines.jvm.internal.DebugMetadata
public final class CrossinlineKt$filter$lambda-3$$inlined$consumeEach$1$1 { public final class CrossinlineKt$filter$lambda-3$$inlined$consumeEach$1$1 {
@@ -183,33 +154,6 @@ public final class CrossinlineKt$filter$lambda-3$$inlined$consumeEach$1 {
public @org.jetbrains.annotations.Nullable method send(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method send(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata
public final class CrossinlineKt$filter$lambda-3$$inlined$consumeEach$2$1 {
field L$0: java.lang.Object
field L$1: java.lang.Object
field L$2: java.lang.Object
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: CrossinlineKt$filter$lambda-3$$inlined$consumeEach$2
inner class CrossinlineKt$filter$lambda-3$$inlined$consumeEach$2
inner class CrossinlineKt$filter$lambda-3$$inlined$consumeEach$2$1
public method <init>(p0: CrossinlineKt$filter$lambda-3$$inlined$consumeEach$2, 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
public final class CrossinlineKt$filter$lambda-3$$inlined$consumeEach$2 {
synthetic final field $predicate$inlined: kotlin.jvm.functions.Function1
synthetic final field $this$inlined: Sink
inner class CrossinlineKt$filter$lambda-3$$inlined$consumeEach$2
inner class CrossinlineKt$filter$lambda-3$$inlined$consumeEach$2$1
public method <init>(p0: kotlin.jvm.functions.Function1, p1: Sink): void
public method close(@org.jetbrains.annotations.Nullable p0: java.lang.Throwable): void
public @org.jetbrains.annotations.Nullable method send$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method send(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata @kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata @kotlin.coroutines.jvm.internal.DebugMetadata
public final class CrossinlineKt$fold$$inlined$consumeEach$1$1 { public final class CrossinlineKt$fold$$inlined$consumeEach$1$1 {
@@ -238,64 +182,8 @@ public final class CrossinlineKt$fold$$inlined$consumeEach$1 {
public @org.jetbrains.annotations.Nullable method send(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method send(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata @kotlin.coroutines.jvm.internal.DebugMetadata
public final class CrossinlineKt$fold$$inlined$consumeEach$2$1 {
field L$0: java.lang.Object
field L$1: java.lang.Object
field L$2: java.lang.Object
field L$3: java.lang.Object
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: CrossinlineKt$fold$$inlined$consumeEach$2
inner class CrossinlineKt$fold$$inlined$consumeEach$2
inner class CrossinlineKt$fold$$inlined$consumeEach$2$1
public method <init>(p0: CrossinlineKt$fold$$inlined$consumeEach$2, 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 CrossinlineKt$fold$$inlined$consumeEach$2 {
synthetic final field $acc$inlined: kotlin.jvm.internal.Ref$ObjectRef
synthetic final field $operation$inlined: kotlin.jvm.functions.Function3
inner class CrossinlineKt$fold$$inlined$consumeEach$2
inner class CrossinlineKt$fold$$inlined$consumeEach$2$1
public method <init>(p0: kotlin.jvm.internal.Ref$ObjectRef, p1: kotlin.jvm.functions.Function3): void
public method close(@org.jetbrains.annotations.Nullable p0: java.lang.Throwable): void
public @org.jetbrains.annotations.Nullable method send$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method send(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata
public final class CrossinlineKt$fold$$inlined$consumeEach$3$1 {
field L$0: java.lang.Object
field L$1: java.lang.Object
field L$2: java.lang.Object
field L$3: java.lang.Object
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: CrossinlineKt$fold$$inlined$consumeEach$3
inner class CrossinlineKt$fold$$inlined$consumeEach$3
inner class CrossinlineKt$fold$$inlined$consumeEach$3$1
public method <init>(p0: CrossinlineKt$fold$$inlined$consumeEach$3, 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
public final class CrossinlineKt$fold$$inlined$consumeEach$3 {
synthetic final field $acc$inlined: kotlin.jvm.internal.Ref$ObjectRef
synthetic final field $operation$inlined: kotlin.jvm.functions.Function3
inner class CrossinlineKt$fold$$inlined$consumeEach$3
inner class CrossinlineKt$fold$$inlined$consumeEach$3$1
public method <init>(p0: kotlin.jvm.internal.Ref$ObjectRef, p1: kotlin.jvm.functions.Function3): void
public method close(@org.jetbrains.annotations.Nullable p0: java.lang.Throwable): void
public @org.jetbrains.annotations.Nullable method send$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method send(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata
final class CrossinlineKt$fold$1 { final class CrossinlineKt$fold$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
@@ -338,8 +226,8 @@ public final class CrossinlineKt$range$$inlined$source$1 {
public @org.jetbrains.annotations.Nullable method consume(@org.jetbrains.annotations.NotNull p0: Sink, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method consume(@org.jetbrains.annotations.NotNull p0: Sink, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata @kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
public final class CrossinlineKt$source$1$consume$1 { public final class CrossinlineKt$source$1$consume$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
@@ -12,8 +12,8 @@ final class InlineWithoutStateMachineKt$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
@kotlin.coroutines.jvm.internal.DebugMetadata @kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
final class InlineWithoutStateMachineKt$complexSuspend$1 { final class InlineWithoutStateMachineKt$complexSuspend$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
@@ -41,8 +41,8 @@ public final class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1
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.coroutines.jvm.internal.DebugMetadata @kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
final class flow/InnerObjectRetransformationKt$check$1 { final class flow/InnerObjectRetransformationKt$check$1 {
field L$0: java.lang.Object field L$0: java.lang.Object
field label: int field label: int
@@ -116,28 +116,6 @@ public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1 {
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
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$2
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1
public method <init>(p0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$2, 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
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2 {
synthetic final field $builderBlock$inlined: kotlin.jvm.functions.Function2
synthetic final field $this$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1
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
}
@kotlin.Metadata @kotlin.Metadata
public final class flow/InnerObjectRetransformationKt { public final class flow/InnerObjectRetransformationKt {
inner class flow/InnerObjectRetransformationKt$box$1 inner class flow/InnerObjectRetransformationKt$box$1
@@ -22,8 +22,8 @@ final class Override5Kt$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
@kotlin.coroutines.jvm.internal.DebugMetadata @kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
public final class Override5Kt$inlineMe$1$generic$1 { public final class Override5Kt$inlineMe$1$generic$1 {
field L$0: java.lang.Object field L$0: java.lang.Object
field label: int field label: int
@@ -0,0 +1,14 @@
var lambda: (() -> String)? = null
fun f() {
try {
return
} finally {
lambda = { "OK" }
}
}
fun box(): String {
f()
return lambda?.let { it() } ?: "fail"
}
@@ -0,0 +1,18 @@
@kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
final class CoroutineContextIntrinsicKt$notTailCall$1 {
field label: int
synthetic field result: java.lang.Object
inner class CoroutineContextIntrinsicKt$notTailCall$1
method <init>(p0: 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
public final class CoroutineContextIntrinsicKt {
inner class CoroutineContextIntrinsicKt$notTailCall$1
public final static @org.jetbrains.annotations.Nullable method mustBeTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method notTailCall(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method retrieveCoroutineContext(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.CoroutineContext, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@@ -1,5 +1,5 @@
@kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata @kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
final class Controller$multipleSuspensions$1 { final class Controller$multipleSuspensions$1 {
field L$0: java.lang.Object field L$0: java.lang.Object
field label: int field label: int
@@ -10,8 +10,8 @@ final class Controller$multipleSuspensions$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
@kotlin.coroutines.jvm.internal.DebugMetadata @kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
final class Controller$nonTailCall$1 { final class Controller$nonTailCall$1 {
field L$0: java.lang.Object field L$0: java.lang.Object
field label: int field label: int
@@ -0,0 +1,17 @@
@kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
final class OomInReturnUnitKt$test$1 {
field L$0: java.lang.Object
field label: int
synthetic field result: java.lang.Object
inner class OomInReturnUnitKt$test$1
method <init>(p0: 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
public final class OomInReturnUnitKt {
inner class OomInReturnUnitKt$test$1
public final static @org.jetbrains.annotations.Nullable method some(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method test(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
}
@@ -150,57 +150,6 @@ public final class TcoContinuationKt$map$$inlined$transform$1 {
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@kotlin.Metadata
public final class TcoContinuationKt$map$$inlined$transform$2$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$2
inner class TcoContinuationKt$map$$inlined$transform$2
inner class TcoContinuationKt$map$$inlined$transform$2$1
public method <init>(p0: TcoContinuationKt$map$$inlined$transform$2, 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.coroutines.jvm.internal.DebugMetadata
public final class TcoContinuationKt$map$$inlined$transform$2$2$1 {
field L$0: java.lang.Object
field L$1: java.lang.Object
field L$2: java.lang.Object
field L$3: java.lang.Object
field L$4: java.lang.Object
field L$5: java.lang.Object
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: TcoContinuationKt$map$$inlined$transform$2$2
inner class TcoContinuationKt$map$$inlined$transform$2$2
inner class TcoContinuationKt$map$$inlined$transform$2$2$1
public method <init>(p0: TcoContinuationKt$map$$inlined$transform$2$2, 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
public final class TcoContinuationKt$map$$inlined$transform$2$2 {
synthetic final field $this$inlined: FlowCollector
synthetic final field $transformer$inlined$1: kotlin.jvm.functions.Function2
inner class TcoContinuationKt$map$$inlined$transform$2$2
inner class TcoContinuationKt$map$$inlined$transform$2$2$1
public method <init>(p0: FlowCollector, p1: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class TcoContinuationKt$map$$inlined$transform$2 {
synthetic final field $this$inlined: Flow
synthetic final field $transformer$inlined$1: kotlin.jvm.functions.Function2
inner class TcoContinuationKt$map$$inlined$transform$2
inner class TcoContinuationKt$map$$inlined$transform$2$1
public method <init>(p0: Flow, p1: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata @kotlin.Metadata
public final class TcoContinuationKt$transform$$inlined$flow$1$1 { public final class TcoContinuationKt$transform$$inlined$flow$1$1 {
field label: int field label: int
@@ -223,50 +172,6 @@ public final class TcoContinuationKt$transform$$inlined$flow$1 {
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@kotlin.Metadata
public final class TcoContinuationKt$transform$$inlined$flow$2$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$2
inner class TcoContinuationKt$transform$$inlined$flow$2
inner class TcoContinuationKt$transform$$inlined$flow$2$1
public method <init>(p0: TcoContinuationKt$transform$$inlined$flow$2, 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
public final class TcoContinuationKt$transform$$inlined$flow$2 {
synthetic final field $this$inlined: Flow
synthetic final field $transformer$inlined: kotlin.jvm.functions.Function3
inner class TcoContinuationKt$transform$$inlined$flow$2
inner class TcoContinuationKt$transform$$inlined$flow$2$1
public method <init>(p0: Flow, p1: kotlin.jvm.functions.Function3): void
public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class TcoContinuationKt$transform$$inlined$flow$3$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: TcoContinuationKt$transform$$inlined$flow$3
inner class TcoContinuationKt$transform$$inlined$flow$3
inner class TcoContinuationKt$transform$$inlined$flow$3$1
public method <init>(p0: TcoContinuationKt$transform$$inlined$flow$3, 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
public final class TcoContinuationKt$transform$$inlined$flow$3 {
synthetic final field $this$inlined: Flow
synthetic final field $transformer$inlined: kotlin.jvm.functions.Function3
inner class TcoContinuationKt$transform$$inlined$flow$3
inner class TcoContinuationKt$transform$$inlined$flow$3$1
public method <init>(p0: Flow, p1: kotlin.jvm.functions.Function3): void
public @org.jetbrains.annotations.Nullable method collect$$forInline(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata @kotlin.Metadata
public final class TcoContinuationKt$transform$lambda-1$$inlined$collect$1$1 { public final class TcoContinuationKt$transform$lambda-1$$inlined$collect$1$1 {
field label: int field label: int
@@ -289,50 +194,6 @@ public final class TcoContinuationKt$transform$lambda-1$$inlined$collect$1 {
public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
} }
@kotlin.Metadata
public final class TcoContinuationKt$transform$lambda-1$$inlined$collect$2$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: TcoContinuationKt$transform$lambda-1$$inlined$collect$2
inner class TcoContinuationKt$transform$lambda-1$$inlined$collect$2
inner class TcoContinuationKt$transform$lambda-1$$inlined$collect$2$1
public method <init>(p0: TcoContinuationKt$transform$lambda-1$$inlined$collect$2, 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
public final class TcoContinuationKt$transform$lambda-1$$inlined$collect$2 {
synthetic final field $this$inlined: FlowCollector
synthetic final field $transformer$inlined: kotlin.jvm.functions.Function3
inner class TcoContinuationKt$transform$lambda-1$$inlined$collect$2
inner class TcoContinuationKt$transform$lambda-1$$inlined$collect$2$1
public method <init>(p0: kotlin.jvm.functions.Function3, p1: FlowCollector): void
public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class TcoContinuationKt$transform$lambda-1$$inlined$collect$3$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: TcoContinuationKt$transform$lambda-1$$inlined$collect$3
inner class TcoContinuationKt$transform$lambda-1$$inlined$collect$3
inner class TcoContinuationKt$transform$lambda-1$$inlined$collect$3$1
public method <init>(p0: TcoContinuationKt$transform$lambda-1$$inlined$collect$3, 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
public final class TcoContinuationKt$transform$lambda-1$$inlined$collect$3 {
synthetic final field $this$inlined: FlowCollector
synthetic final field $transformer$inlined: kotlin.jvm.functions.Function3
inner class TcoContinuationKt$transform$lambda-1$$inlined$collect$3
inner class TcoContinuationKt$transform$lambda-1$$inlined$collect$3$1
public method <init>(p0: kotlin.jvm.functions.Function3, p1: FlowCollector): void
public @org.jetbrains.annotations.Nullable method emit$$forInline(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata @kotlin.Metadata
public final class TcoContinuationKt { public final class TcoContinuationKt {
inner class TcoContinuationKt$collect$2 inner class TcoContinuationKt$collect$2
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
class Introspector { class Introspector {
inner class SchemaRetriever(val transaction: String) { inner class SchemaRetriever(val transaction: String) {
inline fun inSchema(crossinline modifier: (String) -> Unit) = inline fun inSchema(crossinline modifier: (String) -> Unit) =
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
interface Introspector { interface Introspector {
class SchemaRetriever(val transaction: String) { class SchemaRetriever(val transaction: String) {
@@ -11902,6 +11902,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/finally/notChainCatch.kt"); runTest("compiler/testData/codegen/box/finally/notChainCatch.kt");
} }
@TestMetadata("objectInFinally.kt")
public void testObjectInFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/objectInFinally.kt");
}
@TestMetadata("tryFinally.kt") @TestMetadata("tryFinally.kt")
public void testTryFinally() throws Exception { public void testTryFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/tryFinally.kt"); runTest("compiler/testData/codegen/box/finally/tryFinally.kt");
@@ -11902,6 +11902,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/finally/notChainCatch.kt"); runTest("compiler/testData/codegen/box/finally/notChainCatch.kt");
} }
@TestMetadata("objectInFinally.kt")
public void testObjectInFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/objectInFinally.kt");
}
@TestMetadata("tryFinally.kt") @TestMetadata("tryFinally.kt")
public void testTryFinally() throws Exception { public void testTryFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/tryFinally.kt"); runTest("compiler/testData/codegen/box/finally/tryFinally.kt");
@@ -10712,6 +10712,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/finally/notChainCatch.kt"); runTest("compiler/testData/codegen/box/finally/notChainCatch.kt");
} }
@TestMetadata("objectInFinally.kt")
public void testObjectInFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/objectInFinally.kt");
}
@TestMetadata("tryFinally.kt") @TestMetadata("tryFinally.kt")
public void testTryFinally() throws Exception { public void testTryFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/tryFinally.kt"); runTest("compiler/testData/codegen/box/finally/tryFinally.kt");
@@ -1 +0,0 @@
// IGNORE_BACKEND: JVM_IR
@@ -9207,6 +9207,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/finally/notChainCatch.kt"); runTest("compiler/testData/codegen/box/finally/notChainCatch.kt");
} }
@TestMetadata("objectInFinally.kt")
public void testObjectInFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/objectInFinally.kt");
}
@TestMetadata("tryFinally.kt") @TestMetadata("tryFinally.kt")
public void testTryFinally() throws Exception { public void testTryFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/tryFinally.kt"); runTest("compiler/testData/codegen/box/finally/tryFinally.kt");
@@ -9207,6 +9207,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/finally/notChainCatch.kt"); runTest("compiler/testData/codegen/box/finally/notChainCatch.kt");
} }
@TestMetadata("objectInFinally.kt")
public void testObjectInFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/objectInFinally.kt");
}
@TestMetadata("tryFinally.kt") @TestMetadata("tryFinally.kt")
public void testTryFinally() throws Exception { public void testTryFinally() throws Exception {
runTest("compiler/testData/codegen/box/finally/tryFinally.kt"); runTest("compiler/testData/codegen/box/finally/tryFinally.kt");