Commit Graph

54 Commits

Author SHA1 Message Date
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
Alexander Korepanov bb8da65188 [Common IR] Do inlining of callable references of inline functions
^KT-52805 Fixed
2022-08-08 17:40:45 +00:00
Steven Schäfer 2acfb3a41f JVM IR: Avoid direct lambda invokes in inline tests 2022-07-14 23:24:18 +02:00
Zalim Bashorov 11d9751844 [Wasm] Unmute inlineVararg 2022-05-05 21:03:39 +00:00
Alexander Korepanov b82c306530 [JS IR] Add deep copying for callable reference
Perform a deep copy of callable reference adapter on inline lowering

^KT-49844 Fixed
2021-12-20 14:02:11 +00:00
Igor Yakovlev 4f9b54da26 [WASM] Remove ignore from wasm std text tests 2021-12-07 21:33:28 +03:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Alexander Udalov 1071919706 Remove backend tests on old inference
Also remove any mentions of NewInference, and rename some tests.
2021-11-09 20:07:33 +01:00
Ivan Kylchik f4bbcdc013 [TESTS] Move global directives outside file scope 2021-10-25 00:14:19 +03:00
Svyatoslav Kuzmich c88cde2f8b [Wasm] DONT_TARGET_WASM_BACKEND => IGNORE_BACKEND in testdata 2021-10-02 06:14:35 +00:00
Roman Artemev f644f47360 [IR] Add test for KT-47767 2021-09-30 14:39:01 +03:00
Igor Yakovlev 41a69ad388 [WASM] Add receiver capturing to callable references 2021-09-20 19:08:22 +03:00
Abduqodiri Qurbonzoda d28d0a6321 Advance String(CharArray) deprecation level to ERROR in Common and JS 2021-04-07 00:23:29 +03:00
Alexander Udalov 73aa465ee9 Add tests for issues fixed in JVM IR
Note that KT-30696 is fixed only in the single-module case, and KT-42012
is not fixed fully (see KT-44855).

 #KT-30041
 #KT-30629
 #KT-30696
 #KT-30933
 #KT-32351
 #KT-32749
 #KT-38849
 #KT-42012
 #KT-42990
 #KT-44234
 #KT-44529
 #KT-44631
 #KT-44647
2021-02-10 21:42:10 +01:00
Igor Chevdar 6f9bcf249b [IR] Supported inlining of adapted references + tests 2021-02-09 17:23:19 +05:00
Dmitriy Novozhilov 64a300bfcd [TD] Update testdata according to previous commit 2021-02-02 17:53:52 +03:00
Alexander Udalov 5480faf5c5 Add tests for issues fixed in JVM IR and other obsolete issues
#KT-6007
 #KT-16445
 #KT-17753
 #KT-22488
 #KT-23881
 #KT-24135
 #KT-26360
 #KT-27427
 #KT-27449
 #KT-27830
 #KT-28042
 #KT-29595
 #KT-30708
 #KT-32793
2021-02-01 18:29:59 +01:00
Denis.Zharkov ad30c6c380 FIR: Fix callable references resolution when they're being returned from lambdas 2021-01-21 18:53:03 +03:00
pyos 6dc08cb2fd Add a bytecode test that checks inlining of adapted references 2020-09-29 19:49:46 +02:00
Mark Punzalan 348ba3e08c [FIR] Enable BlackBoxInlineCodegen tests for FIR.
16 out of 638 tests (2.5%) are currently failing.
2020-09-29 10:21:21 +03:00
Alexander Udalov 9e357354fb Add JVM/JVM_IR mixed compilation tests for compileKotlinAgainstKotlin/boxInline 2020-09-07 19:41:37 +02:00
Mikhael Bogdanov 4b6202c902 JVM_IR. Support inlining of bound CR 2019-12-30 08:35:46 +01:00
Mikhael Bogdanov b9dee4e93a Remove assertion on sorted ranges: it could be empty if lambda doesn't contain any linenumber
#KT-35101 Fixed
2019-12-02 12:08:36 +01:00
Alexander Udalov a485a5ffd6 JVM IR: load fields for JvmField properties from dependencies
This is needed to properly lower JvmField property calls to field
accesses.
2019-11-20 15:35:12 +01:00
Georgy Bronnikov 7ede26e8f4 IrCompileKotlinAgainstInlineKotlin tests 2019-09-06 09:19:57 +03:00
Igor Chevdar ad8bcda99e [IR] Merged K/N inliner with the common one 2019-08-16 18:32:19 +03:00
Mikhael Bogdanov 81e6416bfe Support bound callable reference inlining in IR 2019-06-04 14:56:13 +02:00
pyos 8c55376f0c Unmute almost all JVM_IR tests that use property references 2019-03-19 12:00:29 +01:00
Svyatoslav Kuzmich aa811dcfb3 [JS IR BE] Add KJS_WITH_FULL_RUNTIME directive to compiler tests 2019-01-24 16:14:40 +03:00
Mikhael Bogdanov f7ce8c18c6 Add tests for Obsolete issues
#KT-18977 Obsolete
2019-01-09 10:20:54 +01:00
Mikhael Bogdanov 9a059809bf Add test for Obsolete issues
#KT-15956 Obsolete
 #KT-15751 Obsolete
 #KT-16417 Obsolete
 #KT-21787 Obsolete
