Commit Graph

2943 Commits

Author SHA1 Message Date
Artem Kobzar de880ce9aa [K/JS] Move ES modules logic to a new transformer with IC 2022-10-13 07:32:44 +00:00
Alexander Korepanov 7b2c125754 [JS IR] Update IC depends graph after intrinsics loading
- Remove unused params from compilerWithIC wrapper.
- Move JsIrBackendContext creation logic into separate function
- Introduce and use compiler interface for IC infrastructure

On dirty rebuild we may reload IR from stdlib,
such reloading may affect files with intrinsics and builtins.
As soon as we load only exported symbols, we must track dependencies
for files with intrinsics or builtins as for others.
This patch implements the logic which updates dependencies for
the stdlib files after loading of intrinsics and builtins.

^KT-54323 Fixed
2022-10-12 22:14:15 +00:00
Dmitriy Novozhilov d423782fac [FE 1.0] Remove usages of safeAs and cast from most of FE 1.0 modules:
- :core:descriptors
- :core:descriptors.jvm
- :core:deserialization
- :compiler:cli
- :compiler:frontend
- :compiler:frontend:cfg
- :compiler:frontend.java
- :compiler:frontend.common.jvm
- :compiler:psi
- :compiler:resolution
- :compiler:resolution.common
- :compiler:resolution.common.jvm
- :kotlin-reflect-api
2022-10-12 13:58:56 +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
Denis.Zharkov d9701c71b7 Minor. Clean ZipImplementation.kt 2022-10-05 15:03:41 +00:00
Denis.Zharkov 337f461ad8 Fix IndexOutOfBoundsException at FastJarFS
If there are more than 0xffff files in the jar,
we have to use Zip64 format

^KT-52786 Fixed
2022-10-05 15:03:41 +00:00
Simon Ogorodnik 53069ee03f Fix application disposer registered only once due to deduplication
Disposer uses passed object identity to decide should it be registered
Since lambda, that passed into disposer doesn't capture anything, it has
only one instance, so it ends up being registered only once
While it should be registered for every parentDisposable
2022-10-03 13:36:05 +00:00
Simon Ogorodnik f2dee2bf85 Core. Fix data-race in ApplicationEnvironment initialization
getOrCreateApplicationEnvironment is main entrypoint to create
ApplicationEnvironment in production and compiler tests
It is subject to be called concurrently, that's why
APPLICATION_LOCK exists

ApplicationEnvironment itself hosts Application from idea-core
It is actually singleton, that is subject to be disposed, once all
operations referencing it completes

To properly dispose ApplicationEnvironment when there is no references
left, we maintain reference counter aka ourProjectCount

Originally, there was data-race caused by the fact, that ourProjectCount
was updated after publication of application

Linear, data-race occurs in following order
T1: getOrCreateApplicationEnvironment returns application
T2: Disposes its reference to application, causing ourProjectCount to
reach zero, and disposing application that is already available to T1
T1: Updates counter, but its application already disposed
2022-10-03 13:36:05 +00:00
Nikolay Krasko 20692c9837 Minor: cleanup code in cli-js and js.sourcemap 2022-10-03 11:08:29 +00:00
Ilya Goncharov c726360ad2 Change policy with legacy compiler backend
[JS] Remove incremental js jps test

[JS] Remove test of maven js archetype

[JS] Fix another one test

[JS] Fix tests for jps

[JS] Try to fix maven test data

[JS] Fix test data

[JS] Fix test data for ant

[JS] Fix jsExtraHelp test

[JS] Fix test run from not-Gradle build tools

[JS] Set flag without compiler error

[JS] Disable warnings and errors in legacy compiler called from Gradle

[JS] Proofread messages

[JS] Not proofread messages

