Revert "[K/N] add header_cache output type"
This reverts commit 84341a9e25.
This commit is contained in:
-1
@@ -47,7 +47,6 @@ internal fun resolveCacheBinaries(
|
||||
val list = when (cache.kind) {
|
||||
CachedLibraries.Kind.DYNAMIC -> dynamicCaches
|
||||
CachedLibraries.Kind.STATIC -> staticCaches
|
||||
CachedLibraries.Kind.HEADER -> error("Header cache ${cache.path} cannot be used for linking")
|
||||
}
|
||||
|
||||
list += if (dependency.kind is DependenciesTracker.DependencyKind.CertainFiles && cache is CachedLibraries.Cache.PerFile)
|
||||
|
||||
+3
-6
@@ -42,7 +42,7 @@ class CachedLibraries(
|
||||
autoCacheDirectory: File,
|
||||
autoCacheableFrom: List<File>
|
||||
) {
|
||||
enum class Kind { DYNAMIC, STATIC, HEADER }
|
||||
enum class Kind { DYNAMIC, STATIC }
|
||||
|
||||
sealed class Cache(protected val target: KonanTarget, val kind: Kind, val path: String, val rootDirectory: String) {
|
||||
val bitcodeDependencies by lazy { computeBitcodeDependencies() }
|
||||
@@ -60,7 +60,6 @@ class CachedLibraries(
|
||||
protected fun Kind.toCompilerOutputKind(): CompilerOutputKind = when (this) {
|
||||
Kind.DYNAMIC -> CompilerOutputKind.DYNAMIC_CACHE
|
||||
Kind.STATIC -> CompilerOutputKind.STATIC_CACHE
|
||||
Kind.HEADER -> CompilerOutputKind.HEADER_CACHE
|
||||
}
|
||||
|
||||
class Monolithic(target: KonanTarget, kind: Kind, path: String)
|
||||
@@ -155,7 +154,6 @@ class CachedLibraries(
|
||||
val baseName = getCachedLibraryName(library)
|
||||
val dynamicFile = cacheBinaryPartDir.child(getArtifactName(target, baseName, CompilerOutputKind.DYNAMIC_CACHE))
|
||||
val staticFile = cacheBinaryPartDir.child(getArtifactName(target, baseName, CompilerOutputKind.STATIC_CACHE))
|
||||
val headerFile = cacheBinaryPartDir.child(getArtifactName(target, baseName, CompilerOutputKind.HEADER_CACHE))
|
||||
|
||||
if (dynamicFile.absolutePath in cacheBinaryPartDirContents && staticFile.absolutePath in cacheBinaryPartDirContents)
|
||||
error("Both dynamic and static caches files cannot be in the same directory." +
|
||||
@@ -163,7 +161,6 @@ class CachedLibraries(
|
||||
return when {
|
||||
dynamicFile.absolutePath in cacheBinaryPartDirContents -> Cache.Monolithic(target, Kind.DYNAMIC, dynamicFile.absolutePath)
|
||||
staticFile.absolutePath in cacheBinaryPartDirContents -> Cache.Monolithic(target, Kind.STATIC, staticFile.absolutePath)
|
||||
headerFile.absolutePath in cacheBinaryPartDirContents -> Cache.Monolithic(target, Kind.HEADER, headerFile.absolutePath)
|
||||
else -> {
|
||||
val libraryFileDirs = library.getFilesWithFqNames().map {
|
||||
child(CacheSupport.cacheFileId(it.fqName, it.filePath))
|
||||
@@ -215,14 +212,14 @@ class CachedLibraries(
|
||||
val hasStaticCaches = allCaches.values.any {
|
||||
when (it.kind) {
|
||||
Kind.STATIC -> true
|
||||
else -> false
|
||||
Kind.DYNAMIC -> false
|
||||
}
|
||||
}
|
||||
|
||||
val hasDynamicCaches = allCaches.values.any {
|
||||
when (it.kind) {
|
||||
Kind.STATIC -> false
|
||||
Kind.DYNAMIC -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-8
@@ -20,7 +20,7 @@ import java.io.File
|
||||
val KonanConfig.isFinalBinary: Boolean get() = when (this.produce) {
|
||||
CompilerOutputKind.PROGRAM, CompilerOutputKind.DYNAMIC,
|
||||
CompilerOutputKind.STATIC -> true
|
||||
CompilerOutputKind.DYNAMIC_CACHE, CompilerOutputKind.STATIC_CACHE, CompilerOutputKind.HEADER_CACHE,
|
||||
CompilerOutputKind.DYNAMIC_CACHE, CompilerOutputKind.STATIC_CACHE,
|
||||
CompilerOutputKind.LIBRARY, CompilerOutputKind.BITCODE -> false
|
||||
CompilerOutputKind.FRAMEWORK -> !omitFrameworkBinary
|
||||
CompilerOutputKind.TEST_BUNDLE -> true
|
||||
@@ -55,14 +55,8 @@ internal val CacheDeserializationStrategy?.containsRuntime: Boolean
|
||||
internal val NativeGenerationState.shouldLinkRuntimeNativeLibraries: Boolean
|
||||
get() = producedLlvmModuleContainsStdlib && cacheDeserializationStrategy.containsRuntime
|
||||
|
||||
val CompilerOutputKind.isFullCache: Boolean
|
||||
get() = this == CompilerOutputKind.STATIC_CACHE || this == CompilerOutputKind.DYNAMIC_CACHE
|
||||
|
||||
val CompilerOutputKind.isHeaderCache: Boolean
|
||||
get() = this == CompilerOutputKind.HEADER_CACHE
|
||||
|
||||
val CompilerOutputKind.isCache: Boolean
|
||||
get() = this.isFullCache || this.isHeaderCache
|
||||
get() = this == CompilerOutputKind.STATIC_CACHE || this == CompilerOutputKind.DYNAMIC_CACHE
|
||||
|
||||
internal fun produceCStubs(generationState: NativeGenerationState) {
|
||||
generationState.cStubsManager.compile(
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ internal class DynamicCompilerDriver : CompilerDriver() {
|
||||
CompilerOutputKind.BITCODE -> error("Bitcode output kind is obsolete.")
|
||||
CompilerOutputKind.DYNAMIC_CACHE -> produceBinary(engine, config, environment)
|
||||
CompilerOutputKind.STATIC_CACHE -> produceBinary(engine, config, environment)
|
||||
CompilerOutputKind.HEADER_CACHE -> produceBinary(engine, config, environment)
|
||||
CompilerOutputKind.PRELIMINARY_CACHE -> TODO()
|
||||
CompilerOutputKind.TEST_BUNDLE -> produceBundle(engine, config, environment)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-11
@@ -90,14 +90,6 @@ internal fun <C : PhaseContext> PhaseEngine<C>.runBackend(backendContext: Contex
|
||||
fun runAfterLowerings(fragment: BackendJobFragment, generationState: NativeGenerationState) {
|
||||
val tempFiles = createTempFiles(config, fragment.cacheDeserializationStrategy)
|
||||
val outputFiles = generationState.outputFiles
|
||||
if (context.config.produce.isHeaderCache) {
|
||||
newEngine(generationState) { generationStateEngine ->
|
||||
generationStateEngine.runPhase(SaveAdditionalCacheInfoPhase)
|
||||
File(outputFiles.nativeBinaryFile).createNew()
|
||||
generationStateEngine.runPhase(FinalizeCachePhase, outputFiles)
|
||||
}
|
||||
return
|
||||
}
|
||||
try {
|
||||
backendEngine.useContext(generationState) { generationStateEngine ->
|
||||
val bitcodeFile = tempFiles.create(generationState.llvmModuleName, ".bc").javaFile()
|
||||
@@ -266,7 +258,7 @@ internal fun PhaseEngine<NativeGenerationState>.compileModule(module: IrModuleFr
|
||||
if (checkExternalCalls) {
|
||||
runPhase(RewriteExternalCallsCheckerGlobals)
|
||||
}
|
||||
if (context.config.produce.isFullCache) {
|
||||
if (context.config.produce.isCache) {
|
||||
runPhase(SaveAdditionalCacheInfoPhase)
|
||||
}
|
||||
runPhase(WriteBitcodeFilePhase, WriteBitcodeFileInput(context.llvm.module, bitcodeFile))
|
||||
@@ -283,10 +275,10 @@ internal fun <C : PhaseContext> PhaseEngine<C>.compileAndLink(
|
||||
runPhase(ObjectFilesPhase, ObjectFilesPhaseInput(moduleCompilationOutput.bitcodeFile, compilationResult))
|
||||
val linkerOutputKind = determineLinkerOutput(context)
|
||||
val (linkerInput, cacheBinaries) = run {
|
||||
val resolvedCacheBinaries by lazy { resolveCacheBinaries(context.config.cachedLibraries, moduleCompilationOutput.dependenciesTrackingResult) }
|
||||
val resolvedCacheBinaries = resolveCacheBinaries(context.config.cachedLibraries, moduleCompilationOutput.dependenciesTrackingResult)
|
||||
when {
|
||||
context.config.produce == CompilerOutputKind.STATIC_CACHE -> {
|
||||
compilationResult to ResolvedCacheBinaries(emptyList(), emptyList())
|
||||
compilationResult to ResolvedCacheBinaries(emptyList(), resolvedCacheBinaries.dynamic)
|
||||
}
|
||||
shouldPerformPreLink(context.config, resolvedCacheBinaries, linkerOutputKind) -> {
|
||||
val prelinkResult = temporaryFiles.create("withStaticCaches", ".o").javaFile()
|
||||
|
||||
+1
-2
@@ -366,8 +366,7 @@ abstract class KotlinAndroidProjectExtension(project: Project) : KotlinSingleTar
|
||||
enum class NativeCacheKind(val produce: String?, val outputKind: CompilerOutputKind?) {
|
||||
NONE(null, null),
|
||||
DYNAMIC("dynamic_cache", CompilerOutputKind.DYNAMIC_CACHE),
|
||||
STATIC("static_cache", CompilerOutputKind.STATIC_CACHE),
|
||||
HEADER("header_cache", CompilerOutputKind.HEADER_CACHE);
|
||||
STATIC("static_cache", CompilerOutputKind.STATIC_CACHE);
|
||||
|
||||
companion object {
|
||||
fun byCompilerArgument(argument: String): NativeCacheKind? =
|
||||
|
||||
@@ -38,8 +38,8 @@ enum class CompilerOutputKind {
|
||||
override fun suffix(target: KonanTarget?) = ".${target!!.family.staticSuffix}"
|
||||
override fun prefix(target: KonanTarget?) = target!!.family.staticPrefix
|
||||
},
|
||||
HEADER_CACHE {
|
||||
override fun suffix(target: KonanTarget?) = ".header"
|
||||
PRELIMINARY_CACHE {
|
||||
override fun suffix(target: KonanTarget?) = ""
|
||||
};
|
||||
|
||||
abstract fun suffix(target: KonanTarget? = null): String
|
||||
|
||||
Reference in New Issue
Block a user