Commit Graph

3105 Commits

Author SHA1 Message Date
Sergej Jaskiewicz eda30ff704 [klib] Implement diagnostics for clashing KLIB signatures
Now, we detect clashing signatures during serialization to KLIB and
report a compiler error if two or more declarations have the same
`IdSignature`

For example, for the following code:
```kotlin
@Deprecated("", level = DeprecationLevel.HIDDEN)
fun foo(): String = ""

fun foo(): Int = 0
```

the compiler will produce this diagnostic:
```
e: main.kt:1:1 Platform declaration clash: The following declarations
       have the same KLIB signature (/foo|foo(){}[0]):
    fun foo(): String defined in root package
    fun foo(): Int defined in root package
e: main.kt:4:1 Platform declaration clash: The following declarations
       have the same KLIB signature (/foo|foo(){}[0]):
    fun foo(): String defined in root package
    fun foo(): Int defined in root package
```

Note that we report this diagnostic during serialization and not earlier
(e.g., in fir2ir) for more robustness, so ensure that we check
exactly the signatures that will be written to a KLIB.
If we later introduce some annotation for customizing a declaration's
signature (e.g., for preserving binary compatibility), this
diagnostic will continue to work as expected.

^KT-63670 Fixed
2024-01-12 15:59:28 +00:00
Sebastian Sellmair 9c3de4332f [ObjCExport] Run new ObjCExport tests as native tests on CI
^KT-64839 Fixed
2024-01-12 15:37:41 +00:00
Sebastian Sellmair 809b278a7b [Minor] Remove unnecessary backend.native/functionalTest/.editorconfig 2024-01-12 15:37:41 +00:00
Alexander Shabalin 30550a6da1 [K/N] Immediately destroy objects that finalize only via ExtraObjectData ^KT-63423 2024-01-12 15:03:46 +00:00
Alexander Shabalin b7fbfb2fde [K/N][tests] Migrate first platform-dependent test to new testing infra
^KT-61259
2024-01-12 00:47:31 +01:00
Vladimir Sukharev bf01cb16b4 [K/N][Tests] Migrate some cinterop tests to new infra
^KT-61259
2024-01-11 23:30:06 +00:00
Sergej Jaskiewicz a0ba878b1d [FIR2IR] De-duplicate creation of Fir2IrConfiguration
This will help to prevent inconsistencies between creating
the configuration in the actual compiler pipeline and in compiler tests.
2024-01-11 12:16:54 +00:00
Aleksei.Glushko 8ed806ebe0 [K/N] Concurrent phase in GC mark (KT-58865)
+ Log Stop The World reasons

Merge-request: KT-MR-13759
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2024-01-09 18:34:36 +00:00
Vladimir Sukharev 7eb239c282 [K/N][Tests] Move objCActionFqName to NativeStandardInteropNames
^KT-61259
2024-01-09 14:17:47 +00:00
Vladimir Sukharev 8f12bf6cc8 [K/N] Move special backend checks test sources to diagnostic tests folder
^KT-61564
2024-01-09 14:17:47 +00:00
Igor Chevdar 8cc9272018 [K/N] Fixed a data race during monolithic caches creation
For per-file caches the data race is still there, but since per-file caches are
only used for incremental compilation, it's ok to leave it as is for now (we cope
with the data race by using a separate folder for each Gradle task).
2024-01-09 08:57:43 +00:00
Sergej Jaskiewicz 4f53204a31 [K/N] Set linkViaSignatures to false
This is already the case for Kotlin/JS.

This is required for fixing KT-63670: `linkViaSignatures` implies that
`SymbolTable` is used in FIR2IR, and in case if two declarations
have the same `IdSignature`, we have a crash in FIR2IR:

exception: java.lang.IllegalStateException: IR declaration with
signature "/foo|foo(){}[0]" found in SymbolTable and not found in
declaration storage

If we're not using SymbolTable, FIR2IR finishes successfully, and we can
safely proceed to the KLIB serialization stage, at which point we
can show the user a diagnostic about clashing signatures.

Since we've disabled SymbolTable, we also needed to fix the logic that
relied on its presence. Fortunately, such logic only includes
filtering out unused libraries. Instead of iterating over symbols in
SymbolTable, we iterate over cached symbols in Fir2IrDeclarationStorage
and Fir2IrClassifierStorage, which seems to do the trick just as well.
2024-01-08 17:17:47 +00:00
Sergej Jaskiewicz 766876b8a2 [K/N] Don't run ManglerChecker in K2 since its checks are disabled
KT-60648 is closed as "Declined", thus this code is not needed anymore.
2024-01-08 17:17:47 +00:00
Sebastian Sellmair ad8d4051b8 [ObjCExport] Fix tests with missing 'MustBeDocumented' annotations missing
KT-64226
2024-01-08 15:25:19 +00:00
Sebastian Sellmair e409c60780 [ObjCExport] Split ObjCExport into K1 and Analysis Api implementation
FL-23390
^KT-64168 Fixed
2024-01-08 15:25:19 +00:00
Dmitriy Dolovov e92017f64e [KLIB Resolver] Deprecate Logger.fatal()
Invocation of Logger.fatal() may cause severe side effects such as
throwing an exception or even terminating the current JVM process
(check various implementations of this function for details).

