JVM: split inline intrinsics into "needed by JVM_IR" and "not"

or, alternatively, "suspend" and "not".
This commit is contained in:
pyos
2021-05-27 16:45:17 +02:00
committed by max-kammerer
parent eb4d831d27
commit d89e2d9f08
6 changed files with 44 additions and 53 deletions
@@ -126,13 +126,8 @@ class IrInlineCodegen(
expression: IrFunctionAccessExpression,
isInsideIfCondition: Boolean,
) {
performInline(
expression.symbol.owner.typeParameters.map { it.symbol },
// Always look for default lambdas to allow custom default argument handling in compiler plugins.
inlineDefaultLambdas = true,
codegen.typeMapper.typeSystem,
registerLineNumberAfterwards = isInsideIfCondition,
)
// Always look for default lambdas to allow custom default argument handling in compiler plugins.
performInline(inlineDefaultLambdas = true, registerLineNumberAfterwards = isInsideIfCondition)
}
override fun genCycleStub(text: String, codegen: ExpressionCodegen) {
@@ -104,10 +104,15 @@ class IrSourceCompilerForInline(
return FunctionCodegen(lambdaInfo.function, codegen.classCodegen).generate(codegen, reifiedTypeParameters)
}
override fun compileInlineFunction(jvmSignature: JvmMethodSignature): SMAPAndMethodNode =
callee.parentClassId?.let { containerId ->
loadCompiledInlineFunction(containerId, jvmSignature.asmMethod, callee.isSuspend, callee.hasMangledReturnType, state)
} ?: ClassCodegen.getOrCreate(callee.parentAsClass, codegen.context).generateMethodNode(callee)
override fun compileInlineFunction(jvmSignature: JvmMethodSignature): SMAPAndMethodNode {
generateInlineIntrinsicForIr(state.languageVersionSettings, callee.toIrBasedDescriptor())?.let {
return it
}
callee.parentClassId?.let {
return loadCompiledInlineFunction(it, jvmSignature.asmMethod, callee.isSuspend, callee.hasMangledReturnType, state)
}
return ClassCodegen.getOrCreate(callee.parentAsClass, codegen.context).generateMethodNode(callee)
}
override fun hasFinallyBlocks() = data.hasFinallyBlocks()