JVM_IR. Basic support of 'inlineCallSiteInfo'

This commit is contained in:
Mikhael Bogdanov
2019-08-07 08:53:59 +02:00
parent f34a08cbbf
commit a444a40849
5 changed files with 16 additions and 8 deletions
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.backend.jvm.codegen
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.backend.common.ir.ir2string
import org.jetbrains.kotlin.codegen.BaseExpressionCodegen
import org.jetbrains.kotlin.codegen.ClassBuilder
import org.jetbrains.kotlin.codegen.OwnerKind
@@ -38,13 +39,12 @@ class IrSourceCompilerForInline(
private val data: BlockInfo
) : SourceCompilerForInline {
//TODO
//TODO: KotlinLookupLocation(callElement)
override val lookupLocation: LookupLocation
get() = NoLookupLocation.FROM_BACKEND
//TODO
override val callElementText: String
get() = callElement.toString()
get() = ir2string(callElement)
override val callsiteFile: PsiFile?
get() = codegen.context.psiSourceManager.getKtFile(codegen.irFunction.fileParent)
@@ -53,7 +53,19 @@ class IrSourceCompilerForInline(
get() = OwnerKind.getMemberOwnerKind(callElement.descriptor.containingDeclaration)
override val inlineCallSiteInfo: InlineCallSiteInfo
get() = InlineCallSiteInfo("TODO", null, null, false, false)
get() {
//TODO: support nested inline calls
val typeMapper = codegen.typeMapper
val signature = typeMapper.mapSignatureSkipGeneric(codegen.irFunction)
return InlineCallSiteInfo(
codegen.classCodegen.type.internalName,
signature.asmMethod.name,
signature.asmMethod.descriptor,
//compilationContextFunctionDescriptor.isInlineOrInsideInline()
false,
compilationContextFunctionDescriptor.isSuspend
)
}
override val lazySourceMapper: DefaultSourceMapper
get() = codegen.classCodegen.getOrCreateSourceMapper()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
// WITH_RUNTIME
@@ -2,7 +2,6 @@
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
// WITH_RUNTIME
// FULL_JDK
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
package test
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// FILE: inline.kt
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
inline fun inlineMe(c: () -> Unit) = c()