Commit Graph

1520 Commits

Author SHA1 Message Date
Dmitriy Dolovov 38a67f3d30 [KLIB] Use -Xmetadata-klib to produce metadata KLIBs
With this change a new `-Xmetadata-klib` CLI flag becomes the
preferable way to instruct K2MetadataCompiler to produce metadata
KLIBs. The old `-Xexpect-actual-linker` flag still works for
K2MetadataCompiler, but that would last just for a short transition
period until the necessary changes are made in the Gradle plugin.

The K2NativeCompiler does not work anymore with `-Xexpect-actual-linker`
and respects only the `-Xmetadata-klib` flag. This is not an
issue since the Gradle plugin anyway supplies both flags for Native
metadata compilations.

^KT-61136
2023-09-20 22:26:36 +00:00
Dmitriy Dolovov 848c88b1a5 [KLIB] Lift up -Xmetadata-klib CLI key from Native to Common args
This is a precondition for obsoleting and finally removing
`-Xexpect-actual-linker` CLI key, which became useless since
the removal of ExpectActualTable.

^KT-61136
2023-09-20 22:26:36 +00:00
Ilya Chernikov e5ee364419 IC: Implement expect/actual tracking
fixes NewMultiplatformIT.testIncrementalCompilation
also #KT-61590 fixed
2023-09-19 15:46:30 +00:00
Pavel Kunyavskiy 71128e232e [K/N] Avoid creating fake overrides before setting class parent
This fixes a tests crash introduced in #KT-61366 fix.
2023-09-19 12:04:05 +00:00
Pavel Kunyavskiy aef5290210 [K/N] Change test to make aggregate green.
The test is using error suppressing, so breaking it is fine.


^KT-62015
2023-09-18 20:02:36 +00:00
Igor Chevdar 2b8bcfda94 [K/N][codegen] Build trampolines for abstract fake overrides
#KT-61924 Fixed
2023-09-15 09:26:54 +00:00
Vladimir Sukharev f5bd7cee05 [K/N] Adjust filecheck tests for atomic intrinsics to -opt mode
^KT-60514 Fixed


Merge-request: KT-MR-12179
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-13 17:46:22 +00:00
Alexander Shabalin c637a228eb [K/N] Fix filecheck kt53621 tests on linux arm64.
For aarch64-unknown-linux-gnu clang generates i1 to represent bool.
On our other targets it generates as zeroext i1 instead.
2023-09-13 16:55:09 +00:00
Sergej Jaskiewicz 9eba17d631 [K/N] Move Native-specific mangle constants to more suitable places
They shouldn't be mixed with target-independent constants.
2023-09-13 14:25:12 +00:00
Sergej Jaskiewicz ddfd94b3b2 [K/N] Move KonanMangler to a new common module
^KT-61248 Fixed
2023-09-13 14:25:10 +00:00
Sergej Jaskiewicz d1127f1a31 [K/N] Move IR-related ObjC interop helpers to a new common module
This is a step towards KT-61248. We need those helpers to be available
in non-Native-specific code.
2023-09-13 14:25:09 +00:00
Sergej Jaskiewicz 5cb252fe49 [descriptors] Move DeclarationDescriptor#findPackage helper to core
There is nothing serialization-specific about this function
2023-09-13 14:25:09 +00:00
Sergej Jaskiewicz dff2d2ed60 [descriptors] Move some annotation-related utilities to the core module
- AnnotationDescriptor#argumentValue is not frontend-specific
- AnnotationDescriptor#getAnnotationStringValue is not Native-specific

We are going to need these functions in the IR code, so it makes
sense to factor them out to the core module.
2023-09-13 14:25:08 +00:00
Sergej Jaskiewicz 56cb0bf071 [utils] Move atMostOne to core/util.runtime
There is nothing backend-specific about this helper function.
2023-09-13 14:25:08 +00:00
Alexander Udalov fd68b9f49c CLI: add -Xuse-ir-fake-override-builder
To be able to test IR fake override builder (KT-61514) outside of
compiler tests.
2023-09-13 15:01:52 +02:00
Alexander Shabalin 503c1a2eb6 [K/N] Fix kt53261_noinline_NonNullNativePtr.kt with K2 2023-09-13 12:15:57 +00:00
Igor Chevdar 9d2d75313b [K/N][tests] Added a test for anonymous object in a top level inline fun 2023-09-13 09:18:26 +03:00
Igor Chevdar b66a6fcc08 [K/N][IR] Moved local declarations names invention down the pipeline 2023-09-13 09:18:26 +03:00
Igor Chevdar ac760cbbfb [K/N][tests] Refactored a bit test
arguments of assertEquals are (expected, actual), not vice versa
2023-09-13 09:18:26 +03:00
Vladimir Sukharev e0e2a57e3d [K/N] Add filecheck tests for atomic intrinsics
https://youtrack.jetbrains.com/issue/KT-60514/Add-llvm-filecheck-tests-for-atomic-intrinsics

Merge-request: KT-MR-12067
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-11 21:28:34 +00:00
Igor Chevdar 1ff7841ac7 [K/N][IR] Renamed PreInlineLowering to TypeOfLowering 2023-09-11 18:16:25 +00:00
Igor Chevdar 8f3b9694f7 [K/N] Extracted asserts removal to a separate lowering 2023-09-11 18:16:25 +00:00
Igor Chevdar e8ca45378b [K/N] Moved couple of phases down the pipeline 2023-09-11 16:31:22 +00:00
Svyatoslav Scherbina 0cd91d9286 Native: fix filecheck_signext_zeroext_objc_export and enable it back
Previously filecheck_signext_zeroext_objc_export test was disabled
after making one-stage compilation mode implemented through two-stage
mode (KT-59245).

