Revert "[warnings] g/c some warnings and idea inspections"
This reverts commit 4b12f1c54c.
This commit is contained in:
-1
@@ -67,7 +67,6 @@ fun runTopLevelPhases(konanConfig: KonanConfig, environment: KotlinCoreEnvironme
|
|||||||
// Translate AST to high level IR.
|
// Translate AST to high level IR.
|
||||||
val translator = Psi2IrTranslator(Psi2IrConfiguration(false))
|
val translator = Psi2IrTranslator(Psi2IrConfiguration(false))
|
||||||
val generatorContext = translator.createGeneratorContext(context.moduleDescriptor, bindingContext)
|
val generatorContext = translator.createGeneratorContext(context.moduleDescriptor, bindingContext)
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
context.psi2IrGeneratorContext = generatorContext
|
context.psi2IrGeneratorContext = generatorContext
|
||||||
|
|
||||||
val symbols = KonanSymbols(context, generatorContext.symbolTable)
|
val symbols = KonanSymbols(context, generatorContext.symbolTable)
|
||||||
|
|||||||
+2
-3
@@ -40,7 +40,7 @@ internal class KonanLower(val context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun lowerModule(irModule: IrModuleFragment) {
|
fun lowerModule(irModule: IrModuleFragment) {
|
||||||
val phaser = PhaseManager(context)
|
val phaser = PhaseManager(context)
|
||||||
|
|
||||||
phaser.phase(KonanPhase.REMOVE_EXPECT_DECLARATIONS) {
|
phaser.phase(KonanPhase.REMOVE_EXPECT_DECLARATIONS) {
|
||||||
@@ -72,12 +72,11 @@ internal class KonanLower(val context: Context) {
|
|||||||
irModule.files.forEach(InteropLoweringPart1(context)::lower)
|
irModule.files.forEach(InteropLoweringPart1(context)::lower)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
irModule.replaceUnboundSymbols(context)
|
irModule.replaceUnboundSymbols(context)
|
||||||
validateIrModule(context, irModule)
|
validateIrModule(context, irModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun lowerFile(irFile: IrFile) {
|
fun lowerFile(irFile: IrFile) {
|
||||||
val phaser = PhaseManager(context)
|
val phaser = PhaseManager(context)
|
||||||
|
|
||||||
phaser.phase(KonanPhase.LOWER_STRING_CONCAT) {
|
phaser.phase(KonanPhase.LOWER_STRING_CONCAT) {
|
||||||
|
|||||||
+1
-3
@@ -1401,8 +1401,6 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
|||||||
|
|
||||||
private fun evaluateConst(value: IrConst<*>): LLVMValueRef {
|
private fun evaluateConst(value: IrConst<*>): LLVMValueRef {
|
||||||
context.log{"evaluateConst : ${ir2string(value)}"}
|
context.log{"evaluateConst : ${ir2string(value)}"}
|
||||||
/* This suppression against IrConst<String> */
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
|
||||||
when (value.kind) {
|
when (value.kind) {
|
||||||
IrConstKind.Null -> return codegen.kNullObjHeaderPtr
|
IrConstKind.Null -> return codegen.kNullObjHeaderPtr
|
||||||
IrConstKind.Boolean -> when (value.value) {
|
IrConstKind.Boolean -> when (value.value) {
|
||||||
@@ -1414,7 +1412,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
|||||||
IrConstKind.Short -> return LLVMConstInt(LLVMInt16Type(), (value.value as Short).toLong(), 1)!!
|
IrConstKind.Short -> return LLVMConstInt(LLVMInt16Type(), (value.value as Short).toLong(), 1)!!
|
||||||
IrConstKind.Int -> return LLVMConstInt(LLVMInt32Type(), (value.value as Int).toLong(), 1)!!
|
IrConstKind.Int -> return LLVMConstInt(LLVMInt32Type(), (value.value as Int).toLong(), 1)!!
|
||||||
IrConstKind.Long -> return LLVMConstInt(LLVMInt64Type(), value.value as Long, 1)!!
|
IrConstKind.Long -> return LLVMConstInt(LLVMInt64Type(), value.value as Long, 1)!!
|
||||||
IrConstKind.String -> return evaluateStringConst(value as IrConst<String>)
|
IrConstKind.String -> return evaluateStringConst(@Suppress("UNCHECKED_CAST") value as IrConst<String>)
|
||||||
IrConstKind.Float -> return LLVMConstRealOfString(LLVMFloatType(), (value.value as Float).toString())!!
|
IrConstKind.Float -> return LLVMConstRealOfString(LLVMFloatType(), (value.value as Float).toString())!!
|
||||||
IrConstKind.Double -> return LLVMConstRealOfString(LLVMDoubleType(), (value.value as Double).toString())!!
|
IrConstKind.Double -> return LLVMConstRealOfString(LLVMDoubleType(), (value.value as Double).toString())!!
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-4
@@ -146,10 +146,7 @@ private fun Context.getDeclaredFields(classDescriptor: ClassDescriptor): List<Pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun ContextUtils.createClassBodyType(name: String, fields: List<PropertyDescriptor>): LLVMTypeRef {
|
private fun ContextUtils.createClassBodyType(name: String, fields: List<PropertyDescriptor>): LLVMTypeRef {
|
||||||
val fieldTypes = fields.map {
|
val fieldTypes = fields.map { getLLVMType(if (it.isDelegated) context.builtIns.nullableAnyType else it.type) }
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
getLLVMType(if (it.isDelegated) context.builtIns.nullableAnyType else it.type)
|
|
||||||
}
|
|
||||||
|
|
||||||
val classType = LLVMStructCreateNamed(LLVMGetModuleContext(context.llvmModule), name)!!
|
val classType = LLVMStructCreateNamed(LLVMGetModuleContext(context.llvmModule), name)!!
|
||||||
|
|
||||||
|
|||||||
+7
-8
@@ -43,7 +43,7 @@ import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
|||||||
|
|
||||||
class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor,
|
class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor,
|
||||||
val parentDescriptor: DeclarationDescriptor,
|
val parentDescriptor: DeclarationDescriptor,
|
||||||
val context: CommonBackendContext) {
|
context: CommonBackendContext) {
|
||||||
|
|
||||||
private val descriptorSubstituteMap: MutableMap<DeclarationDescriptor, DeclarationDescriptor> = mutableMapOf()
|
private val descriptorSubstituteMap: MutableMap<DeclarationDescriptor, DeclarationDescriptor> = mutableMapOf()
|
||||||
private var typeSubstitutor: TypeSubstitutor? = null
|
private var typeSubstitutor: TypeSubstitutor? = null
|
||||||
@@ -276,7 +276,6 @@ class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor,
|
|||||||
|
|
||||||
val oldContainingDeclaration = oldDescriptor.containingDeclaration
|
val oldContainingDeclaration = oldDescriptor.containingDeclaration
|
||||||
val newContainingDeclaration = descriptorSubstituteMap.getOrDefault(oldContainingDeclaration, oldContainingDeclaration) as ClassDescriptor
|
val newContainingDeclaration = descriptorSubstituteMap.getOrDefault(oldContainingDeclaration, oldContainingDeclaration) as ClassDescriptor
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
return PropertyDescriptorImpl.create(
|
return PropertyDescriptorImpl.create(
|
||||||
/* containingDeclaration = */ newContainingDeclaration,
|
/* containingDeclaration = */ newContainingDeclaration,
|
||||||
/* annotations = */ oldDescriptor.annotations,
|
/* annotations = */ oldDescriptor.annotations,
|
||||||
@@ -289,7 +288,7 @@ class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor,
|
|||||||
/* lateInit = */ oldDescriptor.isLateInit,
|
/* lateInit = */ oldDescriptor.isLateInit,
|
||||||
/* isConst = */ oldDescriptor.isConst,
|
/* isConst = */ oldDescriptor.isConst,
|
||||||
/* isExpect = */ oldDescriptor.isExpect,
|
/* isExpect = */ oldDescriptor.isExpect,
|
||||||
/* isActual = */ oldDescriptor.isActual,
|
/* isActual = */ oldDescriptor.isActual,
|
||||||
/* isExternal = */ oldDescriptor.isExternal,
|
/* isExternal = */ oldDescriptor.isExternal,
|
||||||
/* isDelegated = */ oldDescriptor.isDelegated
|
/* isDelegated = */ oldDescriptor.isDelegated
|
||||||
).apply {
|
).apply {
|
||||||
@@ -381,7 +380,6 @@ class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor,
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------//
|
//-----------------------------------------------------------------------------//
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
inner class InlineCopyIr : DeepCopyIrTree() {
|
inner class InlineCopyIr : DeepCopyIrTree() {
|
||||||
|
|
||||||
override fun mapClassDeclaration (descriptor: ClassDescriptor) = descriptorSubstituteMap.getOrDefault(descriptor, descriptor) as ClassDescriptor
|
override fun mapClassDeclaration (descriptor: ClassDescriptor) = descriptorSubstituteMap.getOrDefault(descriptor, descriptor) as ClassDescriptor
|
||||||
@@ -600,6 +598,8 @@ class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val context = context
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SubstitutedDescriptor(val inlinedFunction: FunctionDescriptor, val descriptor: DeclarationDescriptor)
|
class SubstitutedDescriptor(val inlinedFunction: FunctionDescriptor, val descriptor: DeclarationDescriptor)
|
||||||
@@ -635,11 +635,10 @@ class DescriptorSubstitutorForExternalScope(val globalSubstituteMap: MutableMap<
|
|||||||
startOffset = oldExpression.startOffset,
|
startOffset = oldExpression.startOffset,
|
||||||
endOffset = oldExpression.endOffset,
|
endOffset = oldExpression.endOffset,
|
||||||
type = oldExpression.type,
|
type = oldExpression.type,
|
||||||
symbol = createFunctionSymbol(newDescriptor),
|
calleeDescriptor = newDescriptor,
|
||||||
descriptor = newDescriptor,
|
|
||||||
typeArguments = oldExpression.typeArguments,
|
typeArguments = oldExpression.typeArguments,
|
||||||
origin = oldExpression.origin,
|
origin = oldExpression.origin,
|
||||||
superQualifierSymbol = createClassSymbolOrNull(oldExpression.superQualifier)
|
superQualifierDescriptor = oldExpression.superQualifier
|
||||||
).apply {
|
).apply {
|
||||||
oldExpression.descriptor.valueParameters.forEach {
|
oldExpression.descriptor.valueParameters.forEach {
|
||||||
val valueArgument = oldExpression.getValueArgument(it)
|
val valueArgument = oldExpression.getValueArgument(it)
|
||||||
@@ -662,7 +661,7 @@ class DescriptorSubstitutorForExternalScope(val globalSubstituteMap: MutableMap<
|
|||||||
if (newDescriptor == oldDescriptor)
|
if (newDescriptor == oldDescriptor)
|
||||||
return oldExpression
|
return oldExpression
|
||||||
|
|
||||||
return oldExpression.shallowCopy(oldExpression.origin, createFunctionSymbol(newDescriptor), oldExpression.superQualifierSymbol)
|
return oldExpression.shallowCopy(oldExpression.origin, newDescriptor, oldExpression.superQualifier)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -41,7 +41,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
|
|||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrMemberAccessExpressionBase
|
import org.jetbrains.kotlin.ir.expressions.impl.IrMemberAccessExpressionBase
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrReturnableBlockImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrReturnableBlockImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrVarargImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrVarargImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.createValueSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||||
@@ -348,7 +347,7 @@ private class Inliner(val globalSubstituteMap: MutableMap<DeclarationDescriptor,
|
|||||||
val getVal = IrGetValueImpl( // Create new expression, representing access the new variable.
|
val getVal = IrGetValueImpl( // Create new expression, representing access the new variable.
|
||||||
startOffset = currentScope.irElement.startOffset,
|
startOffset = currentScope.irElement.startOffset,
|
||||||
endOffset = currentScope.irElement.endOffset,
|
endOffset = currentScope.irElement.endOffset,
|
||||||
symbol = createValueSymbol(newVariable.descriptor)
|
descriptor = newVariable.descriptor
|
||||||
)
|
)
|
||||||
substituteMap[parameterDescriptor] = getVal // Parameter will be replaced with the new variable.
|
substituteMap[parameterDescriptor] = getVal // Parameter will be replaced with the new variable.
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-7
@@ -32,8 +32,6 @@ import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
|||||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.createFunctionSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.createValueSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
@@ -102,7 +100,7 @@ internal class InlineConstructorsTransformation(val context: Context): IrElement
|
|||||||
val newThisGetValue = IrGetValueImpl( // Create new expression, representing access the new variable.
|
val newThisGetValue = IrGetValueImpl( // Create new expression, representing access the new variable.
|
||||||
startOffset = 0,
|
startOffset = 0,
|
||||||
endOffset = 0,
|
endOffset = 0,
|
||||||
symbol = createValueSymbol(thisVariable.descriptor)
|
descriptor = thisVariable.descriptor
|
||||||
)
|
)
|
||||||
|
|
||||||
val classDescriptor = delegatingCall.descriptor.constructedClass
|
val classDescriptor = delegatingCall.descriptor.constructedClass
|
||||||
@@ -121,7 +119,7 @@ internal class InlineConstructorsTransformation(val context: Context): IrElement
|
|||||||
statements = newStatements
|
statements = newStatements
|
||||||
)
|
)
|
||||||
|
|
||||||
val returnThis = IrReturnImpl(0, 0, createFunctionSymbol(functionDescriptor), block)
|
val returnThis = IrReturnImpl(0, 0, functionDescriptor, block)
|
||||||
|
|
||||||
statements.clear()
|
statements.clear()
|
||||||
statements += returnThis
|
statements += returnThis
|
||||||
@@ -129,13 +127,12 @@ internal class InlineConstructorsTransformation(val context: Context): IrElement
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------//
|
//-------------------------------------------------------------------------//
|
||||||
|
|
||||||
private fun generateIrCall(expression: IrDelegatingConstructorCallImpl): IrVariable {
|
fun generateIrCall(expression: IrDelegatingConstructorCallImpl): IrVariable {
|
||||||
|
|
||||||
val newExpression = IrCallImpl(
|
val newExpression = IrCallImpl(
|
||||||
expression.startOffset,
|
expression.startOffset,
|
||||||
expression.endOffset,
|
expression.endOffset,
|
||||||
expression.descriptor.returnType,
|
expression.descriptor.returnType,
|
||||||
expression.symbol,
|
|
||||||
expression.descriptor,
|
expression.descriptor,
|
||||||
expression.typeArguments,
|
expression.typeArguments,
|
||||||
expression.origin
|
expression.origin
|
||||||
@@ -146,10 +143,12 @@ internal class InlineConstructorsTransformation(val context: Context): IrElement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentScope!!.scope.createTemporaryVariable( // Create new variable and init it with constructor call.
|
val newVariable = currentScope!!.scope.createTemporaryVariable( // Create new variable and init it with constructor call.
|
||||||
irExpression = newExpression,
|
irExpression = newExpression,
|
||||||
nameHint = newExpression.descriptor.fqNameSafe.toString() + ".this",
|
nameHint = newExpression.descriptor.fqNameSafe.toString() + ".this",
|
||||||
isMutable = false)
|
isMutable = false)
|
||||||
|
|
||||||
|
return newVariable
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------//
|
//-------------------------------------------------------------------------//
|
||||||
|
|||||||
+3
-2
@@ -93,6 +93,7 @@ internal class ObjCExport(val context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val file = directory.child("Info.plist")
|
val file = directory.child("Info.plist")
|
||||||
|
val bundleExecutable = name
|
||||||
val pkg = context.moduleDescriptor.guessMainPackage() // TODO: consider showing warning if it is root.
|
val pkg = context.moduleDescriptor.guessMainPackage() // TODO: consider showing warning if it is root.
|
||||||
val bundleId = pkg.child(Name.identifier(name)).asString()
|
val bundleId = pkg.child(Name.identifier(name)).asString()
|
||||||
|
|
||||||
@@ -103,7 +104,7 @@ internal class ObjCExport(val context: Context) {
|
|||||||
else -> error(target)
|
else -> error(target)
|
||||||
}
|
}
|
||||||
val properties = context.config.platform.configurables as AppleConfigurables
|
val properties = context.config.platform.configurables as AppleConfigurables
|
||||||
val minimumOsVersion = properties.osVersionMin
|
val minimumOsVersion = properties.osVersionMin!!
|
||||||
|
|
||||||
val contents = StringBuilder()
|
val contents = StringBuilder()
|
||||||
contents.append("""
|
contents.append("""
|
||||||
@@ -112,7 +113,7 @@ internal class ObjCExport(val context: Context) {
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$name</string>
|
<string>$bundleExecutable</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>$bundleId</string>
|
<string>$bundleId</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
|||||||
+2
-4
@@ -42,8 +42,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrGetObjectValueImpl
|
|||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.createValueSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.util.getArguments
|
import org.jetbrains.kotlin.ir.util.getArguments
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||||
@@ -197,7 +195,7 @@ private class ExpressionValuesExtractor(val returnableBlockValues: Map<IrReturna
|
|||||||
else -> {
|
else -> {
|
||||||
if ((expression.type.isUnit() || expression.type.isNothing())) {
|
if ((expression.type.isUnit() || expression.type.isNothing())) {
|
||||||
block(IrGetObjectValueImpl(expression.startOffset, expression.endOffset,
|
block(IrGetObjectValueImpl(expression.startOffset, expression.endOffset,
|
||||||
expression.type, IrClassSymbolImpl(expression.type.constructor.declarationDescriptor as ClassDescriptor)))
|
expression.type, (expression.type.constructor.declarationDescriptor as ClassDescriptor)))
|
||||||
}
|
}
|
||||||
else TODO(ir2stringWhole(expression))
|
else TODO(ir2stringWhole(expression))
|
||||||
}
|
}
|
||||||
@@ -562,7 +560,7 @@ internal class ModuleDFGBuilder(val context: Context, val irModule: IrModuleFrag
|
|||||||
|
|
||||||
is IrDelegatingConstructorCall -> {
|
is IrDelegatingConstructorCall -> {
|
||||||
val thiz = IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
val thiz = IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
||||||
createValueSymbol((descriptor as ConstructorDescriptor).constructedClass.thisAsReceiverParameter))
|
(descriptor as ConstructorDescriptor).constructedClass.thisAsReceiverParameter)
|
||||||
val arguments = listOf(thiz) + value.getArguments().map { it.second }
|
val arguments = listOf(thiz) + value.getArguments().map { it.second }
|
||||||
DataFlowIR.Node.StaticCall(
|
DataFlowIR.Node.StaticCall(
|
||||||
symbolTable.mapFunction(value.descriptor),
|
symbolTable.mapFunction(value.descriptor),
|
||||||
|
|||||||
+1
-1
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.backend.konan.optimizations
|
|||||||
import org.jetbrains.kotlin.backend.konan.DirectedGraphCondensationBuilder
|
import org.jetbrains.kotlin.backend.konan.DirectedGraphCondensationBuilder
|
||||||
import org.jetbrains.kotlin.backend.konan.DirectedGraphMultiNode
|
import org.jetbrains.kotlin.backend.konan.DirectedGraphMultiNode
|
||||||
import org.jetbrains.kotlin.backend.konan.llvm.Lifetime
|
import org.jetbrains.kotlin.backend.konan.llvm.Lifetime
|
||||||
|
import org.jetbrains.kotlin.backend.konan.optimizations.*
|
||||||
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
|
|
||||||
@@ -161,7 +162,6 @@ internal object EscapeAnalysis {
|
|||||||
assignRole(value.node, Role.FIELD_WRITTEN, RoleInfoEntry(node))
|
assignRole(value.node, Role.FIELD_WRITTEN, RoleInfoEntry(node))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> TODO()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FunctionAnalysisResult(function, nodesRoles)
|
FunctionAnalysisResult(function, nodesRoles)
|
||||||
|
|||||||
+15
-7
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.serialization.ProtoBuf
|
|||||||
import org.jetbrains.kotlin.serialization.deserialization.*
|
import org.jetbrains.kotlin.serialization.deserialization.*
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirementTable
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirementTable
|
||||||
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
|
||||||
// This class knows how to construct contexts for
|
// This class knows how to construct contexts for
|
||||||
// MemberDeserializer to deserialize descriptors declared in IR.
|
// MemberDeserializer to deserialize descriptors declared in IR.
|
||||||
@@ -100,7 +101,12 @@ class LocalDeclarationDeserializer(val rootDescriptor: DeclarationDescriptor) {
|
|||||||
contextStack.pop()
|
contextStack.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deserializeInlineType(type: ProtoBuf.Type) = typeDeserializer.type(type)
|
fun deserializeInlineType(type: ProtoBuf.Type): KotlinType {
|
||||||
|
|
||||||
|
val result = typeDeserializer.type(type)
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
fun deserializeClass(irProto: KonanIr.KotlinDescriptor): ClassDescriptor {
|
fun deserializeClass(irProto: KonanIr.KotlinDescriptor): ClassDescriptor {
|
||||||
return DeserializedClassDescriptor(parentContext, irProto.irLocalDeclaration.descriptor.clazz, nameResolver, SourceElement.NO_SOURCE)
|
return DeserializedClassDescriptor(parentContext, irProto.irLocalDeclaration.descriptor.clazz, nameResolver, SourceElement.NO_SOURCE)
|
||||||
@@ -115,8 +121,9 @@ class LocalDeclarationDeserializer(val rootDescriptor: DeclarationDescriptor) {
|
|||||||
|
|
||||||
val proto = irProto.irLocalDeclaration.descriptor.constructor
|
val proto = irProto.irLocalDeclaration.descriptor.constructor
|
||||||
val isPrimary = !Flags.IS_SECONDARY.get(proto.flags)
|
val isPrimary = !Flags.IS_SECONDARY.get(proto.flags)
|
||||||
|
val constructor = memberDeserializer.loadConstructor(proto, isPrimary)
|
||||||
|
|
||||||
return memberDeserializer.loadConstructor(proto, isPrimary)
|
return constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deserializeProperty(irProto: KonanIr.KotlinDescriptor): VariableDescriptor {
|
fun deserializeProperty(irProto: KonanIr.KotlinDescriptor): VariableDescriptor {
|
||||||
@@ -131,17 +138,18 @@ class LocalDeclarationDeserializer(val rootDescriptor: DeclarationDescriptor) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun propertyToVariable(property: PropertyDescriptor): LocalVariableDescriptor {
|
fun propertyToVariable(property: PropertyDescriptor): LocalVariableDescriptor {
|
||||||
// TODO: Should we transform the getter and the setter too?
|
val variable = LocalVariableDescriptor(
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
return LocalVariableDescriptor(
|
|
||||||
property.containingDeclaration,
|
property.containingDeclaration,
|
||||||
property.annotations,
|
property.annotations,
|
||||||
property.name,
|
property.name,
|
||||||
property.type,
|
property.type,
|
||||||
property.isVar,
|
property.isVar,
|
||||||
property.isDelegated,
|
property.isDelegated,
|
||||||
SourceElement.NO_SOURCE)
|
SourceElement.NO_SOURCE)
|
||||||
|
|
||||||
|
// TODO: Should we transform the getter and the setter too?
|
||||||
|
return variable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -97,9 +97,8 @@ internal class LocalDeclarationSerializer(val context: Context, val rootFunction
|
|||||||
// serialization to serialize variables for now.
|
// serialization to serialize variables for now.
|
||||||
// Need to introduce an extension protobuf message
|
// Need to introduce an extension protobuf message
|
||||||
// and serialize variables directly.
|
// and serialize variables directly.
|
||||||
private fun variableAsProperty(variable: VariableDescriptor): PropertyDescriptor {
|
fun variableAsProperty(variable: VariableDescriptor): PropertyDescriptor {
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
val isDelegated = when (variable) {
|
val isDelegated = when (variable) {
|
||||||
is LocalVariableDescriptor -> variable.isDelegated
|
is LocalVariableDescriptor -> variable.isDelegated
|
||||||
is IrTemporaryVariableDescriptor -> false
|
is IrTemporaryVariableDescriptor -> false
|
||||||
|
|||||||
+289
-281
File diff suppressed because it is too large
Load Diff
-1
@@ -55,7 +55,6 @@ internal fun IrModuleFragment.replaceUnboundSymbols(context: Context) {
|
|||||||
|
|
||||||
// Generate missing external stubs:
|
// Generate missing external stubs:
|
||||||
// TODO: ModuleGenerator::generateUnboundSymbolsAsDependencies(IRModuleFragment) is private function :/
|
// TODO: ModuleGenerator::generateUnboundSymbolsAsDependencies(IRModuleFragment) is private function :/
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
ExternalDependenciesGenerator(symbolTable = context.psi2IrGeneratorContext.symbolTable, irBuiltIns = context.irBuiltIns).generateUnboundSymbolsAsDependencies(this)
|
ExternalDependenciesGenerator(symbolTable = context.psi2IrGeneratorContext.symbolTable, irBuiltIns = context.irBuiltIns).generateUnboundSymbolsAsDependencies(this)
|
||||||
|
|
||||||
// Merge duplicated module and package declarations:
|
// Merge duplicated module and package declarations:
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ open class KlibInstall: Exec() {
|
|||||||
|
|
||||||
override fun configure(config: Closure<*>): Task {
|
override fun configure(config: Closure<*>): Task {
|
||||||
val result = super.configure(config)
|
val result = super.configure(config)
|
||||||
val konanHomePath = project.findProperty("konan.home") ?: "dist"
|
val konanHome = project.rootProject.file(project.findProperty("konan.home") ?: "dist")
|
||||||
val konanHome = project.rootProject.file(konanHomePath)
|
|
||||||
val suffix = if (TargetManager.host == KonanTarget.MINGW) ".bat" else ""
|
val suffix = if (TargetManager.host == KonanTarget.MINGW) ".bat" else ""
|
||||||
val klibProgram = "$konanHome/bin/klib$suffix"
|
val klibProgram = "$konanHome/bin/klib$suffix"
|
||||||
|
|
||||||
@@ -44,4 +43,4 @@ open class KlibInstall: Exec() {
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user