Commit Graph

848 Commits

Author SHA1 Message Date
Yahor Berdnikau eb4e96a113 Add kotlin-build-tools-enum-compat workaround
It acts as a workaround for the case when build tools or dependencies
are compiled with latest 'kotlin-stdlib' version, but at a runtime older
 'kotlin-stdlib' is provided, which does not know about new
 `EnumEntries`.

 ^KT-57317 Fixed
2023-04-21 14:57:17 +00:00
Alexander Korepanov 79d378f2bd [JS IR] Perform optimizations on the generated JS code
The patch adopts and reuses the optimizations from the legacy backend.

The optimizations remove useless temporary variables,
statements and simplify generated JS code.

The optimizations can be disabled by `-Xoptimize-generated-js=false`.

Related to KT-51139
2023-04-18 12:49:33 +00:00
Sebastian Sellmair 5d0bf2de24 [CLI] Restore K2JVMCompilerArguments.classpath and javaModulePath
to support IDEs < 2023.2

Reverts:
- 9dcd40d7b7
- fb66764c4d

KTIJ-25227
2023-04-18 09:18:10 +00:00
Sebastian Sellmair fb66764c4d [CLI] K2JVMCompilerArguments: Model modulePath as Array<String>
to allow interning individual file-path arguments on the IDE

KTIJ-24976
2023-04-06 16:03:04 +00:00
Sebastian Sellmair 9dcd40d7b7 [CLI] K2JVMCompilerArguments: Model classpath as Array<String>
to allow interning individual file-path arguments on the IDE

KTIJ-24976
2023-04-06 16:03:03 +00:00
Sebastian Sellmair 7f91e94e7a [CLI] Arguments: Implement raw vs resolved delimiters
KTIJ-24976
2023-04-06 16:03:03 +00:00
Sebastian Sellmair eb0ff4fbcd [Gradle] K2JVMCompilerArguments: Remove hardcoded jvmTarget argument default
KTIJ-24976
2023-04-06 16:03:01 +00:00
Sebastian Sellmair 2c8491cf27 [Gradle] Fix CompilerOptionsIT.passesOptInAnnotationNative
KTIJ-24976
2023-04-06 16:02:59 +00:00
Justin Paupore acca7de42d Fix extension point name for FirExtensionRegistrar.
This changes the declared entry point name to match that actually
defined in FirExtensionRegistrarAdapter.

^KT-57763
2023-04-05 07:31:08 +00:00
Leonid Shalupov 7480befe32 Replace reflection-based compiler arguments copying with generated code
Using of Kotlin reflection for simple operations like bean management is very slow

First time initialization time: 261 ms for `copyBean(K2JVMCompilerArguments())`
Subsequent calls of `copyBean(K2JVMCompilerArguments())` take 1.7 ms per call

Unfortunately compiler argument handling is also used in Kotlin IntelliJ plugin
to parse facet settings. Big projects may have thousands of Kotlin facets

The same `ArgumentUtilsKt.copyProperties` frame is seen across various freezes:
IDEA-252440 2-3 minutes freeze on Kotlin project reimporting in last 203 eap
IDEA-253107 A lot of short freezes (1-3 sec) during Kotlin project development
KTIJ-23501 Make main run configuration detection lighter
KTIJ-22435 Unresponsive UI with 100% cpu

Reflection issue:
KT-56358 KClasses.getMemberProperties takes too much time

This commit replaces all reflection stuff with a simple code generation
Now `K2JVMCompilerArguments().clone()` goes to hard-to-measure time
2023-04-03 15:47:35 +02:00
Dmitriy Dolovov 46ed6e5766 [PL] Change semantics of CLI parameter -Xpartial-linkage
This parameter accepts the name of the "mode" in which the partial linkage would work. Currently, only two options are supported: 'enable', 'disable'. But the list may be extended in the future as needed.

