Commit Graph

892 Commits

Author SHA1 Message Date
Dmitry Petrov 653b26174b KT-43006 don't generate no-arg constructor with inline class parameters 2020-11-13 09:59:34 +03:00
Mikhail Glukhikh e7a84fd1ee [FIR2IR] Preserve 'EnhancedNullability' type annotation in IR 2020-11-10 21:07:26 +03:00
Georgy Bronnikov d246005891 JVM_IR: fix unbound type parameters in AddContinuationLowering 2020-11-10 17:49:55 +03:00
Ilmir Usmanov 7b315a8b52 JVM_IR: Do not box inline class in methods 2020-11-02 10:50:00 +01:00
Ilmir Usmanov 28e148d35a Old JVM: support init blocks in inline classes
#KT-28055 Fixed
2020-10-29 20:38:03 +01:00
Denis Zharkov 2bdb21793f FIR: Adjust test data 2020-10-28 11:43:25 +03:00
Jinseong Jeon 46cc01602e FIR2IR: add implicit NOT_NULL cast if needed 2020-10-22 10:51:20 +03:00
Dmitry Petrov b1b87becc8 PSI2IR more JVM-like exhaustive when behavior KT-36840 2020-10-21 20:07:11 +03:00
Mads Ager 0505bd958a [JVM] Fix the nop removal optimization.
Never remove a nop if that would cause a line number to move
across a local lifetime boundary.

This fixes KT-42725.
2020-10-16 19:21:08 +03:00
pyos a9b53adc50 JVM_IR: make primitive == object slightly less lazy.
Discarding the value used to leave an unused-but-never-destroyed
temporary variable. It's best to not separate calls to `enterTemp`
and `leaveTemp`.

Not sure what kind of test to add though, since this is minor -- if the
result of the comparison is discarded, then the entire statement is more
or less pointless.

 #KT-42251 Fixed
2020-10-16 12:25:55 +02:00
Jinseong Jeon 5f64d6ec76 FIR2IR: add support for callable reference to Java field
#KT-42656 Fixed
2020-10-15 08:47:46 +03:00
Mikhail Glukhikh 2f9b7495fc [FIR2IR] Make safe call result always nullable 2020-10-14 16:33:37 +03:00
Mark Punzalan 8bc7370b92 ForLoopsLowering: Add PLUSEQ origin to increment to use IINC
instructions if possible.
2020-10-09 21:34:56 +02:00
Mark Punzalan ccbf7cc2ee ForLoopsLowering: Use last-exclusive for-loops for optimized until
progressions instead of decrementing "last".

#KT-41352 Fixed
2020-10-09 21:34:56 +02:00
Ilmir Usmanov 375d92cf67 Merge two consequent records in LVT
Otherwise, atomicfu will be unable to transform atomic variable usages.
2020-10-09 18:36:37 +02:00
pyos adcbfc7b4c IR: add an emptiness check to all unsigned until loops
Unlike signed integers, a larger unsigned type does not mean a lower
minimum value, so `x - 1` can overflow even if `x` is casted to a larger
type.

 #KT-42186 Fixed
2020-10-07 12:53:00 +02:00
Mikhael Bogdanov ed5c2b0565 Add tests for data class runtime string concatenation
#KT-35176
2020-10-06 13:20:41 +02:00
Mikhael Bogdanov eb32a6ddbd Add test for for kt42457 wrong behaviour. Align runtime concatenation with it
#KT-42457
2020-10-06 13:20:40 +02:00
Mikhael Bogdanov d2c4be18a0 Rename runtime-string-concat option into 'string-concat' 2020-10-06 07:14:39 +02:00
Dmitry Petrov e018f2bd3e JVM_IR more precise check for special bridges in super class
KT-41123
2020-10-02 12:51:49 +03:00
Mikhael Bogdanov cf5bd38bec JVM_IR. Support runtime string concatenation 2020-10-02 11:47:28 +02:00
Mikhael Bogdanov 1938f9459f Support indy concatenation 2020-10-02 11:47:28 +02:00
Mikhael Bogdanov 942e1962d9 Properly process constants 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov c329c22630 Add runtime string concat options. Some renaming 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov 04012951c1 Basic invokedynamic string concatenation support 2020-10-02 11:47:27 +02:00
Mikhail Glukhikh 2fd752f8f6 IR interpreter: fix calculation of constant Java fields
#KT-42117 Fixed
2020-10-02 08:57:44 +03:00
Denis Zharkov 3dfbd36f15 FIR: Unmute passing blackbox tests 2020-10-01 17:49:02 +03:00
Mikhail Glukhikh ac50433e17 Fix failing bytecode text test
In this commit I moved IGNORE_BACKEND_FIR to the end or deleted it
when it was applicable, to preserve correct line numbers
2020-09-29 19:16:42 +03:00
Alexander Udalov 445b2d6eb1 JVM IR: minor, unmute bytecode text test
Also fix typo in the name
2020-09-29 12:38:54 +02:00
Mark Punzalan 238cc7c257 [FIR] Enable BytecodeText tests for FIR.
143 out of 767 tests (18.6%) are currently failing.
2020-09-29 10:21:21 +03:00
pyos bd6ead0467 JVM_IR: check for null when converting unboxed inline classes to strings
`C?` can be unboxed into `T?` if if wraps a reference type `T!!`, but in
this case `null` is not a valid value to pass to `toString-impl`.

 #KT-42005 Fixed
