Fix warnings in build-common/daemon code
This commit is contained in:
@@ -168,6 +168,8 @@ open class IncrementalJvmCache(
|
|||||||
constantsMap.process(kotlinClass, changesCollector)
|
constantsMap.process(kotlinClass, changesCollector)
|
||||||
inlineFunctionsMap.process(kotlinClass, changesCollector)
|
inlineFunctionsMap.process(kotlinClass, changesCollector)
|
||||||
}
|
}
|
||||||
|
KotlinClassHeader.Kind.UNKNOWN, KotlinClassHeader.Kind.SYNTHETIC_CLASS -> {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ open class LookupStorage(
|
|||||||
|
|
||||||
for (lookupSymbol in lookups.keySet().sorted()) {
|
for (lookupSymbol in lookups.keySet().sorted()) {
|
||||||
val key = LookupSymbolKey(lookupSymbol.name, lookupSymbol.scope)
|
val key = LookupSymbolKey(lookupSymbol.name, lookupSymbol.scope)
|
||||||
val paths = lookups[lookupSymbol]!!
|
val paths = lookups[lookupSymbol]
|
||||||
val fileIds = paths.mapTo(TreeSet()) { pathToId[it]!! }
|
val fileIds = paths.mapTo(TreeSet()) { pathToId[it]!! }
|
||||||
fileIds.addAll(lookupMap[key] ?: emptySet())
|
fileIds.addAll(lookupMap[key] ?: emptySet())
|
||||||
lookupMap[key] = fileIds
|
lookupMap[key] = fileIds
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ object KotlinCompilerRunnerUtils {
|
|||||||
additionalJvmParams: Array<String> = arrayOf()
|
additionalJvmParams: Array<String> = arrayOf()
|
||||||
): CompileServiceSession? {
|
): CompileServiceSession? {
|
||||||
val daemonJVMOptions = configureDaemonJVMOptions(
|
val daemonJVMOptions = configureDaemonJVMOptions(
|
||||||
additionalParams = *additionalJvmParams,
|
additionalParams = additionalJvmParams,
|
||||||
inheritMemoryLimits = true,
|
inheritMemoryLimits = true,
|
||||||
inheritOtherJvmOptions = false,
|
inheritOtherJvmOptions = false,
|
||||||
inheritAdditionalProperties = true
|
inheritAdditionalProperties = true
|
||||||
|
|||||||
+3
-3
@@ -297,13 +297,13 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
|||||||
log.info("Executing daemon compilation with args: " + filteredArgs.joinToString(" "))
|
log.info("Executing daemon compilation with args: " + filteredArgs.joinToString(" "))
|
||||||
val servicesFacade =
|
val servicesFacade =
|
||||||
CompilerCallbackServicesFacadeServerServerSide()
|
CompilerCallbackServicesFacadeServerServerSide()
|
||||||
val serverRun = servicesFacade.runServer()
|
servicesFacade.runServer()
|
||||||
try {
|
try {
|
||||||
val memBefore = daemon.getUsedMemory().get() / 1024
|
val memBefore = daemon.getUsedMemory().get() / 1024
|
||||||
val startTime = System.nanoTime()
|
val startTime = System.nanoTime()
|
||||||
|
|
||||||
val compResults = createCompResults()
|
val compResults = createCompResults()
|
||||||
val compResultsServerRun = compResults.runServer()
|
compResults.runServer()
|
||||||
val res = daemon.compile(
|
val res = daemon.compile(
|
||||||
CompileService.NO_SESSION,
|
CompileService.NO_SESSION,
|
||||||
filteredArgs.toList().toTypedArray(),
|
filteredArgs.toList().toTypedArray(),
|
||||||
@@ -373,7 +373,6 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
|||||||
|
|
||||||
// --- Implementation ---------------------------------------
|
// --- Implementation ---------------------------------------
|
||||||
|
|
||||||
@Synchronized
|
|
||||||
private inline fun <R> connectLoop(reportingTargets: DaemonReportingTargets, autostart: Boolean, body: (Boolean) -> R?): R? {
|
private inline fun <R> connectLoop(reportingTargets: DaemonReportingTargets, autostart: Boolean, body: (Boolean) -> R?): R? {
|
||||||
try {
|
try {
|
||||||
var attempts = 1
|
var attempts = 1
|
||||||
@@ -544,6 +543,7 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
|||||||
// assuming that all important output is already done, the rest should be routed to the log by the daemon itself
|
// assuming that all important output is already done, the rest should be routed to the log by the daemon itself
|
||||||
if (stdoutThread.isAlive) {
|
if (stdoutThread.isAlive) {
|
||||||
// TODO: find better method to stop the thread, but seems it will require asynchronous consuming of the stream
|
// TODO: find better method to stop the thread, but seems it will require asynchronous consuming of the stream
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
stdoutThread.stop()
|
stdoutThread.stop()
|
||||||
}
|
}
|
||||||
reportingTargets.out?.flush()
|
reportingTargets.out?.flush()
|
||||||
|
|||||||
+1
-2
@@ -31,7 +31,6 @@ import org.jetbrains.kotlin.utils.isProcessCanceledException
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.rmi.server.UnicastRemoteObject
|
import java.rmi.server.UnicastRemoteObject
|
||||||
|
|
||||||
|
|
||||||
open class CompilerCallbackServicesFacadeServer(
|
open class CompilerCallbackServicesFacadeServer(
|
||||||
val incrementalCompilationComponents: IncrementalCompilationComponents? = null,
|
val incrementalCompilationComponents: IncrementalCompilationComponents? = null,
|
||||||
val lookupTracker: LookupTracker? = null,
|
val lookupTracker: LookupTracker? = null,
|
||||||
@@ -40,7 +39,7 @@ open class CompilerCallbackServicesFacadeServer(
|
|||||||
val incrementalResultsConsumer: IncrementalResultsConsumer? = null,
|
val incrementalResultsConsumer: IncrementalResultsConsumer? = null,
|
||||||
val incrementalDataProvider: IncrementalDataProvider? = null,
|
val incrementalDataProvider: IncrementalDataProvider? = null,
|
||||||
port: Int = SOCKET_ANY_FREE_PORT
|
port: Int = SOCKET_ANY_FREE_PORT
|
||||||
) : CompilerCallbackServicesFacade,
|
) : @Suppress("DEPRECATION") CompilerCallbackServicesFacade,
|
||||||
UnicastRemoteObject(
|
UnicastRemoteObject(
|
||||||
port,
|
port,
|
||||||
LoopbackNetworkInterface.clientLoopbackSocketFactory,
|
LoopbackNetworkInterface.clientLoopbackSocketFactory,
|
||||||
|
|||||||
+7
-3
@@ -63,7 +63,7 @@ object KotlinCompilerClient {
|
|||||||
daemonOptions: DaemonOptions,
|
daemonOptions: DaemonOptions,
|
||||||
reportingTargets: DaemonReportingTargets,
|
reportingTargets: DaemonReportingTargets,
|
||||||
autostart: Boolean = true,
|
autostart: Boolean = true,
|
||||||
checkId: Boolean = true
|
@Suppress("UNUSED_PARAMETER") checkId: Boolean = true
|
||||||
): CompileService? {
|
): CompileService? {
|
||||||
val flagFile = getOrCreateClientFlagFile(daemonOptions)
|
val flagFile = getOrCreateClientFlagFile(daemonOptions)
|
||||||
return connectToCompileService(compilerId, flagFile, daemonJVMOptions, daemonOptions, reportingTargets, autostart)
|
return connectToCompileService(compilerId, flagFile, daemonJVMOptions, daemonOptions, reportingTargets, autostart)
|
||||||
@@ -142,6 +142,7 @@ object KotlinCompilerClient {
|
|||||||
compilerService.releaseCompileSession(sessionId)
|
compilerService.releaseCompileSession(sessionId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
@Deprecated("Use other compile method", ReplaceWith("compile"))
|
@Deprecated("Use other compile method", ReplaceWith("compile"))
|
||||||
fun compile(compilerService: CompileService,
|
fun compile(compilerService: CompileService,
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
@@ -156,6 +157,7 @@ object KotlinCompilerClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
@Deprecated("Use non-deprecated compile method", ReplaceWith("compile"))
|
@Deprecated("Use non-deprecated compile method", ReplaceWith("compile"))
|
||||||
fun incrementalCompile(compileService: CompileService,
|
fun incrementalCompile(compileService: CompileService,
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
@@ -277,6 +279,7 @@ object KotlinCompilerClient {
|
|||||||
val memBefore = daemon.getUsedMemory().get() / 1024
|
val memBefore = daemon.getUsedMemory().get() / 1024
|
||||||
val startTime = System.nanoTime()
|
val startTime = System.nanoTime()
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
val res = daemon.remoteCompile(CompileService.NO_SESSION, CompileService.TargetPlatform.JVM, filteredArgs.toList().toTypedArray(), servicesFacade, outStrm, CompileService.OutputFormat.PLAIN, outStrm, null)
|
val res = daemon.remoteCompile(CompileService.NO_SESSION, CompileService.TargetPlatform.JVM, filteredArgs.toList().toTypedArray(), servicesFacade, outStrm, CompileService.OutputFormat.PLAIN, outStrm, null)
|
||||||
|
|
||||||
val endTime = System.nanoTime()
|
val endTime = System.nanoTime()
|
||||||
@@ -308,8 +311,9 @@ object KotlinCompilerClient {
|
|||||||
|
|
||||||
// --- Implementation ---------------------------------------
|
// --- Implementation ---------------------------------------
|
||||||
|
|
||||||
@Synchronized
|
private inline fun <R> connectLoop(
|
||||||
private inline fun <R> connectLoop(reportingTargets: DaemonReportingTargets, autostart: Boolean, body: (Boolean) -> R?): R? {
|
reportingTargets: DaemonReportingTargets, autostart: Boolean, body: (Boolean) -> R?
|
||||||
|
): R? = synchronized(this) {
|
||||||
try {
|
try {
|
||||||
var attempts = 1
|
var attempts = 1
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|||||||
+2
-2
@@ -43,7 +43,7 @@ class CompileServiceClientSideImpl(
|
|||||||
} ?: false
|
} ?: false
|
||||||
|
|
||||||
override suspend fun clientHandshake(input: ByteReadChannelWrapper, output: ByteWriteChannelWrapper, log: Logger): Boolean {
|
override suspend fun clientHandshake(input: ByteReadChannelWrapper, output: ByteWriteChannelWrapper, log: Logger): Boolean {
|
||||||
return trySendHandshakeMessage(output, log) && tryAcquireHandshakeMessage(input, log)
|
return trySendHandshakeMessage(output) && tryAcquireHandshakeMessage(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun startKeepAlives() {
|
override fun startKeepAlives() {
|
||||||
@@ -186,7 +186,7 @@ class CompileServiceClientSideImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun clearJarCache() {
|
override suspend fun clearJarCache() {
|
||||||
val id = sendMessage(ClearJarCacheMessage())
|
sendMessage(ClearJarCacheMessage())
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun releaseReplSession(sessionId: Int): CompileService.CallResult<Nothing> {
|
override suspend fun releaseReplSession(sessionId: Int): CompileService.CallResult<Nothing> {
|
||||||
|
|||||||
+3
-2
@@ -8,10 +8,8 @@ package org.jetbrains.kotlin.daemon.common.experimental
|
|||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.jetbrains.kotlin.cli.common.repl.ReplCodeLine
|
import org.jetbrains.kotlin.cli.common.repl.ReplCodeLine
|
||||||
import org.jetbrains.kotlin.daemon.common.*
|
import org.jetbrains.kotlin.daemon.common.*
|
||||||
import org.jetbrains.kotlin.daemon.common.LoopbackNetworkInterface
|
|
||||||
import org.jetbrains.kotlin.daemon.common.experimental.socketInfrastructure.Client
|
import org.jetbrains.kotlin.daemon.common.experimental.socketInfrastructure.Client
|
||||||
import org.jetbrains.kotlin.daemon.common.experimental.socketInfrastructure.DefaultClientRMIWrapper
|
import org.jetbrains.kotlin.daemon.common.experimental.socketInfrastructure.DefaultClientRMIWrapper
|
||||||
import org.jetbrains.kotlin.daemon.common.*
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.rmi.NoSuchObjectException
|
import java.rmi.NoSuchObjectException
|
||||||
@@ -74,6 +72,7 @@ class CompileServiceRMIWrapper(val server: CompileServiceServerSide, daemonOptio
|
|||||||
server.scheduleShutdown(graceful)
|
server.scheduleShutdown(graceful)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||||
override fun remoteCompile(
|
override fun remoteCompile(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
targetPlatform: CompileService.TargetPlatform,
|
targetPlatform: CompileService.TargetPlatform,
|
||||||
@@ -85,6 +84,7 @@ class CompileServiceRMIWrapper(val server: CompileServiceServerSide, daemonOptio
|
|||||||
operationsTracer: RemoteOperationsTracer?
|
operationsTracer: RemoteOperationsTracer?
|
||||||
) = deprecated()
|
) = deprecated()
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||||
override fun remoteIncrementalCompile(
|
override fun remoteIncrementalCompile(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
targetPlatform: CompileService.TargetPlatform,
|
targetPlatform: CompileService.TargetPlatform,
|
||||||
@@ -123,6 +123,7 @@ class CompileServiceRMIWrapper(val server: CompileServiceServerSide, daemonOptio
|
|||||||
server.clearJarCache()
|
server.clearJarCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||||
override fun leaseReplSession(
|
override fun leaseReplSession(
|
||||||
aliveFlagPath: String?,
|
aliveFlagPath: String?,
|
||||||
targetPlatform: CompileService.TargetPlatform,
|
targetPlatform: CompileService.TargetPlatform,
|
||||||
|
|||||||
+1
-1
@@ -248,7 +248,7 @@ class DefaultClient<ServerType : ServerBase>(
|
|||||||
serverHost: String = LoopbackNetworkInterface.loopbackInetAddressName
|
serverHost: String = LoopbackNetworkInterface.loopbackInetAddressName
|
||||||
) : DefaultAuthorizableClient<ServerType>(serverPort, serverHost) {
|
) : DefaultAuthorizableClient<ServerType>(serverPort, serverHost) {
|
||||||
override suspend fun clientHandshake(input: ByteReadChannelWrapper, output: ByteWriteChannelWrapper, log: Logger) = true
|
override suspend fun clientHandshake(input: ByteReadChannelWrapper, output: ByteWriteChannelWrapper, log: Logger) = true
|
||||||
override suspend fun authorizeOnServer(output: ByteWriteChannelWrapper): Boolean = true
|
override suspend fun authorizeOnServer(serverOutputChannel: ByteWriteChannelWrapper): Boolean = true
|
||||||
override fun startKeepAlives() {}
|
override fun startKeepAlives() {}
|
||||||
override fun delayKeepAlives() {}
|
override fun delayKeepAlives() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -193,7 +193,7 @@ suspend fun <T> runWithTimeout(
|
|||||||
): T? = withTimeoutOrNull(unit.toMillis(timeout)) { block() }
|
): T? = withTimeoutOrNull(unit.toMillis(timeout)) { block() }
|
||||||
|
|
||||||
//@Throws(ConnectionResetException::class)
|
//@Throws(ConnectionResetException::class)
|
||||||
suspend fun tryAcquireHandshakeMessage(input: ByteReadChannelWrapper, log: Logger): Boolean {
|
suspend fun tryAcquireHandshakeMessage(input: ByteReadChannelWrapper): Boolean {
|
||||||
val bytes = runWithTimeout {
|
val bytes = runWithTimeout {
|
||||||
input.nextBytes()
|
input.nextBytes()
|
||||||
} ?: return false
|
} ?: return false
|
||||||
@@ -205,7 +205,7 @@ suspend fun tryAcquireHandshakeMessage(input: ByteReadChannelWrapper, log: Logge
|
|||||||
|
|
||||||
|
|
||||||
//@Throws(ConnectionResetException::class)
|
//@Throws(ConnectionResetException::class)
|
||||||
suspend fun trySendHandshakeMessage(output: ByteWriteChannelWrapper, log: Logger): Boolean {
|
suspend fun trySendHandshakeMessage(output: ByteWriteChannelWrapper): Boolean {
|
||||||
runWithTimeout {
|
runWithTimeout {
|
||||||
output.writeBytesAndLength(FIRST_HANDSHAKE_BYTE_TOKEN.size, FIRST_HANDSHAKE_BYTE_TOKEN)
|
output.writeBytesAndLength(FIRST_HANDSHAKE_BYTE_TOKEN.size, FIRST_HANDSHAKE_BYTE_TOKEN)
|
||||||
} ?: return false
|
} ?: return false
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ interface CompileService : Remote {
|
|||||||
|
|
||||||
// TODO: consider adding async version of shutdown and release
|
// TODO: consider adding async version of shutdown and release
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
@Deprecated("The usages should be replaced with `compile` method", ReplaceWith("compile"))
|
@Deprecated("The usages should be replaced with `compile` method", ReplaceWith("compile"))
|
||||||
@Throws(RemoteException::class)
|
@Throws(RemoteException::class)
|
||||||
fun remoteCompile(
|
fun remoteCompile(
|
||||||
@@ -118,6 +119,7 @@ interface CompileService : Remote {
|
|||||||
operationsTracer: RemoteOperationsTracer?
|
operationsTracer: RemoteOperationsTracer?
|
||||||
): CallResult<Int>
|
): CallResult<Int>
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
@Deprecated("The usages should be replaced with `compile` method", ReplaceWith("compile"))
|
@Deprecated("The usages should be replaced with `compile` method", ReplaceWith("compile"))
|
||||||
@Throws(RemoteException::class)
|
@Throws(RemoteException::class)
|
||||||
fun remoteIncrementalCompile(
|
fun remoteIncrementalCompile(
|
||||||
@@ -149,6 +151,7 @@ interface CompileService : Remote {
|
|||||||
@Throws(RemoteException::class)
|
@Throws(RemoteException::class)
|
||||||
fun clearJarCache()
|
fun clearJarCache()
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
@Deprecated("The usages should be replaced with other `leaseReplSession` method", ReplaceWith("leaseReplSession"))
|
@Deprecated("The usages should be replaced with other `leaseReplSession` method", ReplaceWith("leaseReplSession"))
|
||||||
@Throws(RemoteException::class)
|
@Throws(RemoteException::class)
|
||||||
fun leaseReplSession(
|
fun leaseReplSession(
|
||||||
|
|||||||
+6
@@ -23,6 +23,7 @@ class CompileServiceClientRMIWrapper(
|
|||||||
private fun reportNotImplemented(): Nothing = throw IllegalStateException("Unexpected call to deprecated method")
|
private fun reportNotImplemented(): Nothing = throw IllegalStateException("Unexpected call to deprecated method")
|
||||||
|
|
||||||
// deprecated methods :
|
// deprecated methods :
|
||||||
|
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||||
override fun remoteCompile(
|
override fun remoteCompile(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
targetPlatform: CompileService.TargetPlatform,
|
targetPlatform: CompileService.TargetPlatform,
|
||||||
@@ -36,6 +37,7 @@ class CompileServiceClientRMIWrapper(
|
|||||||
reportNotImplemented()
|
reportNotImplemented()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||||
override fun remoteIncrementalCompile(
|
override fun remoteIncrementalCompile(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
targetPlatform: CompileService.TargetPlatform,
|
targetPlatform: CompileService.TargetPlatform,
|
||||||
@@ -49,6 +51,7 @@ class CompileServiceClientRMIWrapper(
|
|||||||
reportNotImplemented()
|
reportNotImplemented()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||||
override fun leaseReplSession(
|
override fun leaseReplSession(
|
||||||
aliveFlagPath: String?,
|
aliveFlagPath: String?,
|
||||||
targetPlatform: CompileService.TargetPlatform,
|
targetPlatform: CompileService.TargetPlatform,
|
||||||
@@ -66,10 +69,12 @@ class CompileServiceClientRMIWrapper(
|
|||||||
reportNotImplemented()
|
reportNotImplemented()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine): CompileService.CallResult<ReplCheckResult> {
|
override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine): CompileService.CallResult<ReplCheckResult> {
|
||||||
reportNotImplemented()
|
reportNotImplemented()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun remoteReplLineCompile(
|
override fun remoteReplLineCompile(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
codeLine: ReplCodeLine,
|
codeLine: ReplCodeLine,
|
||||||
@@ -78,6 +83,7 @@ class CompileServiceClientRMIWrapper(
|
|||||||
reportNotImplemented()
|
reportNotImplemented()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun remoteReplLineEval(
|
override fun remoteReplLineEval(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
codeLine: ReplCodeLine,
|
codeLine: ReplCodeLine,
|
||||||
|
|||||||
+1
-1
@@ -329,7 +329,7 @@ fun configureDaemonJVMOptions(vararg additionalParams: String,
|
|||||||
inheritAdditionalProperties: Boolean
|
inheritAdditionalProperties: Boolean
|
||||||
): DaemonJVMOptions =
|
): DaemonJVMOptions =
|
||||||
configureDaemonJVMOptions(DaemonJVMOptions(),
|
configureDaemonJVMOptions(DaemonJVMOptions(),
|
||||||
additionalParams = *additionalParams,
|
additionalParams = additionalParams,
|
||||||
inheritMemoryLimits = inheritMemoryLimits,
|
inheritMemoryLimits = inheritMemoryLimits,
|
||||||
inheritOtherJvmOptions = inheritOtherJvmOptions,
|
inheritOtherJvmOptions = inheritOtherJvmOptions,
|
||||||
inheritAdditionalProperties = inheritAdditionalProperties)
|
inheritAdditionalProperties = inheritAdditionalProperties)
|
||||||
|
|||||||
+1
@@ -16,4 +16,5 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.daemon.common
|
package org.jetbrains.kotlin.daemon.common
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
interface JpsCompilerServicesFacade : CompilerServicesFacadeBase, CompilerCallbackServicesFacade
|
interface JpsCompilerServicesFacade : CompilerServicesFacadeBase, CompilerCallbackServicesFacade
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@file:Suppress("NOTHING_TO_INLINE")
|
||||||
|
|
||||||
package org.jetbrains.kotlin.daemon.common
|
package org.jetbrains.kotlin.daemon.common
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory
|
import java.lang.management.ManagementFactory
|
||||||
@@ -101,7 +103,7 @@ inline fun endMeasureWallTime(perfCounters: PerfCounters, startState: List<Long>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline fun beginMeasureWallAndThreadTimes(perfCounters: PerfCounters, threadMXBean: ThreadMXBean): List<Long> {
|
inline fun beginMeasureWallAndThreadTimes(threadMXBean: ThreadMXBean): List<Long> {
|
||||||
val startTime = System.nanoTime()
|
val startTime = System.nanoTime()
|
||||||
val startThreadTime = threadMXBean.threadCpuTime()
|
val startThreadTime = threadMXBean.threadCpuTime()
|
||||||
val startThreadUserTime = threadMXBean.threadUserTime()
|
val startThreadUserTime = threadMXBean.threadUserTime()
|
||||||
@@ -117,12 +119,7 @@ inline fun endMeasureWallAndThreadTimes(perfCounters: PerfCounters, threadMXBean
|
|||||||
threadUser = threadMXBean.threadUserTime() - startThreadUserTime)
|
threadUser = threadMXBean.threadUserTime() - startThreadUserTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun beginMeasureWallAndThreadTimes(perfCounters: PerfCounters) =
|
inline fun beginMeasureWallAndThreadTimesAndMemory(withGC: Boolean = false, threadMXBean: ThreadMXBean): List<Long> {
|
||||||
beginMeasureWallAndThreadTimes(perfCounters, ManagementFactory.getThreadMXBean())
|
|
||||||
inline fun endMeasureWallAndThreadTimes(perfCounters: PerfCounters, startState: List<Long>) =
|
|
||||||
endMeasureWallAndThreadTimes(perfCounters, ManagementFactory.getThreadMXBean(), startState)
|
|
||||||
|
|
||||||
inline fun beginMeasureWallAndThreadTimesAndMemory(perfCounters: PerfCounters, withGC: Boolean = false, threadMXBean: ThreadMXBean): List<Long> {
|
|
||||||
val startMem = usedMemory(withGC)
|
val startMem = usedMemory(withGC)
|
||||||
val startTime = System.nanoTime()
|
val startTime = System.nanoTime()
|
||||||
val startThreadTime = threadMXBean.threadCpuTime()
|
val startThreadTime = threadMXBean.threadCpuTime()
|
||||||
@@ -141,13 +138,6 @@ inline fun endMeasureWallAndThreadTimesAndMemory(perfCounters: PerfCounters, wit
|
|||||||
memory = usedMemory(withGC) - startMem)
|
memory = usedMemory(withGC) - startMem)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun<R> beginMeasureWallAndThreadTimesAndMemory(perfCounters: PerfCounters, withGC: Boolean) =
|
|
||||||
beginMeasureWallAndThreadTimesAndMemory(perfCounters, withGC, ManagementFactory.getThreadMXBean())
|
|
||||||
|
|
||||||
inline fun<R> endMeasureWallAndThreadTimesAndMemory(perfCounters: PerfCounters, withGC: Boolean, startState: List<Long>) =
|
|
||||||
endMeasureWallAndThreadTimesAndMemory(perfCounters, withGC, ManagementFactory.getThreadMXBean(), startState)
|
|
||||||
|
|
||||||
|
|
||||||
class DummyProfiler : Profiler {
|
class DummyProfiler : Profiler {
|
||||||
override fun getCounters(): Map<Any?, PerfCounters> = mapOf(null to SimplePerfCounters())
|
override fun getCounters(): Map<Any?, PerfCounters> = mapOf(null to SimplePerfCounters())
|
||||||
override fun getTotalCounters(): PerfCounters = SimplePerfCounters()
|
override fun getTotalCounters(): PerfCounters = SimplePerfCounters()
|
||||||
@@ -174,7 +164,7 @@ class WallTotalProfiler : TotalProfiler() {
|
|||||||
|
|
||||||
class WallAndThreadTotalProfiler : TotalProfiler() {
|
class WallAndThreadTotalProfiler : TotalProfiler() {
|
||||||
@Suppress("OVERRIDE_BY_INLINE")
|
@Suppress("OVERRIDE_BY_INLINE")
|
||||||
override inline fun beginMeasure(obj: Any?) = beginMeasureWallAndThreadTimes(total, threadMXBean)
|
override inline fun beginMeasure(obj: Any?) = beginMeasureWallAndThreadTimes(threadMXBean)
|
||||||
@Suppress("OVERRIDE_BY_INLINE")
|
@Suppress("OVERRIDE_BY_INLINE")
|
||||||
override inline fun endMeasure(obj: Any?, startState: List<Long>) = endMeasureWallAndThreadTimes(total, threadMXBean, startState)
|
override inline fun endMeasure(obj: Any?, startState: List<Long>) = endMeasureWallAndThreadTimes(total, threadMXBean, startState)
|
||||||
}
|
}
|
||||||
@@ -183,7 +173,7 @@ class WallAndThreadTotalProfiler : TotalProfiler() {
|
|||||||
class WallAndThreadAndMemoryTotalProfiler(val withGC: Boolean) : TotalProfiler() {
|
class WallAndThreadAndMemoryTotalProfiler(val withGC: Boolean) : TotalProfiler() {
|
||||||
@Suppress("OVERRIDE_BY_INLINE")
|
@Suppress("OVERRIDE_BY_INLINE")
|
||||||
override inline fun beginMeasure(obj: Any?) =
|
override inline fun beginMeasure(obj: Any?) =
|
||||||
beginMeasureWallAndThreadTimesAndMemory(total, withGC, threadMXBean)
|
beginMeasureWallAndThreadTimesAndMemory(withGC, threadMXBean)
|
||||||
@Suppress("OVERRIDE_BY_INLINE")
|
@Suppress("OVERRIDE_BY_INLINE")
|
||||||
override inline fun endMeasure(obj: Any?, startState: List<Long>) =
|
override inline fun endMeasure(obj: Any?, startState: List<Long>) =
|
||||||
endMeasureWallAndThreadTimesAndMemory(total, withGC, threadMXBean, startState)
|
endMeasureWallAndThreadTimesAndMemory(total, withGC, threadMXBean, startState)
|
||||||
@@ -198,7 +188,7 @@ class WallAndThreadByClassProfiler() : TotalProfiler() {
|
|||||||
|
|
||||||
@Suppress("OVERRIDE_BY_INLINE")
|
@Suppress("OVERRIDE_BY_INLINE")
|
||||||
override inline fun beginMeasure(obj: Any?) =
|
override inline fun beginMeasure(obj: Any?) =
|
||||||
beginMeasureWallAndThreadTimes(counters.getOrPut(obj?.javaClass?.name, { SimplePerfCountersWithTotal(total) }), threadMXBean)
|
beginMeasureWallAndThreadTimes(threadMXBean)
|
||||||
@Suppress("OVERRIDE_BY_INLINE")
|
@Suppress("OVERRIDE_BY_INLINE")
|
||||||
override inline fun endMeasure(obj: Any?, startState: List<Long>) =
|
override inline fun endMeasure(obj: Any?, startState: List<Long>) =
|
||||||
endMeasureWallAndThreadTimes(counters.getOrPut(obj?.javaClass?.name, { SimplePerfCountersWithTotal(total) }), threadMXBean, startState)
|
endMeasureWallAndThreadTimes(counters.getOrPut(obj?.javaClass?.name, { SimplePerfCountersWithTotal(total) }), threadMXBean, startState)
|
||||||
|
|||||||
@@ -309,6 +309,7 @@ abstract class CompileServiceImplBase(
|
|||||||
CompileService.CallResult.Good(ExitCode.COMPILATION_ERROR.code)
|
CompileService.CallResult.Good(ExitCode.COMPILATION_ERROR.code)
|
||||||
} else when (compilationOptions.compilerMode) {
|
} else when (compilationOptions.compilerMode) {
|
||||||
CompilerMode.JPS_COMPILER -> {
|
CompilerMode.JPS_COMPILER -> {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
servicesFacade as JpsServicesFacadeT
|
servicesFacade as JpsServicesFacadeT
|
||||||
withIC(enabled = servicesFacade.hasIncrementalCaches()) {
|
withIC(enabled = servicesFacade.hasIncrementalCaches()) {
|
||||||
doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler ->
|
doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler ->
|
||||||
@@ -609,6 +610,7 @@ abstract class CompileServiceImplBase(
|
|||||||
body: KotlinJvmReplServiceT.() -> CompileService.CallResult<R>
|
body: KotlinJvmReplServiceT.() -> CompileService.CallResult<R>
|
||||||
): CompileService.CallResult<R> =
|
): CompileService.CallResult<R> =
|
||||||
withValidClientOrSessionProxy(sessionId) { session ->
|
withValidClientOrSessionProxy(sessionId) { session ->
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
(session?.data as? KotlinJvmReplServiceT?)?.body() ?: CompileService.CallResult.Error("Not a REPL session $sessionId")
|
(session?.data as? KotlinJvmReplServiceT?)?.body() ?: CompileService.CallResult.Error("Not a REPL session $sessionId")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,6 +705,7 @@ class CompileServiceImpl(
|
|||||||
CompileService.CallResult.Good(res)
|
CompileService.CallResult.Good(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||||
override fun remoteCompile(
|
override fun remoteCompile(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
targetPlatform: CompileService.TargetPlatform,
|
targetPlatform: CompileService.TargetPlatform,
|
||||||
@@ -728,6 +731,7 @@ class CompileServiceImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||||
override fun remoteIncrementalCompile(
|
override fun remoteIncrementalCompile(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
targetPlatform: CompileService.TargetPlatform,
|
targetPlatform: CompileService.TargetPlatform,
|
||||||
@@ -784,7 +788,7 @@ class CompileServiceImpl(
|
|||||||
override fun leaseReplSession(
|
override fun leaseReplSession(
|
||||||
aliveFlagPath: String?,
|
aliveFlagPath: String?,
|
||||||
targetPlatform: CompileService.TargetPlatform,
|
targetPlatform: CompileService.TargetPlatform,
|
||||||
servicesFacade: CompilerCallbackServicesFacade,
|
@Suppress("DEPRECATION") servicesFacade: CompilerCallbackServicesFacade,
|
||||||
templateClasspath: List<File>,
|
templateClasspath: List<File>,
|
||||||
templateClassName: String,
|
templateClassName: String,
|
||||||
scriptArgs: Array<out Any?>?,
|
scriptArgs: Array<out Any?>?,
|
||||||
@@ -819,15 +823,17 @@ class CompileServiceImpl(
|
|||||||
// TODO: add more checks (e.g. is it a repl session)
|
// TODO: add more checks (e.g. is it a repl session)
|
||||||
override fun releaseReplSession(sessionId: Int): CompileService.CallResult<Nothing> = releaseCompileSession(sessionId)
|
override fun releaseReplSession(sessionId: Int): CompileService.CallResult<Nothing> = releaseCompileSession(sessionId)
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine): CompileService.CallResult<ReplCheckResult> =
|
override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine): CompileService.CallResult<ReplCheckResult> =
|
||||||
ifAlive(minAliveness = Aliveness.Alive) {
|
ifAlive(minAliveness = Aliveness.Alive) {
|
||||||
withValidRepl(sessionId) {
|
withValidRepl(sessionId) {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
CompileService.CallResult.Good(check(codeLine))
|
CompileService.CallResult.Good(check(codeLine))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createCompileServices(
|
private fun createCompileServices(
|
||||||
facade: CompilerCallbackServicesFacade,
|
@Suppress("DEPRECATION") facade: CompilerCallbackServicesFacade,
|
||||||
eventManager: EventManager,
|
eventManager: EventManager,
|
||||||
rpcProfiler: Profiler
|
rpcProfiler: Profiler
|
||||||
): Services {
|
): Services {
|
||||||
@@ -835,7 +841,7 @@ class CompileServiceImpl(
|
|||||||
if (facade.hasIncrementalCaches()) {
|
if (facade.hasIncrementalCaches()) {
|
||||||
builder.register(
|
builder.register(
|
||||||
IncrementalCompilationComponents::class.java,
|
IncrementalCompilationComponents::class.java,
|
||||||
RemoteIncrementalCompilationComponentsClient(facade, eventManager, rpcProfiler)
|
RemoteIncrementalCompilationComponentsClient(facade, rpcProfiler)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (facade.hasLookupTracker()) {
|
if (facade.hasLookupTracker()) {
|
||||||
@@ -857,6 +863,7 @@ class CompileServiceImpl(
|
|||||||
return builder.build()
|
return builder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun remoteReplLineCompile(
|
override fun remoteReplLineCompile(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
codeLine: ReplCodeLine,
|
codeLine: ReplCodeLine,
|
||||||
@@ -864,10 +871,12 @@ class CompileServiceImpl(
|
|||||||
): CompileService.CallResult<ReplCompileResult> =
|
): CompileService.CallResult<ReplCompileResult> =
|
||||||
ifAlive(minAliveness = Aliveness.Alive) {
|
ifAlive(minAliveness = Aliveness.Alive) {
|
||||||
withValidRepl(sessionId) {
|
withValidRepl(sessionId) {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
CompileService.CallResult.Good(compile(codeLine, history))
|
CompileService.CallResult.Good(compile(codeLine, history))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun remoteReplLineEval(
|
override fun remoteReplLineEval(
|
||||||
sessionId: Int,
|
sessionId: Int,
|
||||||
codeLine: ReplCodeLine,
|
codeLine: ReplCodeLine,
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ open class KotlinJvmReplService(
|
|||||||
templateClasspath: List<File>,
|
templateClasspath: List<File>,
|
||||||
templateClassName: String,
|
templateClassName: String,
|
||||||
messageCollector: MessageCollector,
|
messageCollector: MessageCollector,
|
||||||
@Deprecated("drop it")
|
// TODO: drop it
|
||||||
protected val operationsTracer: RemoteOperationsTracer?
|
protected val operationsTracer: RemoteOperationsTracer?
|
||||||
) : KotlinJvmReplServiceBase(disposable, compilerId, templateClasspath, templateClassName, messageCollector) {
|
) : KotlinJvmReplServiceBase(disposable, compilerId, templateClasspath, templateClassName, messageCollector) {
|
||||||
|
|
||||||
@@ -142,9 +142,11 @@ open class KotlinJvmReplService(
|
|||||||
@Deprecated("remove after removal state-less check/compile/eval methods")
|
@Deprecated("remove after removal state-less check/compile/eval methods")
|
||||||
protected val defaultStateFacade: RemoteReplStateFacadeServer by lazy { createRemoteState() }
|
protected val defaultStateFacade: RemoteReplStateFacadeServer by lazy { createRemoteState() }
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
@Deprecated("Use check(state, line) instead")
|
@Deprecated("Use check(state, line) instead")
|
||||||
fun check(codeLine: ReplCodeLine): ReplCheckResult = check(defaultStateFacade.state, codeLine)
|
fun check(codeLine: ReplCodeLine): ReplCheckResult = check(defaultStateFacade.state, codeLine)
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION", "UNUSED_PARAMETER")
|
||||||
@Deprecated("Use compile(state, line) instead")
|
@Deprecated("Use compile(state, line) instead")
|
||||||
fun compile(codeLine: ReplCodeLine, verifyHistory: List<ReplCodeLine>?): ReplCompileResult = compile(defaultStateFacade.state, codeLine)
|
fun compile(codeLine: ReplCodeLine, verifyHistory: List<ReplCodeLine>?): ReplCompileResult = compile(defaultStateFacade.state, codeLine)
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -17,14 +17,17 @@
|
|||||||
package org.jetbrains.kotlin.daemon
|
package org.jetbrains.kotlin.daemon
|
||||||
|
|
||||||
import org.jetbrains.kotlin.daemon.common.*
|
import org.jetbrains.kotlin.daemon.common.*
|
||||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
|
||||||
import org.jetbrains.kotlin.progress.CompilationCanceledException
|
import org.jetbrains.kotlin.progress.CompilationCanceledException
|
||||||
|
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
|
||||||
val CANCELED_STATUS_CHECK_THRESHOLD_NS = TimeUnit.MILLISECONDS.toNanos(100)
|
val CANCELED_STATUS_CHECK_THRESHOLD_NS = TimeUnit.MILLISECONDS.toNanos(100)
|
||||||
|
|
||||||
class RemoteCompilationCanceledStatusClient(val facade: CompilerCallbackServicesFacade, val profiler: Profiler = DummyProfiler()): CompilationCanceledStatus {
|
class RemoteCompilationCanceledStatusClient(
|
||||||
|
@Suppress("DEPRECATION") val facade: CompilerCallbackServicesFacade,
|
||||||
|
val profiler: Profiler = DummyProfiler()
|
||||||
|
): CompilationCanceledStatus {
|
||||||
|
|
||||||
private val log by lazy { Logger.getLogger("compiler") }
|
private val log by lazy { Logger.getLogger("compiler") }
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.daemon
|
package org.jetbrains.kotlin.daemon
|
||||||
|
|
||||||
import org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade
|
|
||||||
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
||||||
import org.jetbrains.kotlin.daemon.common.Profiler
|
import org.jetbrains.kotlin.daemon.common.Profiler
|
||||||
import org.jetbrains.kotlin.daemon.common.withMeasure
|
import org.jetbrains.kotlin.daemon.common.withMeasure
|
||||||
@@ -13,7 +12,7 @@ import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class RemoteExpectActualTracker(
|
class RemoteExpectActualTracker(
|
||||||
val facade: CompilerCallbackServicesFacade,
|
@Suppress("DEPRECATION") val facade: org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade,
|
||||||
val profiler: Profiler = DummyProfiler()
|
val profiler: Profiler = DummyProfiler()
|
||||||
): ExpectActualTracker {
|
): ExpectActualTracker {
|
||||||
override fun report(expectedFile: File, actualFile: File) {
|
override fun report(expectedFile: File, actualFile: File) {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.daemon
|
package org.jetbrains.kotlin.daemon
|
||||||
|
|
||||||
import org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade
|
|
||||||
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
||||||
import org.jetbrains.kotlin.daemon.common.Profiler
|
import org.jetbrains.kotlin.daemon.common.Profiler
|
||||||
import org.jetbrains.kotlin.daemon.common.withMeasure
|
import org.jetbrains.kotlin.daemon.common.withMeasure
|
||||||
@@ -24,8 +23,11 @@ import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
|||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.JvmPackagePartProto
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.JvmPackagePartProto
|
||||||
import org.jetbrains.kotlin.modules.TargetId
|
import org.jetbrains.kotlin.modules.TargetId
|
||||||
|
|
||||||
class RemoteIncrementalCacheClient(val facade: CompilerCallbackServicesFacade, val target: TargetId, val profiler: Profiler = DummyProfiler()): IncrementalCache {
|
class RemoteIncrementalCacheClient(
|
||||||
|
@Suppress("DEPRECATION") val facade: org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade,
|
||||||
|
val target: TargetId,
|
||||||
|
val profiler: Profiler = DummyProfiler()
|
||||||
|
): IncrementalCache {
|
||||||
override fun getObsoletePackageParts(): Collection<String> = profiler.withMeasure(this) { facade.incrementalCache_getObsoletePackageParts(target) }
|
override fun getObsoletePackageParts(): Collection<String> = profiler.withMeasure(this) { facade.incrementalCache_getObsoletePackageParts(target) }
|
||||||
|
|
||||||
override fun getObsoleteMultifileClasses(): Collection<String> = profiler.withMeasure(this) { facade.incrementalCache_getObsoleteMultifileClassFacades(target) }
|
override fun getObsoleteMultifileClasses(): Collection<String> = profiler.withMeasure(this) { facade.incrementalCache_getObsoleteMultifileClassFacades(target) }
|
||||||
|
|||||||
+6
-4
@@ -16,13 +16,15 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.daemon
|
package org.jetbrains.kotlin.daemon
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
||||||
|
import org.jetbrains.kotlin.daemon.common.Profiler
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||||
import org.jetbrains.kotlin.modules.TargetId
|
import org.jetbrains.kotlin.modules.TargetId
|
||||||
import org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade
|
|
||||||
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
|
||||||
import org.jetbrains.kotlin.daemon.common.Profiler
|
|
||||||
|
|
||||||
class RemoteIncrementalCompilationComponentsClient(val facade: CompilerCallbackServicesFacade, eventManager: EventManager, val profiler: Profiler = DummyProfiler()) : IncrementalCompilationComponents {
|
class RemoteIncrementalCompilationComponentsClient(
|
||||||
|
@Suppress("DEPRECATION") val facade: org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade,
|
||||||
|
val profiler: Profiler = DummyProfiler()
|
||||||
|
) : IncrementalCompilationComponents {
|
||||||
override fun getIncrementalCache(target: TargetId): IncrementalCache = RemoteIncrementalCacheClient(facade, target, profiler)
|
override fun getIncrementalCache(target: TargetId): IncrementalCache = RemoteIncrementalCacheClient(facade, target, profiler)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.daemon
|
package org.jetbrains.kotlin.daemon
|
||||||
|
|
||||||
import org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade
|
|
||||||
import org.jetbrains.kotlin.daemon.common.Profiler
|
import org.jetbrains.kotlin.daemon.common.Profiler
|
||||||
import org.jetbrains.kotlin.daemon.common.withMeasure
|
import org.jetbrains.kotlin.daemon.common.withMeasure
|
||||||
import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider
|
import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider
|
||||||
@@ -13,8 +12,10 @@ import org.jetbrains.kotlin.incremental.js.IrTranslationResultValue
|
|||||||
import org.jetbrains.kotlin.incremental.js.TranslationResultValue
|
import org.jetbrains.kotlin.incremental.js.TranslationResultValue
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class RemoteIncrementalDataProvider(val facade: CompilerCallbackServicesFacade, val rpcProfiler: Profiler) :
|
class RemoteIncrementalDataProvider(
|
||||||
IncrementalDataProvider {
|
@Suppress("DEPRECATION") val facade: org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade,
|
||||||
|
val rpcProfiler: Profiler
|
||||||
|
) : IncrementalDataProvider {
|
||||||
override val serializedIrFiles: Map<File, IrTranslationResultValue>
|
override val serializedIrFiles: Map<File, IrTranslationResultValue>
|
||||||
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
|
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.daemon
|
package org.jetbrains.kotlin.daemon
|
||||||
|
|
||||||
import org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade
|
|
||||||
import org.jetbrains.kotlin.daemon.common.Profiler
|
import org.jetbrains.kotlin.daemon.common.Profiler
|
||||||
import org.jetbrains.kotlin.daemon.common.withMeasure
|
import org.jetbrains.kotlin.daemon.common.withMeasure
|
||||||
import org.jetbrains.kotlin.incremental.js.FunctionWithSourceInfo
|
import org.jetbrains.kotlin.incremental.js.FunctionWithSourceInfo
|
||||||
@@ -13,8 +12,11 @@ import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumer
|
|||||||
import org.jetbrains.kotlin.incremental.js.JsInlineFunctionHash
|
import org.jetbrains.kotlin.incremental.js.JsInlineFunctionHash
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class RemoteIncrementalResultsConsumer(val facade: CompilerCallbackServicesFacade, eventManager: EventManager, val rpcProfiler: Profiler) :
|
class RemoteIncrementalResultsConsumer(
|
||||||
IncrementalResultsConsumer {
|
@Suppress("DEPRECATION") val facade: org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade,
|
||||||
|
eventManager: EventManager,
|
||||||
|
val rpcProfiler: Profiler
|
||||||
|
) : IncrementalResultsConsumer {
|
||||||
override fun processIrFile(
|
override fun processIrFile(
|
||||||
sourceFile: File,
|
sourceFile: File,
|
||||||
fileData: ByteArray,
|
fileData: ByteArray,
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.daemon
|
|||||||
import com.intellij.util.containers.StringInterner
|
import com.intellij.util.containers.StringInterner
|
||||||
import gnu.trove.THashMap
|
import gnu.trove.THashMap
|
||||||
import gnu.trove.THashSet
|
import gnu.trove.THashSet
|
||||||
import org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade
|
|
||||||
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
||||||
import org.jetbrains.kotlin.daemon.common.Profiler
|
import org.jetbrains.kotlin.daemon.common.Profiler
|
||||||
import org.jetbrains.kotlin.daemon.common.withMeasure
|
import org.jetbrains.kotlin.daemon.common.withMeasure
|
||||||
@@ -28,9 +27,8 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker
|
|||||||
import org.jetbrains.kotlin.incremental.components.Position
|
import org.jetbrains.kotlin.incremental.components.Position
|
||||||
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
||||||
|
|
||||||
|
|
||||||
class RemoteLookupTrackerClient(
|
class RemoteLookupTrackerClient(
|
||||||
val facade: CompilerCallbackServicesFacade,
|
@Suppress("DEPRECATION") val facade: org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade,
|
||||||
eventManager: EventManager,
|
eventManager: EventManager,
|
||||||
val profiler: Profiler = DummyProfiler()
|
val profiler: Profiler = DummyProfiler()
|
||||||
) : LookupTracker {
|
) : LookupTracker {
|
||||||
|
|||||||
+3
-3
@@ -175,10 +175,10 @@ class CompileServiceServerSideImpl(
|
|||||||
} ?: false
|
} ?: false
|
||||||
|
|
||||||
override suspend fun serverHandshake(input: ByteReadChannelWrapper, output: ByteWriteChannelWrapper, log: Logger): Boolean {
|
override suspend fun serverHandshake(input: ByteReadChannelWrapper, output: ByteWriteChannelWrapper, log: Logger): Boolean {
|
||||||
return tryAcquireHandshakeMessage(input, log) && trySendHandshakeMessage(output, log)
|
return tryAcquireHandshakeMessage(input) && trySendHandshakeMessage(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var scheduler: CompileServiceTaskScheduler
|
private var scheduler: CompileServiceTaskScheduler
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
serverSocket: ServerSocketWrapper,
|
serverSocket: ServerSocketWrapper,
|
||||||
@@ -651,7 +651,7 @@ class CompileServiceServerSideImpl(
|
|||||||
if (facade.hasIncrementalCaches()) {
|
if (facade.hasIncrementalCaches()) {
|
||||||
builder.register(
|
builder.register(
|
||||||
IncrementalCompilationComponents::class.java,
|
IncrementalCompilationComponents::class.java,
|
||||||
RemoteIncrementalCompilationComponentsClient(facade, eventManager, rpcProfiler)
|
RemoteIncrementalCompilationComponentsClient(facade, rpcProfiler)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (facade.hasLookupTracker()) {
|
if (facade.hasLookupTracker()) {
|
||||||
|
|||||||
+8
-22
@@ -7,31 +7,14 @@ package org.jetbrains.kotlin.daemon.experimental
|
|||||||
|
|
||||||
import kotlinx.coroutines.Deferred
|
import kotlinx.coroutines.Deferred
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
|
||||||
import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback
|
|
||||||
import org.jetbrains.kotlin.cli.js.K2JSCompiler
|
|
||||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
|
||||||
import org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler
|
|
||||||
import org.jetbrains.kotlin.daemon.CompileServiceImplBase
|
import org.jetbrains.kotlin.daemon.CompileServiceImplBase
|
||||||
import org.jetbrains.kotlin.daemon.CompilerSelector
|
import org.jetbrains.kotlin.daemon.CompilerSelector
|
||||||
import org.jetbrains.kotlin.daemon.common.*
|
|
||||||
import org.jetbrains.kotlin.daemon.common.experimental.findPortForSocket
|
|
||||||
import org.jetbrains.kotlin.daemon.common.ensureServerHostnameIsSetUp
|
|
||||||
import java.io.File
|
|
||||||
import java.io.IOException
|
|
||||||
import java.io.OutputStream
|
|
||||||
import java.io.PrintStream
|
|
||||||
import java.lang.management.ManagementFactory
|
|
||||||
import java.net.URLClassLoader
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.*
|
|
||||||
import java.util.jar.Manifest
|
|
||||||
import java.util.logging.Level
|
|
||||||
import java.util.logging.LogManager
|
|
||||||
import java.util.logging.Logger
|
|
||||||
import kotlin.concurrent.schedule
|
|
||||||
import org.jetbrains.kotlin.daemon.KotlinCompileDaemonBase
|
import org.jetbrains.kotlin.daemon.KotlinCompileDaemonBase
|
||||||
|
import org.jetbrains.kotlin.daemon.common.*
|
||||||
import org.jetbrains.kotlin.daemon.common.experimental.CompileServiceServerSide
|
import org.jetbrains.kotlin.daemon.common.experimental.CompileServiceServerSide
|
||||||
|
import org.jetbrains.kotlin.daemon.common.experimental.findPortForSocket
|
||||||
|
import java.util.*
|
||||||
|
import kotlin.concurrent.schedule
|
||||||
|
|
||||||
object KotlinCompileDaemon : KotlinCompileDaemonBase() {
|
object KotlinCompileDaemon : KotlinCompileDaemonBase() {
|
||||||
override fun <T> runSynchronized(block: () -> T) = runBlocking { block() }
|
override fun <T> runSynchronized(block: () -> T) = runBlocking { block() }
|
||||||
@@ -73,7 +56,10 @@ object KotlinCompileDaemon : KotlinCompileDaemonBase() {
|
|||||||
|
|
||||||
override fun runCompileService(compileService: CompileServiceImplBase) = (compileService as CompileServiceServerSide).runServer()
|
override fun runCompileService(compileService: CompileServiceImplBase) = (compileService as CompileServiceServerSide).runServer()
|
||||||
override fun awaitServerRun(serverRun: Any?) {
|
override fun awaitServerRun(serverRun: Any?) {
|
||||||
runBlocking { (serverRun as Deferred<Unit>?)?.await() }
|
runBlocking {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
(serverRun as Deferred<Unit>?)?.await()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|||||||
+3
-4
@@ -5,14 +5,13 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.daemon.experimental
|
package org.jetbrains.kotlin.daemon.experimental
|
||||||
|
|
||||||
import org.jetbrains.kotlin.daemon.EventManager
|
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
||||||
|
import org.jetbrains.kotlin.daemon.common.Profiler
|
||||||
import org.jetbrains.kotlin.daemon.common.experimental.CompilerCallbackServicesFacadeClientSide
|
import org.jetbrains.kotlin.daemon.common.experimental.CompilerCallbackServicesFacadeClientSide
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||||
import org.jetbrains.kotlin.modules.TargetId
|
import org.jetbrains.kotlin.modules.TargetId
|
||||||
import org.jetbrains.kotlin.daemon.common.DummyProfiler
|
|
||||||
import org.jetbrains.kotlin.daemon.common.Profiler
|
|
||||||
|
|
||||||
class RemoteIncrementalCompilationComponentsClient(val facade: CompilerCallbackServicesFacadeClientSide, eventManager: EventManager, val profiler: Profiler = DummyProfiler()) : IncrementalCompilationComponents {
|
class RemoteIncrementalCompilationComponentsClient(val facade: CompilerCallbackServicesFacadeClientSide, val profiler: Profiler = DummyProfiler()) : IncrementalCompilationComponents {
|
||||||
override fun getIncrementalCache(target: TargetId): IncrementalCache = RemoteIncrementalCacheClient(facade, target, profiler)
|
override fun getIncrementalCache(target: TargetId): IncrementalCache = RemoteIncrementalCacheClient(facade, target, profiler)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -64,8 +64,8 @@ class RemoteReplStateFacadeClientSide(val serverPort: Int) : ReplStateFacadeClie
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun historyResetTo(id: ILineId): List<ILineId> {
|
override suspend fun historyResetTo(id: ILineId): List<ILineId> {
|
||||||
val id = sendMessage(ReplStateFacadeServerSide.HistoryResetToMessage(id))
|
val message = sendMessage(ReplStateFacadeServerSide.HistoryResetToMessage(id))
|
||||||
return readMessage(id)
|
return readMessage(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -303,6 +303,8 @@ class IncrementalJvmCompilerRunner(
|
|||||||
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> {
|
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> {
|
||||||
result.addAll(partsByFacadeName(outputClass.classHeader.multifileClassName!!))
|
result.addAll(partsByFacadeName(outputClass.classHeader.multifileClassName!!))
|
||||||
}
|
}
|
||||||
|
KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.SYNTHETIC_CLASS, KotlinClassHeader.Kind.UNKNOWN -> {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user