[JS IR] Rollback PL hacks from JS IR IC infra

^KT-57347 related
This commit is contained in:
Alexander Korepanov
2023-05-09 15:40:18 +02:00
committed by Space Team
parent fab8a101bb
commit 97620030c6
16 changed files with 26 additions and 35 deletions
@@ -125,28 +125,12 @@ class CacheUpdater(
libs.memoryOptimizedFilter { it.libraryFile.canonicalPath in friendPaths }
}
private val klibCacheDirs = libraryDependencies.keys.map { lib ->
private val incrementalCaches = libraryDependencies.keys.associate { lib ->
val libFile = KotlinLibraryFile(lib)
val file = File(libFile.path)
val pathHash = file.absolutePath.cityHash64().toULong().toString(Character.MAX_RADIX)
File(cacheRootDir, "${file.name}.$pathHash")
}
init {
// Enabled Partial Linkage may replace entire IR expressions with a stub during klib linking and loading.
// This may break the incremental cache dependency graph.
// Dropping incremental cache files after updating klibs (e.g. update klib version)
// covers almost all cases which could not be tracked due to a broken dependency graph.
// TODO: This code could be removed after fixing KT-57347
val oldKlibCaches = cacheRootDir.listFiles { file: File -> file.isDirectory }?.mapTo(hashSetOf()) { it.name } ?: emptySet()
val newKlibCaches = klibCacheDirs.mapTo(hashSetOf()) { it.name }
if (oldKlibCaches != newKlibCaches) {
cacheRootDir.deleteRecursively()
}
}
private val incrementalCaches = libraryDependencies.keys.zip(klibCacheDirs).associate { (lib, libraryCacheDir) ->
KotlinLibraryFile(lib) to IncrementalCache(KotlinLoadedLibraryHeader(lib, internationService), libraryCacheDir)
val libraryCacheDir = File(cacheRootDir, "${file.name}.$pathHash")
libFile to IncrementalCache(KotlinLoadedLibraryHeader(lib, internationService), libraryCacheDir)
}
private val removedIncrementalCaches = buildList {
@@ -1,11 +1,11 @@
STEP 0:
added file: l1a.kt, l1b.kt
STEP 1:
added file: l1b.kt, l1a.kt
updated exports: l1b.kt, l1a.kt
STEP 2:
updated exports: l1a.kt
STEP 3:
added file: l1b.kt, l1a.kt
removed inverse depends: l1b.kt, l1a.kt
STEP 4:
modifications:
U : l1a.4.kt -> l1a.kt
@@ -14,5 +14,6 @@ STEP 3:
rebuild klib: false
modifications:
D : l2.kt
removed file: l2.kt
STEP 4:
rebuild klib: false
@@ -7,7 +7,7 @@ STEP 1:
dependencies: lib1, lib2
modifications:
U : m.1.kt -> m.kt
added file: m.kt
modified ir: m.kt
STEP 2:
dependencies: lib1, lib2
updated imports: m.kt
@@ -15,6 +15,6 @@ STEP 3:
dependencies: lib1
modifications:
U : m.0.kt -> m.kt
added file: m.kt
modified ir: m.kt
STEP 4:
dependencies: lib1
@@ -33,7 +33,7 @@ STEP 7:
STEP 8:
modifications:
U : l1.0.kt -> l1.kt
added file: l1.kt
modified ir: l1.kt
STEP 9:
modifications:
U : l1.1.kt -> l1.kt
@@ -14,7 +14,7 @@ STEP 8:
dependencies: lib1, libProxy
modifications:
U : m.proxy.kt -> m.kt
added file: m.kt
modified ir: m.kt
STEP 9..13:
dependencies: lib1, libProxy
updated imports: m.kt
@@ -7,4 +7,6 @@ STEP 2:
modifications:
U : l1.2.kt -> l1.kt
modified ir: l1.kt
STEP 3..5:
STEP 3:
removed file: l1.kt
STEP 4..5:
@@ -2,7 +2,9 @@ STEP 0:
modifications:
U : l1.0.kt -> l1.kt
added file: l1.kt
STEP 1..2:
STEP 1:
removed file: l1.kt
STEP 2:
STEP 3:
modifications:
U : l1.3.kt -> l1.kt
@@ -3,13 +3,13 @@ STEP 0:
added file: m.kt
STEP 1:
dependencies: lib1-new
added file: m.kt
removed direct depends: m.kt
STEP 2:
dependencies: lib1-new
updated imports: m.kt
STEP 3:
dependencies: lib1
added file: m.kt
removed direct depends: m.kt
STEP 4..5:
dependencies: lib1
updated imports: m.kt
@@ -7,4 +7,5 @@ STEP 2..3:
STEP 4:
modifications:
D : l1a.kt
removed file: l1a.kt
STEP 5:
@@ -14,4 +14,5 @@ STEP 3:
STEP 4:
modifications:
D : l1b.kt
removed file: l1b.kt
STEP 5:
@@ -7,4 +7,5 @@ STEP 2..3:
STEP 4:
modifications:
D : l1c.kt
removed file: l1c.kt
STEP 5:
@@ -9,6 +9,7 @@ STEP 1:
D : l1a.kt
D : l1b.kt
D : l1c.kt
removed file: l1c.kt, l1b.kt, l1a.kt
STEP 2..3:
STEP 4:
modifications:
@@ -5,12 +5,12 @@ STEP 0:
added file: l2.kt
STEP 1:
dependencies: lib1-a, lib1-b, lib1-c
added file: l2.kt
removed direct depends: l2.kt
STEP 2..3:
dependencies: lib1-a, lib1-b, lib1-c
updated imports: l2.kt
STEP 4:
dependencies: lib1
added file: l2.kt
removed direct depends: l2.kt
STEP 5:
dependencies: lib1
@@ -3,11 +3,9 @@ STEP 0:
added file: m.kt
STEP 1:
dependencies: lib1-a, lib1-b, lib1-c, lib2
added file: m.kt
STEP 2..3:
dependencies: lib1-a, lib1-b, lib1-c, lib2
STEP 4:
dependencies: lib1, lib2
added file: m.kt
STEP 5:
dependencies: lib1, lib2
@@ -5,13 +5,13 @@ STEP 0:
dirty js: lib1, lib2, main
STEP 1:
libs: lib1-a, lib1-b, lib1-c, lib2, main
dirty js: lib1-a, lib1-b, lib1-c, main, lib2
dirty js: lib1-a, lib1-b, lib1-c, lib2
STEP 2..3:
libs: lib1-a, lib1-b, lib1-c, lib2, main
dirty js: lib1-b, lib2
STEP 4:
libs: lib1, lib2, main
dirty js: lib1, lib2, main
dirty js: lib1, lib2
STEP 5:
libs: lib1, lib2, main
dirty js: lib1