Commit Graph

2647 Commits

Author SHA1 Message Date
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
Svyatoslav Scherbina 7ca0cb1077 Native: don't add ExperimentalForeignApi to platform libs
Use -Xdisable-experimental-annotation when generating platform libs.
As a result, unlike all other cinterop libraries, declarations in
platform libs won't require ExperimentalForeignApi opt-in

^KT-58362
2023-07-21 11:54:14 +00:00
Svyatoslav Scherbina cabb25d3e0 Native: add -Xdisable-experimental-annotation flag to cinterop
It disables adding `ExperimentalForeignApi` opt-in to declarations
generated by cinterop.
Main use case is platform libraries, which are not supposed to have this
annotation. Applying the flag to user cinterop libraries is discouraged
and effectively means opting in.

^KT-58362
2023-07-21 11:54:14 +00:00
Svyatoslav Scherbina 1053d18871 Native: add support for annotations on typealiases in cinterop
^KT-58362
2023-07-21 11:54:14 +00:00
Svyatoslav Scherbina aecf18b842 Native: move copying of toolchain builder artifact from Docker to host
Don't make Docker container copy artifact to a host directory mounted
with -v, because this fails due to a file permission issue:
build is run by a regular user, but the volume directory inside the
container is owned by root.

Instead, make the host copy the artifact from the container.

Also, make the container print the artifact path before that.
Just in case, in order to easily copy file manually, should something
go wrong.

^KT-58864
2023-07-21 10:40:13 +00:00
Svyatoslav Scherbina a276ad48a0 Native: don't use -it for docker run in toolchain builder
To make it more suitable for running in a CI

^KT-58864
2023-07-21 10:40:13 +00:00
Svyatoslav Scherbina 28a736ea30 Native: update isl download URL in a toolchain builder config
The previous URL no longer works. The isl project has moved hosting to
sourceforge.io. Update the mirror accordingly.
This is fixed in Crosstool-NG 1.25.0, but the URL is included in config
and needs to be updated there.

Note: to make the rest of toolchains buildable, the same change should
be applied to their configs.

See also https://github.com/crosstool-ng/crosstool-ng/pull/1614.

^KT-58864
2023-07-21 10:40:12 +00:00
Svyatoslav Scherbina 4e563aa299 Native: add arm toolchain gcc-8.3.0-glibc-2.12.1-kernel-4.9.config
Based on gcc-8.3.0-glibc-2.19-kernel-4.9.config, but with glibc version
downgraded from 2.19 to 2.12.1.

^KT-58864
2023-07-21 10:40:12 +00:00
Svyatoslav Scherbina 3c568e7b86 Native: update zlib download URL in toolchain builder
zlib 1.2.11 has been moved to fossils/ on the official website.

^KT-58864
2023-07-21 10:40:12 +00:00
Svyatoslav Scherbina 785e70c31a Native: update toolchain builder Docker image to Ubuntu 16.04
Ubuntu 14.04, used before, has expired root SSL certificate for
Let's Encrypt. As a result, OpenSSL couldn't verify SSL certificates
issued by Let's Encrypt, failing, in particular, kernel download.

^KT-58864
2023-07-21 10:40:12 +00:00
Pavel Kunyavskiy b6060f8440 [K/N] Fix lazy header export in one-shot compilation mode 2023-07-21 09:37:52 +00:00
Ivan Kylchik ca8db7d0b8 [IR] Move toIrConst method into common IrUtils file
This method is used not only in IR interpreter, so it makes sense to
move it.
2023-07-19 15:12:54 +00:00
Svyatoslav Scherbina f18c6755cc Native: fix runtime compilation against older glibc versions
Replace `#include <inttypes.h>` with `cinttypes`.
Improve other includes in the same file.

^KT-58864


Co-authored-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-07-19 14:41:51 +00:00
Dmitriy Novozhilov 11974c14d8 [IR] Fix various TODOs in SymbolTable 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 8ad202eb8b [IR] Remove descriptor-related methods from SymbolTable
Replace them with calls to SymbolTableExtension
2023-07-17 21:02:39 +00:00
Dmitriy Novozhilov 4986cb14aa [IR] Extract descriptor part from SymbolTable into separate component
After this change SymbolTable (and ReferenceSymbolTable) contains only
  methods with IdSignatures. All descriptors-related methods are moved
  into DescriptorSymbolTableExtension, which automatically delegates to
  the SymbolTable if needed

At this moment there are cross-references between SymbolTable, because
  descriptor API is still actively used across backends. So SymbolTable
  is accessible in some place then descriptor extension will be accessible
  too

DescriptorSymbolTableExtension is an implementation of abstract SymbolTableExtension
  which allows to implement different kinds of storages, e.g. FIR based
  (it probably will be needed for FIR2IR)
