Commit Graph

79 Commits

Author SHA1 Message Date
mvicsokolova 298c4f8c32 [K/N] Introduce atomic arrays in K/N stdlib
This commit introduces API for AtomicIntArray, AtomicLongArray and AtomicArray<T>.

The current set of functions is implemented via atomic arrays intrinsics (see KT-58360) and provides sequentially consistent memory ordering guarantees and no spurious failures in compareAndSet/compareAndExchange operations.

For details see: KT-60608

Merge-request: KT-MR-11071
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-21 15:30:20 +00:00
Abduqodiri Qurbonzoda 209c916a7e OptIn ExperimentalNativeApi 2023-06-30 15:27:09 +00:00
Abduqodiri Qurbonzoda 4ae19b2b44 [K/N] Deprecate SharedImmutable annotation #KT-57837
As a part of efforts to stabilize Native stdlib.
2023-06-19 11:35:32 +00:00
Abduqodiri Qurbonzoda 193aa0f935 Align the Boolean.hashCode() value across platforms
Boolean.hashCode() should return 1231/1237 for true/false correspondingly.

As a part of efforts to stabilize Native stdlib.
2023-06-14 08:19:46 +00:00
Alexander Shabalin aea8bac7d2 [K/N] Do not compile for deprecated targets and legacy MM
^KT-56533
^KT-58853
2023-05-30 16:44:58 +00:00
Kirill Rakhman e2dafdb5b9 [Native/Tests] Add explicit import for SharedImmutable
This fixes an overload resolution ambiguity in K2.

#KT-56272
2023-05-11 13:10:34 +00:00
Vsevolod Tolstopyatov f4e8ae5191 Explicitly declare stability levels of declarations in kotlinx.cinterop package
* @ExperimentalForeignApi for all declarations that operate on
    unmanaged memory (i.e. pointers and references)
* @BetaInteropApi for the rest of the interoperability declarations,
    namely Swift/CInterop-specific interfaces and convenience-functions

### Implementation details

* Some typealiases are not marked explicitly because it crashes the compiler,
    yet their experimentality is properly propagated
* License header is adjusted where it previously had been existing
* Deprecated with ERROR interop declarations that are deprecated for more than
    two years are removed
* WASM target interop declarations are deprecated
* Deliberately make Boolean.toByte and Byte.toBoolean foreign-experimental to scare
    people away

^KT-57728 fixed

Merge-request: KT-MR-9788
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-05-04 13:52:21 +00:00
mvicsokolova 75b4469757 [K/N] Stabilization of Atomics API
`AtomicInt`, `AtomicLong`, `AtomicReference` and `AtomicNativePtr` classes were moved to `kotlin.concurrent` package. The corresponding classes from `kotlin.native.concurrent` were deprecated with warning since Kotlin 1.9.

In order to prepare for further commonization of Atomics API the following changes were made:
* `kotlin.concurrent.AtomicInt`: 
    * `increment(): Unit` and `decrement(): Unit` methods were deprecated with error
    * New methods were added: `incrementAndGet(): Int` , `decrementAndGet(): Int`, `getAndIncrement(): Int`, `getAndDecrement(): Int`, `getAndSet(newValue: Int): Int` 
* `kotlin.concurrent.AtomicLong`:
    * `increment(): Unit` and `decrement(): Unit` methods were deprecated with error
    * New methods were added: `incrementAndGet(): Long`, `decrementAndGet(): Long`, `getAndIncrement(): Long`, `getAndDecrement(): Long`, `getAndSet(newValue: Long): Long`
    * Deprecated `AtomicLong()` constructor with default parameter value
* For all atomic classes `compareAndSwap` method was renamed to `compareAndExchange`

See KT-58074 for more details.

Merge-request: KT-MR-9272
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-04-25 16:55:42 +00:00
Abduqodiri Qurbonzoda 5407ac1c72 [K/N] Mark UnhandledExceptionHook-related API with ExperimentalNativeApi
Instead of ExperimentalStdlibApi

As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-19 20:36:31 +00:00
Abduqodiri Qurbonzoda 208b279d2b [K/N] Internalize CharCategory.value/valueOf
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:42 +00:00
Vsevolod Tolstopyatov af9252aa96 Mark all Worker-related API as obsolete.
* Explain what obsolete means and why workers are obsolete
* Add some documentation to workers to explain its common pitfalls

