Commit Graph

611 Commits

Author SHA1 Message Date
Alexander Shabalin a8cec11772 [K/N] Protect filecheck tests for KT-53261 from DCE. 2023-09-07 15:35:57 +00:00
Alexander.Likhachev 357d12fc8e [Build] Move JUnit dependencies into the version catalog
The `kotlin-test` dependencies are left untouched as changing them affects publications, thus these versions are independent from the used inside our build
#KTI-1349 In Progress
2023-09-06 22:47:33 +00:00
Alexander Shabalin 9ab6a5ff56 [K/N] Migrate all stdlib_external tests to new testing infra ^KT-61259
- Move backend.native/tests/stdlib_external to runtime/test This mirrors
  tests location (in relation to sources) on other backends.
- Remove all backend.native/tests tasks using stdlib_external.
  Additionally remove now unused KonanGTest.
- Include complete native-wasm/test and runtime/test in
  native/native.test
- In runtime/test/numbers/MathTest.kt leave only native-specific part.
2023-09-04 18:51:10 +00:00
Alexander Shabalin 6a19c4ce96 [K/N] Remove legacy executors. 2023-09-04 11:38:47 +00:00
Svyatoslav Scherbina b8e1349b72 Native: fix filecheck_constants_merge test after 4774912f
4774912f updated the patterns for the filecheck_constants_merge test,
because the commit slightly changed the code generated for TypeInfo.
But the test update was made with a copy-paste-related mistake.

As a result, the test didn't work with `-Ptest_with_cache_kind=static`.
This commit fixes this, buy reverting the unintended changes in
the filecheck patterns.
2023-08-29 13:48:30 +00:00
Alexander Shabalin 452e67f0e6 [K/N] Make kotlin-native:backend.native:tests:sanity same as run. 2023-08-28 09:27:58 +00:00
Ilya Chernikov b821009617 K2: add missing checks for integral parameter type on implicit coercion
#KT-61418 fixed
#KT-61442 fixed
#KT-61441 fixed
2023-08-25 08:55:58 +00:00
Svyatoslav Scherbina 4774912fdc Native: don't use aliases for kclass:* globals, fix KT-61417
Currently, when generating a TypeInfo with a vtable attached, the K/N
compiler generates two globals to the resulting LLVM module:
- "ktypeglobal:$fqName#internal" -- an internal global of the aggregate
type (TypeInfo+vtable)
- "kclass:$fqName" -- an internal or hidden alias pointing to the
TypeInfo part of that global

The reason for emitting two globals is to have everything strict-typed,
since other LLVM modules might import the kclass as a TypeInfo.
Importing an aggregate TypeInfo+vtable global as a TypeInfo global works
too, of course. It is just a little bit less clean.

The new Xcode 15 linker now emits symbols for the ktypeglobal to the
symbol table, including an STSYM. This happens for classes compiled to
cache, when the kclass is hidden, not internal.

The problem is: for some reason, such an STSYM for
"ktypeglobal:kotlin.String#internal" makes lldb find a wrong address
(0xffffffffffffffff) for "kclass:kotlin.String", despite those being
two different symbol names. This seems to be related to them having
the same address though.
The K/N lldb script, konan_lldb.py, uses "kclass:kotlin.String" to
determine if an object is a string, in order to display it properly.

Therefore, using the new Xcode 15 linker when compiling with caches
makes the debugger unable to display string variables properly. As a
side effect, this also breaks displaying array-typed variables (because
the script first checks if an object is a string).

This commit fixes this by removing ktypeglobals completely, making the
compiler emit only a kclass as an aggregate global directly.

Now, there are other ways to fix the problem. For example, making the
ktypeglobal private instead of internal, or making konan_lldb.py use a
runtime function instead of querying "kclass:kotlin.String" directly.
But it seems that LLVM aliases are not common on darwin platforms. For
example, Clang doesn't support `__attribute__((alias(...)))` on these
platforms.
So it is safer to just stop using aliases here.