2019-01-08 13:52:47 +01:00
Mikhael Bogdanov 02d9c526e2 Proper resort variables on inlining lowered ir closures
Original problem is that lowered ir closures doesn't meet inliner expectations
 about captured variable position in inlining method.
 E.g.: Call 'foo(valueParam) { capturedParam }' to
  inline function 'foo' with declaration

      inline fun foo(valueParam: Foo, inlineParamWithCaptured: Bar.() ->) ....

 is reorganized through inlining to equivalent call foo(valueParam, capturedParam1, cp2 ...).
 But lowered closure for lambda parameter has totally different parameters order:

     fun loweredLambda$x(extensionReceiver, captured1, cp2..., valueParam1, vp2...)

 So before inlining lowered closure should be transformed to

     fun loweredLambda$x(extensionReceiver, valueParam1, vp2..., captured1, cp2..)

 #KT-28547 Fixed
2019-01-03 07:57:36 +01:00
Roman Artemev fb499def59 Update tests 2018-10-25 15:49:21 +03:00
Roman Artemev 89bec8ec59 Update tests 2018-09-18 15:30:17 +03:00
Mikhael Bogdanov 357359b1dd Unmute ir-tests after CR support 2018-08-09 14:22:50 +03:00
Anton Bannykh 07b3b66fd9 JS IR: unmute tests 2018-07-10 13:34:19 +03:00
Mikhael Bogdanov e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02:00
Anton Bannykh 96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Alexander Udalov 386a3fb5ce Fix tests after f4f5359725 2017-11-27 16:03:38 +01:00
Alexander Udalov f4f5359725 Fix exception on inlining callable reference with implicit this in LHS
Use ResolvedCall to determine the receiver type in the JVM codegen,
instead of manually inspecting the PSI

 #KT-20821 Fixed
2017-11-27 12:46:55 +01:00
Mikhael Bogdanov 49252f6eec Properly process primitive receiver on inlining bound callable references
#KT-18728 Fixed
2017-07-03 10:51:51 +02:00
Mikhael Bogdanov 4f914fafca Calculate default mask shift properly
#KT-18689 Fixed
2017-06-29 14:57:42 +02:00
Mikhael Bogdanov a8625b632d Fix for KT-16411, KT-16412: Exception from compiler when try call SAM constructor where argument is callable reference to nested class inside object
#Fixed KT-16411
  #Fixed KT-16412
2017-02-21 11:40:25 +01:00
Alexey Andreev d35ddc1017 JS: unmute tests that now pass 2017-01-24 20:09:32 +03:00
Alexey Andreev 7a0f75f164 JS: refactor generation of callable references to functions 2017-01-24 20:09:29 +03:00
Anton Bannykh 07bb7ef4d3 JS: extension lambdas translated same as local lambdas (KT-13312 fixed) 2017-01-23 20:09:36 +03:00
Mikhael Bogdanov 2566a7a25e Rename receiver$0 in CallableReference to receiver
#KT-15449 Fixed
2016-12-29 16:57:02 +01:00
Anton Bannykh 159df7964a JS: bound callable references (KT-13573). 2016-11-28 16:33:58 +03:00
Michael Bogdanov 7230965e62 Support for property reference inlining 2016-09-07 12:01:49 +03:00
Michael Bogdanov a12d7b6019 Check lambda inlining in package part files in test framework 2016-09-07 12:01:47 +03:00