Commit Graph

99 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
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
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 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
Vladimir Sukharev 4d9f93e4eb [K2/N/MPP] Disable one-stage MPP compilation
^KT-56855

Merge-request: KT-MR-10735
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-23 15:51:59 +00:00
Vladimir Sukharev 5bf51318eb [K2/N] Exit compilation on errors at first stage
^KT-56855

Merge-request: KT-MR-10344
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-05-29 10:38:28 +00:00
Vladimir Sukharev 74c57e6057 [K2/N] Compile to native binary in two stages
^KT-56855 Fixed

Merge-request: KT-MR-10219
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-05-24 13:07:12 +00:00
Igor Chevdar ab892037df [K/N] Propagate IrMessageLogger to subcompilations
Otherwise, some warnings/errors (like from IrLinker) might be lost
2023-04-11 07:08:41 +00:00
Dmitriy Dolovov f86fa807cf [PL][Native] Propagate PL configuration to cache compilation 2023-04-04 22:24:02 +02:00
Johan Bay 349a6b6e82 Introduce flag for bitcode to native compilation
This enables splitting the compilation pipeline into multiple
invocations of the compiler.
2023-03-04 16:13:42 +00:00
Pavel Punegov c9aeadd31f [K/N] Remove old Compiler and Meta Version ^KT-55677 Fixed
* Replace it with KotlinCompilerVersion
* K/N version should be set now with `deployVersion`.
* Cleanup deprecated functions in older versions
 of the Gradle plugin
* Cleanup tests for older versions of compiler downloader

Merge-request: KT-MR-8436
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-01-30 13:10:08 +00:00
Mikhail Glukhikh 7a61578e08 Language version 2.0: fix compiler messages and minor details 2023-01-16 18:16:48 +01:00
Artem Daugel-Dauge 0d1e7e83b5 [K/N, CLI] Pass through errors from Gradle to Xcode
^KT-55650

Merge-request: KT-MR-8245
Merged-by: Artem Daugel-Dauge <Artem.Daugel-Dauge@jetbrains.com>
2023-01-13 20:54:05 +00:00
Igor Chevdar 9aa287257b [K/N] Refactored a bit configuration setup 2023-01-11 14:13:04 +00:00
Igor Chevdar 9c86532eb0 [K/N] Implemented cache orchestration machinery in the compiler 2023-01-11 14:13:01 +00:00
Vladimir Sukharev 924898afb7 [K/N] KFC-446: K2 platform: Native alpha
Merge-request: KT-MR-7905
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-01-04 16:10:40 +00:00
Sergey Bogolepov 366edcfe3c [K/N] Drop obsolete static driver 2022-12-20 06:30:36 +00:00
Troels Bjerre Lund bb1acf729b [K/N] Add custom allocator prototype ^KT-55364
Enable custom allocator with -Xallocator=custom.

If the gc is cms (default):
 * a patched version of the memory manager is used that does not build a
   list of allocated objects.
 * a patched version of the cms is used that defers to the allocator for
   sweeping.

Otherwise, a warning is printed, and the allocator is used using the
standard api.

Design doc:
https://docs.google.com/document/d/15xMp-nE-DWL8OrtOc8DoXB80AHUphFICEGjj5K0aNFc

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

Merge-request: KOTLIN-MR-546
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
2022-12-08 17:22:04 +00:00
Sergej Jaskiewicz 1539d7ef1a [klib] Bring package names in sync with the directory layout
Basically, some package names were Native-specific, whilst the packages
themselves were not Native-specific at all. This was already reflected
in the directory layout, but not in the package names.
This is fixed here.

NFC, just an automatic rename of packages with fixes of imports.
2022-12-01 21:46:43 +00:00
Sergey Bogolepov c22cad07ed Introduce FlexiblePhaseConfig
For dynamic Kotlin/Native driver we need a PhaseConfigurationService
that does not force us to provide a list of phases upfront.
2022-11-30 11:24:38 +00:00
Sebastian Sellmair 7870c82221 [Gradle][Native] K2NativeCompilerArguments.refinesPaths: Use Array<String> instead of String
^KT-55071 Verification Pending
2022-11-24 14:42:11 +00:00
Sebastian Sellmair 752ff04245 [Gradle][Native] Setup refinesPaths as expectedBy module dependencies
Previously, dependsOn dependencies were just passed as friend modules
to shared native compilations.

