Commit Graph

6138 Commits

Author SHA1 Message Date
Alexander Udalov d2b66e5004 IR: remove IrCallMatcher/IrFunctionMatcher and usages
There doesn't seem to be much value over a simple imperative code which
checks exactly the same things in the same order. The main downside of
the removed API is that it was more difficult to debug.
2022-12-28 14:06:57 +01:00
Alexander Udalov 18950b448c IR: simplify for-loop lowering internals a bit
Remove ExpressionHandler, HeaderInfoFromCallHandler, ProgressionHandler.
2022-12-28 14:06:57 +01:00
Pavel Mikhailovskii 906c161068 KT-52791 Make it possible to pass multiple context receivers to a class 2022-12-28 11:21:03 +00:00
Svyatoslav Kuzmich 62217b39ec [Wasm] Rename WasmImportPair -> WasmImportDescriptor 2022-12-28 12:14:16 +01:00
Svyatoslav Kuzmich dd53998c2d [Wasm] Add uninstantiated MJS wrapper
It allows

* Custom imports
* Ability to skip initializer
2022-12-28 12:13:52 +01:00
Svyatoslav Kuzmich 3bbd8c291a [Wasm] Add @WasmImport annotation
Imports top-level function from given module
2022-12-28 12:13:18 +01:00
Pavel Mikhailovskii 3704d54101 KT-52459 Handle context receivers when generating a bridge 2022-12-27 16:19:59 +00:00
Pavel Mikhailovskii 9ca5e1b421 KT-54357 Fix passing of context receivers to object literal constructors 2022-12-27 11:52:36 +00:00
xiaozihan.larryxiao 22a9b84966 KT-55398 Fix nested inline variable not correctly
^KT-55398 Fixed
Add nested variable's ReifiedTypeParametersUsages into closureReifiedMarkers for MethodInliner to generate nested inline anonymous class
2022-12-23 01:15:18 +00:00
Svyatoslav Kuzmich d788adcbb5 [Wasm] Move non-recursive function types out of rec group
This fixes linking with other wasm modules with non-rec types
2022-12-21 20:20:13 +00:00
Ilya Chernikov a89dfdce03 K2 Scripting: add support for script args to FIR part 2022-12-21 14:34:20 +00:00
Ilya Chernikov 533a5671bc K2 Scripting, IR: add script receiver on conversion to class 2022-12-21 14:34:19 +00:00
Mikhail Glukhikh fc95889115 Move isCompilingAgainstJdk8OrLater to JvmBackendContext
This should solve multi-thread synchronization problem
Probably #KT-55483 Fixed
2022-12-20 21:41:43 +00:00
Artem Kobzar cd0ae20c38 [K/JS] Capture stackTrace before the init function call ^Fixed KT-55315 2022-12-20 18:15:02 +00:00
Alexander Korepanov 48daf0befe [JS IR] Take into account file annotations for calculating symbol hashes
^KT-55367 Fixed
2022-12-20 16:04:14 +00:00
Alexander Korepanov 4136189114 [JS IR] Check all signatures of dependent file in IC graph
It is important to check all signatures, because signatures
 can be simultaneously moved between files and modified.
