Commit Graph

2391 Commits

Author SHA1 Message Date
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
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
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 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
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
Andrey Uskov 339868305e Fixed handling of special symbols in paths when reporting errors
#KT-53246 Fixed
2022-08-17 10:38:28 +04:00
Aleksei.Cherepanov df017ea187 Clean JavaClassesTracker and LookupTracker on call RetryWithAdditionalRoots
#KT-38576 Fixed
2022-08-16 14:38:01 +00:00
Abduqodiri Qurbonzoda 983c7adb1e Remove :libraries:tools:stdlib-compiler-classpath project
It was used as a workaround to allow jvmTarget=1.6 in stdlib.
2022-08-13 01:42:43 +03:00
Jiaxiang Chen 94abeb64c5 use top level classId for looking up java classes in KotlinCliJavaFileManagerImpl 2022-08-12 14:24:13 +02:00
Aleksei.Cherepanov 92551b7685 Prevent overwriting output dir to empty string
#KTIJ-921 Fixed

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

Merge-request: KT-MR-6183
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2022-08-03 14:46:32 +00:00
Mikhael Bogdanov 90f8f8e14e Support inner classes in -Xjdk-release
#KT-52823 Fixed
2022-08-02 04:56:20 +00:00
Ivan Kochurkin 2f56b29b3f [FIR] Extract FirSessionConfigurator and IncrementalCompilationContext to separated classes
With FirSessionFactory and FirJsSessionFactory
2022-07-25 23:30:09 +02:00
Mikhail Glukhikh 9add6f3d55 K2: add more accurate & more automatic control of diagnostic suppression
#KT-51363 Fixed
2022-07-22 11:35:26 +00:00
Dmitriy Novozhilov b2e558a174 [CLI] Make -Xcompiler-plugin experimental and K2 only 2022-07-20 09:07:27 +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
Dmitry Gridin 0e17d9b452 [light classes] extract KotlinLightClassFactory to service
^KT-53097
2022-07-19 15:42:07 +00:00
Dmitry Gridin e5519064f4 [light classes] move script creation logic to KotlinLightClassFactory
^KT-53097
2022-07-19 15:41:45 +00:00
Dmitry Gridin dc552c9fe3 [light classes] move facade creation logic to KotlinLightClassFactory
^KT-53097
2022-07-19 15:41:44 +00:00
Dmitry Gridin 9510c4876c [light classes] introduce KotlinLightClassFactory
^KT-53097
2022-07-19 15:41:43 +00:00
Dmitry Gridin 47fa444792 [light classes] move descriptors from KtLightClassForSourceDeclaration to KtLightClassImpl
^KT-53097
2022-07-19 15:41:36 +00:00
Yahor Berdnikau 93a0cdbf97 Improve warnings and errors emitted by compiler in Gradle build
Make warnings and errors location clickable by using file URI scheme.
In most terminals and code editors (including IDEA) clicking on such uri
will open file at given line and offset.

^KT-51923 Fixed
2022-07-19 09:30:36 +00:00
Denis.Zharkov f7a2889a40 FastJarHandler: Add information for exceptions thrown during CD parsing
^KT-52786 Related
2022-07-12 14:45:37 +00:00
Nikita Nazarov 2ab92bcb7e Add a key to enable spilling of all variables in a suspending context
This commit adds a new key that will allow users to enhance their
debugging experience in suspending contexts when using the IR backend.
After the key is enabled, the following things are changed:
1. All variables in a suspending context are spilled regardless their
liveness.
2. Their LVT records are not shrunk.
3. ACONST_NULL is not spilled to dead variables.

#KT-48678 In progress

(cherry picked from commit 38d97d0621)
2022-07-07 14:51:24 +03:00
Nikolay Krasko c6299ee277 Revert "Add a key to enable spilling of all variables in a suspending context"
This reverts commit 38d97d0621.
2022-07-05 11:04:50 +00:00
Nikita Nazarov 38d97d0621 Add a key to enable spilling of all variables in a suspending context
This commit adds a new key that will allow users to enhance their
debugging experience in suspending contexts when using the IR backend.
After the key is enabled, the following things are changed:
1. All variables in a suspending context are spilled regardless their
liveness.
2. Their LVT records are not shrunk.
3. ACONST_NULL is not spilled to dead variables.

#KT-48678 In progress
2022-07-02 18:29:18 +03:00
Dmitriy Novozhilov 65e240679e [FE] Move utility of parsing plugin options to :compiler:frontend.common
This is needed to be able to use this utility inside FIR part of IDE plugin
2022-06-29 12:00:00 +00:00
Dmitriy Novozhilov f587c02d38 [FE] Move ServiceLoaderLite to :compiler:frontend.common
This is needed to be able to use this class inside FIR part of IDE plugin
2022-06-29 12:00:00 +00:00
Dmitriy Novozhilov c979e1edcf [Plugins] Deprecate ComponentRegistrar
^KT-52665 In Progress
2022-06-29 11:59:58 +00:00
Dmitriy Novozhilov 8b42638afa [Plugins] Introduce new API for registering compiler plugins
Original `ComponentRegistrar` exposes Project to its registration method,
  so plugins should manually register extensions to it. To prepare for
  possible unbound compiler from Project API in future new  `K2ComponentRegistrar`
  introduced which provides registration method without Project at all
2022-06-29 11:59:58 +00:00
Dmitriy Novozhilov 7fa459044f [Test] Fix extracting path to standard libraries from incorrect places for external users 2022-06-29 06:41:07 +00:00
Dmitry Gridin 6e75e4a56e Revert "Revert "[light classes] drop old light classes and backend: iteration #12""
This reverts commit 732a08f0df.
2022-06-28 17:57:35 +02:00
Dmitry Gridin d14a71acfc Revert "Revert "[light classes] drop old light classes and backend: iteration #11""
This reverts commit 357e15085e.
2022-06-28 17:57:34 +02:00
Dmitry Gridin 28aa47af8a Revert "Revert "[light classes] drop old light classes and backend: iteration #10""
This reverts commit 4b3e48dc47.
2022-06-28 17:57:34 +02:00
Dmitry Gridin cbf9b13ef8 Revert "Revert "[light classes] drop old light classes and backend: iteration #9""
This reverts commit 38c623bc3a.
2022-06-28 17:57:33 +02:00
Dmitry Gridin 9f3a269d62 Revert "Revert "[light classes] drop old light classes and backend: iteration #8""
This reverts commit 91fa6af556.
2022-06-28 17:57:33 +02:00