^KT-55071 Verification Pending
2022-11-24 14:42:10 +00:00
Svyatoslav Scherbina 2987340edd Get rid of unsafe cast function usages in :kotlin-native:backend.native 2022-10-11 15:11:36 +00:00
Svyatoslav Scherbina 28dea9d949 Native: remove obsolete compiler flags that have no effect
Same for compiler configuration keys.
2022-10-07 15:33:42 +00:00
Sergey Bogolepov d7fff3ca01 [K/N] Add -Xforce-compiler-driver=(static, dynamic) flag
Useful for development purposes when one wants to compare
the outputs of different drivers.
2022-10-06 13:10:50 +00:00
Igor Chevdar 1963860a92 [K/N][caches] Removed old slow and hacky version of per-file caches building 2022-09-27 17:06:48 +00:00
Igor Chevdar 77f24a22dd [K/N][IR][codegen][caches] Speed-up of per-file caches 2022-09-27 17:06:48 +00:00
Igor Chevdar 030e3b306f [K/N][build] Added -Xmake-per-file-cache compiler option 2022-08-06 17:40:24 +00:00
Igor Chevdar 7e79b2b500 [K/N][IR][codegen] Preliminary support of per-file caches 2022-08-06 17:40:23 +00:00
Sergey Bogolepov cd54afea8f [K/N] Add option to omit generation of binary when producing framework
`-Xomit-framework-binary` is useful when the user does not care about
generated machine code, but only about its public interface.
Current use-case is for development purposes only: to iterate faster
on ObjCExport. But potentially it can be turned into user-facing feature
2022-07-22 11:57:15 +00:00
Dmitriy Novozhilov 928416c9c5 [CLI] Introduce new compiler arguments for registering compiler plugins
With new syntax each plugin should be registered in separate argument with syntax
`-Xcompiler-plugin=classpath1,classpath2[=argument1=value1,argument2=value2]`
2022-07-20 09:07:26 +00:00
Yahor Berdnikau 603d043abc Move Kotlin/Native compiler arguments into :compiler:cli:cli-common
This allows to reference them in the Gradle plugins without enabling
kotlin-native part of the repository

^KT-53108 In Progress
2022-07-14 10:57:28 +00:00
Sergey Bogolepov 231a014818 [K/N] Drop obsolete -Xmeaningful-bridge-names compiler flag 2022-07-13 17:15:17 +00:00
Mads Ager ef499fedbb [K/N] Deprecate -Xbundle-id and use binary options for Info.plist. 2022-06-23 09:57:13 +00:00
Mads Ager c7e7080af6 [K/N] Allow control of BundleShortVersionString and BundleVersion
Adding -Xbundle-version and -Xbundle-short-version-string
compiler arguments. These can be used in the freeCompilerArgs
in the gradle configuration to control the version strings
in the Info.plist in generated frameworks.

```
version = "1.0"

macosX64("native") {
    binaries.framework {
        compilation.kotlinOptions.freeCompilerArgs += "-Xbundle-version=$version"
    }
}
```

^KT-33117 Fixed.
2022-06-23 09:57:12 +00:00
Pavel Kunyavskiy 9801a21abb [K/N] Enable new mm for native by default 2022-05-11 10:26:13 +00:00
Mikhail Glukhikh 08ba89b4ec CLI K2: report an error for JS/Native/Metadata #KT-52035 Fixed 2022-04-28 13:25:48 +00:00
Svyatoslav Scherbina 4cf10686d6 Native: delete konan_temp right after the compilation instead of on exit
The Kotlin/Native compiler uses `.deleteOnExit()` as a substitute for
"delete after the compilation". But when the compiler runs in a Gradle
daemon, `.deleteOnExit()` means "delete on Gradle daemon exit", which
might be not soon. If a single Gradle daemon runs the compiler many
times, the remaining temporary files can consume quite a lot of disk
space. For example, this is the case for the Kotlin build.

Replace some of `.deleteOnExit()` calls with an explicit removal of
temporary files at the end of a compilation session.
2022-04-22 06:47:39 +00:00
Sergey Bogolepov 21399b4edd [K/N] Update documentation on building and using LLVM 2022-04-19 14:27:33 +00:00
Dmitriy Dolovov 56510fbc6c [Native][tests] Dump the list of all available tests during compilation
^KT-50316
2022-02-17 12:45:37 +03:00
Ilya Matveev 1e78036a1b [K/N] Enable CMS GC by default for the new MM
Issue #KT-50713 Fixed
2022-01-28 12:24:57 +07:00
Dmitriy Dolovov cc37934d6f [IR, Native] Add compiler flag for partial linkage mode
^KT-50775
2022-01-26 13:36:23 +03:00
Dmitriy Novozhilov dd953908df [FE 1.0] Add compiler flag for rendering internal diagnostic names in error messages 2022-01-23 11:14:56 +03:00
Alexander Udalov 8b57675002 Revert "Remove obsolete check for language version and IR backends"
This check is no longer obsolete since language version 1.3 support is
restored for Kotlin/JVM, but JS and Native never supported LV 1.3.

This is a partial revert of 0213c25c9b,
without the diagnostic in K2JVMCompilerArguments (which is not needed
since the earliest supported LV is 1.3).

 #KT-50695 Fixed
2022-01-10 21:15:51 +01:00
Pavel Kunyavskiy c97f4a4d20 [K/N] Support -Xsave-llvm-ir-after compiler option 2021-12-23 11:09:27 +00:00
Alexander Shabalin cc8f278948 [K/N] Add a separate aggressive GC scheduler
^KT-48537

Merge-request: KT-MR-5253
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2021-12-20 11:04:46 +00:00
Roman Artemev a68eabac0a [K/N] Setup config about path relativeness and normalization in config 2021-12-15 21:13:52 +03:00