Revert "Compiler daemon (#3442)"

This reverts commit e4fb6fd271.
This commit is contained in:
Nikolay Igotti
2019-10-09 20:58:27 +03:00
parent e4fb6fd271
commit 64be2b7fdc
24 changed files with 140 additions and 246 deletions
@@ -4723,4 +4723,4 @@ private external fun kniBridge335(p0: NativePtr, p1: Int, p2: NativePtr): Unit
private external fun kniBridge336(p0: NativePtr): Int
private external fun kniBridge337(p0: NativePtr): Int
private external fun kniBridge338(p0: NativePtr): Int
private val loadLibrary = loadKonanLibrary("clangstubs")
private val loadLibrary = System.loadLibrary("clangstubs")
@@ -371,7 +371,11 @@ private class CEnumType(private val rawValueCType: CType<Any>) : CType<CEnum>(ra
private typealias FfiClosureImpl = LongConsumer
private typealias UserData = FfiClosureImpl
private val topLevelInitializer = loadKonanLibrary("callbacks")
private fun loadCallbacksLibrary() {
System.loadLibrary("callbacks")
}
private val topLevelInitializer = loadCallbacksLibrary()
/**
@@ -16,10 +16,6 @@
package kotlinx.cinterop
import java.io.File
import java.nio.file.Files
import java.nio.file.Paths
internal fun decodeFromUtf8(bytes: ByteArray) = String(bytes)
internal fun encodeToUtf8(str: String) = str.toByteArray()
@@ -86,23 +82,4 @@ inline fun <reified R : Number> Long.narrow(): R = when (R::class.java) {
inline fun <reified R : Number> Number.invalidNarrowing(): R {
throw Error("unable to narrow ${this.javaClass.simpleName} \"${this}\" to ${R::class.java.simpleName}")
}
fun loadKonanLibrary(name: String) {
try {
System.loadLibrary(name)
} catch (e: UnsatisfiedLinkError) {
val fullLibraryName = System.mapLibraryName(name)
val dir = "${System.getProperty("konan.home")}/konan/nativelib"
try {
System.load("$dir/$fullLibraryName")
} catch (e: UnsatisfiedLinkError) {
val tempDir = createTempDir(directory = File(dir)).absolutePath
Files.createLink(Paths.get(tempDir, fullLibraryName), Paths.get(dir, fullLibraryName))
// TODO: Does not work on Windows. May be use FILE_FLAG_DELETE_ON_CLOSE?
File(tempDir).deleteOnExit()
File("$tempDir/$fullLibraryName").deleteOnExit()
System.load("$tempDir/$fullLibraryName")
}
}
}
@@ -180,8 +180,9 @@ class StubIrTextEmitter(
emitKotlinFileHeader()
stubLines.forEach(out)
nativeBridges.kotlinLines.forEach(out)
if (context.platform == KotlinPlatform.JVM)
out("private val loadLibrary = loadKonanLibrary(\"${context.libName}\")")
if (context.platform == KotlinPlatform.JVM) {
out("private val loadLibrary = System.loadLibrary(\"${context.libName}\")")
}
}
}
private val printer = object : StubIrVisitor<StubContainer?, Unit> {