Commit Graph

2758 Commits

Author SHA1 Message Date
Alexander Udalov 07ebf4ed29 Do not suppress errors with -Xsuppress-version-warnings
#KT-48833 Fixed
2022-03-18 12:28:28 +01:00
Mads Ager 0c4f2711d6 Avoid reading /tmp/build.txt in standalone compiler invocations.
^KT-51627 Fixed

kotlinc will currently read /tmp/build.txt in an attempt to
determine an IDEA version number for IDEA plugin compatibility
checking. If that file exists and does not match the expected
format kotlinc will fail.

Since standalone kotlinc is not IDEA, this change explicitly
sets the system property for the build number to a fallback
value. That avoids reading /tmp/build.txt.

closes https://github.com/JetBrains/kotlin/pull/4763
2022-03-15 18:37:01 +01:00
Jinseong Jeon a106ec6530 Do not create FastJarFileSystem when USE_PSI_CLASS_FILES_READING
because the intention of that configuration is to use "slower" class
reading.

In the near future, even though FIR is enabled, which uses experimental
faster jar file system, FIR clients (e.g., FIR UAST or Android Lint) may
still need to use slower class reading. So, we need to handle that
configuration before checking others.
2022-03-15 19:50:18 +03:00
Alexander Korepanov 69295f2cf0 [JS IR] IC invalidation refactoring
- Huge refactoring for IC
  - Update hash combination logic
  - Introduce value class for IC hashes
  - Calc md5 directly by function IR
  - Split IC logic by classes
  - Move JsIrLinkerLoader into separate file
  - CacheUpdateStatus is a sealed class
  - Render TYPE_PARAMETER reified flag

^KT-51081 Fixed
^KT-51084 Fixed
2022-03-15 05:34:19 +00:00
nataliya.valtman c38dd1c004 Fix unstable testIncrementalCompilationAfterCacheHit test 2022-03-14 20:08:14 +03:00
Nikita Bobko f0290d8c98 Freezable: fix binary compatibility
Intellij API Compatibility Check reports that compatibility was broken
for IJ Bazel plugin. This commit fixes this problem.

Binary compatibility was broken in
705a2881fab109ab7d3e365255d01e0491b17d6d.

Ideally, I'd rename extension functions to names other than "frozen" and
"unfrozen" because this would allow keeping source compatibility for
Java clients as well. But the new extension functions API has been
already released in EAP versions of IDEA, and I don't want change the
API back and forth for clients that already migrated to the new API. I
wish I knew earlier that this API is used by external plugins
2022-03-08 11:53:43 +00:00
Yahor Berdnikau cb474f9b43 Remove 'jdkHome' option from Gradle options
Toolchain feature is replaced it.

^KT-46541 Fixed
2022-02-28 10:08:50 +00:00
Dmitriy Novozhilov faba9c4272 [CLI] Don't register classpath roots twice
There are two ways how content roots are registered in compiler configuration
  in JVM CLI compiler:
1. Directly from arguments
2. From Module, which build from arguments

And there was a problem that both ways used at the same time in some
  circumstances (regular compilation without .xml module file) which
  caused duplication of all content roots.

Ideal solution for this problem is removal of Module usages at all,
  because it looks like redundant abstraction which just complicate
  things, but it's too scary to remove it, because it hove some none
  trivial usages inside compiler. So to fix problem with duplicated
  roots this commit just removes registration of roots from arguments
  if Module is used
2022-02-23 19:33:51 +03:00
Mikhail Glukhikh 8274c43ee6 Make useExperimental non-CLI argument 2022-02-21 22:32:53 +03:00
tdn120 8d1fb7bb5e Check analysis error before checking compiler args
ExperimentalUsageChecker.checkCompilerArguments() will crash if there was an error running analyze().
This checks for the error first so it can be properly reported.
2022-02-21 20:31:05 +01:00
Mikhail Glukhikh 570189e833 Mark deprecated 'useExperimental' with IDEAPluginsCompatibilityAPI 2022-02-21 14:33:10 +00:00
Dmitriy Novozhilov 44bfb6fde8 [FIR] Don't register FirJavaElementFinder for common session 2022-02-18 17:44:40 +03:00
Victor Petukhov 5c8ca0ca9b [Compiler CLI] Use reading language version settings from environment only if the resource is presented or flag is set 2022-02-16 18:41:51 +03:00
Victor Petukhov 683a3e74a0 [Compiler CLI] Implement reading language version settings from environment variable
^KT-51306 Fixed
2022-02-16 18:41:50 +03:00
Alexander Korepanov 43a0876c26 [JS IR] IC invalidation performance improvements
- Cache signature readers and deserializers
 - Cache inline function hashes
 - IC refactoring
 - [gradle] Use hash of module path for cache dir; Fix KT-51238

