[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:
committed by
Space Team
parent
31ba1f1534
commit
7b2c125754
+15
@@ -0,0 +1,15 @@
|
||||
interface MyInterface {
|
||||
fun interfaceFunction(): String
|
||||
}
|
||||
|
||||
class MyClass1 {
|
||||
companion object {
|
||||
fun companionFunction() = 0
|
||||
}
|
||||
}
|
||||
|
||||
class MyClass2 {
|
||||
companion object {
|
||||
fun companionFunction() = "0"
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
interface MyInterface {
|
||||
fun interfaceFunction(): String
|
||||
}
|
||||
|
||||
class MyClass1 {
|
||||
companion object {
|
||||
fun companionFunction() = 1
|
||||
}
|
||||
}
|
||||
|
||||
class MyClass2 {
|
||||
companion object {
|
||||
fun companionFunction() = "1"
|
||||
}
|
||||
}
|
||||
+8
@@ -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
|
||||
+15
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
STEP 0:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2.0.kt -> l2.kt
|
||||
added file: l2.kt
|
||||
STEP 1:
|
||||
dependencies: lib1
|
||||
+10
@@ -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"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
STEP 0:
|
||||
dependencies: lib1, lib2
|
||||
added file: m.kt
|
||||
STEP 1:
|
||||
dependencies: lib1, lib2
|
||||
+8
@@ -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
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class TestClass1 {
|
||||
enum class TestEnum {
|
||||
A, B
|
||||
}
|
||||
}
|
||||
|
||||
inline fun foo1(): List<Enum<*>> {
|
||||
return TestClass1.TestEnum.values().toList()
|
||||
}
|
||||
|
||||
inline fun foo2(): List<Enum<*>> {
|
||||
return emptyList()
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
class TestClass1 {
|
||||
enum class TestEnum {
|
||||
A, B
|
||||
}
|
||||
}
|
||||
|
||||
class TestClass2 {
|
||||
enum class TestEnum {
|
||||
A, B, C
|
||||
}
|
||||
}
|
||||
|
||||
inline fun foo1(): List<Enum<*>> {
|
||||
return TestClass1.TestEnum.values().toList()
|
||||
}
|
||||
|
||||
inline fun foo2(): List<Enum<*>> {
|
||||
return TestClass2.TestEnum.values().toList()
|
||||
}
|
||||
|
||||
inline fun foo3(): List<Enum<*>> {
|
||||
return emptyList()
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
class TestClass1 {
|
||||
enum class TestEnum {
|
||||
A, B
|
||||
}
|
||||
}
|
||||
|
||||
class TestClass3 {
|
||||
enum class TestEnum {
|
||||
A
|
||||
}
|
||||
}
|
||||
|
||||
inline fun foo1(): List<Enum<*>> {
|
||||
return TestClass1.TestEnum.values().toList()
|
||||
}
|
||||
|
||||
inline fun foo2(): List<Enum<*>> {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
inline fun foo3(): List<Enum<*>> {
|
||||
return TestClass3.TestEnum.values().toList()
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
inline fun foo1(): List<Enum<*>> {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
inline fun foo2(): List<Enum<*>> {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
inline fun foo3(): List<Enum<*>> {
|
||||
return emptyList()
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
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
|
||||
STEP 2:
|
||||
modifications:
|
||||
U : l1.2.kt -> l1.kt
|
||||
modified ir: l1.kt
|
||||
STEP 3:
|
||||
updated exports: l1.kt
|
||||
STEP 4:
|
||||
modifications:
|
||||
U : l1.4.kt -> l1.kt
|
||||
modified ir: l1.kt
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class TestClass100 {
|
||||
enum class TestEnum {
|
||||
A, B
|
||||
}
|
||||
}
|
||||
|
||||
fun testEnums(): List<Enum<*>> {
|
||||
val enums1 = foo1()
|
||||
val enums2 = foo2()
|
||||
|
||||
return TestClass100.TestEnum.values().toList() + enums1 + enums2
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class TestClass2 {
|
||||
enum class TestEnum {
|
||||
A, B
|
||||
}
|
||||
}
|
||||
|
||||
fun testEnums(): List<Enum<*>> {
|
||||
val enums1 = foo1()
|
||||
val enums3 = foo3()
|
||||
|
||||
return TestClass2.TestEnum.values().toList() + enums1 + enums3
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
STEP 0:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2.0.kt -> l2.kt
|
||||
added file: l2.kt
|
||||
STEP 1:
|
||||
dependencies: lib1
|
||||
updated imports: l2.kt
|
||||
STEP 2:
|
||||
dependencies: lib1
|
||||
updated imports: l2.kt
|
||||
STEP 3:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2.3.kt -> l2.kt
|
||||
modified ir: l2.kt
|
||||
STEP 4:
|
||||
dependencies: lib1
|
||||
updated imports: l2.kt
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
fun box(stepId: Int): String {
|
||||
val enums = testEnums()
|
||||
when (stepId) {
|
||||
0 -> if (enums.toString() != "[A, B, A, B]") return "Fail, got $enums"
|
||||
1 -> if (enums.toString() != "[A, B, A, B, A, B, C]") return "Fail, got $enums"
|
||||
2 -> if (enums.toString() != "[A, B, A, B]") return "Fail, got $enums"
|
||||
3 -> if (enums.toString() != "[A, B, A, B, A]") return "Fail, got $enums"
|
||||
4 -> if (enums.toString() != "[A, B]") return "Fail, got $enums"
|
||||
else -> return "Unknown"
|
||||
}
|
||||
|
||||
for (i1 in 0..enums.size - 1) {
|
||||
for (i2 in 0..enums.size - 1) {
|
||||
if (i1 == i2) {
|
||||
continue
|
||||
}
|
||||
if (enums[i1] == enums[i2]) {
|
||||
return "Fail eq2"
|
||||
}
|
||||
if (enums[i1] === enums[i2]) {
|
||||
return "Fail eq3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
STEP 0:
|
||||
dependencies: lib1, lib2
|
||||
added file: m.kt
|
||||
STEP 1..4:
|
||||
dependencies: lib1, lib2
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
MODULES: lib1, lib2, main
|
||||
|
||||
STEP 0..4:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2, main
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
inline fun foo() = 0
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
inline fun foo() : Int {
|
||||
val x: Any? = "1"
|
||||
return x as Int
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
inline fun foo() : Int {
|
||||
val x: Any? = null
|
||||
return x!! as Int
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
inline fun foo() : Int {
|
||||
throw NumberFormatException()
|
||||
return 5
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
inline fun foo() = 6
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
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
|
||||
STEP 2:
|
||||
STEP 3:
|
||||
modifications:
|
||||
U : l1.3.8.kt -> l1.kt
|
||||
modified ir: l1.kt
|
||||
STEP 4:
|
||||
STEP 5:
|
||||
modifications:
|
||||
U : l1.5.kt -> l1.kt
|
||||
modified ir: l1.kt
|
||||
STEP 6:
|
||||
modifications:
|
||||
U : l1.6.kt -> l1.kt
|
||||
modified ir: l1.kt
|
||||
STEP 7:
|
||||
STEP 8:
|
||||
modifications:
|
||||
U : l1.3.8.kt -> l1.kt
|
||||
modified ir: l1.kt
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
fun qux(): Int {
|
||||
return foo()
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
fun qux(): Int {
|
||||
try {
|
||||
return foo()
|
||||
} catch(ex: ClassCastException) {
|
||||
return 2
|
||||
}
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
fun qux(): Int {
|
||||
try {
|
||||
return foo()
|
||||
} catch(ex: NullPointerException) {
|
||||
return 4
|
||||
}
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
fun qux(): Int {
|
||||
return foo() + 1
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
STEP 0:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2.0.kt -> l2.kt
|
||||
added file: l2.kt
|
||||
STEP 1:
|
||||
dependencies: lib1
|
||||
updated imports: l2.kt
|
||||
STEP 2:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2.2.kt -> l2.kt
|
||||
modified ir: l2.kt
|
||||
STEP 3:
|
||||
dependencies: lib1
|
||||
updated imports: l2.kt
|
||||
STEP 4:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2.4.kt -> l2.kt
|
||||
modified ir: l2.kt
|
||||
STEP 5..6:
|
||||
dependencies: lib1
|
||||
updated imports: l2.kt
|
||||
STEP 7:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2.7.kt -> l2.kt
|
||||
modified ir: l2.kt
|
||||
STEP 8:
|
||||
dependencies: lib1
|
||||
updated imports: l2.kt
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
fun box(stepId: Int): String {
|
||||
when (stepId) {
|
||||
0, 2, 4, 6, 7 -> if (qux() != stepId) return "Fail"
|
||||
1, 3, 5, 8 -> {
|
||||
try {
|
||||
val r = qux()
|
||||
return "Fail, got $r"
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
else -> return "Unknown"
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
STEP 0:
|
||||
dependencies: lib1, lib2
|
||||
added file: m.kt
|
||||
STEP 1..8:
|
||||
dependencies: lib1, lib2
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
MODULES: lib1, lib2, main
|
||||
|
||||
STEP 0:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2, main
|
||||
STEP 1:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2
|
||||
STEP 2:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2, main
|
||||
STEP 3:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2
|
||||
STEP 4:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib2, main
|
||||
STEP 5..6:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2
|
||||
STEP 7:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib2
|
||||
STEP 8:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2
|
||||
Reference in New Issue
Block a user