[JS IR] Update IC depends graph after intrinsics loading

- Remove unused params from compilerWithIC wrapper.
- Move JsIrBackendContext creation logic into separate function
- Introduce and use compiler interface for IC infrastructure

On dirty rebuild we may reload IR from stdlib,
such reloading may affect files with intrinsics and builtins.
As soon as we load only exported symbols, we must track dependencies
for files with intrinsics or builtins as for others.
This patch implements the logic which updates dependencies for
the stdlib files after loading of intrinsics and builtins.

^KT-54323 Fixed
This commit is contained in:
Alexander Korepanov
2022-10-12 22:14:15 +00:00
committed by Space Team
parent 31ba1f1534
commit 7b2c125754
40 changed files with 628 additions and 170 deletions
@@ -0,0 +1,15 @@
interface MyInterface {
fun interfaceFunction(): String
}
class MyClass1 {
companion object {
fun companionFunction() = 0
}
}
class MyClass2 {
companion object {
fun companionFunction() = "0"
}
}
@@ -0,0 +1,15 @@
interface MyInterface {
fun interfaceFunction(): String
}
class MyClass1 {
companion object {
fun companionFunction() = 1
}
}
class MyClass2 {
companion object {
fun companionFunction() = "1"
}
}
@@ -0,0 +1,8 @@
STEP 0:
modifications:
U : l1.0.kt -> l1.kt
added file: l1.kt
STEP 1:
modifications:
U : l1.1.kt -> l1.kt
modified ir: l1.kt
@@ -0,0 +1,15 @@
inline fun makeMyInterfaceObject(x: Boolean): MyInterface {
return if (x) {
object : MyInterface {
override fun interfaceFunction(): String {
return MyClass1.companionFunction().toString()
}
}
} else {
object : MyInterface {
override fun interfaceFunction(): String {
return MyClass2.companionFunction()
}
}
}
}
@@ -0,0 +1,7 @@
STEP 0:
dependencies: lib1
modifications:
U : l2.0.kt -> l2.kt
added file: l2.kt
STEP 1:
dependencies: lib1
@@ -0,0 +1,10 @@
fun box(stepId: Int): String {
when (stepId) {
0, 1 -> {
if (makeMyInterfaceObject(false).interfaceFunction() != "$stepId") return "Fail x = false"
if (makeMyInterfaceObject(true).interfaceFunction() != "$stepId") return "Fail x = true"
}
else -> return "Unknown"
}
return "OK"
}
@@ -0,0 +1,5 @@
STEP 0:
dependencies: lib1, lib2
added file: m.kt
STEP 1:
dependencies: lib1, lib2
@@ -0,0 +1,8 @@
MODULES: lib1, lib2, main
STEP 0:
libs: lib1, lib2, main
dirty js: lib1, lib2, main
STEP 1:
libs: lib1, lib2, main
dirty js: lib1