KT-42326
2022-09-29 13:56:30 +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
Alexander Udalov 4a00d1f978 Add internal way to enable old backend
Needed for tests on debugger in Kotlin IDE plugin.
2022-09-26 13:35:41 +00:00
Ilya Goncharov 4906f17d09 [JS IR] Fix js compiler arguments 2022-09-21 10:58:25 +00:00
Ilya Goncharov cab79d950f [Gradle, JS] outputName -> moduleName 2022-09-21 10:58:25 +00:00
Ilya Goncharov 55731f27a4 [Gradle, JS] Adopt changes about compilerOptions 2022-09-21 10:58:24 +00:00
Ilya Goncharov 4eedfe7f58 [Gradle, JS] Fix compilation after rebase 2022-09-21 10:58:24 +00:00
Ilya Goncharov 8d90173ea5 [JS, IR] Deprecated outputFile 2022-09-21 10:58:23 +00:00
Ilya Goncharov 9685b0a86b [JS, IR] Wasm with outputDir and outputName 2022-09-21 10:58:21 +00:00
Ilya Goncharov 642fae1a5b [Gradle, JS] Migrate onto destinationDirectory and outputName 2022-09-21 10:58:20 +00:00
Ilya Goncharov d203dc35bf [JS IR] Add to IR keep possibility similar to legacy-dce one
It helps to:

- keep declarations even if they are not reachable and not exported
- not minify names of not exported declarations

Compiler argument: -Xir-keep=A,B

Can be used for top-level declarations or for member

^KT-54118 fixed
2022-09-20 16:06:17 +00:00
Yahor Berdnikau 286d0d56af Introduce Kotlin compiler options with Gradle Properties API types
Old one is deprecated and delegates to new options. All new options
are marked with task input types, so they could be used as `@Nested`
input.

Generated options are using specific types in generated
compiler options. This should simplify code completion and provide
meaningful hints to user.

At this point repository compilation will fail.

^KT-27301 In Progress
2022-09-19 12:30:39 +02:00
Ilya Goncharov bf8681296b [Gradle, JS] IR by default and report warnings for using legacy compiler
- just legacy - report warning about deprecation
- both - report warning about deprecation of legacy
- no compiler explicitly chosen - error about explicit setting compiler

warn from cli legacy compiler

nowarn flag - kotlin.js.compiler.nowarn

KT-42326
KT-53074
2022-09-16 09:48:41 +00:00
Alexander Korepanov 639af77b91 [JS IR] Invalidate IC cache after modifying language settings
^KT-54010 Fixed
2022-09-16 07:19:20 +00:00
Alexander Korepanov ef05a0d9ed [JS IR] Disable JS IR IC infrastructure when WASM is enabled 2022-09-16 07:19:19 +00:00
Anže Sodja 09d6dfc8bf [Assign plugin] Add a compiler plugin for overloading assign ('=') operator 2022-09-16 10:12:41 +03:00
Anže Sodja 6052962f50 Register AssignResolutionAltererExtension in KotlinCoreEnvironment 2022-09-16 10:12:41 +03:00
Alexander Udalov 0569f429dd Report error on -Xuse-old-backend, remove Gradle option useOldBackend
Allow using old JVM backend only to compile kts.

 #KT-48532 Fixed
2022-09-16 00:16:31 +02:00
Aleksei.Cherepanov 782dc55800 Make exception more user-friendly (2)
Add stacktrace and given error to error message

#KTIJ-21077 Fixed


Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>

Merge-request: KT-MR-7122
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2022-09-15 13:33:11 +00:00
Aleksei.Cherepanov 0d1b748cd5 Make exception more user-friendly
Accompany registration of non-compatible compiler plugin with readable error

