Commit Graph

263 Commits

Author SHA1 Message Date
Sergei Kharitontcev-Beglov 55bfd3efcb KT-52178: Argument propagation into IR backend & lowering dump action 2023-07-06 10:55:26 +00:00
Artem Kobzar 64158a8a2f [K/JS] Add file-to-file compilation ^KT-6168 Fixed 2023-06-22 18:23:45 +00:00
Alexander Udalov bb4d25dfc9 IR: do not copy calls/references in ExpectSymbolTransformer
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol and other similar fields are now mutable.
2023-06-22 17:18:59 +00:00
Dmitriy Novozhilov 5717b59f52 [FIR/IR] Introduce an ability to propagate generated IR annotation to metadata
^KT-58638 Fixed
2023-06-21 06:56:59 +00:00
Ivan Kylchik 0021a5f655 [K2] Save inlined java field into special InlineConstTracker 2023-06-14 19:02:39 +00:00
Dmitriy Novozhilov ba41e8ec38 [IR] Use common expect/actual matching algorithm in IR actualizer
^KT-58578 Fixed
2023-06-10 07:33:29 +00:00
Nikolay Lunyak 23f87eda1f [FIR] KT-57803: Report the error message for light tree
The renaming prevents the JVM clash.

^KT-57803 Fixed
2023-06-06 07:43:37 +00:00
Alexander Korepanov e4d7897071 [JS IR] Check fir compilation errors after checking IC next round 2023-05-23 10:13:26 +00:00
Alexander Korepanov 28b781f60a [JS IR] Move fir to klib serialization code in separate class 2023-05-23 10:13:26 +00:00
Nikolay Lunyak c57d9097c2 [FIR] Add the syntax tree suffix to buildResolveAndCheckFir 2023-05-16 12:11:47 +00:00
Nikolay Lunyak d72a50b3f5 [FIR] KT-58065: Support LT in K2JsIrCompiler 2023-05-16 12:11:46 +00:00
Sergej Jaskiewicz a74df3b4b4 [IR] Store manglers used for signature computation in IrBackendInput
We will need them in signature dump tests later.
2023-05-04 14:58:06 +00:00
Zalim Bashorov 4e36f5b391 [Wasm, JS] Add a warning that dumping reachability and size infos to file is supported only for Kotlin/Wasm 2023-04-25 19:44:03 +02:00
Zalim Bashorov bd852e87ab [Wasm] Add an option to dump declaration IR sizes to file 2023-04-25 19:44:03 +02:00
Zalim Bashorov 62b21ac078 [Wasm] Add an option to dump reachability info to file 2023-04-25 19:44:02 +02:00
Anton Bannykh c839fdca3e [JS IR] initial support for KLIB incremental compilation with K2 2023-04-23 14:47:48 +02:00
Dmitriy Dolovov 7da05d66e3 [PL][tests] Run JS tests with enabled PL with ERROR log level
#KT-57378
2023-04-20 10:23:47 +00:00
Ivan Kylchik 0b70b7904d [K2] Create and add EvaluatedConstTracker in configuration 2023-04-19 13:52:43 +00:00
Ivan Kylchik fe989d0ba7 [K2] Add languageVersionSettings to Fir2IrConfiguration class 2023-04-19 13:52:42 +00:00
Ivan Kylchik e16231104e [K2] Add Fir2IrConfiguration class to store configuration parameters
One example of such parameter is `linkViaSignatures`. There is
`Psi2IrConfiguration` as an analog for K1.
2023-04-19 13:52:41 +00:00
Ivan Kylchik 525098dea6 [K2] Unbind fir:fir2ir:jvm-backend from other non jvm modules 2023-04-19 13:52:41 +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
Dmitriy Dolovov 66797ff876 [PL] Temporarily disable PL for WASM 2023-04-18 09:22:54 +00:00
Dmitriy Dolovov 000cf47c21 [PL][JS] Fix: Pass PL CLI arguments properly 2023-04-18 09:22:53 +00:00
Dmitriy Dolovov 16da1af525 [PL] Support handling IR error types 2023-04-18 09:22:50 +00:00
Ivan Kochurkin 3a60b30dae Minor: IrActualizationResult -> IrActualizedResult 2023-04-17 19:55:35 +00:00
Sergej Jaskiewicz 78d19e143c [JS IR] Don't use JVM-specific mangler in JS IR backend
^KT-54638 Fixed
2023-04-05 14:23:51 +00:00
Dmitriy Novozhilov 92a59279d5 [FIR] Properly implement serializer extension for klib compilation
^KT-57654 Fixed
2023-04-05 07:31:33 +00:00
Ivan Kylchik 32297c0f21 Serialize and deserialize const val's properly for K2 klib
#KT-57312 Fixed
2023-04-04 12:35:54 +00:00
Svyatoslav Kuzmich 02beaa1daa [Wasm] Add BuiltInsPlatform.WASM
Use it instead of BuiltInsPlatform.JS in klibs
2023-04-01 10:50:29 +00:00
Dmitriy Dolovov b7d0209e4b [PL] Disallow partial linkage when compiler is configured to produce KLIB
Partial linkage is intended for producing binaries, not libraries.
2023-03-31 18:29:44 +00:00
Dmitriy Dolovov 1fef48bb60 [PL] Log partial linkage messages at different severity
As specified in -Xpartial-linkage-loglevel CLI argument.
2023-03-31 18:29:44 +00: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 a450866db3 [PL] Commonize Native & JS compiler configuration keys 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
Vladimir Sukharev b9633375b4 [K2/N] KT-56030: Support Objective-C overloading by param names only
Merge-request: KT-MR-8901
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-30 09:37:57 +00:00
Ivan Kochurkin ee73e4774b [K2, MPP] Remove redundant expect declarations from klib metadata
^KT-57250 Fixed

