Commit Graph

57 Commits

Author SHA1 Message Date
Ilmir Usmanov d9821412d0 Do not generate fields for unused suspend lambda parameters
This also allows us to not spill them in the lambda.
But, disable this optimization for local named functions.

 #KT-16222 In progress
2020-06-17 12:00:25 +02:00
Mark Punzalan e46adbae29 [JVM IR] Fix checkLocalVariablesTableTest/parametersInSuspendLambda
for JVM IR.
2020-01-14 20:47:36 +01:00
Mark Punzalan 31ba2d64db [JVM IR] Mangle variable names for anonymous parameters in lambdas. 2020-01-09 17:57:50 +01:00
Mark Punzalan 36c4df6d99 [JVM IR] Use names of local functions in names of local classes.
This undoes changes in
https://github.com/JetBrains/kotlin/commit/fbe66c3496d082d2d487b2c39673f0cd4ac5b70a
which broke calculation of the simple name of local classes in
reflection (the enclosing method was not a substring of the name of the
local class).
2020-01-08 18:45:40 +01:00
Mark Punzalan 70b304e6e4 [JVM IR] Support target templates in
AbstractCheckLocalVariablesTableTest and fix
`checkLocalVariablesTable/localFun.kt` for JVM IR.

Also improved diagnosability of CheckLocalVariablesTableTest failures.
2020-01-08 18:45:40 +01:00
Mads Ager 3b2843fe7a Introduce local variable type checker.
CheckLocalVariablesTableTests will now check the validity of
the locals table against types of locals computed based on the
bytecode.

These checks and the new destructuringInFor test act as a
regression test for the changes in
https://github.com/JetBrains/kotlin/pull/2613

These checks also caught a similar issue for destructuring
lambda parameters, where the local is introduced before the
value has been written to the local slot. This change also
fixes that.

