[K/N] Move KonanIrFileSerializer to the serialization.native module
KT-64392
This commit is contained in:
committed by
Space Team
parent
a032db500c
commit
3f9de91bec
+10
-5
@@ -1,15 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.backend.konan.serialization
|
package org.jetbrains.kotlin.backend.konan.serialization
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.CompatibilityMode
|
import org.jetbrains.kotlin.backend.common.serialization.CompatibilityMode
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.DeclarationTable
|
import org.jetbrains.kotlin.backend.common.serialization.DeclarationTable
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer
|
import org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer
|
||||||
import org.jetbrains.kotlin.backend.konan.RuntimeNames
|
|
||||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrAnnotationContainer
|
import org.jetbrains.kotlin.ir.declarations.IrAnnotationContainer
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||||
import org.jetbrains.kotlin.ir.util.hasAnnotation
|
import org.jetbrains.kotlin.ir.util.hasAnnotation
|
||||||
|
import org.jetbrains.kotlin.name.NativeRuntimeNames
|
||||||
|
|
||||||
class KonanIrFileSerializer(
|
class KonanIrFileSerializer(
|
||||||
messageLogger: IrMessageLogger,
|
messageLogger: IrMessageLogger,
|
||||||
@@ -32,13 +37,13 @@ class KonanIrFileSerializer(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
override fun backendSpecificExplicitRoot(node: IrAnnotationContainer): Boolean {
|
override fun backendSpecificExplicitRoot(node: IrAnnotationContainer): Boolean {
|
||||||
val fqn = when (node) {
|
val classId = when (node) {
|
||||||
is IrFunction -> RuntimeNames.exportForCppRuntime
|
is IrFunction -> NativeRuntimeNames.Annotations.exportForCppRuntimeClassId
|
||||||
is IrClass -> RuntimeNames.exportTypeInfoAnnotation
|
is IrClass -> NativeRuntimeNames.Annotations.exportTypeInfoClassId
|
||||||
else -> return false
|
else -> return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return node.annotations.hasAnnotation(fqn)
|
return node.hasAnnotation(classId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun backendSpecificSerializeAllMembers(irClass: IrClass) = !KonanFakeOverrideClassFilter.needToConstructFakeOverrides(irClass)
|
override fun backendSpecificSerializeAllMembers(irClass: IrClass) = !KonanFakeOverrideClassFilter.needToConstructFakeOverrides(irClass)
|
||||||
@@ -14,6 +14,7 @@ object NativeRuntimeNames {
|
|||||||
val exportedBridgeClassId = ClassId(kotlinNativeInternalPackage, Name.identifier("ExportedBridge"))
|
val exportedBridgeClassId = ClassId(kotlinNativeInternalPackage, Name.identifier("ExportedBridge"))
|
||||||
val exportForCppRuntimeClassId = ClassId(kotlinNativeInternalPackage, Name.identifier("ExportForCppRuntime"))
|
val exportForCppRuntimeClassId = ClassId(kotlinNativeInternalPackage, Name.identifier("ExportForCppRuntime"))
|
||||||
val exportForCompilerClassId = ClassId(kotlinNativeInternalPackage, Name.identifier("ExportForCompiler"))
|
val exportForCompilerClassId = ClassId(kotlinNativeInternalPackage, Name.identifier("ExportForCompiler"))
|
||||||
|
val exportTypeInfoClassId = ClassId(kotlinNativeInternalPackage, Name.identifier("ExportTypeInfo"))
|
||||||
val gcUnsafeCallClassId = ClassId(kotlinNativeInternalPackage, Name.identifier("GCUnsafeCall"))
|
val gcUnsafeCallClassId = ClassId(kotlinNativeInternalPackage, Name.identifier("GCUnsafeCall"))
|
||||||
val Throws = ClassId(StandardClassIds.BASE_KOTLIN_PACKAGE, Name.identifier("Throws"))
|
val Throws = ClassId(StandardClassIds.BASE_KOTLIN_PACKAGE, Name.identifier("Throws"))
|
||||||
val ThrowsAlias = ClassId(kotlinNativePackage, Name.identifier("Throws"))
|
val ThrowsAlias = ClassId(kotlinNativePackage, Name.identifier("Throws"))
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ object RuntimeNames {
|
|||||||
val exportForCppRuntime = NativeRuntimeNames.Annotations.exportForCppRuntimeClassId.asSingleFqName()
|
val exportForCppRuntime = NativeRuntimeNames.Annotations.exportForCppRuntimeClassId.asSingleFqName()
|
||||||
val exportedBridge = NativeRuntimeNames.Annotations.exportedBridgeClassId.asSingleFqName()
|
val exportedBridge = NativeRuntimeNames.Annotations.exportedBridgeClassId.asSingleFqName()
|
||||||
val exportForCompilerAnnotation = NativeRuntimeNames.Annotations.exportForCompilerClassId.asSingleFqName()
|
val exportForCompilerAnnotation = NativeRuntimeNames.Annotations.exportForCompilerClassId.asSingleFqName()
|
||||||
val exportTypeInfoAnnotation = FqName("kotlin.native.internal.ExportTypeInfo")
|
val exportTypeInfoAnnotation = NativeRuntimeNames.Annotations.exportTypeInfoClassId.asSingleFqName()
|
||||||
val cCall = FqName("kotlinx.cinterop.internal.CCall")
|
val cCall = FqName("kotlinx.cinterop.internal.CCall")
|
||||||
val cStructMemberAt = FqName("kotlinx.cinterop.internal.CStruct.MemberAt")
|
val cStructMemberAt = FqName("kotlinx.cinterop.internal.CStruct.MemberAt")
|
||||||
val cStructArrayMemberAt = FqName("kotlinx.cinterop.internal.CStruct.ArrayMemberAt")
|
val cStructArrayMemberAt = FqName("kotlinx.cinterop.internal.CStruct.ArrayMemberAt")
|
||||||
|
|||||||
Reference in New Issue
Block a user