[JS IR] Rework incremental cache invalidation
Replace loading the whole world IR with loading only exported (reachable) IR.
For that purpose the direct and inverse dependency graph is used.
It is stored in a cache directory and the cache updater keeps it up to date.
If after loading it is found that other files must be also implicitly rebuilt
(see rebuilt reasons below), IR for that files also will be loaded.
This algorithm repeats until the number of implicitly rebuilt files is not 0.
More rebuilt reasons (dirty state) have been added:
- added file: this is a new file;
- modified ir: ir of the file has been updated;
- updated exports: exports from the file have been added or removed
(e.g. a function has been used from another file);
- updated inline imports: imported inline function has been modified
(transitively);
- removed inverse depends: a dependent file has been removed;
- removed direct depends: a dependency file has been removed;
- removed file: this file has been removed.
Incremental cache tests has been refactored:
- The supporting of all rebuilt reasons (dirty states) has been added;
- New file name format "*.$suffix.kt" for the test steps has been allowed,
so the syntax highlight works now;
- Explicit stdlib dependency usage has been removed.
This commit is contained in:
committed by
Space
parent
f003f19e1d
commit
9e780afdca
@@ -0,0 +1 @@
|
||||
fun fun1() = "fun1"
|
||||
@@ -0,0 +1 @@
|
||||
fun fun2() = "fun2"
|
||||
@@ -0,0 +1 @@
|
||||
fun fun3() = "fun3"
|
||||
@@ -0,0 +1 @@
|
||||
fun fun4() = "fun4"
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
STEP 0:
|
||||
added file: l1a.kt, l1b.kt, l1c.kt, l1d.kt
|
||||
STEP 1:
|
||||
STEP 2:
|
||||
updated exports: l1c.kt
|
||||
STEP 3:
|
||||
STEP 4:
|
||||
updated exports: l1b.kt
|
||||
STEP 5:
|
||||
updated exports: l1d.kt, l1c.kt
|
||||
removed inverse depends: l1a.kt
|
||||
STEP 6:
|
||||
updated exports: l1b.kt, l1c.kt
|
||||
STEP 7:
|
||||
removed inverse depends: l1d.kt, l1c.kt, l1a.kt, l1b.kt
|
||||
STEP 8:
|
||||
updated exports: l1c.kt
|
||||
STEP 9:
|
||||
updated exports: l1b.kt
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
fun funA() = listOf(fun1()).joinToString()
|
||||
fun funB() = listOf(fun2()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funA() = listOf(fun1()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funA() = listOf(fun3()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funA() = listOf(fun1()).joinToString()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
fun funA() = listOf(fun4()).joinToString()
|
||||
fun funB() = listOf(fun1()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funB() = listOf(fun4()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funB() = listOf(fun1(), fun3(), fun2()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funB() = listOf(fun2(), fun1()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funB() = listOf(fun2(), fun3()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funB() = listOf(fun3()).joinToString()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
fun funA() = listOf(fun4()).joinToString()
|
||||
fun funB() = listOf(fun1()).joinToString()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
fun funA() = listOf(fun4(), fun3()).joinToString()
|
||||
fun funB() = listOf(fun1(), fun2(), fun4()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funA() = listOf(fun1(), fun3()).joinToString()
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun funA() = listOf(fun4()).joinToString()
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
STEP 0:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2a.0.kt -> l2a.kt
|
||||
added file: l2a.kt
|
||||
STEP 1:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2a.1.kt -> l2a.kt
|
||||
U : l2b.1.kt -> l2b.kt
|
||||
added file: l2b.kt
|
||||
modified ir: l2a.kt
|
||||
STEP 2:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2a.2.kt -> l2a.kt
|
||||
modified ir: l2a.kt
|
||||
STEP 3:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2a.3.kt -> l2a.kt
|
||||
U : l2b.3.kt -> l2b.kt
|
||||
modified ir: l2a.kt, l2b.kt
|
||||
STEP 4:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2b.4.kt -> l2b.kt
|
||||
modified ir: l2b.kt
|
||||
STEP 5:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2b.5.kt -> l2b.kt
|
||||
D : l2a.kt
|
||||
modified ir: l2b.kt
|
||||
STEP 6:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2b.6.kt -> l2b.kt
|
||||
modified ir: l2b.kt
|
||||
STEP 7:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2a.7.kt -> l2a.kt
|
||||
D : l2b.kt
|
||||
added file: l2a.kt
|
||||
STEP 8:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2a.8.kt -> l2a.kt
|
||||
U : l2b.8.kt -> l2b.kt
|
||||
modified ir: l2a.kt
|
||||
added file: l2b.kt
|
||||
STEP 9:
|
||||
dependencies: lib1
|
||||
modifications:
|
||||
U : l2a.9.kt -> l2a.kt
|
||||
U : l2b.9.kt -> l2b.kt
|
||||
modified ir: l2a.kt, l2b.kt
|
||||
@@ -0,0 +1,46 @@
|
||||
fun box(stepId: Int): String {
|
||||
when (stepId) {
|
||||
0 -> {
|
||||
if (funA() != "fun1") return "Fail funA"
|
||||
if (funB() != "fun2") return "Fail funB"
|
||||
}
|
||||
1 -> {
|
||||
if (funA() != "fun1") return "Fail funA"
|
||||
if (funB() != "fun2, fun1") return "Fail funB"
|
||||
}
|
||||
2 -> {
|
||||
if (funA() != "fun3") return "Fail funA"
|
||||
if (funB() != "fun2, fun1") return "Fail funB"
|
||||
}
|
||||
3 -> {
|
||||
if (funA() != "fun1") return "Fail funA"
|
||||
if (funB() != "fun2, fun3") return "Fail funB"
|
||||
}
|
||||
4 -> {
|
||||
if (funA() != "fun1") return "Fail funA"
|
||||
if (funB() != "fun3") return "Fail funB"
|
||||
}
|
||||
5 -> {
|
||||
if (funA() != "fun4") return "Fail funA"
|
||||
if (funB() != "fun1") return "Fail funB"
|
||||
}
|
||||
6 -> {
|
||||
if (funA() != "fun4, fun3") return "Fail funA"
|
||||
if (funB() != "fun1, fun2, fun4") return "Fail funB"
|
||||
}
|
||||
7 -> {
|
||||
if (funA() != "fun4") return "Fail funA"
|
||||
if (funB() != "fun1") return "Fail funB"
|
||||
}
|
||||
8 -> {
|
||||
if (funA() != "fun1, fun3") return "Fail funA"
|
||||
if (funB() != "fun4") return "Fail funB"
|
||||
}
|
||||
9 -> {
|
||||
if (funA() != "fun4") return "Fail funA"
|
||||
if (funB() != "fun1, fun3, fun2") return "Fail funB"
|
||||
}
|
||||
else -> return "Unknown"
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
STEP 0:
|
||||
dependencies: lib1, lib2
|
||||
added file: m.kt
|
||||
STEP 1..4:
|
||||
dependencies: lib1, lib2
|
||||
STEP 5:
|
||||
dependencies: lib1, lib2
|
||||
removed direct depends: m.kt
|
||||
STEP 6:
|
||||
dependencies: lib1, lib2
|
||||
STEP 7:
|
||||
dependencies: lib1, lib2
|
||||
removed direct depends: m.kt
|
||||
STEP 8..9:
|
||||
dependencies: lib1, lib2
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
MODULES: lib1, lib2, main
|
||||
|
||||
STEP 0:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2, main
|
||||
STEP 1:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib2
|
||||
STEP 2:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2
|
||||
STEP 3:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib2
|
||||
STEP 4:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2
|
||||
STEP 5:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2, main
|
||||
STEP 6:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2
|
||||
STEP 7:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2, main
|
||||
STEP 8..9:
|
||||
libs: lib1, lib2, main
|
||||
dirty js: lib1, lib2
|
||||
Reference in New Issue
Block a user