#KTIJ-21077 Fixed
2022-09-14 10:30:42 +00:00
Mikhail Glukhikh 036f9affd8 K2: link via signatures if -Xlink-via-signatures is set
Related to KT-53505
2022-09-14 10:15:22 +00:00
Alexander Udalov 7dad47cd76 Add -X argument to disable generation of @SourceDebugExtension
This will be used in tests in the subsequent commit.
2022-09-09 14:32:35 +02:00
Dmitry Gridin aa31ca67e2 [lc] KotlinAsJavaSupportBase: make librariesTracker abstract
^KT-50241
2022-09-08 13:47:40 +00:00
Dmitry Gridin ec1b6f4f3e [lc] KotlinAsJavaSupportBase: reduce number of findModule calls
^KT-50241
2022-09-08 13:47:39 +00:00
Dmitry Gridin e58b98bb5c [lc] KotlinAsJavaSupportBase: implement getLightClassForScript
^KT-50241
2022-09-08 13:47:39 +00:00
Dmitry Gridin 46548e5443 [lc] KotlinAsJavaSupportBase: implement getLightClass
add more caching

^KT-50241
2022-09-08 13:47:38 +00:00
Pavel Mikhailovskii 6a14400342 KT-53804 Restore old and incorrect logic of generating InnerClasses attributes for kotlin-stdlib 2022-09-05 14:02:52 +00:00
Alexander Korepanov 453faeaa45 [JS IR] Memory consumption optimization
- Remove IR after JS AST generation
 - Remove JS AST after/during JS code generation
2022-09-05 11:15:55 +00:00
Alexander Udalov 13ca189825 Support -Xjdk-release=8 as alias for -Xjdk-release=1.8
#KT-53278 Fixed
2022-09-01 12:15:47 +02:00
Alexander Udalov a76de14026 Remove obsolete compiler argument -Xsingle-module
#KT-51622
2022-08-31 20:54:50 +02:00
Mikhael Bogdanov bd6aff7f6a Xjdk-release: avoid folder duplication 2022-08-29 12:26:27 +00:00
Dmitry Gridin 924dd38144 [lc] introduce KotlinAsJavaSupportBase with new common facade logic
^KT-53543
2022-08-29 11:51:42 +00:00
Alexander Udalov 690322b203 Add flag -Xno-new-java-annotation-targets
Do not generate TYPE_USE/TYPE_PARAMETER Java annotation targets when
this flag is specified.

 #KT-53712 Fixed
2022-08-29 13:43:49 +02:00
Nikita Bobko 2a4f3f41aa 2/5 Replace source dependency on kotlin-reflect with binary dependency
Review: https://jetbrains.team/p/kt/reviews/6753

Meaningful semantic change was splitted into 5 commits to simplify the
change review. Sinle commit would be too big.

Why replace source to binary: to get rid of kotlin-reflect in Kotlin
plugin artifact KTIJ-22276

Note: Kotlin Maven artifacts (./gradlew publish) changed their
dependency on kotlin-reflect
2022-08-22 15:43:49 +02:00
Nikita Bobko 0874fb71c6 Replace all kotlin-reflect-api dependencies with kotlin-reflect
Review: https://jetbrains.team/p/kt/reviews/6753

Why: I'm going to replace source dependency on kotlin-reflect with
binary dependency. Normalize reflect dependency before global
processing.
2022-08-22 15:43:11 +02:00
Dmitriy Novozhilov f843883985 [FE 1.0] Introduce AssignResolutionAltererExtension
This extension can be used to override resolution of assign statements
  with custom logic

WARNING: there is no compatibility guarantees for this extension
2022-08-19 07:44:08 +00:00
Ivan Kylchik 3027ea9551 Add new jvm compilation key ignoreConstOptimizationErrors
This key suppose to be a workaround in keys if something goes
wrong in ir interpreter.
2022-08-18 16:50:06 +00:00
Alexander Udalov 45abea5b0a Use platform class loader in 'kotlin' runner on JDK 9+
#KT-46312 Fixed
2022-08-17 22:23:10 +02:00
Andrey Uskov 339868305e Fixed handling of special symbols in paths when reporting errors
#KT-53246 Fixed
2022-08-17 10:38:28 +04:00