That change made the compiler sort the methods, and filecheck patterns
didn't match that order after that.

This commit fixes the test by adding sorted prefixes to method names,
so sorting alphabetically them doesn't really change the order.
2023-09-11 13:49:36 +00:00
Ivan Kylchik 5d88a1f1c3 [Native] Rename Lowerings to NativeLoweringPhases
This is done to unify the way how we name file
that contains lowerings in different backends.
2023-09-11 10:04:50 +00:00
Alexander Shabalin 2f22b0a6b0 [K/N] Migrate runtime/atomics tests to new testing infra ^KT-61259 2023-09-09 07:25:35 +00:00
Alexander Shabalin a8cec11772 [K/N] Protect filecheck tests for KT-53261 from DCE. 2023-09-07 15:35:57 +00:00
Johan Bay 1e66f25546 [K/N] Link small bitcode modules together first
Repeatedly linking many smaller bitcode modules into one large is very
slow. We are seeing a 10x improvement by instead linking all the small
modules together first and link the result into the larger main module.
This commit implements this optimization in the
LinkBitcodeDependenciesPhase phase.

^KT-61604 Fixed


Co-authored-by: Johan Bay <jobay@google.com>
2023-09-07 07:44:31 +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 Udalov 1d5ade1166 K2: minor, remove misleading FirMemberDeclaration.containerSource
"Container source" means "the source of the container". So, if you
called this extension on a class (`FirClassLikeDeclaration`), it was
reasonable to assume that you would get the source of its _containing
class_, whereas the function actually returned the source of the class
itself.

Instead of inventing another name for this function, I've decided to
inline and remove it because it has only one usage.
2023-09-06 08:05:34 +00:00
Alexander Shabalin f4289e1287 [K/N] Enable concurrent weak processing ^KT-61093 2023-09-05 13:53:35 +00:00
Ivan Kylchik 40c9f831e2 [Native] Drop IrUtils2 file 2023-09-05 11:21:51 +00:00
Ivan Kylchik 8142ae2579 [Native] Drop irCatch from IrUtils2 2023-09-05 11:21:51 +00:00
Ivan Kylchik c2076a0227 [Native] Move hasNonConstInitializer from IrUtils2
This function could be useful for other backends.
2023-09-05 11:21:51 +00:00
Ivan Kylchik ddde95bd78 [Native] Move irByte from IrUtils2
We already have similar functions in `ExpressionHelpers`. Makes
sense to keep them together.
2023-09-05 11:21:51 +00:00
Ivan Kylchik d62323cdf1 [Native] Move addTopLevelInitializer from IrUtils2
This function is actually used only in `InteropLowering` and it
is too specific to be included into utils.
2023-09-05 11:21:51 +00:00
Ivan Kylchik 5cd96831dc [Native] Move isRestrictedSuspendFunction from IrUtils2
This function is also helpful for JVM backend.
2023-09-05 11:21:50 +00:00
Ivan Kylchik 2657adc6dc [Native] Move addFile from IrUtils2
This function is actually used only in `BackendPhases` and it is
too specific to be included into utils.
2023-09-05 11:21:50 +00:00
Ivan Kylchik 4fb29a5e12 [Native] Drop addArguments from IrUtils2
We can simplify single usage of this function
2023-09-05 11:21:50 +00:00
Ivan Kylchik 20165dd699 [Native] Drop defaultOrNullableType from IrUtils2
We can simplify most usages of `defaultOrNullableType`
2023-09-05 11:21:50 +00:00
Ivan Kylchik 583a5496d5 [Native] Drop irCall from IrUtils2
We can reuse the same function from common `ExpressionHelpers`
2023-09-05 11:21:50 +00:00
Ivan Kylchik 5c68ea2b64 [Native] Simplify irCatch from IrUtils2 2023-09-05 11:21:50 +00:00
Ivan Kylchik 8cc4db39d2 [Native] Drop copy from IrUtils2
It is not used anywhere
2023-09-05 11:21:50 +00:00
Ivan Kylchik b3474ac730 [Native] Drop irBuilder from IrUtils2
We can reuse `createIrBuilder` function
2023-09-05 11:21:50 +00:00
Ivan Kylchik 9e750e900d [Native] Drop createField from IrUtils2
We can call `IrFieldImpl` directly, the same way it is done
for other IR declarations in `CBridgeGen` file.
2023-09-05 11:21:50 +00:00
Ivan Kylchik 7e71e778c9 [Native] Drop stub from IrUtils2
It is not used anywhere
2023-09-05 11:21:50 +00:00
Ivan Kylchik b10d330cfd [Native] Drop getContainingFile from IrUtils2
We can reuse `fileOrNull` function from common `IrUtils`
2023-09-05 11:21:50 +00:00
Ivan Kylchik a437e0378a [Native] Drop irCallOp from IrUtils2
It is not used anywhere
2023-09-05 11:21:50 +00:00
Ivan Kylchik 4376e58acb [Native] Drop createArrayOfExpression from IrUtils2
We can reuse the same function from common `IrUtils`
2023-09-05 11:21:50 +00:00
Ivan Kylchik 962172f96d [Native] Drop irSetVar from IrUtils2
We can reuse `irSet` function
2023-09-05 11:21:50 +00:00