^KT-54702


Merge-request: KT-MR-9563
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-04-19 09:28:23 +00:00
Alexander Shabalin 9fd05632f0 [K/N] Track object counts during sweep ^KT-55364
Previously object count was tracked via allocator. It adds additional
burden on every allocation. Tracking via sweeper is better because
it mostly happens on the GC thread during a concurrent sweep.
2023-04-18 12:08:02 +00:00
Abduqodiri Qurbonzoda e1c91ee50f [K/N] Move kotlin.native.internal.GC into kotlin.native.runtime
As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-12 13:07:50 +03:00
Abduqodiri Qurbonzoda bb8498b0c5 [K/N] Move kotlin.native.internal.Debugging into kotlin.native.runtime
As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-12 13:07:49 +03:00
Abduqodiri Qurbonzoda 16078ae8e8 [K/N] Mark WeakReference with ExperimentalNativeApi
As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-12 09:44:25 +00:00
Abduqodiri Qurbonzoda 8e995e6c62 [K/N] Deprecate ArrayIndexOutOfBoundsException
As a part of efforts to stabilize Native stdlib.
2023-04-11 13:32:54 +00:00
Abduqodiri Qurbonzoda 8663239369 [K/N] Mark UnhandledExceptionHook-related API as experimental
As a part of efforts to stabilize Native stdlib.
2023-04-01 20:40:40 +03:00
Abduqodiri Qurbonzoda d738646a61 [K/N] Move kotlin.native.internal.Cleaner to kotlin.native.ref.Cleaner
As a part of efforts to stabilize Native stdlib #KT-55765.


Co-authored-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
Co-authored-by: Ilya Gorbunov <Ilya.Gorbunov@jetbrains.com>

Merge-request: KT-MR-9347
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-03-31 16:04:26 +00:00
Abduqodiri Qurbonzoda 0d53e11851 [K/N] Internalize all annotations in kotlin.native.internal package
As a part of efforts to stabilize Native stdlib #KT-55765.
2023-03-27 11:47:25 +00:00
Abduqodiri Qurbonzoda 9076e5b112 [K/N] Mark BitSet usages in stdlib with @ObsoleteNativeApi 2023-03-23 14:48:23 +00:00
Vladimir Sukharev 26b6c0b310 [K2/N] Unlock old testinfra runs with K2 frontend
Merge-request: KT-MR-8552
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-01 15:28:14 +00:00
Aleksei.Glushko 20e80401b2 [K/N] Hide throwable constructor frames from stack traces.
Merge-request: KT-MR-8242
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-01-13 14:14:40 +00:00
Pavel Kunyavskiy 0be789e9e3 [K/N] Add API for garbage collection statistics
^KT-53064
2022-11-24 13:14:37 +00:00
Alexander Shabalin 5ef9a5a240 [K/N] Crash with OOM on large array allocations ^KT-54659
Merge-request: KT-MR-7507
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-11-01 11:00:23 +00:00
Vladimir Sukharev 7f1ab29668 Fix Windows targets has bad addresses in stacktrace
^KT-49240 Fixed

Merge-request: KT-MR-6883
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2022-08-24 09:05:06 +00:00
Alexander Shabalin 6f844f15e0 [K/N] Worker API improvements ^KT-52429
Merge-request: KT-MR-6898
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-08-22 10:41:14 +00:00
Alexander Shabalin 41d6dc5914 [K/N] Allow to unset unhandled exception hook ^KT-49228 2022-08-01 19:53:21 +00:00
Pavel Kunyavskiy c7131a68ce [K/N] Support of collectReferenceFieldValues function 2022-07-19 08:40:14 +00:00
Alexander Shabalin 29f3445721 [K/N] Deprecated freezing ^KT-50541
Starting with 1.7.20 freezing is deprecated. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details.

