Commit Graph

2695 Commits

Author SHA1 Message Date
Johan Bay fafea27283 [klib tool] Add option to print ir
Dumping the IR from a klib is useful for debugging klib compilations.

^KT-58877
2023-07-31 09:45:19 +00:00
Yan Zhulanow 7d88ade005 [fir2ir] Allow non-cached type parameters
In the IDE, there might come declarations from other files/modules
that we link against, but not compile. Type parameters are one of such
declaration kinds.
2023-07-28 16:05:34 +00:00
Pavel Kunyavskiy 858f432807 [K/N] Normalize on nan values in code generator
^KT-56041
2023-07-28 15:53:34 +00:00
mvicsokolova 0521b63cb1 [K/N] Do not cast the result of atomicGet/atomicSet invocation from Boolean to Byte in VolatileFieldsLowering, because this cast is done by the property getter.
Merge-request: KT-MR-11347
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-28 10:14:27 +00:00
Ivan Kylchik 84159596bd [FIR] Pass diagnosticReporter in Fir2IrConfiguration
This parameter will be used to report diagnostics from constant
evaluator, in addition to report diagnostic from actualizer.
2023-07-27 22:50:21 +00:00
Alexander Shabalin 576f6642f9 [K/N] Add hard memory boundary ^KT-54727 2023-07-27 21:27:30 +00:00
Alexander Shabalin 220ecc4788 [K/N] Track memory in big chunks ^KT-57773
Additionally removed testFixtures{} and test{} in gcScheduler/common runtime module,
because that source set became empty.
2023-07-27 21:27:30 +00:00
Alexander Shabalin 0a726d4ebf [K/N] Move CUSTOM_ALLOCATOR macro to gc modules only ^KT-55364 2023-07-27 21:27:30 +00:00
Alexander Shabalin a69cd5e333 [K/N] Extract ThreadRegistry::waitAllThreads 2023-07-27 21:27:30 +00:00
Alexander Shabalin 9baac3685d [K/N] Add tests on safe points 2023-07-27 21:27:30 +00:00
Alexander Shabalin fd522ea756 [K/N] Add condition_variable that spins on atomics 2023-07-27 21:27:30 +00:00
Alexander Shabalin ee736c90b0 [K/N] Allow tweaking executionTimeout of RunGTest 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 7010bf2c20 Move copyToArrayImpl implementation to Common source set 2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 6fdfd4e8dd Null-terminate Collection.toArray destination only in JVM
In other platforms the elements following the collection elements
should not be changed.

As a part of efforts to stabilize Native stdlib.
2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 672a40c7cb [K/N] Remove redundant collectionToArray functions 2023-07-27 11:16:58 +00:00
Mikhail Glukhikh e76cf24d01 Explicitly use language version 1.9 for K2-unsupported parts
This commit explicitly sets LV 1.9 for all projects with disabled FIR
bootstrap, as well as for libraries, including Native stdlib.

Related to KT-59171
2023-07-26 18:19:58 +00:00
Alexander Shabalin 22d075dcda [K/N] Fix swiftinterop performance build 2023-07-26 15:45:26 +00:00
Alexander Shabalin fefb95a432 [K/N] Fix numerical performance build 2023-07-26 15:45:26 +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
Abduqodiri Qurbonzoda 86c1e0ded6 Remove reified constraint from Array constructors #KT-57363
This is an attempt to bring consistency to array constructors reified requirement.
Currently,
JVM - reified type in all three: arrayOfNulls, arrayOf, emptyArray
Native - reified in arrayOfNulls and arrayOf, but not in emptyArray
JS & Wasm - reified in arrayOfNulls, but not in arrayOf and emptyArray

Merge-request: KT-MR-11005
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-07-26 10:17:45 +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
Svyatoslav Scherbina dcb34e0ec0 Native: mention cinterop libraries in the ExperimentalForeignApi KDoc
Now (mostly after 3f3f6eb) cinterop adds ExperimentalForeignApi to all
Kotlin declarations it generates from C and Objective-C libraries,
except for the platform libraries.
This commit changes the KDoc for ExperimentalForeignApi to reflect that
change.

^KT-58362
2023-07-25 17:18:00 +00:00
Abduqodiri Qurbonzoda 7a0af5d058 Mark the CName annotation with ExperimentalNativeApi 2023-07-25 15:01:49 +00:00
Abduqodiri Qurbonzoda e5ab1d9ccf Commonize the ExperimentalNativeApi annotation 2023-07-25 15:01:49 +00:00
Sergey Bogolepov c8a07ae156 [K/N] Keep osVersionMinFlagLd property for compatibility purposes.
Compiler build uses a bit older version of kotlin-native-shared which
still refers to an older property.
This commit should be reverted after compiler update.
2023-07-25 14:30:06 +00:00
Sergey Bogolepov 9daa40d2ed [K/N] Use platform_version instead of sdk_version and os_version_min 2023-07-25 14:30:06 +00:00
Pavel Kunyavskiy 9cbd55aa72 [K/N] Intrinsify enumEntries<T>
^KT-59711
2023-07-25 14:24:44 +00:00
Sergey Bogolepov 26b0b02553 [K/N] Update ObjCExport test data 2023-07-25 13:31:37 +00:00
Sergey Bogolepov 38babdda07 [K/N] Fix KT-58863
Sort all kinds of descriptors in the header generator
to untie declaration order from the behavior of the frontend.

Note that this commit does not affect bridge order in the binary.
2023-07-25 13:31:37 +00:00
Sergey Bogolepov 196a47c25b [K/N] ObjCExport: minor code cleanup 2023-07-25 13:31:37 +00:00
mvicsokolova ba7e6ff154 [K/N] Intrinsics for atomic get/set of volatile properties.
These intrinsics are equivalent to KMutableProperty0.get/set invocation and used internally to optimize allocation of a property reference.