At the moment the 'disable' option is the default one. This will be changed in #KT-51447, #KT-51443.
2023-03-30 12:38:07 +00:00
Dmitriy Dolovov 831611d577 [PL] Introduce new CLI parameter: -Xpartial-linkage-loglevel
The parameter controls the level of logs produced during the compile time by the partial linkage: 'info', 'warn' (default for now), and 'error'.
2023-03-30 12:38:06 +00:00
Leonid Shalupov 34c82011fc Remove copying of transient fields in argumentUtils
Current code in argumentUtils handles transient fields incorrectly
and copies them (not intended behaviour)

change is required for further work in arguments handling

ref https://jetbrains.team/im/review/3CCOfH4ffz5J?message=9fPd30T1rQz&channel=1y9ZTj2JB0aG
2023-03-29 20:20:02 +01:00
Ivan Kylchik 5d5582d201 Move ignoreConstOptimizationErrors compiler key from jvm to common
#KT-56023
2023-03-24 15:55:03 +00:00
Artem Kobzar 4da81b2b6e [K/JS] Remove an internal system property and replace it with the new compiler flag 2023-03-17 12:38:34 +00:00
Ivan Kylchik 1c210822ea Add new configuration key that can enable IR inlining for JVM 2023-03-14 20:47:41 +00:00
Alexander Udalov fba5b96bef JVM IR: introduce ClassGeneratorExtension
This is a low-level extension point for Kotlin/JVM, which is supposed to
be used instead of ClassBuilderInterceptorExtension.

 #KT-54758 Fixed
 #KT-56814 Fixed
2023-03-13 13:51:52 +01:00
Igor Chevdar f442936320 [K/N] Build per-file caches in parallel 2023-03-10 11:05:54 +00:00
Yahor Berdnikau 5ddd60a015 Add '-progressive' option into Gradle compiler options DSL
^KT-53923 Fixed
2023-03-07 17:32:20 +00:00
Yahor Berdnikau 174f39aa46 Add '-opt-in' option into Gradle compiler options DSL
^KT-53924 Fixed
2023-03-07 09:40:09 +00: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
Sebastian Sellmair b90207edb9 [Gradle] Rename -Xdepends-on to -Xfragment-refines and use ':' for -Xfragment-sources instead of ';'
^KT-56210 Verification Pending
2023-03-01 16:30:44 +00:00
Sebastian Sellmair 21bf497830 [CLI] Replace K2 -Xmodule by -Xfragments and -Xfragment-sources
KT-56210
2023-03-01 16:30:41 +00:00
Yahor Berdnikau 96316a4016 Generate KotlinNativeCompilerOptions Gradle DSL
^KT-53108 In Progress
2023-02-22 13:02:59 +00:00
Yahor Berdnikau 0cad069522 [Build] Pin api and language level to 1.8 in Kotlin compiler modules used by KGP
This is required to be able to compile KGP and it's dependencies which
set LV to 1.4 when repo will use LV 1.9. This caused by the change how
enums are compiled (KT-48872).
2023-02-18 13:26:54 +00:00
Dmitriy Novozhilov 94faa759cb [CLI] Rename -XdependsOn flag to -Xdepends-on to keep convention
^KT-56209
2023-02-17 14:09:30 +00:00
Dmitriy Novozhilov 77caa31640 [CLI] Add CLI arguments to pass HMPP module structure to the compiler
^KT-56209
2023-02-17 11:08:50 +00:00
Igor Chevdar ba172358d8 [K/N] Option to specify IR validation severity 2023-02-14 07:30:47 +00:00
Anna Kozlova f784628ebf [CLI] reduce memory usage for compiler settings
make write protection directly in properties
it creates no additional wrapper with the link to the containing class
for ij project, this reduces memory usage for ~15 mb