^KT-51238 Fixed
2022-02-16 13:41:53 +00:00
Alexander Udalov 7952e8b28f Add JVM target bytecode version 18
#KT-51309 Fixed
2022-02-14 21:21:57 +01:00
nataliya.valtman d4d5c701fe Make statistic more readable 2022-02-11 17:23:38 +03:00
Svyatoslav Kuzmich 4636f71076 [Wasm] Loader improvements
- Output ES modules instead of plain files
- Support -Xwasm-launcher=d8 for d8 shell used in tests and benchmarks.
- Reuse launcher generation logic in CLI and box tests runners.
- Create separate output directory for each box since
  there are multiple output files generated for each test.
- Stop using absolute paths in generate JS files
  to simplify running generated code on different machine
- Remove ">>>" from println output


Merge-request: KT-MR-5729
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2022-02-10 22:59:44 +00:00
Mads Ager 66bf5b08ba Allow versionNeededToExtract between 0 and 20 in Zip impl.
In the Android eco-system, there are jars with entries with a
versionNeededToExtract of 0. That should probably have been 10,
but will be hard to fix. This change proposes to just check
that the versionNeededToExtract is between 0 and 20.
2022-02-09 13:01:12 +03:00
Alexander Udalov 25edf64daf Psi2ir: support mode without generation of bodies
This is needed for kapt + JVM IR.

 #KT-49682
2022-02-08 20:15:14 +01:00
Yahor Berdnikau 5320a32d67 Check also the cause of throwable for OOM exception
Sometimes OOM exception is the cause of some higher-level one
exception in compilation.

^KT-51116 Fixed
2022-02-07 13:59:48 +00:00
Ilya Goncharov 77b367fe96 rra/ilgonmic/ic-to-compiler
[JS IR] Fix compilation in tests

[JS IR] Fix test after migrating IC to compiler

[JS IR] Fix memory leak

[JS IR] Move js ic to compiler

Merge-request: KT-MR-5673
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>
2022-02-07 11:40:16 +00:00
Alexander Udalov 6601b8b62c Write snapshot by chunks in ProfilingCompilerPerformanceManager.dumpProfile
To prevent OutOfMemoryError from converting the whole string to byte
array, in case the snapshot is very big (see KT-51058).

Also, remove 'framebuf' option from -Xprofile help, since async-profiler
2.0+ has unlimited frame buffer.
2022-02-03 22:09:44 +01:00
Ilya Goncharov a2167200d6 [JS IR] IR module to name
Merge-request: KT-MR-5672
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>
2022-02-03 17:28:46 +00:00
Alexander Udalov 9826172720 CLI: support "arg=value" for argument's deprecatedName
#KT-51093 Fixed
2022-02-03 16:23:12 +01:00
Igor Laevsky 4e84e14d34 [Wasm] Don't squish modules together 2022-02-03 18:19:30 +03:00
Alexander Udalov 6379fe4c4c JVM IR: link via descriptors instead of signatures by default
Doing so speeds up psi2ir ~2 times, and thus improves total compiler
performance by about 6-8%.

Unless JVM IR is in the mode where linking via signatures is the only
way (-Xserialize-ir, -Xklib), signatures are actually not needed at all,
SymbolTable can use the frontend representation (descriptors for FE1.0,
and hopefully FIR elements for K2) as hash table keys. The only catch is
that since other backends still need to work with signatures, all the
common IR utilities, such as irTypePredicates.kt, need to work correctly
for IR elements both with signatures and without.

Also, introduce a fallback compiler flag -Xlink-via-signatures, in case
something goes wrong, to be able to troubleshoot and workaround any
issues.

 #KT-48233