^KT-61417
2023-08-24 15:03:27 +00:00
Pavel Punegov 2b6ca6d8e1 [K/N] Exclude a part of the test that fails due to the ^KT-61418 2023-08-23 15:40:07 +00:00
mvicsokolova 5f431e4e87 [K/N] Updated deprecations for native atomics
* Removed deprecated methods from the new atomics in kotlin.concurrent
* Changed deprecation level from WARNING to ERROR for the old atomics in kotlin.native.concurrent
* Removed FreezingIsDeprecated annotation from kotlin.concurrent.AtomicReference

See KT-58123

Merge-request: KT-MR-10650
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-08-22 13:42:12 +00:00
Svyatoslav Scherbina 05d38c8297 Native: don't build tests/samples/echoServer on Windows
Because of KT-50547, this test doesn't work on Windows with HMPP
enabled.

Previously, because of that HMPP was disabled for all samples.
But now disabling HMPP is no longer possible, so ce9a45b enables HMPP
for samples.

Disable echoServer sample on Windows to workaround ^KT-50547
2023-08-09 16:22:14 +00:00
Svyatoslav Scherbina ce9a45bf92 Native: enable HMPP in tests/samples
Remove `kotlin.mpp.hierarchicalStructureSupport=false`.
Disabling HMPP is not supported anymore.

^KT-59304
2023-08-09 12:14:13 +00:00
Aleksei.Glushko 0a09d1e140 [K/N] Use ptr-sized types in objc_firendly_dealloc tests
Merge-request: KT-MR-11525
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-08-08 15:38:36 +00:00
Aleksei.Glushko f1efeff21b [K/N] GC: parallel mark with work balancing ^KT-57771
Merge-request: KT-MR-11460
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-08-03 16:25:19 +00:00
Alexander Shabalin 22a3000789 [K/N] Make a stress test faster with aggressive GC 2023-08-01 16:25:51 +00:00
Abduqodiri Qurbonzoda 0f33d71de3 Migrate Vector128 from kotlin.native to kotlinx.cinterop #KT-58402
Make kotlin.native.Vector128 a typealias for kotlinx.cinterop.Vector128
Choose source compatibility over binary compatibility.
2023-07-31 19:38:05 +00:00
Pavel Kunyavskiy 858f432807 [K/N] Normalize on nan values in code generator
^KT-56041
2023-07-28 15:53:34 +00:00
Alexander Shabalin 576f6642f9 [K/N] Add hard memory boundary ^KT-54727 2023-07-27 21:27:30 +00:00
Aleksei.Glushko 1eda35a59c [K/N] Process objc run loop on the finalizer thread ^KT-58851
Merge-request: KT-MR-11024
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-07-27 14:17:48 +00:00
Abduqodiri Qurbonzoda df16fa3306 [K/N] Regex matching zero length should split surrogate pairs #KT-57401
Merge-request: KT-MR-11110
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-07-26 14:19:25 +00:00
Pavel Kunyavskiy f420b6c709 [K/N] Enable ir verification in interop_objc_smoke
^KT-57716
2023-07-26 08:32:09 +00:00
Pavel Kunyavskiy 0fbc42de03 [K/N] Remove interop_kt49034_objcprotocol test
It doesn't check anything meaningful after d797505f06

^KT-56028
2023-07-26 08:32:09 +00:00
Sergey Bogolepov 26b0b02553 [K/N] Update ObjCExport test data 2023-07-25 13:31:37 +00:00
Pavel Kunyavskiy d797505f06 [K/N] Drop merging forward and real declaration in deserializer
^KT-59643
2023-07-24 08:24:20 +00:00
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
Svyatoslav Scherbina 3280d3ef80 Native: prepare existing tests for cinterop adding ExperimentalForeignApi
cinterop tool should add ExperimentalForeignApi to all generated
declarations by default. This commit prepares existing tests for this.