2022-12-20 16:04:14 +00:00
Evgeniy.Zhelenskiy 53b98503ed [IR] Support MFVC properties without backing fields
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-12-18 22:11:23 +00:00
Igor Chevdar 0e4e53786c [K/N] Fixed a problem with built coroutine visibility
#KT-55494 Fixed
2022-12-16 18:32:43 +00:00
mcpiroman a244aaf162 KT-53957 Fix indy lambdas with extension and context receivers (#5021) 2022-12-16 17:47:58 +01:00
Evgeniy.Zhelenskiy f6c63c6e4f [IR, Serialization] Support kotlinx-based (de)serialization of MFVC, nullable MFVC value assignment to nonnull variable
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-12-16 17:20:51 +01:00
Svyatoslav Kuzmich 62ac77ca39 [Wasm] Add comments to .wat files 2022-12-16 13:57:59 +00:00
Alexander Udalov 5dd1777624 IR: minor, deprecate nameForIrSerialization, use name instead 2022-12-15 12:31:11 +00:00
Steven Schäfer 6af616d3c3 FIR: make declarations marked with 'override' implicitly open
#KT-52236 Fixed
2022-12-14 21:46:41 +00:00
Svyatoslav Kuzmich 777bb0f0cb [Wasm] Rename Wasm*CodegenContextImpl to Wasm*CodegenContext 2022-12-13 16:08:49 +01:00
Svyatoslav Kuzmich b9b2723b0a [Wasm] Remove Wasm*CodegenContext interfaces
Use classes instead
2022-12-13 16:08:48 +01:00
Ilya Chernikov 42a0acac4f Scripting, IR: fix capturing of implicit receiver
#KT-55068 fixed
2022-12-11 09:08:55 +00:00
Pavel Mikhailovskii 1a76804862 KT-51290 Account for context receivers when generating delegate function bodies 2022-12-09 15:36:45 +00:00
Pavel Mikhailovskii 08767d572b KT-51247 Fix resolution of functional types with context receivers 2022-12-09 15:29:39 +00:00
Dmitriy Novozhilov 5d6cb2b691 [Test] Use IrPluginContext for searching declarations for DUMP_EXTERNAL_CLASS check 2022-12-09 12:02:07 +00:00
Pavel Mikhailovskii 76997edebe KT-52373 Fix generation of synthetic functions with context receivers and default parameters 2022-12-09 09:39:26 +00:00
Evgeniy.Zhelenskiy 40f38c8adb [IR] Eliminate redundant boxing/unboxing of MFVC after inlining
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-12-08 15:12:28 +00:00
Zalim Bashorov 49c3ba33f1 [Wasm] Add a basic end-to-end sourcemap generation in wasm backend
More constructions/instructions will be supported separately.
2022-12-08 12:44:26 +00:00
Alexander Udalov a594434a95 Kapt+JVM_IR: do not run IR plugins in kapt mode
Because in kapt stub generation mode (aka ClassBuilderMode.KAPT3, aka
generateBodies=false in psi2ir), method bodies are not generated and
compiler plugins such as kotlinx-serialization might not expect that.

 #KT-54245 Fixed
2022-12-07 21:14:30 +00:00
Mark Mann 3592c87abf Fix enumeration of empty list in KotlinLikeDumper
In some cases where the Kotlin compiler encounters an exception, it attempts to print the contents of the file that it was compiling at the time. Sometimes the content contains symbols that aren't bound to implementations. When that happens the safe value parameters for a function are empty because none of them can be resolved, but the value parameter count is still non-zero because the function reference still has multiple params — this causes exception messages to fail with an error:

```
Exception in thread "main" java.lang.IllegalStateException: Problem with constructing exception message
```
This fixes the issue by only attempting to access the safe value parameters if the list is of the proper size.

KT-54012
2022-12-07 19:46:49 +01:00
Alexander Korepanov 9edaebf235 [JS IR] Enable DTS generation in IC
^KT-54398 Fixed
2022-12-07 18:05:53 +00:00
Alexander Korepanov d21cbfe02e [JS IR] Take into account the declaration annotations in IC hash
So the annotation modifications invalidate the caller.
2022-12-07 18:05:53 +00:00
Alexander Korepanov 0a35d84193 [JS IR] DTS generation refactoring
Keep a DTS fragment in JsIrProgramFragment
 for each file and build the module DTS from them.
2022-12-07 18:05:52 +00:00
Zalim Bashorov fb4dcc6a6a [Sourcemap] Introduce getCurrentColumn and stop using TextOutput directly
The general goal is remove dependency on TextOutput and
make it simpler to use for wasm backend.
2022-12-07 12:03:54 +00:00
Pavel Mikhailovskii 2d69fd5a8a KT-52027 Encapsulate and fix calculation of parameter indices 2022-12-06 23:16:11 +00:00
Alexander Udalov 60d96b7d15 Remove some leftover imports of unsafe cast functions 2022-12-06 19:44:56 +00:00
Alexander Udalov fd9b19ee49 Remove unsafe cast function usages from IR modules 2022-12-06 19:44:55 +00:00
Alexander Udalov 1418423423 Remove unsafe cast function usages from JVM backend modules 2022-12-06 19:44:55 +00:00
Pavel Mikhailovskii 25ad7fe31c KT-51863 Account for context receivers in calls with changed parameter order 2022-12-06 16:28:08 +00:00
Mikhail Glukhikh 5cf1a88c42 FE: move delegate name functions to NameUtils 2022-12-02 21:54:18 +00:00
Steven Schäfer a7ba081d22 FIR: Fix interface delegation ABI
- Unifies the name of the `$$delegate_<n>` field between K1 and K2.
- Make the `$$delegate_<n>` field private
2022-12-02 21:54:18 +00:00
Vladislav Grechko cb93e9d408 Get rid of redundant boxing of unsigned operands of infix 'compareTo'
^KT-48759: Fixed
2022-12-02 18:25:52 +00:00
Alexander Korepanov d8ab9498ab [JS IR] Fix inline functions call graph in IC
Add a dependency for inline function references,
 because in some cases the references may be inlined.

^KT-55144 Fixed
2022-12-02 13:50:37 +00:00
Alexander Korepanov c31705240a [JS IR] Support a module friendship in IC infrastructure
^KT-55097 Fixed
2022-12-02 13:50:36 +00:00
Artem Kobzar 76e629340f [K/JS] Add miss LazyIr into klib Ir generation process 2022-12-02 13:28:18 +00:00
Sergej Jaskiewicz 1539d7ef1a [klib] Bring package names in sync with the directory layout
Basically, some package names were Native-specific, whilst the packages
themselves were not Native-specific at all. This was already reflected
in the directory layout, but not in the package names.
This is fixed here.

NFC, just an automatic rename of packages with fixes of imports.
2022-12-01 21:46:43 +00:00