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