Merge-request: KT-MR-6399
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-06-16 09:04:14 +00:00
Ilya Matveev 78d179e9ab [K/N][runtime] Track safepoints in aggressive GC
Issue #KT-49188 Fixed
2022-05-18 13:48:49 +00:00
Svyatoslav Scherbina 42ed0c5fe6 Native: add .alloc(value) for primitive types to interop runtime
^KT-50312 Fixed
2022-03-22 18:49:09 +03:00
Ilya Matveev 8668797afd [K/N][tests] Do not run backed.native tests with aggressive GC 2022-02-03 07:30:33 +00:00
Pavel Kunyavskiy 803014ef24 [K/N] Test for freezing disabling 2022-01-25 13:43:48 +00:00
Pavel Kunyavskiy 3798920183 [K/N] Any.isFrozen is now always false when freezing is disabled 2022-01-24 13:38:30 +00:00
Alexander Shabalin 4fd61ad1b0 [K/N] Change AtomicReference for the new MM ^KT-50026
Make AtomicReference behave like FreezableAtomicReference with the new MM: not frozen by default, don't require freezing value unless the ref itself is frozen. The behaviour with the old MM is unchanged.

Merge-request: KT-MR-5155
2021-12-03 17:08:21 +00:00
Svyatoslav Scherbina 24e7a11abc Native: fix losing Worker.executeAfter jobs on scheduled time clash
The implementation was keeping delayed jobs in std::set sorted
only by the scheduled execution time (in microseconds since epoch).
So two jobs submitted to a worker and having the same scheduled time
were considered equivalent by the set, and one of them got lost.

Fix this by using std::multiset instead of std::set.
2021-11-26 11:59:40 +00:00
Sergey Bogolepov bc144887ea [K/N] Add native test for KT-48591
We can't rely on stdlib tests now, because they are not
executed with compiler caches.
2021-11-09 08:27:58 +00:00
Alexander Shabalin c678702847 [K/N] Add tests on Atomic integers ^KT-49348 2021-10-27 13:54:35 +00:00
Pavel Kunyavskiy 504d72011b [K/N] Transform FunctionReference without bound values to ConstantValue 2021-10-14 11:22:26 +00:00
Pavel Kunyavskiy 0bd4dbc0c1 [K/N] Disable debug info in runtime by default
Bundle grows 200mb if debug info is enabled, it's too much.
But probably, this can be useful for debug, so we need gradle option.
2021-10-11 11:45:24 +00:00
Abduqodiri Qurbonzoda 93833f7db2 Advance K/N StringBuilder.appendln() deprecation level to ERROR #KT-38754 2021-09-20 15:25:53 +03:00
Pavel Kunyavskiy c704fd6ae7 [K/N] Support stacktrace using libbacktrace 2021-09-20 11:28:08 +00:00
Abduqodiri Qurbonzoda 718965227e Advance deprecation level of K/N StringBuilder renamed functions to ERROR #KT-46101 2021-09-16 19:45:04 +03:00
Elena Lepilkina cb067e160b [K/N] Updated RSS limit for new version of mimalloc 2021-09-08 13:53:18 +00:00
Abduqodiri Qurbonzoda 97eb28144f Introduce Common readln() and readlnOrNull() top-level functions #KT-48456 2021-09-05 15:31:11 +00:00
Pavel Kunyavskiy 98e4d67900 [K/N] Add opt-in flag to use debug info from native libs
Unfortunately, llvm removes full debug info from module on any error.
Different version debug info in bitcode is not always compatible, also
it adds this debug info additional requirements on generated debug info.

So this feature is quite unstable and shouldn't be enabled by default,
although it has almost no downsides when worked correctly.
2021-09-01 08:35:21 +00:00
Dmitriy Dolovov b506704a2b [Native][tests] Fix failing 'runtime_basic_init' test
This test should have it's own test data file.

Previously it used 'hello3.kt' test data file shared with 'hello3' test which uses golden data. This caused a conflict.
2021-09-01 10:14:17 +03:00
Dmitriy Dolovov bf82db5ee2 [Native][tests] Move input data outside of Gradle build file 2021-09-01 10:14:06 +03:00
Dmitriy Dolovov 1a863106e6 [Native][tests] Move golden data outside of Gradle build file 2021-09-01 10:14:01 +03:00
Dmitriy Dolovov c2e2d3a43e [Native][tests] workers5 - remove redundant test annotations 2021-09-01 10:13:55 +03:00