[kotlin compiler][update] 1.3.40-dev-1234
This commit is contained in:
+3
-1
@@ -9,6 +9,8 @@ import org.jetbrains.kotlin.backend.konan.ir.*
|
||||
import org.jetbrains.kotlin.backend.konan.isInlined
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.isUnit
|
||||
import org.jetbrains.kotlin.types.SimpleType
|
||||
|
||||
@@ -218,7 +220,7 @@ internal tailrec fun IrDeclaration.findPackage(): IrPackageFragment {
|
||||
?: (parent as IrDeclaration).findPackage()
|
||||
}
|
||||
|
||||
fun IrFunction.isComparisonFunction(map: Map<SimpleType, IrSimpleFunction>): Boolean =
|
||||
fun IrFunctionSymbol.isComparisonFunction(map: Map<SimpleType, IrSimpleFunctionSymbol>): Boolean =
|
||||
this in map.values
|
||||
|
||||
val IrDeclaration.isPropertyAccessor get() =
|
||||
|
||||
+8
-8
@@ -2000,7 +2000,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
else args
|
||||
return when {
|
||||
function.isTypedIntrinsic -> intrinsicGenerator.evaluateCall(callee, args)
|
||||
function.origin == IrDeclarationOrigin.IR_BUILTINS_STUB -> evaluateOperatorCall(callee, argsWithContinuationIfNeeded)
|
||||
function.symbol in context.irBuiltIns.irBuiltInsSymbols -> evaluateOperatorCall(callee, argsWithContinuationIfNeeded)
|
||||
function is IrConstructor -> evaluateConstructorCall(callee, argsWithContinuationIfNeeded)
|
||||
else -> evaluateSimpleFunctionCall(function, argsWithContinuationIfNeeded, resultLifetime, callee.superQualifierSymbol?.owner)
|
||||
}
|
||||
@@ -2100,23 +2100,23 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
val ib = context.irModule!!.irBuiltins
|
||||
|
||||
with(functionGenerationContext) {
|
||||
val functionSymbol = function.symbol
|
||||
return when {
|
||||
function == ib.eqeqeqFun -> icmpEq(args[0], args[1])
|
||||
function.symbol == ib.booleanNotSymbol -> icmpNe(args[0], kTrue)
|
||||
|
||||
function.isComparisonFunction(ib.greaterFunByOperandType) -> {
|
||||
functionSymbol == ib.eqeqeqSymbol -> icmpEq(args[0], args[1])
|
||||
functionSymbol == ib.booleanNotSymbol -> icmpNe(args[0], kTrue)
|
||||
functionSymbol.isComparisonFunction(ib.greaterFunByOperandType) -> {
|
||||
if (args[0].type.isFloatingPoint()) fcmpGt(args[0], args[1])
|
||||
else icmpGt(args[0], args[1])
|
||||
}
|
||||
function.isComparisonFunction(ib.greaterOrEqualFunByOperandType) -> {
|
||||
functionSymbol.isComparisonFunction(ib.greaterOrEqualFunByOperandType) -> {
|
||||
if (args[0].type.isFloatingPoint()) fcmpGe(args[0], args[1])
|
||||
else icmpGe(args[0], args[1])
|
||||
}
|
||||
function.isComparisonFunction(ib.lessFunByOperandType) -> {
|
||||
functionSymbol.isComparisonFunction(ib.lessFunByOperandType) -> {
|
||||
if (args[0].type.isFloatingPoint()) fcmpLt(args[0], args[1])
|
||||
else icmpLt(args[0], args[1])
|
||||
}
|
||||
function.isComparisonFunction(ib.lessOrEqualFunByOperandType) -> {
|
||||
functionSymbol.isComparisonFunction(ib.lessOrEqualFunByOperandType) -> {
|
||||
if (args[0].type.isFloatingPoint()) fcmpLe(args[0], args[1])
|
||||
else icmpLe(args[0], args[1])
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ internal class LlvmDeclarations(
|
||||
private val staticFields: Map<IrField, StaticFieldLlvmDeclarations>,
|
||||
private val unique: Map<UniqueKind, UniqueLlvmDeclarations>) {
|
||||
fun forFunction(function: IrFunction) = functions[function] ?:
|
||||
error("${function.descriptor} in ${(function.parent as IrDeclaration).name}")
|
||||
error("${function.descriptor} in ${function.parent.fqNameSafe}")
|
||||
|
||||
fun forClass(irClass: IrClass) = classes[irClass] ?:
|
||||
error(irClass.descriptor.toString())
|
||||
|
||||
+1
-1
@@ -301,7 +301,7 @@ private class InlineClassTransformer(private val context: Context) : IrBuildingT
|
||||
putValueArgument(1, irNullPointer())
|
||||
}
|
||||
}
|
||||
is BinaryType.Reference -> irCall(context.irBuiltIns.eqeqeqFun).apply {
|
||||
is BinaryType.Reference -> irCall(context.irBuiltIns.eqeqeqSymbol).apply {
|
||||
putValueArgument(0, expression)
|
||||
putValueArgument(1, irNull())
|
||||
}
|
||||
|
||||
+15
-14
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.ir.types.makeNullable
|
||||
import org.jetbrains.kotlin.ir.util.irCall
|
||||
import org.jetbrains.kotlin.ir.builders.irGet
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.isNothing
|
||||
import org.jetbrains.kotlin.ir.types.toKotlinType
|
||||
@@ -69,19 +70,19 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
|
||||
return expression
|
||||
}
|
||||
|
||||
private fun ieee754EqualsDescriptors(): List<FunctionDescriptor> =
|
||||
irBuiltins.ieee754equalsFunByOperandType.values.map(IrSimpleFunction::descriptor)
|
||||
private fun ieee754EqualsSymbols(): List<IrSimpleFunctionSymbol> =
|
||||
irBuiltins.ieee754equalsFunByOperandType.values.toList()
|
||||
|
||||
private fun transformBuiltinOperator(expression: IrCall): IrExpression = when (expression.descriptor) {
|
||||
irBuiltins.eqeq, in ieee754EqualsDescriptors() -> lowerEqeq(expression)
|
||||
private fun transformBuiltinOperator(expression: IrCall): IrExpression = when (expression.symbol) {
|
||||
irBuiltins.eqeqSymbol, in ieee754EqualsSymbols() -> lowerEqeq(expression)
|
||||
|
||||
irBuiltins.eqeqeq -> lowerEqeqeq(expression)
|
||||
irBuiltins.eqeqeqSymbol -> lowerEqeqeq(expression)
|
||||
|
||||
irBuiltins.throwNpe -> IrCallImpl(expression.startOffset, expression.endOffset,
|
||||
irBuiltins.throwNpeSymbol -> IrCallImpl(expression.startOffset, expression.endOffset,
|
||||
context.ir.symbols.ThrowNullPointerException.owner.returnType,
|
||||
context.ir.symbols.ThrowNullPointerException)
|
||||
|
||||
irBuiltins.noWhenBranchMatchedException -> IrCallImpl(expression.startOffset, expression.endOffset,
|
||||
irBuiltins.noWhenBranchMatchedExceptionSymbol -> IrCallImpl(expression.startOffset, expression.endOffset,
|
||||
context.ir.symbols.ThrowNoWhenBranchMatchedException.owner.returnType,
|
||||
context.ir.symbols.ThrowNoWhenBranchMatchedException)
|
||||
|
||||
@@ -129,12 +130,12 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
|
||||
if (expression.symbol == irBuiltins.eqeqSymbol) {
|
||||
lhs.type.getInlinedClass()?.let {
|
||||
if (it == rhs.type.getInlinedClass() && inlinedClassHasDefaultEquals(it)) {
|
||||
return genInlineClassEquals(expression.descriptor, rhs, lhs)
|
||||
return genInlineClassEquals(expression.symbol, rhs, lhs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return genFloatingOrReferenceEquals(expression.descriptor, lhs, rhs)
|
||||
return genFloatingOrReferenceEquals(expression.symbol, lhs, rhs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +156,7 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
|
||||
}
|
||||
|
||||
fun IrBuilderWithScope.genInlineClassEquals(
|
||||
descriptor: FunctionDescriptor,
|
||||
symbol: IrFunctionSymbol,
|
||||
rhs: IrExpression,
|
||||
lhs: IrExpression
|
||||
): IrExpression {
|
||||
@@ -176,7 +177,7 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
|
||||
val rhsRawType = irBuiltins.anyClass.owner.defaultOrNullableType(rhsBinaryType.nullable)
|
||||
|
||||
genFloatingOrReferenceEquals(
|
||||
descriptor,
|
||||
symbol,
|
||||
reinterpret(lhs, lhsRawType),
|
||||
reinterpret(rhs, rhsRawType)
|
||||
)
|
||||
@@ -201,11 +202,11 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
|
||||
private fun IrBuilderWithScope.irIsNull(exp: IrExpression) = irEqeqeq(exp, irNull())
|
||||
private fun IrBuilderWithScope.irIsNotNull(exp: IrExpression) = irNot(irEqeqeq(exp, irNull()))
|
||||
|
||||
private fun IrBuilderWithScope.genFloatingOrReferenceEquals(descriptor: FunctionDescriptor, lhs: IrExpression, rhs: IrExpression): IrExpression {
|
||||
private fun IrBuilderWithScope.genFloatingOrReferenceEquals(symbol: IrFunctionSymbol, lhs: IrExpression, rhs: IrExpression): IrExpression {
|
||||
// TODO: areEqualByValue and ieee754Equals intrinsics are specially treated by code generator
|
||||
// and thus can be declared synthetically in the compiler instead of explicitly in the runtime.
|
||||
fun callEquals(lhs: IrExpression, rhs: IrExpression) =
|
||||
if (descriptor in ieee754EqualsDescriptors())
|
||||
if (symbol in ieee754EqualsSymbols())
|
||||
// Find a type-compatible `konan.internal.ieee754Equals` intrinsic:
|
||||
irCall(selectIntrinsic(symbols.ieee754Equals, lhs.type, rhs.type, true)!!).apply {
|
||||
putValueArgument(0, lhs)
|
||||
@@ -220,7 +221,7 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
|
||||
val lhsIsNotNullable = !lhs.type.containsNull()
|
||||
val rhsIsNotNullable = !rhs.type.containsNull()
|
||||
|
||||
return if (descriptor in ieee754EqualsDescriptors()) {
|
||||
return if (symbol in ieee754EqualsSymbols()) {
|
||||
if (lhsIsNotNullable && rhsIsNotNullable)
|
||||
callEquals(lhs, rhs)
|
||||
else irBlock {
|
||||
|
||||
+3
-2
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
@@ -157,7 +158,7 @@ private class RangeLoopTransformer(
|
||||
val compareTo = symbols.getBinaryOperator(OperatorNameConventions.COMPARE_TO,
|
||||
forLoopHeader.bound.type.toKotlinType(),
|
||||
minConst.type.toKotlinType())
|
||||
return irCall(irBuiltIns.greaterFunByOperandType[irBuiltIns.int]?.symbol!!).apply {
|
||||
return irCall(irBuiltIns.greaterFunByOperandType[irBuiltIns.int]!!).apply {
|
||||
val compareToCall = irCall(compareTo).apply {
|
||||
dispatchReceiver = irGet(forLoopHeader.bound)
|
||||
putValueArgument(0, minConst)
|
||||
@@ -176,7 +177,7 @@ private class RangeLoopTransformer(
|
||||
loopHeader.inductionVariable.type.toKotlinType(),
|
||||
loopHeader.last.type.toKotlinType())
|
||||
|
||||
val check = irCall(comparingBuiltIn).apply {
|
||||
val check = irCall(comparingBuiltIn as IrFunctionSymbol).apply {
|
||||
putValueArgument(0, irCallOp(compareTo.owner, irGet(loopHeader.inductionVariable), irGet(loopHeader.last)))
|
||||
putValueArgument(1, irInt(0))
|
||||
}
|
||||
|
||||
+5
-4
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.util.isSimpleTypeWithQuestionMark
|
||||
@@ -49,9 +50,9 @@ internal class ProgressionLoopHeader(
|
||||
private val increasing = headerInfo.increasing
|
||||
|
||||
fun comparingFunction(builtIns: IrBuiltIns) = if (increasing)
|
||||
builtIns.lessOrEqualFunByOperandType[builtIns.int]?.symbol!!
|
||||
builtIns.lessOrEqualFunByOperandType[builtIns.int]
|
||||
else
|
||||
builtIns.greaterOrEqualFunByOperandType[builtIns.int]?.symbol!!
|
||||
builtIns.greaterOrEqualFunByOperandType[builtIns.int]
|
||||
|
||||
override fun initializeLoopVariable(symbols: KonanSymbols, builder: DeclarationIrBuilder) = with(builder) {
|
||||
irGet(inductionVariable)
|
||||
@@ -99,8 +100,8 @@ internal class ArrayLoopHeader(
|
||||
|
||||
override fun buildBody(builder: DeclarationIrBuilder, loop: IrLoop, newBody: IrExpression?): IrLoop = with (builder) {
|
||||
val builtIns = context.irBuiltIns
|
||||
val callee = builtIns.lessOrEqualFunByOperandType[builtIns.int]?.symbol!!
|
||||
val newCondition = irCall(callee).apply {
|
||||
val callee = builtIns.lessOrEqualFunByOperandType[builtIns.int]
|
||||
val newCondition = irCall(callee as IrFunctionSymbol).apply {
|
||||
putValueArgument(0, irGet(inductionVariable))
|
||||
putValueArgument(1, irGet(last))
|
||||
}
|
||||
|
||||
+1
-1
@@ -582,7 +582,7 @@ internal object DataFlowIR {
|
||||
if (returnsNothing)
|
||||
attributes = attributes or FunctionAttributes.RETURNS_NOTHING
|
||||
val symbol = when {
|
||||
it.isExternal || (it.origin == IrDeclarationOrigin.IR_BUILTINS_STUB) -> {
|
||||
it.isExternal || (it.symbol in context.irBuiltIns.irBuiltInsSymbols) -> {
|
||||
val escapesAnnotation = it.descriptor.annotations.findAnnotation(FQ_NAME_ESCAPES)
|
||||
val pointsToAnnotation = it.descriptor.annotations.findAnnotation(FQ_NAME_POINTS_TO)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
||||
-4
@@ -15,7 +15,3 @@ class KonanDeclarationTable(builtIns: IrBuiltIns, descriptorTable: DescriptorTab
|
||||
loadKnownBuiltins()
|
||||
}
|
||||
}
|
||||
|
||||
// This is what we pre-populate tables with.
|
||||
val IrBuiltIns.knownBuiltins
|
||||
get() = irBuiltInsExternalPackageFragment.declarations
|
||||
|
||||
+2
-2
@@ -24,13 +24,13 @@ internal fun IrModuleFragment.replaceUnboundSymbols(context: Context) {
|
||||
val collector = DeclarationSymbolCollector()
|
||||
with(collector) {
|
||||
with(irBuiltins) {
|
||||
for (op in arrayOf(eqeqeqFun, eqeqFun, throwNpeFun, noWhenBranchMatchedExceptionFun) +
|
||||
for (op in arrayOf(eqeqeqSymbol, eqeqSymbol, throwNpeSymbol, noWhenBranchMatchedExceptionSymbol) +
|
||||
lessFunByOperandType.values +
|
||||
lessOrEqualFunByOperandType.values +
|
||||
greaterOrEqualFunByOperandType.values +
|
||||
greaterFunByOperandType.values +
|
||||
ieee754equalsFunByOperandType.values) {
|
||||
register(op.symbol)
|
||||
register(op)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
cli_bc project(path: ':backend.native', configuration: 'cli_bc')
|
||||
update_tests (group: 'org', name: 'Kotlin_dev_CompilerAllPlugins', version: testKotlinVersion) {
|
||||
update_tests (group: 'org', name: 'Kotlin_dev_Compiler', version: testKotlinVersion) {
|
||||
artifact {
|
||||
name = 'internal/kotlin-test-data'
|
||||
type = 'zip'
|
||||
|
||||
@@ -216,6 +216,11 @@ abstract class KonanTest extends JavaExec {
|
||||
| var finished = false
|
||||
|
|
||||
| var proceed: () -> Unit = {}
|
||||
| fun reset() {
|
||||
| counter = 0
|
||||
| finished = false
|
||||
| proceed = {}
|
||||
| }
|
||||
|
|
||||
| suspend fun suspendHere() = suspendCoroutine<Unit> { c ->
|
||||
| counter++
|
||||
|
||||
+5
-5
@@ -15,12 +15,12 @@
|
||||
#
|
||||
|
||||
# A version of the Kotlin "toolchain" (compiler, runtime, stdlib etc) used by the build script.
|
||||
buildKotlinVersion=1.3.30-dev-1945
|
||||
buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_CompilerAllPlugins),number:1.3.30-dev-1945,pinned:true/artifacts/content/maven
|
||||
buildKotlinVersion=1.3.40-dev-431
|
||||
buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_Compiler),number:1.3.40-dev-431,pinned:true/artifacts/content/maven
|
||||
remoteRoot=konan_tests
|
||||
kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_CompilerAllPlugins),number:1.3.40-dev-990,branch:default:true,pinned:true/artifacts/content/maven
|
||||
kotlinVersion=1.3.40-dev-990
|
||||
testKotlinVersion=1.3.40-dev-990
|
||||
kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_Compiler),number:1.3.40-dev-1234,branch:default:true,pinned:true/artifacts/content/maven
|
||||
kotlinVersion=1.3.40-dev-1234
|
||||
testKotlinVersion=1.3.40-dev-1234
|
||||
sharedRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinNativeShared_BuildAndTest),number:1.0-dev-23,branch:default:true,pinned:true/artifacts/content/maven
|
||||
sharedVersion=1.0-dev-23
|
||||
konanVersion=1.3.0
|
||||
|
||||
Reference in New Issue
Block a user