JVM IR: extract separate module backend.jvm.codegen

The main benefit is that now lowerings and codegen are compiled in
parallel, which speeds up the build. Hopefully, this will also improve
incremental compilation in case of implementation changes because the
rest of the compiler (cli & tests) has no "api" dependency on lowerings
and codegen.
This commit is contained in:
Alexander Udalov
2021-09-15 01:48:16 +02:00
parent 616cec8527
commit a95375cd9f
68 changed files with 26 additions and 4 deletions
+1
View File
@@ -242,6 +242,7 @@ val fe10CompilerModules = arrayOf(
":compiler:ir.psi2ir",
":compiler:backend.jvm",
":compiler:backend.jvm.lower",
":compiler:backend.jvm.codegen",
":compiler:backend.jvm.entrypoint",
":compiler:backend.js",
":compiler:backend.wasm",
+1 -2
View File
@@ -4,13 +4,12 @@ plugins {
}
dependencies {
api(project(":kotlin-annotations-jvm"))
api(project(":compiler:backend"))
api(project(":compiler:ir.tree"))
api(project(":compiler:ir.backend.common"))
api(project(":compiler:backend.common.jvm"))
compileOnly(project(":compiler:ir.tree.impl"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "asm-all", "guava", rootProject = rootProject) }
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "asm-all", rootProject = rootProject) }
}
sourceSets {
@@ -0,0 +1,19 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
api(project(":compiler:ir.tree"))
api(project(":compiler:ir.backend.common"))
api(project(":compiler:backend.jvm"))
implementation(project(":compiler:ir.tree.impl"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core", rootProject = rootProject) }
}
sourceSets {
"main" {
projectDefault()
}
"test" {}
}
@@ -9,6 +9,7 @@ dependencies {
api(project(":compiler:ir.tree.impl"))
api(project(":compiler:ir.serialization.jvm"))
implementation(project(":compiler:backend.jvm.lower"))
implementation(project(":compiler:backend.jvm.codegen"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core", rootProject = rootProject) }
}
@@ -67,7 +67,7 @@ private class IrJvmFlexibleTypeImpl(
}
}
internal fun IrType.isWithFlexibleNullability(): Boolean =
fun IrType.isWithFlexibleNullability(): Boolean =
hasAnnotation(JvmSymbols.FLEXIBLE_NULLABILITY_ANNOTATION_FQ_NAME)
internal fun IrType.isWithFlexibleMutability(): Boolean =
@@ -385,7 +385,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
}
// TODO get rid of 'caller' argument
internal fun mapToCallableMethod(expression: IrCall, caller: IrFunction?): IrCallableMethod {
fun mapToCallableMethod(expression: IrCall, caller: IrFunction?): IrCallableMethod {
val callee = expression.symbol.owner
val calleeParent = expression.superQualifierSymbol?.owner
?: expression.dispatchReceiver?.type?.classOrNull?.owner?.let {
+2
View File
@@ -140,6 +140,7 @@ include ":benchmarks",
":compiler:backend.wasm",
":compiler:backend.jvm",
":compiler:backend.jvm.lower",
":compiler:backend.jvm.codegen",
":compiler:backend.jvm.entrypoint",
":compiler:backend-common",
":compiler:backend",
@@ -588,6 +589,7 @@ project(':compiler:backend.js').projectDir = "$rootDir/compiler/ir/backend.js" a
project(':compiler:backend.wasm').projectDir = "$rootDir/compiler/ir/backend.wasm" as File
project(':compiler:backend.jvm').projectDir = "$rootDir/compiler/ir/backend.jvm" as File
project(':compiler:backend.jvm.lower').projectDir = "$rootDir/compiler/ir/backend.jvm/lower" as File
project(':compiler:backend.jvm.codegen').projectDir = "$rootDir/compiler/ir/backend.jvm/codegen" as File
project(':compiler:backend.jvm.entrypoint').projectDir = "$rootDir/compiler/ir/backend.jvm/entrypoint" as File
project(':compiler:ir.serialization.common').projectDir = "$rootDir/compiler/ir/serialization.common" as File
project(':compiler:ir.serialization.jvm').projectDir = "$rootDir/compiler/ir/serialization.jvm" as File