2023-07-17 21:02:39 +00:00
Alexander Shabalin bdb534c3de [K/N] Fix perf build 2023-07-17 16:56:34 +00:00
Vladimir Sukharev 52068e11ee [K/N] Pass USE_FIR config setting to splitted first stage, and not to second stage
Merge-request: KT-MR-11084
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-07-14 15:23:27 +00:00
Abduqodiri Qurbonzoda fed453fdea Provide Common StringBuilder.append/insert with primitive type arguments #KT-57359
Merge-request: KT-MR-10892
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-07-13 11:52:14 +00:00
Yahor Berdnikau 5b5dae9249 [repo] Move buildSrc into repo/gradle-build-conventions/buildsrc-compat project
Include new project as build logic included build. Such change will
allow us to start migration into build convention plugins by splitting
buildSrc logic into subprojects.
2023-07-13 08:24:49 +00:00
Sebastian Sellmair 3f0130ecf1 [Gradle] Change 'UnsafeNumber' RequiresOptIn.level to 'ERROR'
^KT-59859 Verification Pending
^KT-55757 Verification Pending
2023-07-12 20:17:03 +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
mvicsokolova d9fa9c1b3b [K/N] Introduce intrinsics that atomically update array elements
Supported atomic update of elements for IntArray, LongArray and Array<T>
See KT-58360

Merge-request: KT-MR-11020
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-12 14:32:36 +00:00
Ivan Kochurkin 1a28067b76 [FIR] Merge FirBasedKotlinMangler into FirMangler
FirMangler has only one implementation and it's FirBasedKotlinMangler

It looks excessive
2023-07-12 13:11:24 +00:00
Dmitrii Krasnov f2816a5531 Added property for overriding konan distribution location
#KT-50463 Fixed

Merge-request: KT-MR-10310
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2023-07-12 12:36:51 +00:00
Abduqodiri Qurbonzoda f152fa537d Collection.toString() should not throw if it contains itself
Merge-request: KT-MR-10591
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-07-11 09:58:38 +00:00
Svyatoslav Scherbina 710381e489 Native: don't report Objective-C-related errors on expect classes
An expect class might lack some details and thus seem incorrect to the
compiler, while the corresponding actual class is totally fine.
Due to the specifics of the compiler, this happens more often then it
should (because the compiler actually always analyzes expects along
with actuals, with most references actualized).

For example, in KT-52882 the compiler analyzes an expect class
(TestImpl), but the class refers to the actual interface Test as its
supertype, meaning that the compiler sees TestImpl as a class inheriting
an Objective-C protocol but not an Objective-C class, which is
prohibited. While the actual class has its super types in order.

So, in reality, from both actualized and non-actualized points of view,
the code is totally correct, and the error was reported only because of
the way the compiler handles multiplatform.

Those compiler checks only matter for the actual class anyway, so
disabling them for expect classes is harmless.

^KT-52882 Fixed
2023-07-10 16:15:49 +00:00
Alexander Shabalin 6619edbbac [K/N] Fix redundant sp removal tests 2023-07-10 15:45:30 +00:00
cristiangarcia 0946039661 Reduce number of tasks realized eagerly from Konan Plugin 2023-07-10 14:42:30 +00:00
Ivan Kylchik 0c6e2f135e [Native] Drop constantInliningPhase
We don't need this lowering anymore because corresponding work is done
by `constEvaluationPhase`
2023-07-10 13:19:52 +00:00
Ivan Kylchik a4b8ab8199 [Native] Forbid to inline NaN values during const evaluation 2023-07-10 13:19:52 +00:00
Ivan Kylchik 8e42ccaccb [IR] Drop FoldConstantLowering and StringTrimLowering 2023-07-10 13:19:51 +00:00
Ivan Kylchik ad6332112e [IR] Support const optimizations for Native backend 2023-07-10 13:19:51 +00:00
Pavel Kunyavskiy 19ccb23088 [K/N] Fix compilation error caused by bad merge 2023-07-10 10:31:00 +00:00
Pavel Kunyavskiy ef9413108b [K/N] Consolidate forward declarations handling
This is refactoring in preparation for KT-59764.
Names and layout of forward declarations related classes
was copy-pasted many times over compiler code.

Implementing KT-59764 would require copy-pasting it two more times.
So instead of doing this it was put in single place.

No behaviour changes intended in this commit.
2023-07-10 08:59:16 +00:00
Igor Chevdar 58639951f6 [K/N] Refactored 2-stage splitting 2023-07-07 17:51:46 +00:00
Igor Chevdar afdc596121 [K/N] Fix for two-stage compilation 2023-07-07 17:51:46 +00:00
Vladimir Sukharev 4cfcf45120 [K/N] Partially fix IncrementalCompilationTest
^KT-59245
2023-07-07 17:51:46 +00:00
Vladimir Sukharev e240d7aae3 [K/N] Fix test split_compilation_pipeline
^KT-59245
2023-07-07 17:51:46 +00:00
Vladimir Sukharev 32a390ea18 [K/N] K1/MPP: Enable splitting 1-stage to two CLI invocations
^KT-59245 Fixed
2023-07-07 17:51:46 +00:00
Vladimir Sukharev a87b662bc5 [K/N] Split 1-stage K1 compilations to two stages
^KT-59245 Fixed
2023-07-07 17:51:46 +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
Dmitriy Dolovov 8aacdb471b [K/N] Fix: Ignore bridge functions in FunctionReferenceLowering
^KT-59858
2023-07-06 12:39:46 +00:00
Ivan Kylchik abbafc0b2a [IR] Move some inline utils from backend.common into ir.util 2023-07-06 11:00:14 +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 6d5f1c84a7 [repo] Migrate Groovy build scripts to use 'javadocJar()' directly from buildSrc 2023-07-04 19:26:38 +00:00
Yahor Berdnikau 5de2b5aeb4 [repo] Migrate Groovy build scripts to use 'kotlinStdlib()' directly from buildSrc 2023-07-04 19:26:38 +00:00