[caches] Restored the topological order of libraries' initializers
This commit is contained in:
+8
-1
@@ -437,7 +437,14 @@ internal class Llvm(val context: Context, val llvmModule: LLVMModuleRef) {
|
||||
val allNonCachedDependencies = context.librariesWithDependencies.filter {
|
||||
context.config.cachedLibraries.getLibraryCache(it) == null
|
||||
}
|
||||
(allNonCachedDependencies + allCachedBitcodeDependencies).distinct()
|
||||
val set = (allNonCachedDependencies + allCachedBitcodeDependencies).toSet()
|
||||
// This list is used in particular to build the libraries' initializers chain.
|
||||
// The initializers must be called in the topological order, so make sure that the
|
||||
// libraries list being returned is also toposorted.
|
||||
context.config.resolvedLibraries
|
||||
.getFullList(TopologicalLibraryOrder)
|
||||
.cast<List<KonanLibrary>>()
|
||||
.filter { it in set }
|
||||
}
|
||||
|
||||
val bitcodeToLink: List<KonanLibrary> by lazy {
|
||||
|
||||
+2
-2
@@ -2369,8 +2369,8 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
|
||||
//-------------------------------------------------------------------------//
|
||||
fun appendStaticInitializers() {
|
||||
// Null for "current" non-library module:
|
||||
val libraries = (context.llvm.allBitcodeDependencies + listOf(null))
|
||||
// Note: the list of libraries is topologically sorted (in order for initializers to be called correctly).
|
||||
val libraries = (context.llvm.allBitcodeDependencies + listOf(null)/* Null for "current" non-library module */)
|
||||
|
||||
val libraryToInitializers = libraries.associateWith {
|
||||
mutableListOf<LLVMValueRef>()
|
||||
|
||||
Reference in New Issue
Block a user