diff --git a/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/ObjectiveCImpl.kt b/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/ObjectiveCImpl.kt index 67b5098138f..b717e6364ca 100644 --- a/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/ObjectiveCImpl.kt +++ b/kotlin-native/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/ObjectiveCImpl.kt @@ -28,6 +28,7 @@ typealias ObjCObjectMeta = ObjCClass interface ObjCProtocol : ObjCObject @ExportTypeInfo("theForeignObjCObjectTypeInfo") +@OptIn(FreezingIsDeprecated::class) @kotlin.native.internal.Frozen internal open class ForeignObjCObject : kotlin.native.internal.ObjCObjectWrapper diff --git a/kotlin-native/NEW_MM.md b/kotlin-native/NEW_MM.md index 6d2a3c4448d..16af04333c0 100644 --- a/kotlin-native/NEW_MM.md +++ b/kotlin-native/NEW_MM.md @@ -60,7 +60,7 @@ If `kotlin.native.isExperimentalMM()` returns `true`, you've successfully enable To improve the performance, please also consider enabling a concurrent implementation for the sweep phase of the garbage collector. See more details [here](https://kotlinlang.org/docs/whatsnew1620.html#concurrent-implementation-for-the-sweep-phase-in-new-memory-manager). -It will be switched on by default in Kotlin 1.7.0. +Since 1.7.0 this is the default GC implementation for the new MM. ### Update the libraries @@ -91,11 +91,53 @@ Other libraries might also have compatibility issues. If you encounter any, repo Known issues: * SQLDelight: https://github.com/cashapp/sqldelight/issues/2556 +## Freezing deprecation + +Starting with 1.7.20 freezing API is deprecated. + +To temporarily support code for both new and legacy MM, ignore deprecation warnings by: +* either annotating usages of deprecated API with `@OptIn(FreezingIsDeprecated::class)`, +* or applying `languageSettings.optIn("kotlin.native.FreezingIsDeprecated")` to all kotlin source sets in gradle, +* or passing compiler flag `-opt-in=kotlin.native.FreezingIsDeprecated`. + +See [Opt-in requirements](https://kotlinlang.org/docs/opt-in-requirements.html) for more details. + +To support new MM only, remove usages of the affected API: +* [`@SharedImmutable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-shared-immutable/): + remove usages. Its usage does not trigger any warning. +* [`class FreezableAtomicReference`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-freezable-atomic-reference/): + use [`class AtomicReference`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-atomic-reference/) instead. +* [`class FreezingException`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-freezing-exception/): + remove usages. +* [`class InvalidMutabilityException`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-invalid-mutability-exception/): + remove usages. +* [`class IncorrectDereferenceException`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native/-incorrect-dereference-exception/): + remove usages. +* [`fun T.freeze()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/freeze.html): + remove usages. +* [`val Any?.isFrozen`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/is-frozen.html): + remove usages assuming it always returns `false`. +* [`fun Any.ensureNeverFrozen()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/ensure-never-frozen.html): + remove usages. +* [`fun atomicLazy(…)`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/atomic-lazy.html): + use [`fun lazy(…)`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/lazy.html) instead. +* [`class MutableData`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-mutable-data/): + use any regular collection instead. +* [`class WorkerBoundReference`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-worker-bound-reference/): + use `T` directly. +* [`class DetachedObjectGraph`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-detached-object-graph/): + use `T` directly. To pass the value through the C interop, use [`class StableRef`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlinx.cinterop/-stable-ref/). + +Additionally, setting `freezing` binary option to anything but `disabled` with the new MM is deprecated. Currently, usage causes a diagnostics message - not a warning. + ## Performance issues For the first preview, we're using the simplest scheme for garbage collection: single-threaded stop-the-world mark-and-sweep algorithm, which is triggered after enough functions, loop iterations, and allocations were executed. This greatly hinders the performance, and one of our top priorities now is addressing these performance issues. +> Starting with 1.7.0 we use stop-the-world mark & concurrent sweep GC with a conventional GC scheduler that tracks alive heap size. This significantly +improves performance. + We don't have nice instruments to monitor the GC performance yet. So far, diagnosing requires looking at GC logs. To enable the logs, add the compilation flag `-Xruntime-logs=gc=info` in a Gradle build script: ```kotlin // build.gradle.kts @@ -111,7 +153,7 @@ Currently, the logs are only printed to stderr. _Note that the exact contents of The list of known performance issues: -* Since the collector is single-threaded stop-the-world, the pause time of every thread linearly depends on the number of objects in the heap. The more objects that are kept alive, the longer the pauses are. Long pauses on the main thread can result in laggy UI event handling. Both the pause time and the number of objects in the heap are printed to the logs for each GC cycle. +* Since the collector has stop-the-world mark phase, the pause time of every thread linearly depends on the number of objects in the heap. The more objects that are kept alive, the longer the pauses are. Long pauses on the main thread can result in laggy UI event handling. Both the pause time and the number of objects in the heap are printed to the logs for each GC cycle. * Being stop-the-world also means that all threads with Kotlin/Native runtime active on them need to synchronize simultaneously for the collection to begin. This also affects the pause time. * There is a complicated relationship between Swift/ObjC objects and their Kotlin/Native counterparts, which causes Swift/ObjC objects to linger longer than necessary. It means that their Kotlin/Native counterparts are kept in the heap longer, contributing to the slower collection time. This typically doesn't happen, but in some corner cases, for example, when a long loop creates several temporary objects that cross the Swift/ObjC interop boundary on each iteration (for example, calling a Kotlin callback from a loop in Swift or vice versa). In the logs, there's a number of stable refs in the root set. If this number keeps growing, it may indicate that the Swift/ObjC objects are not being freed when they should. Try putting `autoreleasepool` around loop bodies (both in Swift/ObjC and Kotlin) that do interop calls. @@ -119,6 +161,7 @@ The list of known performance issues: This manifests in time between cycles being close (or even less) than the pause time. Both of these numbers are printed to the logs. Try increasing `kotlin.native.internal.GC.threshold` and `kotlin.native.internal.GC.thresholdAllocations` to force GC to happen less often. Note that the exact meaning of `threshold` and `thresholdAllocations` may change in the future. * Freezing is currently implemented suboptimally: internally, a separate memory allocation may occur for each frozen object (this recursively includes the object subgraph), which puts unnecessary pressure on the heap. + Won't be fixed, because [freezing is deprecated](#freezing-deprecation) since 1.7.20. * Unterminated `Worker`s and unconsumed `Future`s have objects pinned to the heap, contributing to the pause time. Like Swift/ObjC interop, this also manifests in a growing number of stable refs in the root set. To mitigate: * Look for calls to `Worker.execute` with the resulting `Future` objects that are never consumed using `Future.consume` or `Future.result`. @@ -131,18 +174,22 @@ If you observe regressions more significant than 5x, please report to [this perf ## Known bugs -* Compiler caches are not supported, so the compilation of debug binaries will be slower. +* Compiler caches are only supported since 1.7.20, so the compilation of debug binaries will be slower with previous compiler versions. * Freezing machinery is not thread-safe: if an object is being frozen on one thread, and its subgraph is being modified on another, by the end, the object will be frozen, but some subgraph of it might be not. + This will not be fixed, because [freezing is deprecated](#freezing-deprecation) since 1.7.20. * Documentation is not updated to reflect changes for the new MM. * There's no application state handling on iOS: the collector will not be throttled down if the application goes into the background. However, the collection is not forced upon going into the background, which leaves the application with a larger memory footprint than necessary, making it a more likely target to be terminated by the OS. * WASM (or any target that doesn't have pthreads) is not supported with the new MM. - ## Workarounds ### Unexpected object freezing +> Since 1.7.20 [freezing is deprecated](#freezing-deprecation). Setting `freezing` to anything but `disabled` is deprecated. + +> Since 1.6.20 freezing is disabled by default with the new MM. + Some libraries might not be ready for the new MM and freeze-transparency of `kotlinx.coroutines`, so unexpected `InvalidMutabilityException` or `FreezingException` might appear. To workaround such cases, we added a `freezing` binary option that disables freezing fully (`disabled`) or partially (`explicitOnly`). diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CacheSupport.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CacheSupport.kt index 5265dd3ee01..4851f17c1cc 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CacheSupport.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CacheSupport.kt @@ -132,4 +132,4 @@ class CacheSupport( configuration.reportCompilationError("Cache cannot be used in optimized compilation") } } -} \ No newline at end of file +} 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 ff41dfd49fe..7d17bca5e15 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 @@ -73,14 +73,13 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration MemoryModel.STRICT -> MemoryModel.STRICT MemoryModel.RELAXED -> { configuration.report(CompilerMessageSeverity.ERROR, - "Relaxed memory model is deprecated and isn't expected to work right way with current Kotlin version." + - " Use strict as default. ") + "Relaxed MM is deprecated and isn't expected to work right way with current Kotlin version. Using legacy MM.") MemoryModel.STRICT } MemoryModel.EXPERIMENTAL -> { if (!target.supportsThreads()) { configuration.report(CompilerMessageSeverity.STRONG_WARNING, - "Experimental memory model requires threads, which are not supported on target ${target.name}. Used strict memory model.") + "New MM requires threads, which are not supported on target ${target.name}. Using legacy MM.") MemoryModel.STRICT } else { MemoryModel.EXPERIMENTAL @@ -90,7 +89,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration }.also { if (it == MemoryModel.EXPERIMENTAL && destroyRuntimeMode == DestroyRuntimeMode.LEGACY) { configuration.report(CompilerMessageSeverity.ERROR, - "Experimental memory model is incompatible with 'legacy' destroy runtime mode.") + "New MM is incompatible with 'legacy' destroy runtime mode.") } } } @@ -127,9 +126,19 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration memoryModel != MemoryModel.EXPERIMENTAL && freezingMode != Freezing.Full -> { configuration.report( CompilerMessageSeverity.ERROR, - "`freezing` can only be adjusted with experimental MM. Falling back to default behavior.") + "`freezing` can only be adjusted with new MM. Falling back to default behavior.") Freezing.Full } + memoryModel == MemoryModel.EXPERIMENTAL && freezingMode != Freezing.Disabled -> { + // INFO because deprecation is currently ignorable via OptIn. Using WARNING will require silencing (for warnings-as-errors) + // by some compiler flag. + // TODO: When moving into proper deprecation cycle replace with WARNING. + configuration.report( + CompilerMessageSeverity.INFO, + "`freezing` should not be enabled with the new MM. Freezing API is deprecated since 1.7.20. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details" + ) + freezingMode + } else -> freezingMode } } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt index 21e77f02de8..daa054f13ea 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt @@ -646,7 +646,7 @@ internal abstract class FunctionGenerationContext( fun switchThreadState(state: ThreadState) { check(context.memoryModel == MemoryModel.EXPERIMENTAL) { - "Thread state switching is allowed in the experimental memory model only." + "Thread state switching is allowed in the new MM only." } check(!forbidRuntime) { "Attempt to switch the thread state when runtime is forbidden" diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 822e89e6ffc..ae639bb0914 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -106,6 +106,12 @@ if (project.globalTestArgs.contains("-g")) { } } +if (!isExperimentalMM) { + tasks.withType(KonanCompileNativeBinary.class).configureEach { + extraOpts "-opt-in=kotlin.native.FreezingIsDeprecated" + } +} + allprojects { // Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set. // backend.native/tests diff --git a/kotlin-native/backend.native/tests/codegen/enum/isFrozen.kt b/kotlin-native/backend.native/tests/codegen/enum/isFrozen.kt index 33950532821..470401ff5a9 100644 --- a/kotlin-native/backend.native/tests/codegen/enum/isFrozen.kt +++ b/kotlin-native/backend.native/tests/codegen/enum/isFrozen.kt @@ -2,7 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ - +@file:OptIn(FreezingIsDeprecated::class) package codegen.enum.isFrozen import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/codegen/initializers/workers1.kt b/kotlin-native/backend.native/tests/codegen/initializers/workers1.kt index 90efc2dcf0e..fab6250febb 100644 --- a/kotlin-native/backend.native/tests/codegen/initializers/workers1.kt +++ b/kotlin-native/backend.native/tests/codegen/initializers/workers1.kt @@ -9,6 +9,7 @@ class X(val s: String) val x = X("zzz") // FILE: lib2.kt +@file:OptIn(FreezingIsDeprecated::class) import kotlin.native.concurrent.* class Z(val x: Int) diff --git a/kotlin-native/backend.native/tests/codegen/objectDeclaration/isFrozen.kt b/kotlin-native/backend.native/tests/codegen/objectDeclaration/isFrozen.kt index 6ee0a7fcfe4..2adbdf9affd 100644 --- a/kotlin-native/backend.native/tests/codegen/objectDeclaration/isFrozen.kt +++ b/kotlin-native/backend.native/tests/codegen/objectDeclaration/isFrozen.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package codegen.objectDeclaration.isFrozen import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/interop/exceptions/exceptionHook.kt b/kotlin-native/backend.native/tests/interop/exceptions/exceptionHook.kt index 94adb7f23a9..224d8770938 100644 --- a/kotlin-native/backend.native/tests/interop/exceptions/exceptionHook.kt +++ b/kotlin-native/backend.native/tests/interop/exceptions/exceptionHook.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.native.concurrent.freeze // KT-47828 diff --git a/kotlin-native/backend.native/tests/interop/migrating_main_thread/lib.kt b/kotlin-native/backend.native/tests/interop/migrating_main_thread/lib.kt index f2bc4c99127..db60205cc54 100644 --- a/kotlin-native/backend.native/tests/interop/migrating_main_thread/lib.kt +++ b/kotlin-native/backend.native/tests/interop/migrating_main_thread/lib.kt @@ -2,6 +2,7 @@ * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) class A { var i = 0 diff --git a/kotlin-native/backend.native/tests/interop/objc/illegal_sharing.kt b/kotlin-native/backend.native/tests/interop/objc/illegal_sharing.kt index 12f7bfe0283..44167903835 100644 --- a/kotlin-native/backend.native/tests/interop/objc/illegal_sharing.kt +++ b/kotlin-native/backend.native/tests/interop/objc/illegal_sharing.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.native.concurrent.* import kotlin.test.* import platform.Foundation.* diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/objcWeakRefs.kt b/kotlin-native/backend.native/tests/interop/objc/tests/objcWeakRefs.kt index 64428150f65..69317ded24e 100644 --- a/kotlin-native/backend.native/tests/interop/objc/tests/objcWeakRefs.kt +++ b/kotlin-native/backend.native/tests/interop/objc/tests/objcWeakRefs.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlinx.cinterop.* import kotlin.native.concurrent.* import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/sharing.kt b/kotlin-native/backend.native/tests/interop/objc/tests/sharing.kt index 6755484edd0..34031583391 100644 --- a/kotlin-native/backend.native/tests/interop/objc/tests/sharing.kt +++ b/kotlin-native/backend.native/tests/interop/objc/tests/sharing.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlinx.cinterop.* import kotlin.native.concurrent.* import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/utils.kt b/kotlin-native/backend.native/tests/interop/objc/tests/utils.kt index 4dc98a58f0f..2172af8bde3 100644 --- a/kotlin-native/backend.native/tests/interop/objc/tests/utils.kt +++ b/kotlin-native/backend.native/tests/interop/objc/tests/utils.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlinx.cinterop.* import kotlin.native.concurrent.* import objcTests.* diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/workerAutoreleasePool.kt b/kotlin-native/backend.native/tests/interop/objc/tests/workerAutoreleasePool.kt index ad942a373f0..fe13e8890d5 100644 --- a/kotlin-native/backend.native/tests/interop/objc/tests/workerAutoreleasePool.kt +++ b/kotlin-native/backend.native/tests/interop/objc/tests/workerAutoreleasePool.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.native.concurrent.* import kotlinx.cinterop.* import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/interop/threadStates/unhandledException.kt b/kotlin-native/backend.native/tests/interop/threadStates/unhandledException.kt index 9b5cba22bd0..95d3075b54a 100644 --- a/kotlin-native/backend.native/tests/interop/threadStates/unhandledException.kt +++ b/kotlin-native/backend.native/tests/interop/threadStates/unhandledException.kt @@ -2,6 +2,7 @@ * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +@file:OptIn(FreezingIsDeprecated::class) import kotlin.native.concurrent.* import kotlin.native.internal.Debugging diff --git a/kotlin-native/backend.native/tests/interop/threadStates/unhandledExceptionInForeignThread.kt b/kotlin-native/backend.native/tests/interop/threadStates/unhandledExceptionInForeignThread.kt index ab60975863b..aa670ed272a 100644 --- a/kotlin-native/backend.native/tests/interop/threadStates/unhandledExceptionInForeignThread.kt +++ b/kotlin-native/backend.native/tests/interop/threadStates/unhandledExceptionInForeignThread.kt @@ -2,6 +2,7 @@ * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +@file:OptIn(FreezingIsDeprecated::class) import kotlin.native.concurrent.* import kotlin.native.internal.Debugging diff --git a/kotlin-native/backend.native/tests/objcexport/values.kt b/kotlin-native/backend.native/tests/objcexport/values.kt index 5f418e8b617..6c580e72a8c 100644 --- a/kotlin-native/backend.native/tests/objcexport/values.kt +++ b/kotlin-native/backend.native/tests/objcexport/values.kt @@ -5,6 +5,7 @@ // All classes and methods should be used in tests @file:Suppress("UNUSED") +@file:OptIn(FreezingIsDeprecated::class) package conversions @@ -856,8 +857,11 @@ class SharedRefs { mutableListOf() } + @OptIn(FreezingIsDeprecated::class) fun createFrozenRegularObject() = createRegularObject().freeze() + @OptIn(FreezingIsDeprecated::class) fun createFrozenLambda() = createLambda().freeze() + @OptIn(FreezingIsDeprecated::class) fun createFrozenCollection() = createCollection().freeze() fun hasAliveObjects(): Boolean { diff --git a/kotlin-native/backend.native/tests/produce_dynamic/simple/hello.kt b/kotlin-native/backend.native/tests/produce_dynamic/simple/hello.kt index 3ea037214a5..43504ae3afc 100644 --- a/kotlin-native/backend.native/tests/produce_dynamic/simple/hello.kt +++ b/kotlin-native/backend.native/tests/produce_dynamic/simple/hello.kt @@ -4,6 +4,7 @@ */ // FILE: hello.kt +@file:OptIn(FreezingIsDeprecated::class) import kotlinx.cinterop.* diff --git a/kotlin-native/backend.native/tests/produce_dynamic/unhandledException/unhandled.kt b/kotlin-native/backend.native/tests/produce_dynamic/unhandledException/unhandled.kt index d4976c9941b..d12ec5cad7f 100644 --- a/kotlin-native/backend.native/tests/produce_dynamic/unhandledException/unhandled.kt +++ b/kotlin-native/backend.native/tests/produce_dynamic/unhandledException/unhandled.kt @@ -2,6 +2,7 @@ * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +@file:OptIn(FreezingIsDeprecated::class) import kotlin.native.concurrent.* import kotlin.native.internal.* diff --git a/kotlin-native/backend.native/tests/runtime/basic/cleaner_basic.kt b/kotlin-native/backend.native/tests/runtime/basic/cleaner_basic.kt index 26d9140c070..3942c8eb692 100644 --- a/kotlin-native/backend.native/tests/runtime/basic/cleaner_basic.kt +++ b/kotlin-native/backend.native/tests/runtime/basic/cleaner_basic.kt @@ -2,7 +2,7 @@ * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ -@file:OptIn(ExperimentalStdlibApi::class) +@file:OptIn(ExperimentalStdlibApi::class, FreezingIsDeprecated::class) package runtime.basic.cleaner_basic diff --git a/kotlin-native/backend.native/tests/runtime/basic/cleaner_workers.kt b/kotlin-native/backend.native/tests/runtime/basic/cleaner_workers.kt index f87e4ab2dbb..964d3cc272e 100644 --- a/kotlin-native/backend.native/tests/runtime/basic/cleaner_workers.kt +++ b/kotlin-native/backend.native/tests/runtime/basic/cleaner_workers.kt @@ -2,7 +2,7 @@ * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ -@file:OptIn(ExperimentalStdlibApi::class) +@file:OptIn(ExperimentalStdlibApi::class, FreezingIsDeprecated::class) package runtime.basic.cleaner_workers diff --git a/kotlin-native/backend.native/tests/runtime/collections/typed_array1.kt b/kotlin-native/backend.native/tests/runtime/collections/typed_array1.kt index 76518e0ba9f..fb11068f4a2 100644 --- a/kotlin-native/backend.native/tests/runtime/collections/typed_array1.kt +++ b/kotlin-native/backend.native/tests/runtime/collections/typed_array1.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.collections.typed_array1 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/concurrent/worker_bound_reference0.kt b/kotlin-native/backend.native/tests/runtime/concurrent/worker_bound_reference0.kt index 50346c9c929..6bb5eaf577a 100644 --- a/kotlin-native/backend.native/tests/runtime/concurrent/worker_bound_reference0.kt +++ b/kotlin-native/backend.native/tests/runtime/concurrent/worker_bound_reference0.kt @@ -2,6 +2,7 @@ * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.concurrent.worker_bound_reference0 diff --git a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook.kt b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook.kt index 077295073b4..220fe0c7fa5 100644 --- a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook.kt +++ b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook.kt @@ -2,6 +2,8 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.test.* import kotlin.native.concurrent.* diff --git a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_get.kt b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_get.kt index 8756497ccd8..9ba9299eb1f 100644 --- a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_get.kt +++ b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_get.kt @@ -2,7 +2,7 @@ * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ -@file:OptIn(ExperimentalStdlibApi::class) +@file:OptIn(ExperimentalStdlibApi::class, FreezingIsDeprecated::class) import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_memory_leak.kt b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_memory_leak.kt index e6d36f23778..c28592247e2 100644 --- a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_memory_leak.kt +++ b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_memory_leak.kt @@ -2,6 +2,8 @@ * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.test.* import kotlin.native.concurrent.* diff --git a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_no_reset.kt b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_no_reset.kt index cd6382f1178..6a284e3f931 100644 --- a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_no_reset.kt +++ b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_no_reset.kt @@ -2,7 +2,7 @@ * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ -@file:OptIn(ExperimentalStdlibApi::class) +@file:OptIn(ExperimentalStdlibApi::class, FreezingIsDeprecated::class) import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_terminate.kt b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_terminate.kt index feed2442bee..22d315fee29 100644 --- a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_terminate.kt +++ b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_terminate.kt @@ -2,7 +2,7 @@ * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ -@file:OptIn(ExperimentalStdlibApi::class) +@file:OptIn(ExperimentalStdlibApi::class, FreezingIsDeprecated::class) import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_terminate_unhandled_exception.kt b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_terminate_unhandled_exception.kt index 681927c3c5f..e78b921642b 100644 --- a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_terminate_unhandled_exception.kt +++ b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_terminate_unhandled_exception.kt @@ -2,7 +2,7 @@ * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ -@file:OptIn(ExperimentalStdlibApi::class) +@file:OptIn(ExperimentalStdlibApi::class, FreezingIsDeprecated::class) import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_throws.kt b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_throws.kt index 31fcbad20a7..e2d9d80042a 100644 --- a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_throws.kt +++ b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_throws.kt @@ -2,6 +2,8 @@ * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.test.* import kotlin.native.concurrent.* diff --git a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_unhandled_exception.kt b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_unhandled_exception.kt index b3c6741dbf3..b448aea61f3 100644 --- a/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_unhandled_exception.kt +++ b/kotlin-native/backend.native/tests/runtime/exceptions/custom_hook_unhandled_exception.kt @@ -2,7 +2,7 @@ * Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ -@file:OptIn(ExperimentalStdlibApi::class) +@file:OptIn(ExperimentalStdlibApi::class, FreezingIsDeprecated::class) import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/freezing_control/basic.kt b/kotlin-native/backend.native/tests/runtime/freezing_control/basic.kt index 4cb9fd142a1..fe66843e6a8 100644 --- a/kotlin-native/backend.native/tests/runtime/freezing_control/basic.kt +++ b/kotlin-native/backend.native/tests/runtime/freezing_control/basic.kt @@ -2,6 +2,7 @@ * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +@file:OptIn(FreezingIsDeprecated::class) import kotlin.test.* import kotlin.native.concurrent.* diff --git a/kotlin-native/backend.native/tests/runtime/memory/stable_ref_cross_thread_check.kt b/kotlin-native/backend.native/tests/runtime/memory/stable_ref_cross_thread_check.kt index 062ccbc2c74..e6e8b7f2d0f 100644 --- a/kotlin-native/backend.native/tests/runtime/memory/stable_ref_cross_thread_check.kt +++ b/kotlin-native/backend.native/tests/runtime/memory/stable_ref_cross_thread_check.kt @@ -2,6 +2,7 @@ * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.memory.stable_ref_cross_thread_check diff --git a/kotlin-native/backend.native/tests/runtime/workers/atomic0.kt b/kotlin-native/backend.native/tests/runtime/workers/atomic0.kt index c30743249fb..8ed4df9263c 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/atomic0.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/atomic0.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.atomic0 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze0.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze0.kt index 0eff9602588..786a4ca32a2 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze0.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/freeze0.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.freeze0 diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze1.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze1.kt index 6a8b9f9a054..82cfc3fad21 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze1.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/freeze1.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.freeze1 diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze2.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze2.kt index 7fb53594c04..ed4fa558ed3 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze2.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/freeze2.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.freeze2 diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze3.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze3.kt index 05dab88d7bf..5ec6e64fe74 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze3.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/freeze3.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.freeze3 diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze4.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze4.kt index 2b1fad294a0..8f49eaae653 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze4.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/freeze4.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.freeze4 diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze6.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze6.kt index e32450ea22b..df2ef1d1345 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze6.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/freeze6.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.freeze6 diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze_disabled.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze_disabled.kt index 9d4d834e1de..35d6beceae4 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze_disabled.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/freeze_disabled.kt @@ -2,6 +2,7 @@ * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.freeze_disabled diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.kt index 3c15d27c6f7..af6ad8a3769 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.freeze_stress diff --git a/kotlin-native/backend.native/tests/runtime/workers/lazy0.kt b/kotlin-native/backend.native/tests/runtime/workers/lazy0.kt index 3322a8779e2..396965d30f0 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/lazy0.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/lazy0.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.lazy0 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/lazy1.kt b/kotlin-native/backend.native/tests/runtime/workers/lazy1.kt index 36da4acf9ad..9249f990bf6 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/lazy1.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/lazy1.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.lazy1 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/lazy3.kt b/kotlin-native/backend.native/tests/runtime/workers/lazy3.kt index 308df46ee15..2f1a267e592 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/lazy3.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/lazy3.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.native.concurrent.* import kotlin.native.ref.* import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/lazy4.kt b/kotlin-native/backend.native/tests/runtime/workers/lazy4.kt index 7af8f3323a8..6b450d9575e 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/lazy4.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/lazy4.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.lazy4 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/mutableData1.kt b/kotlin-native/backend.native/tests/runtime/workers/mutableData1.kt index 4cadf459db0..197704f9310 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/mutableData1.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/mutableData1.kt @@ -1,3 +1,4 @@ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.mutableData1 import kotlin.native.concurrent.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker10.kt b/kotlin-native/backend.native/tests/runtime/workers/worker10.kt index eb4c9622591..5fd7b72ce4e 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker10.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker10.kt @@ -1,3 +1,4 @@ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.worker10 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker11.kt b/kotlin-native/backend.native/tests/runtime/workers/worker11.kt index 06f646fa127..a3df122edb5 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker11.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker11.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.worker11 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker4.kt b/kotlin-native/backend.native/tests/runtime/workers/worker4.kt index cdcba55d7fc..72d339d56f9 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker4.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker4.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.worker4 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker5.kt b/kotlin-native/backend.native/tests/runtime/workers/worker5.kt index bca67943d01..fe2b8f1e56c 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker5.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker5.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker6.kt b/kotlin-native/backend.native/tests/runtime/workers/worker6.kt index ee2d8aaca1e..4a0985ae122 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker6.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker6.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.worker6 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker8.kt b/kotlin-native/backend.native/tests/runtime/workers/worker8.kt index 72ebb86b2fd..7aad72bde82 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker8.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker8.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.worker8 diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker9.kt b/kotlin-native/backend.native/tests/runtime/workers/worker9.kt index 7dbed3563d3..cc171548a17 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker9.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker9.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.worker9 import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker9_experimentalMM.kt b/kotlin-native/backend.native/tests/runtime/workers/worker9_experimentalMM.kt index 2fe14beb890..ee41170e113 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker9_experimentalMM.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker9_experimentalMM.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.worker9_experimentalMM import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker_exception_messages.kt b/kotlin-native/backend.native/tests/runtime/workers/worker_exception_messages.kt index d5b450c0823..97212f8c46f 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker_exception_messages.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker_exception_messages.kt @@ -1,3 +1,4 @@ +@file:OptIn(FreezingIsDeprecated::class) package runtime.workers.worker_exception_messages import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions.kt b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions.kt index fa27d42052e..1f5a7830425 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + package runtime.workers.worker_exceptions import kotlin.test.* 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 index 917aee36c47..e33e5f7b951 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_legacy.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_legacy.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + package runtime.workers.worker_exceptions_legacy import kotlin.test.* diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate.kt b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate.kt index 1d9d8a37684..3b5d3373723 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.native.concurrent.* fun main() { diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_current.kt b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_current.kt index 45e5cb81841..54134c6281c 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_current.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_current.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.native.concurrent.* fun main() { diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_hook.kt b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_hook.kt index a12e97e4406..b7ef022c81a 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_hook.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_hook.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.native.concurrent.* fun main() { diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_hook_current.kt b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_hook_current.kt index c2ddc38fe87..d55b988209e 100644 --- a/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_hook_current.kt +++ b/kotlin-native/backend.native/tests/runtime/workers/worker_exceptions_terminate_hook_current.kt @@ -1,3 +1,5 @@ +@file:OptIn(FreezingIsDeprecated::class) + import kotlin.native.concurrent.* fun main() { diff --git a/kotlin-native/backend.native/tests/stdlib_external/text/StringEncodingTestNative.kt b/kotlin-native/backend.native/tests/stdlib_external/text/StringEncodingTestNative.kt index 758f56c27d2..a2280c709e5 100644 --- a/kotlin-native/backend.native/tests/stdlib_external/text/StringEncodingTestNative.kt +++ b/kotlin-native/backend.native/tests/stdlib_external/text/StringEncodingTestNative.kt @@ -2,6 +2,7 @@ * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(FreezingIsDeprecated::class) package test.text diff --git a/kotlin-native/performance/ring/src/main/kotlin-native/org/jetbrains/ring/Utils.kt b/kotlin-native/performance/ring/src/main/kotlin-native/org/jetbrains/ring/Utils.kt index 113db5e1c23..9015b2c70ea 100644 --- a/kotlin-native/performance/ring/src/main/kotlin-native/org/jetbrains/ring/Utils.kt +++ b/kotlin-native/performance/ring/src/main/kotlin-native/org/jetbrains/ring/Utils.kt @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +// We benchmark both new and legacy MM. +@file:OptIn(FreezingIsDeprecated::class) package org.jetbrains.ring diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Lazy.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Lazy.kt index 40687105adb..3fa5d427fa9 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Lazy.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Lazy.kt @@ -19,7 +19,7 @@ import kotlin.native.isExperimentalMM * Note that the returned instance uses itself to synchronize on. Do not synchronize from external code on * the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future. */ -@OptIn(kotlin.ExperimentalStdlibApi::class) +@OptIn(kotlin.ExperimentalStdlibApi::class, FreezingIsDeprecated::class) public actual fun lazy(initializer: () -> T): Lazy = if (isExperimentalMM()) SynchronizedLazyImpl(initializer) @@ -38,7 +38,7 @@ public actual fun lazy(initializer: () -> T): Lazy = * Also this behavior can be changed in the future. */ @FixmeConcurrency -@OptIn(kotlin.ExperimentalStdlibApi::class) +@OptIn(kotlin.ExperimentalStdlibApi::class, FreezingIsDeprecated::class) public actual fun lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy = when (mode) { LazyThreadSafetyMode.SYNCHRONIZED -> if (isExperimentalMM()) SynchronizedLazyImpl(initializer) else throw UnsupportedOperationException() diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/String.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/String.kt index 07dc633a313..0c0ede4c472 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/String.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/String.kt @@ -10,6 +10,7 @@ import kotlin.native.internal.Frozen import kotlin.native.internal.GCUnsafeCall @ExportTypeInfo("theStringTypeInfo") +@OptIn(FreezingIsDeprecated::class) @Frozen public final class String : Comparable, CharSequence { public companion object { diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt index 815536707c8..257298ebd62 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt @@ -19,6 +19,7 @@ import kotlin.native.internal.NativePtrArray * @param cause the cause of this throwable. */ @ExportTypeInfo("theThrowableTypeInfo") +@OptIn(FreezingIsDeprecated::class) public open class Throwable(open val message: String?, open val cause: Throwable?) { constructor(message: String?) : this(message, null) @@ -173,6 +174,7 @@ public actual inline fun Throwable.printStackTrace(): Unit = printStackTrace() * Does nothing if this [Throwable] is frozen. */ @SinceKotlin("1.4") +@OptIn(FreezingIsDeprecated::class) public actual fun Throwable.addSuppressed(exception: Throwable) { if (this !== exception && !this.isFrozen) { val suppressed = suppressedExceptionsList diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/coroutines/SafeContinuationNative.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/coroutines/SafeContinuationNative.kt index d5aeca5eb04..491fa5fb211 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/coroutines/SafeContinuationNative.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/coroutines/SafeContinuationNative.kt @@ -13,6 +13,7 @@ import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED @PublishedApi @SinceKotlin("1.3") +@OptIn(FreezingIsDeprecated::class) internal actual class SafeContinuation internal actual constructor( private val delegate: Continuation, diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt index bf1ea50bcb1..0dd82050019 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Annotations.kt @@ -57,6 +57,7 @@ public typealias Throws = kotlin.Throws public typealias ThreadLocal = kotlin.native.concurrent.ThreadLocal /** @suppress */ +// Not @FreezingIsDeprecated: Lots of usages. Usages will trigger INFO reports in the frontend. public typealias SharedImmutable = kotlin.native.concurrent.SharedImmutable /** @@ -82,4 +83,3 @@ public annotation class EagerInitialization @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.BINARY) public actual annotation class CName(actual val externName: String = "", actual val shortName: String = "") - diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Runtime.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Runtime.kt index 2422aa3bbad..9f0046a7f64 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Runtime.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Runtime.kt @@ -28,6 +28,7 @@ external public fun deinitRuntimeIfNeeded(): Unit /** * Exception thrown when top level variable is accessed from incorrect execution context. */ +@FreezingIsDeprecated public class IncorrectDereferenceException : RuntimeException { constructor() : super() @@ -55,6 +56,7 @@ public typealias ReportUnhandledExceptionHook = Function1 * i.e. top level main(), or when Objective-C to Kotlin call not marked with @Throws throws an exception. * Hook must be a frozen lambda, so that it could be called from any thread/worker. */ +@OptIn(FreezingIsDeprecated::class) public fun setUnhandledExceptionHook(hook: ReportUnhandledExceptionHook): ReportUnhandledExceptionHook? { try { return UnhandledExceptionHookHolder.hook.swap(hook) @@ -68,6 +70,7 @@ public fun setUnhandledExceptionHook(hook: ReportUnhandledExceptionHook): Report */ @ExperimentalStdlibApi @SinceKotlin("1.6") +@OptIn(FreezingIsDeprecated::class) public fun getUnhandledExceptionHook(): ReportUnhandledExceptionHook? { return UnhandledExceptionHookHolder.hook.value } diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Annotations.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Annotations.kt index e7db20f1110..30e80797b0b 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Annotations.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Annotations.kt @@ -20,6 +20,8 @@ package kotlin.native.concurrent public actual annotation class ThreadLocal /** + * Note: with the new MM this annotation has no effect. + * * Marks a top level property with a backing field as immutable. * It is possible to share the value of such property between multiple threads, but it becomes deeply frozen, * so no changes can be made to its state or the state of objects it refers to. @@ -27,7 +29,10 @@ public actual annotation class ThreadLocal * The annotation has effect only in Kotlin/Native platform. * * PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES. + * + * Since 1.7.20 usage of this annotation is deprecated. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details. */ @Target(AnnotationTarget.PROPERTY) @Retention(AnnotationRetention.BINARY) +// Not @FreezingIsDeprecated: Lots of usages, only the doc updated. public actual annotation class SharedImmutable \ No newline at end of file diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Atomics.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Atomics.kt index 12e36f5b113..5a397c6c153 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Atomics.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Atomics.kt @@ -14,6 +14,7 @@ import kotlin.native.internal.* * in frozen subgraphs. So shared frozen objects can have fields of atomic types. */ @Frozen +@OptIn(FreezingIsDeprecated::class) public class AtomicInt(private var value_: Int) { /** * The value being held by this class. @@ -81,6 +82,7 @@ public class AtomicInt(private var value_: Int) { } @Frozen +@OptIn(FreezingIsDeprecated::class) public class AtomicLong(private var value_: Long = 0) { /** * The value being held by this class. @@ -156,6 +158,7 @@ public class AtomicLong(private var value_: Long = 0) { } @Frozen +@OptIn(FreezingIsDeprecated::class) public class AtomicNativePtr(private var value_: NativePtr) { /** * The value being held by this class. @@ -218,6 +221,7 @@ private fun debugString(value: Any?): String { @FrozenLegacyMM @LeakDetectorCandidate @NoReorderFields +@OptIn(FreezingIsDeprecated::class) public class AtomicReference { private var value_: T @@ -311,6 +315,7 @@ public class AtomicReference { @NoReorderFields @LeakDetectorCandidate @ExportTypeInfo("theFreezableAtomicReferenceTypeInfo") +@FreezingIsDeprecated public class FreezableAtomicReference(private var value_: T) { // A spinlock to fix potential ARC race. private var lock: Int = 0 diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Continuation.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Continuation.kt index 44d671ed819..8de1a89bea2 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Continuation.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Continuation.kt @@ -8,6 +8,7 @@ package kotlin.native.concurrent import kotlin.native.internal.* import kotlinx.cinterop.* +@OptIn(FreezingIsDeprecated::class) public class Continuation0(block: () -> Unit, private val invoker: CPointer Unit>>, private val singleShot: Boolean = false): Function0 { @@ -31,6 +32,7 @@ public class Continuation0(block: () -> Unit, } } +@OptIn(FreezingIsDeprecated::class) public class Continuation1( block: (p1: T1) -> Unit, private val invoker: CPointer Unit>>, @@ -62,6 +64,7 @@ public class Continuation1( } } +@OptIn(FreezingIsDeprecated::class) public class Continuation2( block: (p1: T1, p2: T2) -> Unit, private val invoker: CPointer Unit>>, diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Freezing.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Freezing.kt index 669fe6a6be0..5e495b66fa3 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Freezing.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Freezing.kt @@ -13,6 +13,7 @@ import kotlin.native.internal.GCUnsafeCall * @param toFreeze an object intended to be frozen. * @param blocker an object preventing freezing, usually one marked with [ensureNeverFrozen] earlier. */ +@FreezingIsDeprecated public class FreezingException(toFreeze: Any, blocker: Any) : RuntimeException("freezing of $toFreeze has failed, first blocker is $blocker") @@ -21,6 +22,7 @@ public class FreezingException(toFreeze: Any, blocker: Any) : * * @param where a frozen object that was attempted to mutate */ +@FreezingIsDeprecated public class InvalidMutabilityException(message: String) : RuntimeException(message) /** @@ -31,6 +33,7 @@ public class InvalidMutabilityException(message: String) : RuntimeException(mess * @return the object itself * @see ensureNeverFrozen */ +@FreezingIsDeprecated public fun T.freeze(): T { freezeInternal(this) return this @@ -41,6 +44,7 @@ public fun T.freeze(): T { * * @return true if given object is null or frozen or permanent */ +@FreezingIsDeprecated public val Any?.isFrozen get() = isFrozenInternal(this) @@ -52,4 +56,5 @@ public val Any?.isFrozen * @see freeze */ @GCUnsafeCall("Kotlin_Worker_ensureNeverFrozen") +@FreezingIsDeprecated public external fun Any.ensureNeverFrozen() \ No newline at end of file diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt index d54ab2818ec..c20201c854f 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt @@ -15,6 +15,7 @@ import kotlin.reflect.KClass import kotlinx.cinterop.* @GCUnsafeCall("Kotlin_Any_isShareable") +@FreezingIsDeprecated external internal fun Any?.isShareable(): Boolean // Implementation details. @@ -94,28 +95,34 @@ external internal fun detachObjectGraphInternal(mode: Int, producer: () -> Any?) external internal fun attachObjectGraphInternal(stable: NativePtr): Any? @GCUnsafeCall("Kotlin_Worker_freezeInternal") +@FreezingIsDeprecated internal external fun freezeInternal(it: Any?) @GCUnsafeCall("Kotlin_Worker_isFrozenInternal") +@FreezingIsDeprecated internal external fun isFrozenInternal(it: Any?): Boolean @ExportForCppRuntime +@FreezingIsDeprecated internal fun ThrowFreezingException(toFreeze: Any, blocker: Any): Nothing = throw FreezingException(toFreeze, blocker) @ExportForCppRuntime +@FreezingIsDeprecated internal fun ThrowInvalidMutabilityException(where: Any): Nothing { val description = debugDescription(where::class, where.identityHashCode()) throw InvalidMutabilityException("mutation attempt of frozen $description") } @ExportForCppRuntime +@FreezingIsDeprecated internal fun ThrowIllegalObjectSharingException(typeInfo: NativePtr, address: NativePtr) { val description = DescribeObjectForDebugging(typeInfo, address) throw IncorrectDereferenceException("illegal attempt to access non-shared $description from other thread") } @GCUnsafeCall("Kotlin_AtomicReference_checkIfFrozen") +@FreezingIsDeprecated external internal fun checkIfFrozen(ref: Any?) @InternalForKotlinNative diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Lazy.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Lazy.kt index 2aacb316b4a..3c522a13b0c 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Lazy.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Lazy.kt @@ -7,6 +7,7 @@ package kotlin.native.concurrent import kotlin.native.internal.Frozen +@FreezingIsDeprecated internal class FreezeAwareLazyImpl(initializer: () -> T) : Lazy { private val value_ = FreezableAtomicReference(UNINITIALIZED) // This cannot be made atomic because of the legacy MM. See https://github.com/JetBrains/kotlin-native/pull/3944 @@ -67,6 +68,7 @@ internal class FreezeAwareLazyImpl(initializer: () -> T) : Lazy { value.toString() else "Lazy value not initialized yet" } +@OptIn(FreezingIsDeprecated::class) internal object UNINITIALIZED { // So that single-threaded configs can use those as well. init { @@ -74,6 +76,7 @@ internal object UNINITIALIZED { } } +@OptIn(FreezingIsDeprecated::class) internal object INITIALIZING { // So that single-threaded configs can use those as well. init { @@ -81,6 +84,7 @@ internal object INITIALIZING { } } +@FreezingIsDeprecated @Frozen internal class AtomicLazyImpl(initializer: () -> T) : Lazy { private val initializer_ = AtomicReference?>(initializer.freeze()) @@ -120,9 +124,11 @@ internal class AtomicLazyImpl(initializer: () -> T) : Lazy { * leak memory, so it is recommended to use `atomicLazy` in cases of objects living forever, * such as object signletons, or in cases where it's guaranteed not to have cyclical garbage. */ +@FreezingIsDeprecated public fun atomicLazy(initializer: () -> T): Lazy = AtomicLazyImpl(initializer) @Suppress("UNCHECKED_CAST") +@OptIn(FreezingIsDeprecated::class) internal class SynchronizedLazyImpl(initializer: () -> T) : Lazy { private var initializer = FreezableAtomicReference<(() -> T)?>(initializer) private var valueRef = FreezableAtomicReference(UNINITIALIZED) @@ -162,6 +168,7 @@ internal class SynchronizedLazyImpl(initializer: () -> T) : Lazy { @Suppress("UNCHECKED_CAST") +@OptIn(FreezingIsDeprecated::class) internal class SafePublicationLazyImpl(initializer: () -> T) : Lazy { private var initializer = FreezableAtomicReference<(() -> T)?>(initializer) private var valueRef = FreezableAtomicReference(UNINITIALIZED) diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Lock.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Lock.kt index 84d2c5bf083..52ba59dc18f 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Lock.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Lock.kt @@ -8,11 +8,13 @@ package kotlin.native.concurrent import kotlin.native.internal.Frozen @ThreadLocal +@OptIn(FreezingIsDeprecated::class) private object CurrentThread { val id = Any().freeze() } @Frozen +@OptIn(FreezingIsDeprecated::class) internal class Lock { private val locker_ = AtomicInt(0) private val reenterCount_ = AtomicInt(0) diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/MutableData.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/MutableData.kt index 7ae4b3f3c95..c8e4f331450 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/MutableData.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/MutableData.kt @@ -22,6 +22,7 @@ internal external fun readHeapRefNoLock(where: Any, index: Int): Any? */ @Frozen @NoReorderFields +@FreezingIsDeprecated public class MutableData constructor(capacity: Int = 16) { init { if (capacity <= 0) throw IllegalArgumentException() diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/ObjectTransfer.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/ObjectTransfer.kt index 146642298a1..9820f1d75e5 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/ObjectTransfer.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/ObjectTransfer.kt @@ -32,6 +32,7 @@ import kotlin.native.internal.Frozen * * @see [kotlin.native.internal.GC.collect]. */ +// Not @FreezingIsDeprecated: every `Worker.execute` uses this. public enum class TransferMode(val value: Int) { /** * Reachibility check is performed. @@ -49,6 +50,7 @@ public enum class TransferMode(val value: Int) { * externally, until it is attached with the [attach] extension function. */ @Frozen +@FreezingIsDeprecated public class DetachedObjectGraph internal constructor(pointer: NativePtr) { @PublishedApi internal val stable = AtomicNativePtr(pointer) @@ -78,6 +80,7 @@ public class DetachedObjectGraph internal constructor(pointer: NativePtr) { * make sense anymore, and shall be discarded, so attach of one DetachedObjectGraph object can only * happen once. */ +@FreezingIsDeprecated public inline fun DetachedObjectGraph.attach(): T { var rawStable: NativePtr do { 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 2d16eedc0b5..2a481fe47ed 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 @@ -27,6 +27,7 @@ import kotlinx.cinterop.* * Class representing worker. */ @Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS") +@OptIn(FreezingIsDeprecated::class) public value class Worker @PublishedApi internal constructor(val id: Int) { companion object { /** diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/WorkerBoundReference.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/WorkerBoundReference.kt index c89b25ec11c..5f1e3672aab 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/WorkerBoundReference.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/WorkerBoundReference.kt @@ -30,6 +30,7 @@ external private fun describeWorkerBoundReference(ref: NativePtr): String @ExportTypeInfo("theWorkerBoundReferenceTypeInfo") @HasFinalizer @HasFreezeHook +@FreezingIsDeprecated public class WorkerBoundReference(value: T) { private var ptr = NativePtr.NULL diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/Annotations.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/Annotations.kt index c55c718bd0f..1a6aaacd938 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/Annotations.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/Annotations.kt @@ -46,6 +46,7 @@ public annotation class ExportForCompiler */ @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.BINARY) +@FreezingIsDeprecated internal annotation class Frozen /** @@ -53,6 +54,7 @@ internal annotation class Frozen */ @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.BINARY) +@FreezingIsDeprecated internal annotation class FrozenLegacyMM /** @@ -161,6 +163,7 @@ internal annotation class InternalForKotlinNative * Marks a class that has a freeze hook. */ @Target(AnnotationTarget.CLASS) +@FreezingIsDeprecated internal annotation class HasFreezeHook /** diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/Cleaner.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/Cleaner.kt index 59799524924..1809dcfe0c2 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/Cleaner.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/Cleaner.kt @@ -69,6 +69,7 @@ public interface Cleaner // by function name in the compiler. @ExperimentalStdlibApi @ExportForCompiler +@OptIn(FreezingIsDeprecated::class) fun createCleaner(argument: T, block: (T) -> Unit): Cleaner { if (!argument.isShareable()) throw IllegalArgumentException("$argument must be shareable") diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/InteropBoxing.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/InteropBoxing.kt index 7412210cc51..ef1e414a466 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/InteropBoxing.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/InteropBoxing.kt @@ -8,6 +8,7 @@ package kotlin.native.internal import kotlinx.cinterop.* @Frozen +@OptIn(FreezingIsDeprecated::class) class NativePtrBox(val value: NativePtr) { override fun equals(other: Any?): Boolean { if (other !is NativePtrBox) { @@ -25,6 +26,7 @@ class NativePtrBox(val value: NativePtr) { fun boxNativePtr(value: NativePtr) = NativePtrBox(value) @Frozen +@OptIn(FreezingIsDeprecated::class) class NativePointedBox(val value: NativePointed) { override fun equals(other: Any?): Boolean { if (other !is NativePointedBox) { @@ -46,6 +48,7 @@ fun boxNativePointed(value: NativePointed?) = if (value != null) NativePointedBo fun unboxNativePointed(box: NativePointedBox?) = box?.value @Frozen +@OptIn(FreezingIsDeprecated::class) class CPointerBox(val value: CPointer) : CValuesRef() { override fun equals(other: Any?): Boolean { if (other !is CPointerBox) { diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt index a69ad4fb9a3..01eab11547c 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt @@ -101,6 +101,7 @@ internal fun ThrowCharacterCodingException(): Nothing { } @ExportForCppRuntime +@FreezingIsDeprecated internal fun ThrowIncorrectDereferenceException() { throw IncorrectDereferenceException( "Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread") @@ -133,6 +134,7 @@ internal fun ReportUnhandledException(throwable: Throwable) { // Using object to make sure that `hook` is initialized when it's needed instead of // in a normal global initialization flow. This is important if some global happens // to throw an exception during it's initialization before this hook would've been initialized. +@OptIn(FreezingIsDeprecated::class) internal object UnhandledExceptionHookHolder { internal val hook: FreezableAtomicReference = if (Platform.memoryModel == MemoryModel.EXPERIMENTAL) { @@ -145,6 +147,7 @@ internal object UnhandledExceptionHookHolder { // TODO: Can be removed only when native-mt coroutines stop using it. @PublishedApi @ExportForCppRuntime +@OptIn(FreezingIsDeprecated::class) internal fun OnUnhandledException(throwable: Throwable) { val handler = UnhandledExceptionHookHolder.hook.value if (handler == null) { @@ -159,6 +162,7 @@ internal fun OnUnhandledException(throwable: Throwable) { } @ExportForCppRuntime("Kotlin_runUnhandledExceptionHook") +@OptIn(FreezingIsDeprecated::class) internal fun runUnhandledExceptionHook(throwable: Throwable) { val handler = UnhandledExceptionHookHolder.hook.value ?: throw throwable handler(throwable) diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/Launcher.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/Launcher.kt index b3c43e92237..29befe90a18 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/Launcher.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/Launcher.kt @@ -37,6 +37,7 @@ fun main(args: Array) { } } +@OptIn(FreezingIsDeprecated::class) fun worker(args: Array) { val worker = Worker.start() val exitCode = worker.execute(TransferMode.SAFE, { args.freeze() }) { diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/ref/WeakPrivate.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/ref/WeakPrivate.kt index 86d1700c86a..67298d14585 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/ref/WeakPrivate.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/ref/WeakPrivate.kt @@ -37,6 +37,7 @@ import kotlin.native.internal.Escapes // Clear holding the counter object, which refers to the actual object. @NoReorderFields @Frozen +@OptIn(FreezingIsDeprecated::class) internal class WeakReferenceCounter(var referred: COpaquePointer?) : WeakReferenceImpl() { // Spinlock, potentially taken when materializing or removing 'referred' object. var lock: Int = 0 diff --git a/kotlin-native/samples/globalState/src/globalStateMain/kotlin/Global.kt b/kotlin-native/samples/globalState/src/globalStateMain/kotlin/Global.kt index 4fa60b882c2..09ac470c783 100644 --- a/kotlin-native/samples/globalState/src/globalStateMain/kotlin/Global.kt +++ b/kotlin-native/samples/globalState/src/globalStateMain/kotlin/Global.kt @@ -20,9 +20,9 @@ data class SharedDataMember(val double: Double) data class SharedData(val string: String, val int: Int, val member: SharedDataMember) -// Here we access the same shared frozen Kotlin object from multiple threads. +// Here we access the same shared Kotlin object from multiple threads. val globalObject: SharedData? - get() = sharedData.frozenKotlinObject?.asStableRef()?.get() + get() = sharedData.kotlinObject?.asStableRef()?.get() fun dumpShared(prefix: String) { println(""" @@ -39,16 +39,11 @@ fun main() { sharedData.f = 0.5f sharedData.string = "Hello Kotlin!".cstr.getPointer(arena) - // Here we create detached mutable object, which could be later reattached by another thread. - sharedData.kotlinObject = DetachedObjectGraph { - SharedData("A string", 42, SharedDataMember(2.39)) - }.asCPointer() - - // Here we create shared frozen object reference, - val stableRef = StableRef.create(SharedData("Shared", 239, SharedDataMember(2.71)).freeze()) - sharedData.frozenKotlinObject = stableRef.asCPointer() + // Here we create shared object reference, + val stableRef = StableRef.create(SharedData("Shared", 239, SharedDataMember(2.71))) + sharedData.kotlinObject = stableRef.asCPointer() dumpShared("thread1") - println("frozen is $globalObject") + println("shared is $globalObject") // Start a new thread, that sees the variable. // memScoped is needed to pass thread's local address to pthread_create(). @@ -57,12 +52,12 @@ fun main() { pthread_create(thread.ptr, null, staticCFunction { argC -> initRuntimeIfNeeded() dumpShared("thread2") - val kotlinObject = DetachedObjectGraph(sharedData.kotlinObject).attach() - val arg = DetachedObjectGraph(argC).attach() - println("thread arg is $arg Kotlin object is $kotlinObject frozen is $globalObject") + val arg = argC!!.asStableRef() + println("thread arg is ${arg.get()} shared is $globalObject") + arg.dispose() // Workaround for compiler issue. null as COpaquePointer? - }, DetachedObjectGraph { SharedDataMember(3.14)}.asCPointer() ).ensureUnixCallResult("pthread_create") + }, StableRef.create(SharedDataMember(3.14)).asCPointer() ).ensureUnixCallResult("pthread_create") pthread_join(thread.value, null).ensureUnixCallResult("pthread_join") } diff --git a/kotlin-native/samples/globalState/src/nativeInterop/cinterop/global.def b/kotlin-native/samples/globalState/src/nativeInterop/cinterop/global.def index f4391051aa9..d04e76a0f74 100644 --- a/kotlin-native/samples/globalState/src/nativeInterop/cinterop/global.def +++ b/kotlin-native/samples/globalState/src/nativeInterop/cinterop/global.def @@ -6,7 +6,6 @@ typedef struct { float f; char* string; void* kotlinObject; - void* frozenKotlinObject; } SharedDataStruct; SharedDataStruct sharedData; diff --git a/kotlin-native/samples/objc/src/objcMain/kotlin/Async.kt b/kotlin-native/samples/objc/src/objcMain/kotlin/Async.kt index 78517f043d7..3a45b6a1364 100644 --- a/kotlin-native/samples/objc/src/objcMain/kotlin/Async.kt +++ b/kotlin-native/samples/objc/src/objcMain/kotlin/Async.kt @@ -1,6 +1,6 @@ package sample.objc -import kotlinx.cinterop.staticCFunction +import kotlinx.cinterop.* import platform.Foundation.NSOperationQueue import platform.Foundation.NSThread import platform.darwin.dispatch_async_f @@ -10,11 +10,12 @@ import kotlin.native.concurrent.* import kotlin.test.assertNotNull inline fun executeAsync(queue: NSOperationQueue, crossinline producerConsumer: () -> Pair Unit>) { - dispatch_async_f(queue.underlyingQueue, DetachedObjectGraph { + dispatch_async_f(queue.underlyingQueue, StableRef.create( producerConsumer() - }.asCPointer(), staticCFunction { it -> - val result = DetachedObjectGraph Unit>>(it).attach() - result.second(result.first) + ).asCPointer(), staticCFunction { it -> + val result = it!!.asStableRef Unit>>() + result.get().second(result.get().first) + result.dispose() }) } @@ -60,8 +61,7 @@ object Continuator { fun wrap(operation: () -> Unit, after: () -> Unit): () -> Unit { assert(NSThread.isMainThread()) - assert(operation.isFrozen) - val id = Any().freeze() + val id = Any() map[id] = Pair(0, after) return { initRuntimeIfNeeded() @@ -69,13 +69,12 @@ object Continuator { executeAsync(NSOperationQueue.mainQueue) { Pair(id, { id: Any -> Continuator.execute(id) }) } - }.freeze() + } } fun

wrap(operation: () -> P, block: (P) -> Unit): () -> Unit { assert(NSThread.isMainThread()) - assert(operation.isFrozen) - val id = Any().freeze() + val id = Any() map[id] = Pair(1, block) return { initRuntimeIfNeeded() @@ -85,7 +84,7 @@ object Continuator { Continuator.execute(it.first, it.second) }) } - }.freeze() + } } fun execute(id: Any) { diff --git a/kotlin-native/samples/objc/src/objcMain/kotlin/Window.kt b/kotlin-native/samples/objc/src/objcMain/kotlin/Window.kt index 29a1024fbce..f80a90cffbe 100644 --- a/kotlin-native/samples/objc/src/objcMain/kotlin/Window.kt +++ b/kotlin-native/samples/objc/src/objcMain/kotlin/Window.kt @@ -18,14 +18,8 @@ import kotlin.test.assertNotNull data class QueryResult(val json: Map?, val error: String?) -private fun MutableData.asNSData() = this.withPointerLocked { it, size -> - val result = NSMutableData.create(length = size.convert())!! - memcpy(result.mutableBytes, it, size.convert()) - result -} - -private fun MutableData.asJSON(): Map? = - NSJSONSerialization.JSONObjectWithData(this.asNSData(), 0, null) as? Map +private val NSData.json: Map? + get() = NSJSONSerialization.JSONObjectWithData(this, 0, null) as? Map fun main() { autoreleasepool { @@ -60,7 +54,7 @@ class Controller : NSObject() { // Here we call continuator service to ensure we can access mutable state from continuation. dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND.convert(), 0), - Continuator.wrap({ println("In queue ${dispatch_get_current_queue()}")}.freeze()) { + Continuator.wrap({ println("In queue ${dispatch_get_current_queue()}")}) { println("After in queue ${dispatch_get_current_queue()}: $index") }) @@ -88,14 +82,10 @@ class Controller : NSObject() { class HttpDelegate: NSObject(), NSURLSessionDataDelegateProtocol { private val asyncQueue = NSOperationQueue() - private val receivedData = MutableData() - - init { - freeze() - } + private var receivedData: NSData? = null fun fetchUrl(url: String) { - receivedData.reset() + receivedData = null val session = NSURLSession.sessionWithConfiguration( NSURLSessionConfiguration.defaultSessionConfiguration(), this, @@ -106,7 +96,7 @@ class Controller : NSObject() { override fun URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, didReceiveData: NSData) { initRuntimeIfNeeded() - receivedData.append(didReceiveData.bytes, didReceiveData.length.convert()) + receivedData = didReceiveData } override fun URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError: NSError?) { @@ -117,7 +107,7 @@ class Controller : NSObject() { Pair(when { response == null -> QueryResult(null, didCompleteWithError?.localizedDescription) response.statusCode.toInt() != 200 -> QueryResult(null, "${response.statusCode.toInt()})") - else -> QueryResult(receivedData.asJSON(), null) + else -> QueryResult(receivedData?.json, null) }, { result: QueryResult -> appDelegate.contentText.string = result.json?.toString() ?: "Error: ${result.error}" appDelegate.canClick = true diff --git a/libraries/stdlib/native-wasm/src/kotlin/collections/HashMap.kt b/libraries/stdlib/native-wasm/src/kotlin/collections/HashMap.kt index 1c186398c47..edfeaf4ed2e 100644 --- a/libraries/stdlib/native-wasm/src/kotlin/collections/HashMap.kt +++ b/libraries/stdlib/native-wasm/src/kotlin/collections/HashMap.kt @@ -6,7 +6,9 @@ package kotlin.collections import kotlin.native.concurrent.isFrozen +import kotlin.native.FreezingIsDeprecated +@OptIn(FreezingIsDeprecated::class) actual class HashMap private constructor( private var keysArray: Array, private var valuesArray: Array?, // allocated only when actually used, always null in pure HashSet diff --git a/libraries/stdlib/native-wasm/src/kotlin/native/FreezingIsDeprecated.kt b/libraries/stdlib/native-wasm/src/kotlin/native/FreezingIsDeprecated.kt new file mode 100644 index 00000000000..9149adf0a35 --- /dev/null +++ b/libraries/stdlib/native-wasm/src/kotlin/native/FreezingIsDeprecated.kt @@ -0,0 +1,36 @@ +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package kotlin.native + +// This is here instead of kotlin-native/runtime because some of native-wasm uses this annotation. +/** + * Freezing API is deprecated since 1.7.20. + * + * See [NEW_MM.md#freezing-deprecation](https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation) for details + */ +// Note: when changing level of deprecation here, also change +// * `freezing` mode handling in KonanConfig.kt +// * frontend diagnostics in ErrorsNative.kt +@SinceKotlin("1.7") +@RequiresOptIn( + message = "Freezing API is deprecated since 1.7.20. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details", + level = RequiresOptIn.Level.WARNING, +) +@Target( + AnnotationTarget.CLASS, + AnnotationTarget.ANNOTATION_CLASS, + AnnotationTarget.PROPERTY, + AnnotationTarget.FIELD, + AnnotationTarget.LOCAL_VARIABLE, + AnnotationTarget.VALUE_PARAMETER, + AnnotationTarget.CONSTRUCTOR, + AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER, + AnnotationTarget.TYPEALIAS, +) +@Retention(AnnotationRetention.BINARY) +actual annotation class FreezingIsDeprecated diff --git a/libraries/stdlib/native-wasm/src/kotlin/text/regex/AbstractCharClass.kt b/libraries/stdlib/native-wasm/src/kotlin/text/regex/AbstractCharClass.kt index f6dbb427354..bd1a8b5ea78 100644 --- a/libraries/stdlib/native-wasm/src/kotlin/text/regex/AbstractCharClass.kt +++ b/libraries/stdlib/native-wasm/src/kotlin/text/regex/AbstractCharClass.kt @@ -27,6 +27,7 @@ import kotlin.collections.associate import kotlin.native.concurrent.AtomicReference import kotlin.native.concurrent.freeze import kotlin.native.BitSet +import kotlin.native.FreezingIsDeprecated /** * Unicode category (i.e. Ll, Lu). @@ -48,6 +49,7 @@ internal class UnicodeCategoryScope(category: Int) : UnicodeCategory(category) { * This class represents character classes, i.e. sets of character either predefined or user defined. * Note: this class represent a token, not node, so being constructed by lexer. */ +@OptIn(FreezingIsDeprecated::class) internal abstract class AbstractCharClass : SpecialToken() { /** * Show if the class has alternative meaning: diff --git a/libraries/stdlib/src/kotlin/annotations/NativeAnnotations.kt b/libraries/stdlib/src/kotlin/annotations/NativeAnnotations.kt index 3781a046699..f90d5be4f20 100644 --- a/libraries/stdlib/src/kotlin/annotations/NativeAnnotations.kt +++ b/libraries/stdlib/src/kotlin/annotations/NativeAnnotations.kt @@ -16,3 +16,33 @@ package kotlin.native @Retention(AnnotationRetention.BINARY) @OptionalExpectation public expect annotation class CName(val externName: String = "", val shortName: String = "") + +/** + * Freezing API is deprecated since 1.7.20. + * + * See [NEW_MM.md#freezing-deprecation](https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation) for details + */ +// Note: when changing level of deprecation here, also change +// * `freezing` mode handling in KonanConfig.kt +// * frontend diagnostics in ErrorsNative.kt +@SinceKotlin("1.7") +@RequiresOptIn( + message = "Freezing API is deprecated since 1.7.20. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details", + level = RequiresOptIn.Level.WARNING, +) +@Target( + AnnotationTarget.CLASS, + AnnotationTarget.ANNOTATION_CLASS, + AnnotationTarget.PROPERTY, + AnnotationTarget.FIELD, + AnnotationTarget.LOCAL_VARIABLE, + AnnotationTarget.VALUE_PARAMETER, + AnnotationTarget.CONSTRUCTOR, + AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER, + AnnotationTarget.TYPEALIAS, +) +@Retention(AnnotationRetention.BINARY) +@OptionalExpectation +expect annotation class FreezingIsDeprecated diff --git a/libraries/stdlib/src/kotlin/annotations/NativeConcurrentAnnotations.kt b/libraries/stdlib/src/kotlin/annotations/NativeConcurrentAnnotations.kt index c303b588c5d..5385a784423 100644 --- a/libraries/stdlib/src/kotlin/annotations/NativeConcurrentAnnotations.kt +++ b/libraries/stdlib/src/kotlin/annotations/NativeConcurrentAnnotations.kt @@ -21,6 +21,8 @@ package kotlin.native.concurrent public expect annotation class ThreadLocal() /** + * Note: with the new MM this annotation has no effect. + * * Marks a top level property with a backing field as immutable. * It is possible to share the value of such property between multiple threads, but it becomes deeply frozen, * so no changes can be made to its state or the state of objects it refers to. @@ -28,9 +30,12 @@ public expect annotation class ThreadLocal() * The annotation has effect only in Kotlin/Native platform. * * PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES. + * + * Since 1.7.20 usage of this annotation is deprecated. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details. */ @Target(AnnotationTarget.PROPERTY) @Retention(AnnotationRetention.BINARY) +// Not @FreezingIsDeprecated: Lots of usages, only the doc updated. @OptionalExpectation public expect annotation class SharedImmutable() diff --git a/native/frontend/src/org/jetbrains/kotlin/resolve/konan/diagnostics/ErrorsNative.kt b/native/frontend/src/org/jetbrains/kotlin/resolve/konan/diagnostics/ErrorsNative.kt index fcebb3b10ed..d8faec6b04a 100644 --- a/native/frontend/src/org/jetbrains/kotlin/resolve/konan/diagnostics/ErrorsNative.kt +++ b/native/frontend/src/org/jetbrains/kotlin/resolve/konan/diagnostics/ErrorsNative.kt @@ -27,13 +27,13 @@ object ErrorsNative { @JvmField val INAPPLICABLE_SHARED_IMMUTABLE_TOP_LEVEL = DiagnosticFactory0.create(Severity.ERROR) @JvmField - val VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL = DiagnosticFactory0.create(Severity.WARNING) + val VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL = DiagnosticFactory0.create(Severity.INFO) @JvmField val INAPPLICABLE_THREAD_LOCAL = DiagnosticFactory0.create(Severity.ERROR) @JvmField val INAPPLICABLE_THREAD_LOCAL_TOP_LEVEL = DiagnosticFactory0.create(Severity.ERROR) @JvmField - val VARIABLE_IN_ENUM = DiagnosticFactory0.create(Severity.WARNING) + val VARIABLE_IN_ENUM = DiagnosticFactory0.create(Severity.INFO) @JvmField val INVALID_CHARACTERS_NATIVE = DiagnosticFactoryForDeprecation1.create(LanguageFeature.ProhibitInvalidCharsInNativeIdentifiers)