JVM_IR. Basic support of 'inlineCallSiteInfo'
This commit is contained in:
+16
-4
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.backend.jvm.codegen
|
|||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
|
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.ClassBuilder
|
||||||
import org.jetbrains.kotlin.codegen.OwnerKind
|
import org.jetbrains.kotlin.codegen.OwnerKind
|
||||||
@@ -38,13 +39,12 @@ class IrSourceCompilerForInline(
|
|||||||
private val data: BlockInfo
|
private val data: BlockInfo
|
||||||
) : SourceCompilerForInline {
|
) : SourceCompilerForInline {
|
||||||
|
|
||||||
//TODO
|
//TODO: KotlinLookupLocation(callElement)
|
||||||
override val lookupLocation: LookupLocation
|
override val lookupLocation: LookupLocation
|
||||||
get() = NoLookupLocation.FROM_BACKEND
|
get() = NoLookupLocation.FROM_BACKEND
|
||||||
|
|
||||||
//TODO
|
|
||||||
override val callElementText: String
|
override val callElementText: String
|
||||||
get() = callElement.toString()
|
get() = ir2string(callElement)
|
||||||
|
|
||||||
override val callsiteFile: PsiFile?
|
override val callsiteFile: PsiFile?
|
||||||
get() = codegen.context.psiSourceManager.getKtFile(codegen.irFunction.fileParent)
|
get() = codegen.context.psiSourceManager.getKtFile(codegen.irFunction.fileParent)
|
||||||
@@ -53,7 +53,19 @@ class IrSourceCompilerForInline(
|
|||||||
get() = OwnerKind.getMemberOwnerKind(callElement.descriptor.containingDeclaration)
|
get() = OwnerKind.getMemberOwnerKind(callElement.descriptor.containingDeclaration)
|
||||||
|
|
||||||
override val inlineCallSiteInfo: InlineCallSiteInfo
|
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
|
override val lazySourceMapper: DefaultSourceMapper
|
||||||
get() = codegen.classCodegen.getOrCreateSourceMapper()
|
get() = codegen.classCodegen.getOrCreateSourceMapper()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
-1
@@ -2,7 +2,6 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// FILE: inline.kt
|
// FILE: inline.kt
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
||||||
|
|
||||||
inline fun inlineMe(c: () -> Unit) = c()
|
inline fun inlineMe(c: () -> Unit) = c()
|
||||||
|
|||||||
Reference in New Issue
Block a user