2022-02-03 02:48:05 +01:00
Igor Yakovlev 1446914ba9 [WASM] Run box tests with dce and non-dce modes 2022-02-02 16:44:47 +03:00
Dmitry Petrov bbad3e9e94 JVM collect additional performance metrics in FE1.0 + JVM_IR pipeline 2022-02-02 11:56:01 +00:00
Yahor Berdnikau 52a21a4e1a Remove 'noStdlib' from Gradle options
^KT-49011 Fixed
2022-01-31 17:28:13 +01:00
Yahor Berdnikau 57c342fec8 Remove 'noReflect' from Gradle options
^KT-49011 In Progress
2022-01-31 17:28:13 +01:00
Yahor Berdnikau 27e449cd56 Remove 'useIR' from Gradle options
^KT-49011 In Progress
2022-01-31 17:28:13 +01:00
Yahor Berdnikau 8ffe78dba4 Remove GradleOption from 'includeRuntime' argument
^KT-49011 In Progress
2022-01-31 17:28:13 +01:00
Yahor Berdnikau c019dbce47 Rename DeprecatedOption into GradleDeprecatedOption
This should make it more explicit

^KT-49011 In Progress
2022-01-31 17:28:13 +01:00
Mads Ager e2c7290214 [JVM CLI] Prefer source over classpath.
If the class `A` is in a jar `previous.jar`, the following CLI
invocation will take that class instead of the `A` class
defined in `A.java`:

kotlinc -cp previous.jar A.java B.kt

This is problematic for build tools that put the jar for a
previous build on the classpath when recompiling some of the
files.

^KT-51025 Fixed.
2022-01-29 00:58:00 +01:00
Mikhail Glukhikh 2a6462ef09 Enable KT-45508 and KT-49017 errors when jvmDefault=all(-compatibility) 2022-01-28 13:40:35 +00:00
Dmitriy Novozhilov aab66bd623 [FIR] Support rendering diagnostic names in CLI FIR compiler 2022-01-28 16:12:12 +03:00
Simon Ogorodnik 4c5eb9ac32 KT-50889: Fix caching of module descriptors in K2MetadataKlibSerializer
Previously, in case of repeated analysis, descriptors cached in
CommonDependenciesContainer was initialized multiple times

 #KT-50889 Fixed
2022-01-27 17:32:18 +00:00
Mikhail Glukhikh eeadd8588d Drop CommonCompilerArguments.optInDeprecated
On the way to KT-22956
2022-01-27 11:48:22 +00:00
Igor Yakovlev 2ec0411a7f [WASM] DCE implementation 2022-01-26 23:40:41 +03:00
Yahor Berdnikau 35ef8cc6da Show user-friendly message on OOM compilation error
This should provide a hint to user how to mitigate out-of-memory error
on compilation inside Kotlin daemon or in-process.

^KT-47522 Fixed
2022-01-24 10:30:53 +01: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 Korepanov 59173baf5a [JS IR] Pass forward -Xir-property-lazy-initialization option
Pass forward -Xir-property-lazy-initialization option
for the incremental cache.

^KT-50175 Fixed
2022-01-19 13:28:47 +00:00
Mikhael Bogdanov 92e893bebe Rework Tune module graph dependencies building
#KT-50701 In progress
2022-01-14 11:22:46 +00:00
Stanislav Erokhin 1326ca674e Introduced IDEAPluginsCompatibilityAPI and returned some API
Please read the description of IDEAPluginsCompatibilityAPI.
Also, you may notice, that Deprecation annotation was removed.
That is because with level ERROR it isn't possible to opt-in
to such API in the legit cases. And with level WARNING it won't be
reported because We have diagnostic with level ERROR about OptIn marker.
Sadly, there is no way to add ReplaceWith to the OptIn marker
2022-01-13 18:03:07 +01:00
Nikita Bobko 735d46efb4 Freezable.{frozen, unfrozen} refactoring: add type safety 2022-01-12 15:25:10 +01:00
Andrey Uskov 2adc851f1b Don't use global state for keeping incremental compilation state
Previously IC state was stored in System properties. As result parallel
compilation might cause incorrect state of IC, what led to corruption
of kotlin_module files. Now IC state is stored via CompilerArguments
and CompilerConfiguration
#KT-46038 Fixed
2022-01-12 13:37:46 +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
Irene Dea 374d287d08 Reorganize TypeAttributeTranslatorExtension 2022-01-08 15:26:38 +03:00
Irene Dea d444978ebf Add support for attribute serialization. 2022-01-08 15:25:07 +03:00