2020-09-25 16:50:34 +02:00
Ilmir Usmanov f22f10febb JVM_IR: Unbox inline classes in suspend functions
if the function can be verified to safely returning unboxed
inline class.
Box the return value on resume path.
2020-09-24 10:08:41 +02:00
Steven Schäfer 111c550f3c JVM IR: More tests for inlining in $default stubs 2020-09-24 07:53:31 +02:00
Steven Schäfer 5e27d9b089 JVM IR: Make inlining in $default stubs compatible with the JVM BE
The JVM BE inlines calls to the underlying function in a $default stub
verbatim, e.g., without renaming LVT entries or regenerating anonymous
objects. This commit introduces the same behavior in the JVM IR BE.

Fixes KT-36769.
2020-09-24 07:53:31 +02:00
Alexander Udalov 84df996204 JVM IR: fix "step over" for inline function calls in conditions
Reimplement the same hacky approach used in the old backend (see
cc2fe6b0c6).

Previously, the debugger incorrectly stepped into Collections.kt on
"step over" inline function calls from stdlib like 'any'.

Since `if` and `when` expressions are represented the same way in IR,
the behavior is fixed for both of them. It's not the case in the old JVM
backend, where stepping over `when` conditions still suffers from the
same problem, which the newly added test checks.
2020-09-23 15:54:15 +02:00
Ilmir Usmanov e8a451072e Minor. Add tests with same JvmType in covariant override 2020-09-09 17:43:41 +02:00
Ilmir Usmanov 1c97eafea8 Check for COROUTINE_SUSPENDED inside callable reference
#KT-41429 Fixed
2020-09-09 17:43:37 +02:00
Ilmir Usmanov 023cdd7cd4 Support not boxing inline class of reference class
even if the class is other than Any.
 #KT-41429 In progress
2020-09-09 17:43:34 +02:00
Steven Schäfer 4792be2522 JVM IR: Optimize static property references (KT-36975) 2020-09-07 21:01:29 +02:00
Steven Schäfer 78ab957bfe JVM IR: Fix mangling for suspend functions with inline class params (KT-41374) 2020-08-31 18:43:29 +02:00
Alexander Udalov c706673de9 Minor, refactor bytecode text tests on when-over-string optimization
- Merge `duplicatingItemsSameHashCode.kt` and
  `duplicatingItemsSameHashCode2.kt` into one test enabled on both
  backends, and rename it to
  `duplicatingItemsSameHashCodeFewBranches.kt`.
- Rename `duplicatingItemsSameHashCode3.kt` to
  `duplicatingItemsSameHashCodeMoreBranches.kt`, and also enable it for
  both backends.
- Use JVM_TEMPLATES/JVM_IR_TEMPLATES to check backend-specific behavior:
    1) JVM IR does not optimize less than 2 branches by design
    2) JVM IR does not generate duplicate branches, also by design

Related to KT-36846.
2020-08-31 16:47:11 +02:00
Steven Schäfer 02e78bcd76 JVM IR: Use package visibility for fields of captured variables 2020-08-28 20:03:19 +02:00
Mark Punzalan a9359eb530 RangeContainsLowering: Handle unsigned ranges. 2020-08-21 21:15:27 +02:00
Mark Punzalan 60a2f7d03f RangeContainsLowering: Handle Comparable ranges. 2020-08-21 21:15:27 +02:00
Mark Punzalan 1c1b1b4b0f Initial version of RangeContainsLowering, which optimizes calls to
contains() on ClosedRanges.
2020-08-21 21:15:27 +02:00
Dmitry Petrov 8f0aecce58 JVM_IR: KT-40330 Unify field names for captured 'this' with JVM
NB some cases such as captured extension receiver for an extension
lambda are not supported yet; to be discussed, to what extent should we
actually follow JVM code shape here.
2020-08-19 11:07:41 +03:00
Ilmir Usmanov 8a098545e6 Minor. Add test 2020-08-11 22:10:51 +02:00
Steven Schäfer 53fe30eb45 JVM IR: Don't produce CHECKCASTs on null constants (KT-36650) 2020-08-11 15:13:40 +02:00
Mads Ager 7f2efabe6a [JVM_IR]: Improve stepping for when.
Additionally, use the line number of the class for default interface
dispatch methods.
2020-08-07 09:16:01 +02:00
Ilmir Usmanov 68342a1f72 Initialize fake inliner variables on resume path
Otherwise, this will cause R8 to complain.
2020-08-05 19:47:55 +02:00