Merge-request: KT-MR-11233
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-25 10:53:37 +00:00
Igor Chevdar 5d6de2f8bf [K/N] Fixed bug in virutal call trampolines
#KT-60645 Fixed
2023-07-25 05:57:31 +00:00
Sergej Jaskiewicz f5a00c788a [klib] Disable ManglerChecker on K2
`ManglerChecker` is a class that verifies that for each IR declaration
(except some, see its `needsChecking` property) its mangled name
(computed from IR) is the same as the mangled name computed from its
frontend representation — `DeclarationDescriptor` on K1 or
`FirDeclaration` on K2.

The way it does it is as follows.

On K1, `ManglerChecker` looks if the declaration has a true,
non-IR-based descriptor, it if it does, then it checks it
(see ManglerChecker.Companion#hasDescriptor).

On K2, since we don’t have any descriptors, `ManglerChecker` looks if
the declaration’s metadata property is `null` (because the corresponding
`FirDeclaration` is stored there). If it’s not, it checks it
(see ManglerChecker.Companion#hasMetadata).

The issue is that those two conditions are not equivalent.

When the Compose compiler plugin transforms an IR function, it copies
its `metadata` property (as it should, because `metadata` can contain
anything, not necessarily the frontend representation), but doesn't set
the descriptor. Because of that, on K1 that transformed function is
skipped in `ManglerChecker`, and on K2 it’s not.

The correct usage would be to properly distinguish which declarations
come from the FE as is, and which are transformed/synthesized,
and skip the latter. But it is unclear how to implement this.

For now, the easiest way to fix this on K2 is to not run ManglerChecker
at all.

KT-60648
^KT-59448 Fixed
2023-07-24 19:29:17 +00:00
Pavel Kunyavskiy 488d24296a [K/N]: Allow invocation of volatile intrinsics on inline function constant arguments.
Invocation of atomic intrinsics is only allowed on property references that are known at compile time. This commit makes it possible to also invoke intrinsics on a constant property reference getter passed as an argument.
See KT-58359

Co-authored-by: Pavel Kunyavskiy <Pavel.Kunyavskiy@jetbrains.com>

Merge-request: KT-MR-10413
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-24 17:45:16 +00:00
Troels Bjerre Lund 2818957689 [K/N] Custom allocator for all GCs ^KT-55364
Also enables the integration tests for custom allocator and the
currently available GCs.

Co-authored-by: Troels Bjerre Lund <troels@google.com>

Merge-request: KT-MR-11199
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-07-24 16:28:47 +00:00
Pavel Kunyavskiy ba75ee4c03 [K/N] Copy more flags to the first stage of one-shot compilation mode
This fixes obj-export lazy header generation in non-default modes,
and makes nightly tests green.
2023-07-24 12:47:14 +00:00
Ilya Gorbunov 61175889b9 KT-53154 extract implementation of enumEntries into an expect/actual internal helper function
It's required, so it can be implemented in different backends
at a different pace and in a different manner
2023-07-24 11:18:44 +00:00
Roman Efremov 8ce1417621 [Stdlib] Fix reports of MPP annotation checker
^KT-58551
2023-07-24 09:48:49 +00:00
Svyatoslav Scherbina bfcb90c716 Native: add ExperimentalForeignApi opt-in to performance tests
3f3f6eb marks all cinterop-generated declarations with
@ExperimentalForeignApi. As a result, all usages of such declarations
have to opt-in explicitly. This commit adds those opt-ins to all
usages in the performance tests.

^KT-58362
2023-07-24 09:11:58 +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
Svyatoslav Scherbina 39ef189e05 Native: change GCC toolchain for linux_arm32_hfp
^KT-58864
2023-07-21 16:13:26 +00:00
Svyatoslav Scherbina a30b1c6cc1 Native: remove a few headers from linux_arm32_hfp linux platform lib
Those are not available in the new GCC toolchain.

^KT-58864
2023-07-21 16:13:26 +00:00
Svyatoslav Scherbina 682c105230 Native: remove unused headers.x86-64 from linux.def
`headers.x86-64` property in a cinterop .def file is not actually used
by cinterop. `headers.x64` should be used instead.

This commit removes it completely instead of renaming -- no functional
changes are done.
2023-07-21 16:13:25 +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 3f3f6eb5a8 Native: add ExperimentalForeignApi to generated cinterop declarations
cinterop tool should add ExperimentalForeignApi to all generated
declarations by default. This commit implements adding the annotation.
Nested declarations don't get the annotation, because they inherit the
opt-in requirement from the enclosing classes implicitly.

The annotation is not added to platform libraries, as intended. See
previous commits.

^KT-58362
2023-07-21 11:54:14 +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
Svyatoslav Scherbina 93ef98cbec Native: make .annotations mutable for some Stub IR nodes
cinterop tool should add ExperimentalForeignApi to all generated
declarations by default. To make this possible to implement in a
non-intrusive manner, this commit enables adding annotations to some of
the existing Stub IR nodes.
After that, one can add annotations to all generated declarations with
a simple post pass.

^KT-58362
2023-07-21 11:54:14 +00:00
Svyatoslav Scherbina d118844b17 Native: represent ExperimentalForeignApi in cinterop's Stub IR
cinterop tool should add ExperimentalForeignApi to all generated
declarations by default. This commit supports this annotation in
cinterop intermediate representation -- Stub IR.

^KT-58362
2023-07-21 11:54:14 +00:00