[kotlin compiler][update] 1.3.20-dev-2191

cherry-picked from 7a6a47ce3
This commit is contained in:
Vasily Levchenko
2018-12-03 14:32:54 +03:00
parent 49dc267eb4
commit 8fd7970119
17 changed files with 75 additions and 101 deletions
@@ -96,9 +96,6 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
@Argument(value="-Xcompatible-compiler-version", valueDescription = "<version>", description = "Assume the given compiler version to be binary compatible")
var compatibleCompilerVersions: Array<String>? = null
@Argument(value = "-Xdisable", deprecatedName = "--disable", valueDescription = "<Phase>", description = "Disable backend phase")
var disablePhases: Array<String>? = null
@Argument(value = EMBED_BITCODE_FLAG, description = "Embed LLVM IR bitcode as data")
var embedBitcode: Boolean = false
@@ -116,9 +113,6 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
)
var exportedLibraries: Array<String>? = null
@Argument(value= "-Xlist-phases", deprecatedName = "--list_phases", description = "List all backend phases")
var listPhases: Boolean = false
@Argument(value = "-Xprint-bitcode", deprecatedName = "--print_bitcode", description = "Print llvm bitcode")
var printBitCode: Boolean = false
@@ -146,9 +140,6 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xtime", deprecatedName = "--time", description = "Report execution time for compiler phases")
var timePhases: Boolean = false
@Argument(value = "-Xverbose", deprecatedName = "--verbose", valueDescription = "<Phase>", description = "Trace phase execution")
var verbosePhases: Array<String>? = null
@Argument(value = "-Xverify-bitcode", deprecatedName = "--verify_bitcode", description = "Verify llvm bitcode after each method")
var verifyBitCode: Boolean = false
@@ -102,8 +102,7 @@ internal val Context.getBoxFunction: (IrClass) -> IrSimpleFunction by Context.la
val startOffset = inlinedClass.startOffset
val endOffset = inlinedClass.endOffset
IrFunctionImpl(startOffset, endOffset, IrDeclarationOrigin.DEFINED, descriptor).apply {
this.returnType = returnType
IrFunctionImpl(startOffset, endOffset, IrDeclarationOrigin.DEFINED, descriptor, returnType).apply {
this.valueParameters.add(IrValueParameterImpl(
startOffset,
endOffset,
@@ -164,9 +163,7 @@ internal val Context.getUnboxFunction: (IrClass) -> IrSimpleFunction by Context.
val startOffset = inlinedClass.startOffset
val endOffset = inlinedClass.endOffset
IrFunctionImpl(startOffset, endOffset, IrDeclarationOrigin.DEFINED, descriptor).apply {
this.returnType = returnType
IrFunctionImpl(startOffset, endOffset, IrDeclarationOrigin.DEFINED, descriptor, returnType).apply {
this.valueParameters.add(IrValueParameterImpl(
startOffset,
endOffset,
@@ -167,9 +167,9 @@ internal class SpecialDeclarationsFactory(val context: Context) {
function.startOffset,
function.endOffset,
DECLARATION_ORIGIN_BRIDGE_METHOD(function),
bridgeDescriptor
bridgeDescriptor,
returnType
).apply {
this.returnType = returnType
this.parent = function.parent
}
@@ -52,8 +52,12 @@ internal class EnumSpecialDeclarationsFactory(val context: Context) {
val valuesField = IrFieldImpl(startOffset, endOffset, DECLARATION_ORIGIN_ENUM, valuesProperty, valuesType)
val valuesGetterDescriptor = createValuesGetterDescriptor(enumClassDescriptor, implObjectDescriptor)
val valuesGetter = IrFunctionImpl(startOffset, endOffset, DECLARATION_ORIGIN_ENUM, valuesGetterDescriptor).also {
it.returnType = valuesType
val valuesGetter = IrFunctionImpl(
startOffset, endOffset,
DECLARATION_ORIGIN_ENUM,
valuesGetterDescriptor,
valuesType
).also {
it.parent = implObject
it.createDispatchReceiverParameter()
}
@@ -461,10 +461,10 @@ private val Context.getLoweredInlineClassConstructor: (IrConstructor) -> IrSimpl
irConstructor.startOffset,
irConstructor.endOffset,
IrDeclarationOrigin.DEFINED,
descriptor
descriptor,
irConstructor.returnType
).apply {
parent = irConstructor.parent
returnType = irConstructor.returnType
irConstructor.valueParameters.mapTo(this.valueParameters) {
it.copy(this.descriptor.valueParameters[it.index])
}
@@ -101,10 +101,9 @@ internal class WorkersBridgesBuilding(val context: Context) : DeclarationContain
jobFunction.startOffset,
jobFunction.endOffset,
IrDeclarationOrigin.DEFINED,
runtimeJobDescriptor
runtimeJobDescriptor,
context.irBuiltIns.anyNType
).also {
it.returnType = context.irBuiltIns.anyNType
it.valueParameters += IrValueParameterImpl(
it.startOffset,
it.endOffset,
@@ -285,9 +285,9 @@ internal class CallableReferenceLowering(val context: Context): FileLoweringPass
startOffset = startOffset,
endOffset = endOffset,
origin = DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
symbol = symbol).apply {
returnType = functionReferenceClass.defaultType
symbol = symbol,
returnType = functionReferenceClass.defaultType
).apply {
val irBuilder = context.createIrBuilder(this.symbol, startOffset, endOffset)
@@ -369,9 +369,9 @@ internal class CallableReferenceLowering(val context: Context): FileLoweringPass
startOffset = startOffset,
endOffset = endOffset,
origin = DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
symbol = ourSymbol).apply {
returnType = superFunctionSymbol.owner.returnType // FIXME: substitute
symbol = ourSymbol,
returnType = superFunctionSymbol.owner.returnType // FIXME: substitute
).apply {
val function = this
val irBuilder = context.createIrBuilder(function.symbol, startOffset, endOffset)
@@ -685,11 +685,10 @@ internal class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescr
startOffset = declaration.startOffset,
endOffset = declaration.endOffset,
origin = mapDeclarationOrigin(declaration.origin),
descriptor = descriptor
descriptor = descriptor,
returnType = context.ir.translateErased(descriptor.returnType!!),
body = declaration.body?.transform(this, null)
).also {
it.returnType = context.ir.translateErased(descriptor.returnType!!)
it.body = declaration.body?.transform(this, null)
it.setOverrides(context.ir.symbols.symbolTable)
}.transformParameters1(declaration)
}
@@ -700,11 +699,10 @@ internal class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescr
startOffset = declaration.startOffset,
endOffset = declaration.endOffset,
origin = mapDeclarationOrigin(declaration.origin),
descriptor = descriptor
).also {
it.returnType = context.ir.translateErased(descriptor.returnType)
it.body = declaration.body?.transform(this, null)
}.transformParameters1(declaration)
descriptor = descriptor,
returnType = context.ir.translateErased(descriptor.returnType),
body = declaration.body?.transform(this, null)
).transformParameters1(declaration)
}
private fun FunctionDescriptor.getTypeParametersToTransform() =
@@ -520,11 +520,10 @@ internal class EnumClassLowering(val context: Context) : ClassLoweringPass {
loweredConstructorDescriptor.returnType = enumConstructor.descriptor.returnType
val loweredEnumConstructor = IrConstructorImpl(
enumConstructor.startOffset, enumConstructor.endOffset, enumConstructor.origin,
loweredConstructorDescriptor
).apply {
returnType = enumConstructor.returnType
body = enumConstructor.body!! // will be transformed later
}
loweredConstructorDescriptor,
enumConstructor.returnType,
enumConstructor.body!!
)
loweredEnumConstructor.valueParameters += valueParameters
loweredEnumConstructor.parent = enumConstructor.parent
@@ -105,9 +105,8 @@ internal class InitializersLowering(val context: CommonBackendContext) : ClassLo
val startOffset = irClass.startOffset
val endOffset = irClass.endOffset
val initializer = IrFunctionImpl(startOffset, endOffset, DECLARATION_ORIGIN_ANONYMOUS_INITIALIZER,
initializerMethodDescriptor)
initializerMethodDescriptor, context.irBuiltIns.unitType)
initializer.returnType = context.irBuiltIns.unitType
initializer.body = IrBlockBodyImpl(startOffset, endOffset, initializers)
initializer.parent = irClass
@@ -197,9 +197,9 @@ internal class InteropLoweringPart1(val context: Context) : IrBuildingTransforme
return IrFunctionImpl(
constructor.startOffset, constructor.endOffset, OVERRIDING_INITIALIZER_BY_CONSTRUCTOR,
resultDescriptor
resultDescriptor,
irClass.defaultType
).also { result ->
result.returnType = irClass.defaultType
result.parent = irClass
result.createDispatchReceiverParameter()
result.valueParameters += valueParameters
@@ -366,10 +366,9 @@ internal class InteropLoweringPart1(val context: Context) : IrBuildingTransforme
val newFunction = IrFunctionImpl(
function.startOffset, function.endOffset,
IrDeclarationOrigin.DEFINED,
newDescriptor
newDescriptor,
function.returnType
).apply {
this.returnType = function.returnType
parameterTypes.mapIndexedTo(this.valueParameters) { index, it ->
IrValueParameterImpl(
startOffset,
@@ -445,9 +445,9 @@ internal class SuspendFunctionsLowering(val context: Context): FileLoweringPass
startOffset = startOffset,
endOffset = endOffset,
origin = DECLARATION_ORIGIN_COROUTINE_IMPL,
symbol = symbol).apply {
returnType = coroutineClass.defaultType
symbol = symbol,
returnType = coroutineClass.defaultType
).apply {
this.valueParameters += constructorParameters
@@ -509,9 +509,9 @@ internal class SuspendFunctionsLowering(val context: Context): FileLoweringPass
startOffset = startOffset,
endOffset = endOffset,
origin = DECLARATION_ORIGIN_COROUTINE_IMPL,
symbol = symbol).apply {
returnType = coroutineClass.defaultType
symbol = symbol,
returnType = coroutineClass.defaultType
).apply {
this.valueParameters += constructorParameters
@@ -580,9 +580,9 @@ internal class SuspendFunctionsLowering(val context: Context): FileLoweringPass
startOffset = startOffset,
endOffset = endOffset,
origin = DECLARATION_ORIGIN_COROUTINE_IMPL,
symbol = symbol).apply {
returnType = coroutineClass.defaultType
symbol = symbol,
returnType = coroutineClass.defaultType
).apply {
parent = coroutineClass
this.valueParameters += parameters
@@ -660,9 +660,9 @@ internal class SuspendFunctionsLowering(val context: Context): FileLoweringPass
startOffset = startOffset,
endOffset = endOffset,
origin = DECLARATION_ORIGIN_COROUTINE_IMPL,
symbol = symbol).apply {
returnType = irFunction.returnType
symbol = symbol,
returnType = irFunction.returnType
).apply {
parent = coroutineClass
valueParameters += parameters
@@ -719,9 +719,9 @@ internal class SuspendFunctionsLowering(val context: Context): FileLoweringPass
startOffset = startOffset,
endOffset = endOffset,
origin = DECLARATION_ORIGIN_COROUTINE_IMPL,
symbol = symbol).apply {
returnType = context.irBuiltIns.anyNType
symbol = symbol,
returnType = context.irBuiltIns.anyNType
).apply {
parent = coroutineClass
this.createDispatchReceiverParameter()
@@ -946,9 +946,7 @@ internal class SuspendFunctionsLowering(val context: Context): FileLoweringPass
CallableMemberDescriptor.Kind.SYNTHESIZED,
SourceElement.NO_SOURCE).apply {
initialize(null, null, emptyList(), emptyList(), context.builtIns.unitType, Modality.ABSTRACT, Visibilities.PRIVATE)
}).apply {
returnType = context.irBuiltIns.unitType
}
}, context.irBuiltIns.unitType)
private val restoreState = IrFunctionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED,
SimpleFunctionDescriptorImpl.create(
@@ -958,9 +956,7 @@ internal class SuspendFunctionsLowering(val context: Context): FileLoweringPass
CallableMemberDescriptor.Kind.SYNTHESIZED,
SourceElement.NO_SOURCE).apply {
initialize(null, null, emptyList(), emptyList(), context.builtIns.unitType, Modality.ABSTRACT, Visibilities.PRIVATE)
}).apply {
returnType = context.irBuiltIns.unitType
}
}, context.irBuiltIns.unitType)
private inner class ExpressionSlicer(val suspensionPointIdType: IrType): IrElementTransformerVoid() {
// TODO: optimize - it has square complexity.
@@ -317,13 +317,11 @@ internal class TestProcessor (val context: KonanBackendContext) {
: GetterBuilder(objectSymbol.typeWithoutArguments, testSuite, getterName) {
override fun buildIr(): IrFunction = IrFunctionImpl(
UNDEFINED_OFFSET,
UNDEFINED_OFFSET,
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
TEST_SUITE_GENERATED_MEMBER,
symbol).apply {
this.returnType = this@ObjectGetterBuilder.returnType
symbol,
this@ObjectGetterBuilder.returnType
).apply {
val builder = context.createIrBuilder(symbol)
createParameterDeclarations(context.ir.symbols.symbolTable)
body = builder.irBlockBody {
@@ -342,13 +340,11 @@ internal class TestProcessor (val context: KonanBackendContext) {
: GetterBuilder(classSymbol.typeWithStarProjections, testSuite, getterName) {
override fun buildIr() = IrFunctionImpl(
startOffset = UNDEFINED_OFFSET,
endOffset = UNDEFINED_OFFSET,
origin = TEST_SUITE_GENERATED_MEMBER,
symbol = symbol).apply {
this.returnType = this@InstanceGetterBuilder.returnType
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
TEST_SUITE_GENERATED_MEMBER,
symbol,
this@InstanceGetterBuilder.returnType
).apply {
val builder = context.createIrBuilder(symbol)
createParameterDeclarations(context.ir.symbols.symbolTable)
body = builder.irBlockBody {
@@ -377,12 +373,11 @@ internal class TestProcessor (val context: KonanBackendContext) {
.single(predicate))
override fun buildIr() = IrConstructorImpl(
UNDEFINED_OFFSET,
UNDEFINED_OFFSET,
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
TEST_SUITE_GENERATED_MEMBER,
symbol).apply {
returnType = testSuite.typeWithStarProjections
symbol,
testSuite.typeWithStarProjections
).apply {
createParameterDeclarations(context.ir.symbols.symbolTable)
@@ -1205,10 +1205,7 @@ internal class IrDeserializer(val context: Context,
start: Int, end: Int, origin: IrDeclarationOrigin): IrFunction {
val body = deserializeStatement(proto.body)
val function = IrFunctionImpl(start, end, origin, descriptor)
function.returnType = descriptor.returnType!!.ir
function.body = body as IrBody
val function = IrFunctionImpl(start, end, origin, descriptor, descriptor.returnType!!.ir, body as IrBody)
function.createParameterDeclarations(context.ir.symbols.symbolTable)
function.setOverrides(context.ir.symbols.symbolTable)
@@ -106,9 +106,10 @@ private fun createFakeOverride(
fun FunctionDescriptor.createFunction(): IrSimpleFunction = IrFunctionImpl(
startOffset, endOffset,
IrDeclarationOrigin.FAKE_OVERRIDE, this
IrDeclarationOrigin.FAKE_OVERRIDE,
this,
symbolTable.translateErased(this@createFunction.returnType!!)
).apply {
returnType = symbolTable.translateErased(this@createFunction.returnType!!)
createParameterDeclarations(symbolTable)
}
@@ -162,9 +163,8 @@ private fun createFakeOverride(
// TODO: this function doesn't substitute types.
fun IrSimpleFunction.copyFake(descriptor: FunctionDescriptor): IrSimpleFunction = IrFunctionImpl(
irClass.startOffset, irClass.endOffset, IrDeclarationOrigin.FAKE_OVERRIDE, descriptor
irClass.startOffset, irClass.endOffset, IrDeclarationOrigin.FAKE_OVERRIDE, descriptor, returnType
).also {
it.returnType = returnType
it.parent = irClass
it.createDispatchReceiverParameter()
+1 -1
View File
@@ -1547,7 +1547,7 @@ task sort1(type: RunKonanTest) {
// when KT-26315 is fixed.
task sortWith(type: RunStandaloneKonanTest) {
source = "runtime/collections/SortWith.kt"
flags = ['-tr', '--disable', 'devirtualization']
flags = ['-tr', '-Xdisable=devirtualization']
arguments = ['--ktest_logger=SILENT']
}
+3 -3
View File
@@ -18,9 +18,9 @@
buildKotlinVersion=1.3.0-rc-116
buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_130_CompilerAllPlugins),number:1.3.0-rc-116,tag:kotlin-native,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.20-dev-2050,tag:kotlin-native,pinned:true/artifacts/content/maven
kotlinVersion=1.3.20-dev-2050
testKotlinVersion=1.3.20-dev-2050
kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_CompilerAllPlugins),number:1.3.20-dev-2191,tag:kotlin-native,pinned:true/artifacts/content/maven
kotlinVersion=1.3.20-dev-2191
testKotlinVersion=1.3.20-dev-2191
konanVersion=1.1.0
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.workers.max=4