mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
Fix warnings in K/Native code
This commit is contained in:
committed by
Space
parent
0a5991d6e7
commit
ca9cbf7eb7
@@ -175,6 +175,8 @@ abstract class StructDef(val size: Long, val align: Int) {
|
|||||||
when (it) {
|
when (it) {
|
||||||
is Field -> add(it)
|
is Field -> add(it)
|
||||||
is AnonymousInnerRecord -> addAll(it.def.fields)
|
is AnonymousInnerRecord -> addAll(it.def.fields)
|
||||||
|
is BitField,
|
||||||
|
is IncompleteField -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,6 +187,8 @@ abstract class StructDef(val size: Long, val align: Int) {
|
|||||||
when (it) {
|
when (it) {
|
||||||
is BitField -> add(it)
|
is BitField -> add(it)
|
||||||
is AnonymousInnerRecord -> addAll(it.def.bitFields)
|
is AnonymousInnerRecord -> addAll(it.def.bitFields)
|
||||||
|
is Field,
|
||||||
|
is IncompleteField -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,6 +241,8 @@ fun StructDef.fieldsHaveDefaultAlignment(): Boolean {
|
|||||||
offset = it.offset / 8 + it.typeSize
|
offset = it.offset / 8 + it.typeSize
|
||||||
}
|
}
|
||||||
is BitField -> return false
|
is BitField -> return false
|
||||||
|
is AnonymousInnerRecord,
|
||||||
|
is IncompleteField -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ class StubIrBridgeBuilder(
|
|||||||
val getAddressExpression = getGlobalAddressExpression(extra.cGlobalName, propertyAccessor)
|
val getAddressExpression = getGlobalAddressExpression(extra.cGlobalName, propertyAccessor)
|
||||||
propertyAccessorBridgeBodies[propertyAccessor] = typeInfo.argFromBridged(getAddressExpression, kotlinFile, nativeBacked = propertyAccessor) + "!!"
|
propertyAccessorBridgeBodies[propertyAccessor] = typeInfo.argFromBridged(getAddressExpression, kotlinFile, nativeBacked = propertyAccessor) + "!!"
|
||||||
}
|
}
|
||||||
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,6 +188,7 @@ class StubIrBridgeBuilder(
|
|||||||
}
|
}
|
||||||
propertyAccessorBridgeBodies[propertyAccessor] = setter
|
propertyAccessorBridgeBodies[propertyAccessor] = setter
|
||||||
}
|
}
|
||||||
|
else -> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
is PropertyAccessor.Setter.WriteBits -> {
|
is PropertyAccessor.Setter.WriteBits -> {
|
||||||
@@ -223,6 +225,11 @@ class StubIrBridgeBuilder(
|
|||||||
simpleBridgeGenerator.insertNativeBridge(propertyAccessor, emptyList(), wrapper.lines)
|
simpleBridgeGenerator.insertNativeBridge(propertyAccessor, emptyList(), wrapper.lines)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
is PropertyAccessor.Getter.ArrayMemberAt,
|
||||||
|
is PropertyAccessor.Getter.GetConstructorParameter,
|
||||||
|
is PropertyAccessor.Getter.GetEnumEntry,
|
||||||
|
is PropertyAccessor.Getter.MemberAt,
|
||||||
|
is PropertyAccessor.Setter.MemberAt -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ internal fun produceOutput(context: Context) {
|
|||||||
context.bitcodeFileName = output
|
context.bitcodeFileName = output
|
||||||
LLVMWriteBitcodeToFile(context.llvmModule!!, output)
|
LLVMWriteBitcodeToFile(context.llvmModule!!, output)
|
||||||
}
|
}
|
||||||
|
null -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,5 +126,5 @@ internal class FileInitializersLowering(val context: Context) : FileLoweringPass
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val IrField.hasNonConstInitializer: Boolean
|
private val IrField.hasNonConstInitializer: Boolean
|
||||||
get() = initializer.let { it != null && it !is IrConst<*> }
|
get() = initializer?.expression.let { it != null && it !is IrConst<*> }
|
||||||
}
|
}
|
||||||
@@ -758,67 +758,64 @@ internal class ModuleDFGBuilder(val context: Context, val irModule: IrModuleFrag
|
|||||||
else
|
else
|
||||||
it
|
it
|
||||||
}
|
}
|
||||||
if (callee is IrConstructor) {
|
|
||||||
error("Constructor call should be done with IrConstructorCall")
|
|
||||||
} else {
|
|
||||||
if (value.isVirtualCall) {
|
|
||||||
val owner = callee.parentAsClass
|
|
||||||
val actualReceiverType = value.dispatchReceiver!!.type
|
|
||||||
val actualReceiverClassifier = actualReceiverType.classifierOrFail
|
|
||||||
|
|
||||||
val receiverType =
|
if (value.isVirtualCall) {
|
||||||
if (actualReceiverClassifier is IrTypeParameterSymbol
|
val owner = callee.parentAsClass
|
||||||
|| !callee.isReal /* Could be a bridge. */)
|
val actualReceiverType = value.dispatchReceiver!!.type
|
||||||
symbolTable.mapClassReferenceType(owner)
|
val actualReceiverClassifier = actualReceiverType.classifierOrFail
|
||||||
else {
|
|
||||||
val actualClassAtCallsite =
|
val receiverType =
|
||||||
(actualReceiverClassifier as IrClassSymbol).descriptor
|
if (actualReceiverClassifier is IrTypeParameterSymbol
|
||||||
|
|| !callee.isReal /* Could be a bridge. */)
|
||||||
|
symbolTable.mapClassReferenceType(owner)
|
||||||
|
else {
|
||||||
|
val actualClassAtCallsite =
|
||||||
|
(actualReceiverClassifier as IrClassSymbol).descriptor
|
||||||
// assert (DescriptorUtils.isSubclass(actualClassAtCallsite, owner.descriptor)) {
|
// assert (DescriptorUtils.isSubclass(actualClassAtCallsite, owner.descriptor)) {
|
||||||
// "Expected an inheritor of ${owner.descriptor}, but was $actualClassAtCallsite"
|
// "Expected an inheritor of ${owner.descriptor}, but was $actualClassAtCallsite"
|
||||||
// }
|
// }
|
||||||
if (DescriptorUtils.isSubclass(actualClassAtCallsite, owner.descriptor)) {
|
if (DescriptorUtils.isSubclass(actualClassAtCallsite, owner.descriptor)) {
|
||||||
symbolTable.mapClassReferenceType(actualReceiverClassifier.owner) // Box if inline class.
|
symbolTable.mapClassReferenceType(actualReceiverClassifier.owner) // Box if inline class.
|
||||||
} else {
|
} else {
|
||||||
symbolTable.mapClassReferenceType(owner)
|
symbolTable.mapClassReferenceType(owner)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val isAnyMethod = callee.target.parentAsClass.isAny()
|
val isAnyMethod = callee.target.parentAsClass.isAny()
|
||||||
if (owner.isInterface && !isAnyMethod) {
|
if (owner.isInterface && !isAnyMethod) {
|
||||||
val itablePlace = context.getLayoutBuilder(owner).itablePlace(callee)
|
val itablePlace = context.getLayoutBuilder(owner).itablePlace(callee)
|
||||||
DataFlowIR.Node.ItableCall(
|
DataFlowIR.Node.ItableCall(
|
||||||
symbolTable.mapFunction(callee.target),
|
symbolTable.mapFunction(callee.target),
|
||||||
receiverType,
|
receiverType,
|
||||||
itablePlace.interfaceId,
|
itablePlace.interfaceId,
|
||||||
itablePlace.methodIndex,
|
itablePlace.methodIndex,
|
||||||
arguments,
|
|
||||||
mapReturnType(value.type, callee.target.returnType),
|
|
||||||
value
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
val vtableIndex = if (isAnyMethod)
|
|
||||||
context.getLayoutBuilder(context.irBuiltIns.anyClass.owner).vtableIndex(callee.target)
|
|
||||||
else
|
|
||||||
context.getLayoutBuilder(owner).vtableIndex(callee)
|
|
||||||
DataFlowIR.Node.VtableCall(
|
|
||||||
symbolTable.mapFunction(callee.target),
|
|
||||||
receiverType,
|
|
||||||
vtableIndex,
|
|
||||||
arguments,
|
|
||||||
mapReturnType(value.type, callee.target.returnType),
|
|
||||||
value
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
val actualCallee = value.actualCallee
|
|
||||||
DataFlowIR.Node.StaticCall(
|
|
||||||
symbolTable.mapFunction(actualCallee),
|
|
||||||
arguments,
|
arguments,
|
||||||
actualCallee.dispatchReceiverParameter?.let { symbolTable.mapType(it.type) },
|
mapReturnType(value.type, callee.target.returnType),
|
||||||
mapReturnType(value.type, actualCallee.returnType),
|
value
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
val vtableIndex = if (isAnyMethod)
|
||||||
|
context.getLayoutBuilder(context.irBuiltIns.anyClass.owner).vtableIndex(callee.target)
|
||||||
|
else
|
||||||
|
context.getLayoutBuilder(owner).vtableIndex(callee)
|
||||||
|
DataFlowIR.Node.VtableCall(
|
||||||
|
symbolTable.mapFunction(callee.target),
|
||||||
|
receiverType,
|
||||||
|
vtableIndex,
|
||||||
|
arguments,
|
||||||
|
mapReturnType(value.type, callee.target.returnType),
|
||||||
value
|
value
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
val actualCallee = value.actualCallee
|
||||||
|
DataFlowIR.Node.StaticCall(
|
||||||
|
symbolTable.mapFunction(actualCallee),
|
||||||
|
arguments,
|
||||||
|
actualCallee.dispatchReceiverParameter?.let { symbolTable.mapType(it.type) },
|
||||||
|
mapReturnType(value.type, actualCallee.returnType),
|
||||||
|
value
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,6 +231,13 @@ internal object EscapeAnalysis {
|
|||||||
for (value in node.values)
|
for (value in node.values)
|
||||||
assignRole(node, Role.ASSIGNED, RoleInfoEntry(value.node, null))
|
assignRole(node, Role.ASSIGNED, RoleInfoEntry(value.node, null))
|
||||||
}
|
}
|
||||||
|
is DataFlowIR.Node.AllocInstance,
|
||||||
|
is DataFlowIR.Node.Call,
|
||||||
|
is DataFlowIR.Node.Const,
|
||||||
|
is DataFlowIR.Node.FunctionReference,
|
||||||
|
is DataFlowIR.Node.Null,
|
||||||
|
is DataFlowIR.Node.Parameter,
|
||||||
|
is DataFlowIR.Node.Scope -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FunctionAnalysisResult(function, nodesRoles)
|
FunctionAnalysisResult(function, nodesRoles)
|
||||||
|
|||||||
@@ -136,6 +136,11 @@ internal object LocalEscapeAnalysis {
|
|||||||
is DataFlowIR.Node.Parameter -> {
|
is DataFlowIR.Node.Parameter -> {
|
||||||
node.escapeState = EscapeState.ARG_ESCAPE
|
node.escapeState = EscapeState.ARG_ESCAPE
|
||||||
}
|
}
|
||||||
|
is DataFlowIR.Node.AllocInstance,
|
||||||
|
is DataFlowIR.Node.Const,
|
||||||
|
is DataFlowIR.Node.FunctionReference,
|
||||||
|
is DataFlowIR.Node.Null,
|
||||||
|
is DataFlowIR.Node.Scope -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user