Finally, this change fixes the asmLike tests to correctly
look up the name of parameters in the locals table.
2019-10-07 15:06:44 +02:00
Ilmir Usmanov f1d31c8221 JVM_IR: Minor. Unmute tests
Rename FAKE_CONTINUATION -> fakeContinuation
2019-09-19 19:28:11 +03:00
Alexander Udalov fbe66c3496 JVM IR: fix another naming inconsistency with old backend
This fixes slice rewrite stacktraces from RecordNamesForKotlinTypeMapper
which are printed out when running some JVM IR tests (even though
they're ignored), e.g. localClassSimpleName.kt
2019-08-27 19:27:46 +02:00
Ilmir Usmanov 06388b885c JVM_IR: Support suspend lambdas with receiver 2019-07-31 21:17:09 +03:00
Steven Schäfer efb938a7c8 (Un)mute tests 2019-07-31 11:18:44 +02:00
Alexander Udalov 29fa1793d3 JVM IR: add InventNamesForLocalClasses pass 2019-07-17 13:55:36 +02:00
Jiaxiang Chen 2c102ecd57 Replicate old backend's naming logic for captured receiver parameter and extension receiver parameters.
Context for determine if a value parameter is captured from outer
context is not directly available after lowering, hence introduce a new
IrDeclarationOrigin for captured receiver parameter to avoid duplicate
calculation.
2019-07-08 16:25:18 +09:00
Ilmir Usmanov 60cbf0696d Do not generate tests with experimental coroutines on JVM_IR backend
Enable working tests.
2019-06-25 16:30:01 +03:00
Mads Ager b1e8a7cfce JVM: Generate LVT entry for this in @JvmOverload methods.
This change also makes sure that no line numbers are generated
in the wrappers in the JVM_IR backend.

Change-Id: If6c37f8a20894455abddb526039df059e02015a3
2019-05-14 15:14:07 +02:00
Ilmir Usmanov d2a80e7938 Add $result to suspend functions' LVT
#KT-28535
2019-04-01 18:19:32 +03:00
Ilmir Usmanov 05937a28ee Rename result to $result
this way it does not interfere with user-defined variables.
 #KT-28535 Fixed
2019-04-01 18:19:31 +03:00
Ilmir Usmanov 8c8ad48152 Enable test 2019-03-30 04:18:55 +03:00
Ilmir Usmanov ea1e72e7b4 Generate $this$<label> as receiver name instead of $receiver 2019-03-30 04:18:53 +03:00
Ilmir Usmanov 6f14dcfacb Put suspend lambda's parameters to LVT
#KT-26412 Fixed
 #KT-28534 Fixed
2019-03-30 04:18:50 +03:00
Yan Zhulanow e43fd713ef Fix new compiler tests (new receiver name mangling – $this$label) 2019-02-25 14:44:00 +03:00
Yan Zhulanow 28e4356e6e Restore original variable name mangling for captured/receiver $this
Design for the new one is still not finished.
2019-02-25 14:43:59 +03:00
Yan Zhulanow 47f0b68a8c Change mangling for destructured lambda parameters 2019-02-25 14:43:56 +03:00
Ilmir Usmanov ec7315e6da Add $completion entry to suspend functions' LVT
#KT-28810 Fixed
2019-02-22 13:50:35 +03:00
Ilmir Usmanov 871134cff8 Update test data
#KT-28309
2018-12-28 14:18:39 +03:00
Yan Zhulanow dd49d35320 Fix backend tests after changing format of synthetic variables for inline functions 2018-12-12 21:40:44 +09:00
Ilmir Usmanov 8ec49adcf0 Minor. Ignore test 2018-09-11 17:50:46 +03:00
Roman Artemev 8a871b3f0c Update tests 2018-08-31 15:34:18 +03:00
Denis Zharkov c6eaaac877 Adjust coroutines test data to changing the default LV to 1.3 2018-08-30 14:58:43 +03:00
Mikhael Bogdanov 232170b72a Migrate AbstractIrCheckLocalVariablesTableTest to CodegenTestCase stuff 2018-08-24 20:17:18 +02:00
Denis Vnukov 65c79ecfe9 Primitive support for LocalVariables for function parameters 2018-08-09 16:13:21 +03:00
Ilmir Usmanov f507a26a12 Generate decomposed lambda params in suspend lambda's local variables
Unlike ordinary lambdas, suspend lambdas do the computation in
doResume(Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;
method. As you can see, there are no decomposed parameters. As a result,
they used not to be generated.
To fix the issue, I add decomposed parameters to value parameters while
generating local variables table.

In addition, when generating suspend lambda for inline, the codegen
does not take this kind of parameters into account. This is also fixed.

 #KT-18576: Fixed
2018-05-03 10:35:13 +03:00
Dmitry Petrov e2fa613b70 Cache array length in for-in-array loop if possible
If the range expression is not a local variable (which can be updated in
the loop body affecting loop behavior, see KT-21354), we can cache the
array length, thus turning a for-in-array loop into a simple optimizable
counter loop.

 #KT-21321 In Progress
2017-11-29 10:15:32 +03:00
Mikhael Bogdanov e1bec0df2e Proper generate interval for catch block variable; Fix for KT-15646: InconsistentDebugInfoException when stepping over throw
#KT-15646 Fixed
2017-01-19 09:33:10 +01:00
Mikhael Bogdanov 5071baf970 Support increment and '*=' operations on inline properties 2017-01-10 14:09:42 +01:00
Denis Zharkov a9fcee098d Support single-underscore named variables in JVM backend
There are mainly two kind of changes:
- skipping 'componentX' calls for destructuring entries named _
- fixing local variable table for them
 - skip entries for destructuring entries named _
 - use $noName_<i> format for lambda parameters named _

 #KT-3824 Fixed
 #KT-2783 Fixed
2016-10-24 10:19:25 +03:00
Denis Zharkov 4793f71da2 Properly generate indices for destructured parameters in inline case
#KT-14399 Fixed
2016-10-19 16:05:50 +03:00
Denis Zharkov 42e85b07c9 Fix types in local var table for destructured variables 2016-09-20 13:44:44 +03:00
Denis Zharkov e75efc88ff Add support for desctructuring of lambda parameters in JVM backend
#KT-5828 In Progress
2016-09-19 20:22:57 +03:00
Natalia Ukhorskaya e611154580 Minor: fix testData after e2d2d696c0d8b24ebe310fd880a912d6eb428872s 2016-03-15 14:53:03 +03:00
Michael Bogdanov 16afe74dc1 Fix for KT-11117: Android Kotlin DEX transformation error when I use arrayOf as an anonymous object property
#KT-11117 Fixed
2016-02-29 12:53:58 +03:00
Dmitry Jemerov 970d6f6834 generate local variables table for @JvmOverloads-generated methods
#KT-7319 Fixed
2016-02-02 12:11:51 +01:00
Ilya Gorbunov 801a26a544 Fix testData 2016-02-01 22:20:30 +03:00
Natalia Ukhorskaya a1f3c5381e Rename local variable for this in inline function 2015-12-01 11:48:41 +03:00
Michael Bogdanov a932315bf9 Rename local vars from inlined function
#KT-9798 Fixed
2015-12-01 11:48:40 +03:00
Natalia Ukhorskaya 9168572b8c Write local variable for inline function and inline argument 2015-10-17 17:02:55 +03:00
Dmitry Petrov a47eaa2cb5 Change part class naming scheme
update tests depending on part class naming
2015-09-07 16:28:42 +03:00
Denis Zharkov 9802931a90 Remove variables with empty ranges from local vars table
As their ranges may intersect after dead code elimination that leads to VerifyError
2015-06-04 16:11:02 +03:00
Michael Bogdanov 8cd496556c Generate local var table 2015-04-09 09:25:26 +03:00
Alexander Udalov c30aa7db84 Include package part name to top level closure names
#KT-4234 Fixed
 #KT-4496 Fixed
2014-09-26 10:22:25 +04:00
Natalia Ukhorskaya bdc60441c0 Try-catch exception value is not visible in debugger's local variables
#KT-3070 Fixed
2014-06-23 17:40:04 +04:00