Introduce flat Fir2IrActualizedResult

It contains output from Fir2Ir and IrActualizer
2023-03-24 14:48:26 +00:00
Dmitriy Dolovov 2a4d880037 [PL] Deep rework of the partial linkage
1. Leaving no unbound symbols in the IR tree, KT-54491:
   - All unbound symbols are bound to synthetic stub declarations
   - Improved detection of the root cause for every partially linked classifier
   - Improved error messages

2. Visibility valiation, KT-54469

3. Always check deserialized symbols:
   If the deserialized symbol mismatches the symbol kind at the call site in the deserializer then generate and reference another symbol with the same signature. In case PL is off, just throw IrSymbolTypeMismatchException.

4. Handle class inheritance violation:
   - Detect illegal inheritance (ex: inheriting from a final class)
   - Detect invalid constructor delegation (ex: delegating to another class than the direct superclass)
   - Simplification: Reduce the number of PartialLinkageCase subclasses
   - Reworked error message generation to have shorter and clearer messages

5. Handle class transformations and all known side-effects, examples:
   - nested <-> inner
   - class <-> enum/object
   - adding/removing subclasses of sealed class
   - adding/removing enum entries

6. Check direct instantiation of abstract class.
   Such instantiation could be possible if a class was non-abstract in the previous version of a library.

7. Handle unlinked annotations on declarations.
   Such annotations are removed from the IR. The appropriate compiler error message is produced for every individual case.

8. Handle value argument count mismatch at call sites

9. Handle calling suspend function from non-suspend context.
   This could happen if a suspen function was non-suspend in the previous version of a library.

10. Handle overriding inline callables.
    Only the leaf final callable can be marked with `inline`.

11. Detect illegal non-local returns from noinline/crossinline lambdas.
2023-03-23 10:24:27 +00:00
Ilya Chernikov 59b88f33b2 [K2, MPP] implement IR errors reporting and test infrastructure
Fix test data

^KT-56344 Fixed
2023-03-22 01:28:16 +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
Artem Kobzar 948c511284 [K/JS] Rework ES modules part with squashed JsImport and right renaming strategy inside import/export statements 2023-03-16 10:28:39 +00:00
Alexander Korepanov e3402fcc87 [K2 JS] Do not load transitive dependencies for building K2/JS klibs
^KT-57262 Fixed
2023-03-15 10:49:54 +00:00
Nikolay Krasko 57934a6870 Revert "Revert "[K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing""
This reverts commit c0c692844e.
2023-03-10 14:24:49 +01:00
Nikolay Krasko c0c692844e Revert "[K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing"
This reverts commit 6964121c15.
2023-03-10 13:14:10 +00:00
Alexander Korepanov 2cad26f4cc [JS IR] Use cacheable ZIP file system accessor in JS IR BE
Related to KT-51712
2023-03-10 09:38:52 +00:00
Vladimir Sukharev 6964121c15 [K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing
Merge-request: KT-MR-9081
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-09 18:56:30 +00:00
Alexander Korepanov bd3eb81aee [JS FIR] Use FIR in JS IR invalidation tests
Related to KT-56740
2023-03-08 13:18:15 +00:00
Ivan Kochurkin de5b475f7a [FIR] Use KlibBasedSymbolProvider in FirCommonSessionFactory
Unify logic of KLib resolving (Common and JS)

^KT-56354 Fixed
2023-03-03 20:58:24 +00:00
Svyatoslav Kuzmich 54a45c49f8 [Wasm] Add Wasm platform and K1 FE infrastructure 2023-02-24 01:05:23 +01:00
Alexander Korepanov e107de6f36 [JS IR] Use a guard file for preventing incremental caches corruption
If a developer interrupts (kill gradle process) a compilation process or
 an internal error interrupts the compilation process,
 the incremental cache files may be corrupted.
 The patch creates a special guard file, which allows detecting
 if the previous compilation was not successful,
 and in case of any issues drops the incremental cache files.

^KT-56581 Fixed
2023-02-20 13:14:30 +00:00