[JS IR] Fix IC invalidation process when symbols are modified

The patch fixes the cases of IC invalidation when symbols are modified:
 adding and removing inline, data, in, out, suspend qualifiers.

 For that purpose an extra hash is used.
 It is written in a direct dependency graph into an IC cache metadata file.
 For inline functions a transitive hash is used.
 For non-inline functions, classes, and others a symbol hash is used.
 The invalidation routine marks the file as dirty
 (with 'updated imports' state) if hash is modified.

^KT-51083 Fixed
^KT-51088 Fixed
^KT-51090 Fixed
^KT-51099 Fixed
This commit is contained in:
Alexander Korepanov
2022-06-15 19:53:13 +02:00
committed by Space
parent 644447db84
commit 5b4e9e2966
62 changed files with 279 additions and 202 deletions
@@ -0,0 +1,2 @@
data class Demo(val x: Int) {
}
@@ -1,3 +0,0 @@
// TODO: After KT-51088, m.kt from main module must be dirty
class Demo(val x: Int) {
}
@@ -1,3 +0,0 @@
// TODO: After KT-51088, m.kt from main module must be dirty
data class Demo(val x: Int) {
}
@@ -0,0 +1,2 @@
class Demo(val x: Int) {
}
@@ -1,3 +1,2 @@
// TODO: After KT-51088, m.kt from main module must be dirty
inline class Demo(val x: Int) {
}
@@ -1,16 +1,19 @@
STEP 0:
modifications:
U : l1.0_simple_class.kt -> l1.kt
U : l1.0_data_class.kt -> l1.kt
added file: l1.kt
STEP 1:
modifications:
U : l1.1_data_class.kt -> l1.kt
U : l1.1_simple_class.kt -> l1.kt
modified ir: l1.kt
updated exports: l1.kt
STEP 2:
modifications:
U : l1.0_simple_class.kt -> l1.kt
modified ir: l1.kt
STEP 3:
modifications:
U : l1.2_inline_class.kt -> l1.kt
modified ir: l1.kt
updated exports: l1.kt
STEP 3:
modifications:
U : l1.1_simple_class.kt -> l1.kt
modified ir: l1.kt
updated exports: l1.kt
@@ -1,8 +1,18 @@
fun box(stepId: Int): String {
val d = Demo(15)
when (stepId) {
0, 2 -> if (Demo(15) == Demo(15)) return "Fail"
1, 3 -> if (Demo(15) != Demo(15)) return "Fail"
0, 2 -> {
if (!testEquals(d, Demo(15))) return "Fail equals"
if (testHashCode(d) != Demo(15).hashCode()) return "Fail hashCode"
if (testToString(d) != "Demo(x=15)") return "Fail toString"
}
1, 3-> {
if (testEquals(d, Demo(15))) return "Fail equals"
if (testHashCode(d) == Demo(15).hashCode()) return "Fail hashCode"
if (testToString(d) != "[object Object]") return "Fail toString"
}
else -> return "Unknown"
}
return "OK"
}
@@ -1,5 +1,6 @@
STEP 0:
dependencies: lib1
added file: m.kt
added file: m.kt, testEquals.kt, testHashCode.kt, testToString.kt
STEP 1..3:
dependencies: lib1
updated imports: m.kt, testEquals.kt, testHashCode.kt, testToString.kt
@@ -0,0 +1,3 @@
fun testEquals(lhs: Demo, rhs: Demo): Boolean {
return lhs == rhs
}
@@ -0,0 +1,3 @@
fun testHashCode(d: Demo): Int {
return d.hashCode()
}
@@ -0,0 +1,3 @@
fun testToString(d: Demo): String {
return d.toString()
}
@@ -5,4 +5,4 @@ STEP 0:
dirty js: lib1, main
STEP 1..3:
libs: lib1, main
dirty js: lib1
dirty js: lib1, main