diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt index 7681f72931a..770cb85e8b7 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt @@ -119,7 +119,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration } val workerExceptionHandling: WorkerExceptionHandling get() = configuration.get(KonanConfigKeys.WORKER_EXCEPTION_HANDLING)?.also { if (it != WorkerExceptionHandling.USE_HOOK) { - configuration.report(CompilerMessageSeverity.STRONG_WARNING, "Legacy exception handling in workers is deprecated") + configuration.report(CompilerMessageSeverity.ERROR, "Legacy exception handling in workers is deprecated") + } else { + configuration.report(CompilerMessageSeverity.STRONG_WARNING, "-Xworker-exception-handling is deprecated") } } ?: WorkerExceptionHandling.USE_HOOK diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index b3dd77b0fdd..eee677af3f3 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -383,23 +383,14 @@ tasks.register("worker10", KonanLocalTest) { } standaloneTest("worker_exceptions") { - flags = ["-tr", "-Xworker-exception-handling=use-hook"] + flags = ["-tr"] outputChecker = { !it.contains("testExecuteAfterStartQuiet error") && it.contains("testExecuteStart error") && !it.contains("testExecuteStartQuiet error") } source = "runtime/workers/worker_exceptions.kt" } -standaloneTest("worker_exceptions_legacy") { - flags = ["-tr", "-Xworker-exception-handling=legacy"] - outputChecker = { - it.contains("testExecuteAfterStartLegacy error") && it.contains("testExecuteStartLegacy error") - } - source = "runtime/workers/worker_exceptions_legacy.kt" -} - standaloneTest("worker_exceptions_terminate") { - flags = ["-Xworker-exception-handling=use-hook"] expectedExitStatusChecker = { it != 0 } outputChecker = { it.contains("some error") && !it.contains("Will not happen") @@ -407,32 +398,14 @@ standaloneTest("worker_exceptions_terminate") { source = "runtime/workers/worker_exceptions_terminate.kt" } -standaloneTest("worker_exceptions_terminate_legacy") { - flags = ["-Xworker-exception-handling=legacy"] - outputChecker = { - it.contains("some error") && it.contains("Will not happen") - } - source = "runtime/workers/worker_exceptions_terminate.kt" -} - standaloneTest("worker_exceptions_terminate_hook") { - flags = ["-Xworker-exception-handling=use-hook"] outputChecker = { it.contains("hook called") && !it.contains("some error") && it.contains("Will happen") } source = "runtime/workers/worker_exceptions_terminate_hook.kt" } -standaloneTest("worker_exceptions_terminate_hook_legacy") { - flags = ["-Xworker-exception-handling=legacy"] - outputChecker = { - !it.contains("hook called") && it.contains("some error") && it.contains("Will happen") - } - source = "runtime/workers/worker_exceptions_terminate_hook.kt" -} - standaloneTest("worker_exceptions_terminate_current") { - flags = ["-Xworker-exception-handling=use-hook"] expectedExitStatusChecker = { it != 0 } outputChecker = { it.contains("some error") && !it.contains("Will not happen") @@ -440,30 +413,13 @@ standaloneTest("worker_exceptions_terminate_current") { source = "runtime/workers/worker_exceptions_terminate_current.kt" } -standaloneTest("worker_exceptions_terminate_current_legacy") { - flags = ["-Xworker-exception-handling=legacy"] - outputChecker = { - it.contains("some error") && it.contains("Will not happen") - } - source = "runtime/workers/worker_exceptions_terminate_current.kt" -} - standaloneTest("worker_exceptions_terminate_hook_current") { - flags = ["-Xworker-exception-handling=use-hook"] outputChecker = { it.contains("hook called") && !it.contains("some error") && it.contains("Will happen") } source = "runtime/workers/worker_exceptions_terminate_hook_current.kt" } -standaloneTest("worker_exceptions_terminate_hook_current_legacy") { - flags = ["-Xworker-exception-handling=legacy"] - outputChecker = { - !it.contains("hook called") && it.contains("some error") && it.contains("Will happen") - } - source = "runtime/workers/worker_exceptions_terminate_hook_current.kt" -} - standaloneTest("worker_threadlocal_no_leak") { source = "runtime/workers/worker_threadlocal_no_leak.kt" } diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_legacy.kt b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_legacy.kt deleted file mode 100644 index 72cb38a8dca..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_legacy.kt +++ /dev/null @@ -1,28 +0,0 @@ -@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class) - -package runtime.workers.worker_exceptions_legacy - -import kotlin.test.* - -import kotlin.native.concurrent.* - -@Test -fun testExecuteAfterStartLegacy() { - val worker = Worker.start() - worker.executeAfter(0L, { - throw Error("testExecuteAfterStartLegacy error") - }.freeze()) - worker.requestTermination().result -} - -@Test -fun testExecuteStartLegacy() { - val worker = Worker.start() - val future = worker.execute(TransferMode.SAFE, {}) { - throw Error("testExecuteStartLegacy error") - } - assertFailsWith { - future.result - } - worker.requestTermination().result -} diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Worker.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Worker.kt index b5e0904e611..b059100d182 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Worker.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Worker.kt @@ -128,12 +128,9 @@ public value class Worker @PublishedApi internal constructor(public val id: Int) /** * Plan job for further execution in the worker. * - * With -Xworker-exception-handling=use-hook, if the worker was created with `errorReporting` set to true, any exception escaping from [operation] will + * If the worker was created with `errorReporting` set to true, any exception escaping from [operation] will * be handled by [processUnhandledException]. * - * Legacy MM: [operation] parameter must be either frozen, or execution to be planned on the current worker. - * Otherwise [IllegalStateException] will be thrown. - * * @param afterMicroseconds defines after how many microseconds delay execution shall happen, 0 means immediately, * @throws [IllegalArgumentException] on negative values of [afterMicroseconds]. * @throws [IllegalStateException] if [operation] parameter is not frozen and worker is not current.