^KT-58362
2023-07-21 11:54:14 +00:00
Pavel Kunyavskiy b6060f8440 [K/N] Fix lazy header export in one-shot compilation mode 2023-07-21 09:37:52 +00:00
Pavel Punegov 61ba29a775 [K/N][test] Excluded filecheck_signext_zeroext_objc_export
With enabled two-stage compilation test fails to match bridges
which generation depends on order
See ^KT-58863
2023-07-12 14:46:27 +00:00
Alexander Shabalin 6619edbbac [K/N] Fix redundant sp removal tests 2023-07-10 15:45:30 +00:00
Pavel Punegov d5c6dd5f5c [K/N][test] Improve testStackTrace test
Make it print stack trace before the checks
2023-07-07 17:09:40 +00:00
Pavel Punegov e722212502 [K/N][test] Suppress internal visibility in the test with @Retain 2023-07-06 16:22:02 +00:00
Pavel Punegov 7cb0875bd8 [K/N][test] Add ExperimentalNativeApi opt-in in the samples 2023-07-05 18:20:35 +00:00
Pavel Kunyavskiy 396cfb3956 [K/N] Make cast to objc forward declaration unchecked
Before this commit it caused compiler crash.
Unchecked cast warning to be done later.

^KT-59645
2023-07-05 06:49:34 +00:00
Yahor Berdnikau 5de2b5aeb4 [repo] Migrate Groovy build scripts to use 'kotlinStdlib()' directly from buildSrc 2023-07-04 19:26:38 +00:00
Sergey Bogolepov 2d945b7226 [K/N] Disable KT-59167 test on watchOS 2023-07-03 14:45:21 +00:00
Abduqodiri Qurbonzoda 209c916a7e OptIn ExperimentalNativeApi 2023-06-30 15:27:09 +00:00
Sergey Bogolepov aee9b7aae3 [K/N] Add a trivial test-case for KT-59167 2023-06-30 09:01:38 +00:00
Vladimir Sukharev 767cba5211 [K/N] Adjust test objc_direct.kt to pass under both K1 and K2
^KT-54610

Merge-request: KT-MR-10825
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-26 16:57:47 +00:00
Pavel Kunyavskiy f486fc942b [K/N] Fix special backend checks tests 2023-06-22 16:22:59 +00:00
Alexander.Likhachev 01276bbe49 [Build] Fix buildscripts deprecation warnings
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Vladimir Sukharev a3758bf70b [K2/N] Mute failed test
^KT-58863

Merge-request: KT-MR-10762
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-22 10:01:01 +00:00
Svyatoslav Scherbina 41247e8cef Native: workaround KT-59552 in filecheck_single_tls_load test
After recent changes (0cfb801) println got inlined into the checked
function. As a result, the test became affected by KT-59552.

Fix the test by moving println out of the checked function.
2023-06-21 15:49:53 +00:00
Pavel Kunyavskiy 12455451fc [K/N] Call class static initializer in constructors
^KT-59058
2023-06-20 08:41:11 +00:00
Igor Chevdar 95bef03d3e [K/N][tests] Added a reproducer for KT-59501 2023-06-20 06:20:52 +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
Pavel Punegov d5bdc7cf8e [K/N][test] Fix sample that uses watchos_x86 target
Simply replace it with watchos_x64
2023-06-15 14:07:42 +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 da1fde2477 [K/N] Enable custom allocator by default ^KT-55364 2023-06-13 10:22:04 +00:00
Alexander Shabalin 7815eec7c1 [K/N] Rework GC switches with better naming
Additionally, deprecate -Xgc in favour of a new binary option "gc".
This will allow setting gc right in gradle.properties

Merge-request: KT-MR-10498
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-06-09 12:04:19 +00:00
Svyatoslav Scherbina 1bf3d55bdf Native: add detachObjCObject internal function for Obj-C objects
For a Kotlin wrapper of an Objective-C object, this functions zeroes
and releases the strong reference from the Kotlin wrapper to the
Objective-C object.
Usually, such a release happens only when the Kotlin wrapper is GCed.
So using this function can help that happen sooner.

^KT-59134
2023-06-07 11:57:54 +00:00