^KT-56351
2023-02-06 07:57:53 +00:00
Anna Kozlova 48b1456290 [CLI] create ArgumentParseErrors instances on request
spare memory for projects with big number of modules
currently 500kb for IJ monorepo of mostly empty errors
2023-01-31 16:08:23 +00:00
Yahor Berdnikau 45213e1468 Switch @GradleOption params to enum classes.
This should improve developers UX when using this annotation.
2023-01-29 20:59:28 +00:00
Ilya Goncharov 1150ec6882 [JS] Implementation dependencies for JS klibs
^KT-56158 fixed
2023-01-27 13:31:59 +00:00
Stanislav Ruban 4523535545 Deprecate -Xuse-k2 compiler flag in Gradle DSL
^KT-56239 Fixed
2023-01-27 12:42:50 +00:00
Sergey Bogolepov 851d84a865 [K/N] Enable proper LLVM IR dump and verify actions
Also introduce -Xsave-llvm-ir-directory argument
that should be used instead of -Xtemporary-files-dir
as a location for LLVM IR from phases.
Motivation for this change: it is simpler to implement
and unties LLVM actions from the awful TempFiles class.
2023-01-26 14:32:48 +00:00
Stanislav Ruban 7e0f69b8de Introduce tweaks and wording changes related to LV2.0-specific CLI warnings
Fix merge conflict related to renaming of one of the tests

Regenerate tests affected by previous commit

Fix merge conflict related to renaming of one of the tests

Improve wording of the `-Xuse-k2 -language-version 1.*` CLI warning

Improve wording of LV2.0-specific CLI warnings some more

Fix output of one of the tests for -Xuse-k2 deprecation

Tweak wording of LV2.0-specific CLI warnings

* make it clear in every warning that -Xuse-k2 is deprecated
* add a reminder to remove -Xuse-k2 for `-Xuse-k2 -language-version 2.0`
* add both possibly wanted fixes for `-Xuse-k2 -language-version 1.*`

Remove deprecated -Xuse-k2 flag from one of the tests

Merge-request: KT-MR-8449
Merged-by: Stanislav Ruban <Stanislav.Ruban@jetbrains.com>
2023-01-26 11:55:03 +00:00
Alexander Likhachev 742e240bdc [IC] Report messages with CompilerMessageSeverity.OUTPUT without grouping
#KT-49785 In Progress
2023-01-17 22:15:51 +00:00
Artem Kobzar 71486a321c [K/JS] Add support of compilation with ES-classes 2023-01-17 18:14:17 +00:00
Mikhail Glukhikh 70fc891260 K2: move -Xuse-k2 VS language version checks to CommonCompilerArguments 2023-01-16 18:16:49 +01:00
Mikhail Glukhikh 3dc05f4ec5 Introduce language version 2.0 and associate K2 compiler with it 2023-01-16 18:12:55 +01:00
Igor Chevdar 9c86532eb0 [K/N] Implemented cache orchestration machinery in the compiler 2023-01-11 14:13:01 +00:00
Yahor Berdnikau 43eea47032 Mark compiler arguments that should generate deprecated kotlinOptions DSL
This will allow to keep backward compatiblity for deprecated
kotlinOptions DSL for already existing compiler arguments, but add a new
 one only into compilerOptions DSL.

^KT-53108 In Progress
2023-01-10 14:56:11 +00:00
Ilya Chernikov 16f52f4c50 K2: use LightTree by default with K2 2023-01-02 19:54:55 +00:00
Alexander Udalov 3f2b51151f Remove -Xexclude-from-dumping
Apparently the underlying logic was removed in b07690fccf and no one
noticed.
2023-01-02 15:26:07 +00:00
Artem Kobzar fbf06b5495 [K/JS] Add a secret system property to enable the old Kotlin/JS compiler only for tests until it will be removed from the sources 2022-12-29 13:32:01 +00:00
Igor Yakovlev 71afbb36f5 [Wasm] Introduce Xwasm-generate-wat compiler flag (disabled by default) 2022-12-29 11:57:48 +00:00
Kevin Bourrillion 70cd547c26 Fix two other tests to treat both old and new JSpecify packages the same 2022-12-27 11:11:00 +00:00
Evgeniy.Zhelenskiy 25db5bf6e1 [IR] Enable -Xvalue-classes flag
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-12-22 12:24:16 +00:00
Sergey Bogolepov 366edcfe3c [K/N] Drop obsolete static driver 2022-12-20 06:30:36 +00:00
Ilya Muradyan db5913bbb6 KTIJ-8463: add possibility to pass additional analyzer flags 2022-12-15 10:30:43 +01:00
Dmitriy Novozhilov f8487ba545 [CLI] Filter out blank arguments from system environment 2022-12-09 12:02:09 +00:00