The code that uses Logger.fatal() sometimes expects a particular kind
of side effect. This is totally a design flaw. And it's definitely not
a responsibility of Logger to influence the execution flow of
the program.
2024-01-08 13:26:24 +00:00
Vladimir Sukharev 35e5b0613d [K/N] Migrate filecheck test redundant_safepoints to new infra
^KT-62157
2024-01-08 08:59:24 +00:00
Pavel Kunyavskiy f45d92eebc [K/N, K/JS, K/WASM] Enable FakeOverrideRebuilder by default
While not beeing final solution, this is closer to what
we want to have in the end. Enabling on non-JVM targets
would help better testing.

Enabling in JVM is now not possible yet, as some of the bugs are
not fixed yet (check KT-61360 for details)

^KT-62476
2024-01-08 07:46:07 +00:00
Dmitrii Gridin b6d373d8e5 Update copyright to 2024 2024-01-05 13:43:17 +00:00
Alexander Shabalin 3f2584bb02 [K/N] Move calls checker into separate module ^KT-62091 2024-01-05 13:35:35 +00:00
Alexander Shabalin d7929f93f2 [K/N] Fix samples compilation 2024-01-05 13:31:53 +00:00
Alexander Shabalin e959e97992 [K/N] Fix :kotlin-native:runtime:clean
The task erroneously deleted the build directory during
configuration phase.
2024-01-05 12:17:08 +00:00
Alexander Shabalin 5208b3c024 [K/N] Put FinalizerProcessor CFRunLoop usage under a flag ^KT-64313 2024-01-05 10:46:49 +00:00
Vladimir Sukharev 0a0da76a56 [K/N][tests] Move some more native tests to new testing infra
^KT-61259
2024-01-04 18:24:37 +00:00
Alexander Shabalin d665eb3575 [K/N] Fix calls checker allow list for signposts ^KT-62689 2024-01-04 16:58:20 +00:00
Igor Chevdar 54328a1db4 [K/N][tests] Added a reproducer for #KT-64508 2024-01-04 11:15:18 +00:00
Alexander Shabalin eea89c7f23 [K/N] Enable safepoint signposts by default ^KT-62689 2024-01-03 18:30:59 +00:00
Alexander Shabalin d6a922bc74 [K/N][tests] Migrate link tests to new testing infra ^KT-61259 2024-01-02 18:47:05 +00:00
Igor Chevdar 519c15419f [K/N] Fixed a problem with dependencies
-Xinclude-library should be treated exactly as source files -
the final binary should depend on all of them.

 #KT-64408 Fixed
2023-12-28 12:13:24 +00:00
cristiangarcia 5a1fb78fcd Declare generated SourceSets correctly
Allow Gradle to keep the track of the task generating the sources
KTI-1502 Fixed
2023-12-24 00:01:59 +00:00
Bogdan Mukvich d5e4c1db50 [K/N] Filter archives by extension for artifact publication
^KTI-1479
2023-12-20 19:05:11 +00:00
Sergey Bogolepov 6556f4fceb [Native][LTO] Drop unused module descriptor 2023-12-20 18:44:43 +00:00
Sergey Bogolepov 14c38aba14 [Native] Reduce number of descriptor occurrences
Mostly a cleanup commit:
* Remove some obsolete files and declarations
* Move some declarations from descriptors package to ir one
2023-12-20 18:44:42 +00:00
Alexander Shabalin 04a2a2d90d [K/N][tests] Migrate termination runtime tests to new testing infra ^KT-61259 2023-12-20 18:24:06 +00:00
Vladimir Sukharev 93642020ff [K/N][Tests] Move codegen test sources interfaceCallsNCasts..vector
^KT-61259
2023-12-20 07:07:27 +00:00
Anastasiia Spaseeva 389095e8f7 [K/N]: Do not deploy files containing checksum strings to a Maven repo
^Related to KTI-1479
2023-12-20 00:23:39 +00:00
Sergej Jaskiewicz 1b557c1657 [IR] Mark IrExpressionBodyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz 2096d22e18 [IR] Mark IrBlockBodyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz f482b6a458 [IR] Mark IrValueParameterImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz c393736473 [IR] Mark IrPropertyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz 41197392f9 [IR] Mark IrFunctionImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz e1d03f6540 [IR] Mark IrFieldImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz 444dcae93d [IR] Mark IrConstructorImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz 2fab853700 [IR] Mark IrClassImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz a1970d3d57 [K/N] Move KonanIrModuleSerializer to serialization.native
KT-64392
2023-12-19 15:20:01 +00:00
Sergej Jaskiewicz 199d9d4880 [K/N] Move KonanDeclarationTable to the serialization.native module
KT-64392
2023-12-19 15:20:01 +00:00
Sergej Jaskiewicz 3f9de91bec [K/N] Move KonanIrFileSerializer to the serialization.native module
KT-64392
2023-12-19 15:20:01 +00:00
Sergej Jaskiewicz a032db500c [K/N] Move KonanFakeOverrideClassFilter to serialization.native
KT-64392
2023-12-19 15:20:01 +00:00
Sergej Jaskiewicz ff1b618dfd [K/N] Move KonanIdSignaturer to the serialization.native module
KT-64392
2023-12-19 15:20:01 +00:00
Sergej Jaskiewicz 7e3b909394 [K/N] Move some utils to the serialization.native module
KT-64392
2023-12-19 15:20:01 +00:00