Commit Graph

966 Commits

Author SHA1 Message Date
Mikhail Glukhikh c0789b5207 PSI/FIR->IR translators: return to 1.7.10 behavior for field references
In 1.7.20 we used the nearest Java-based receiver for such field
references in backend. Now we are using use-site receiver again,
it can lead to accidental usage of derived class property backing field.

This is effectively a revert of KT-49507 fix, see commits:
- fa914f20
- b0a6508d

#KT-54393 Fixed
#KT-49507 Planned
#KT-52338 Planned
2022-10-25 08:36:01 +00:00
vladislav.grechko 70c2f2b86f Support specifying different bytecode listings for FIR and old frontend 2022-10-21 12:57:11 +00:00
Evgeniy.Zhelenskiy 6117cdc0c3 [IR] Remove unused MFVC getters
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-10-07 12:43:46 +00:00
Evgeniy.Zhelenskiy 9dd308dc01 [IR] Add context receivers test, fix a flattening fields bug
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-10-07 12:43:46 +00:00
Evgeniy.Zhelenskiy e1f886936c [IR] Support try for MFVC
#KT-1179
2022-10-07 12:43:45 +00:00
Evgeniy.Zhelenskiy f8aa3612f8 [IR] Support if and when for MFVC, fix several bugs, refactor
#KT-1179
2022-10-07 12:43:44 +00:00
Evgeniy.Zhelenskiy 70293fab60 [IR] Rename MFVC tests + Add test for get-field optimization
#KT-1179
2022-10-07 12:43:43 +00:00
Evgeniy.Zhelenskiy 6f94af80ab [IR] Correct work of the new MFVC lowering classes
#KT-1179
2022-10-07 12:43:42 +00:00
Evgeniy.Zhelenskiy 8ba20bee5b [IR] Prepare MFVC-lowering for the new MFVC classes
#KT-1179
2022-10-07 12:43:41 +00:00
Evgeniy.Zhelenskiy 14b8e41967 [IR] Integrate MFVC with Inline classes
#KT-1179
2022-10-07 12:43:39 +00:00
Evgeniy.Zhelenskiy 765c212327 [IR] Add MFVC generation tests
#KT-1179
2022-10-07 12:43:38 +00:00
Evgeniy.Zhelenskiy d4969e9b97 Revert "rra/zhelenskiy/flattening_impl"
This reverts commit b7f5c039a6.
2022-10-07 12:43:36 +00:00
Evgeniy.Zhelenskiy dff949344d [IR] Remove unused MFVC getters
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-10-07 12:42:15 +00:00
Evgeniy.Zhelenskiy 5c0784fef5 [IR] Add context receivers test, fix a flattening fields bug
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-10-07 12:42:14 +00:00
Evgeniy.Zhelenskiy afe67f9bc1 [IR] Support try for MFVC
#KT-1179
2022-10-07 12:42:14 +00:00
Evgeniy.Zhelenskiy ca789607ba [IR] Support if and when for MFVC, fix several bugs, refactor
#KT-1179
2022-10-07 12:42:13 +00:00
Evgeniy.Zhelenskiy e76041bb3b [IR] Rename MFVC tests + Add test for get-field optimization
#KT-1179
2022-10-07 12:42:12 +00:00
Evgeniy.Zhelenskiy c2284d15a5 [IR] Correct work of the new MFVC lowering classes
#KT-1179
2022-10-07 12:42:11 +00:00
Evgeniy.Zhelenskiy 5ea1edf6d1 [IR] Prepare MFVC-lowering for the new MFVC classes
#KT-1179
2022-10-07 12:42:10 +00:00
Evgeniy.Zhelenskiy b1dced6cda [IR] Integrate MFVC with Inline classes
#KT-1179
2022-10-07 12:42:08 +00:00
Evgeniy.Zhelenskiy a788433aac [IR] Add MFVC generation tests
#KT-1179
2022-10-07 12:42:07 +00:00
Evgeniy.Zhelenskiy 93ffd9f233 Revert "rra/zhelenskiy/flattening_impl"
This reverts commit b7f5c039a6.
2022-10-07 12:42:05 +00:00
Evgeniy.Zhelenskiy b7f5c039a6 rra/zhelenskiy/flattening_impl
[IR] Remove unused MFVC getters

Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179

[IR] Add context receivers test, fix a flattening fields bug

Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179

[IR] Support `try` for MFVC

#KT-1179

[IR] Support `if` and `when` for MFVC, fix several bugs, refactor

#KT-1179

[IR] Rename MFVC tests + Add test for get-field optimization

#KT-1179

[IR] Suppress temporary test failing on Android

Bug is fixed in https://jetbrains.team/p/kt/reviews/6452

#KT-1179

[IR] Document the new MFVC lowering classes when necessary

#KT-1179

[IR] Correct work of the new MFVC lowering classes

#KT-1179

[IR] Prepare MFVC-lowering for the new MFVC classes

#KT-1179

[IR] Fix MFVC with type arguments/parameters

#KT-1179

[IR] Support MFVC with type parameters

#KT-1179

[IR] Integrate MFVC with Inline classes

#KT-1179

[IR] Fix compilation of MFVC in different module

#KT-1179

[IR] Add MFVC generation tests

#KT-1179

[IR] Implement equals call correct generation for MFVC

#KT-1179

[IR] Implement bridges generation for MFVC

#KT-1179

[IR] Implement MFVC basic flattening

#KT-1179

Merge-request: KT-MR-6213
Merged-by: Evgeniy Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>
2022-10-06 20:45:45 +00:00
Pavel Mikhailovskii a75d5ba4cf KT-53465, KT-53677 Get rid of unnecessary checkcasts to array of reified type 2022-09-06 18:33:38 +00:00
Pavel Mikhailovskii 6a14400342 KT-53804 Restore old and incorrect logic of generating InnerClasses attributes for kotlin-stdlib 2022-09-05 14:02:52 +00:00
Alexander Udalov 19bbcc5869 Do not generate metadata for callable reference classes
After an accidental change in 846537b367, we started generating metadata
into anonymous classes for callable references. This metadata contained
the Kotlin representation of the referenced function. In KT-53794, this
led to a problem where Java's protected visibility could not be
represented in Kotlin terms, which crashed the backend.

But also, this metadata is useless because there's no real use case for
interpreting it (since you already have a function reference object at
runtime with all the needed information), so it would take some extra
space in the bytecode.

 #KT-53794 Fixed
2022-09-01 12:15:25 +02:00
Pavel Mikhailovskii 18e61315f4 KT-27936 Generate InnerClasses attributes 2022-08-23 22:06:10 +00:00
Mikhail Glukhikh 8a4105e542 IR: fix origin of default getter of Enum.entries synthetic property 2022-08-19 10:08:08 +00:00
Abduqodiri Qurbonzoda de775ad728 Remove unsignedIntCompare_before.kt test data 2022-08-13 01:33:47 +03:00
Vsevolod Tolstopyatov c0f81cbc45 [JVM] Improve code coverage of EntriesMapping
Ensure that when .entries is accessed from an inline function body
or lambda argument, EntriesMapping are properly generated and used
without excessive mappings and duplicated fields

#KT-53236
2022-08-12 09:35:24 +00:00
Vsevolod Tolstopyatov e3bff290bd [JVM] Lower .entries calls on Kotlin enums
Leveraging the same mechanism with $EntriesMapping as Java enums.
Old (compiled with LV/AV < 1.8) enums are detected by looking for
static special <get-entries> method that cannot be introduced on
Kotlin enums otherwise

#KT-53236
2022-08-12 09:35:22 +00:00
Vsevolod Tolstopyatov e708809e55 [JVM] Support Enum.entries for enums being compiled with Kotlin 1.8+
#KT-53236
2022-08-12 09:35:20 +00:00
Steven Schäfer 2acfb3a41f JVM IR: Avoid direct lambda invokes in inline tests 2022-07-14 23:24:18 +02:00
Steven Schäfer 7d59c7689c JVM IR: Avoid direct invokes in callable reference tests
Due to the direct invoke optimization, most callable reference tests
were not generating callable references/lambdas.
2022-07-14 23:24:18 +02:00
Ilmir Usmanov f34ae686a0 JVM: Make coroutines spilling tests runtime
instead of bytecode text ones. Check the content of continuation
object instead of bytecode, since this is less prone to changes during
changes in coroutines codegen.

 #KT-48678
2022-06-27 23:11:40 +02:00
Victor Petukhov fa7809cd80 [FE] Remove BuilderInference annotation from tests 2022-06-21 15:01:56 +02:00
Mikhail Glukhikh fa914f20a4 Use nearest Java super qualifier for fields in IR converter
Related to KT-49507
2022-06-16 06:51:34 +00:00
Mikhail Glukhikh b0a6508d4b Handle Java base class field read properly in IR converters
For FE 1.0, we just change super qualifier symbol to
base class, if it's possible.
For FIR, we introduce using of super qualifier symbols for
field accesses and repeat FE 1.0 behavior here.

#KT-49507 Fixed
2022-06-16 06:51:33 +00:00
Pavel Mikhailovskii ecb3cc193c KT-51883 Don't use "-" in generated unique lifted declaration names 2022-06-10 18:36:04 +00:00
Pavel Mikhailovskii 3b5179686e KT-52592 Fix NPE from KProperty.getExtensionDelegate on property delegated to another property; make $delegate methods private 2022-06-01 14:02:28 +00:00
Ivan Kylchik 44cf64a00c Convert const values in ranges without explicit cast 2022-05-18 21:20:01 +03:00
Ivan Kylchik 51ccc32a3f Update test data after introducing IntrinsicConstEvaluation annotation 2022-05-18 21:19:57 +03:00
pyos c43acba0b9 JVM: restore call site line number after inlining lambda
E.g. in `x + f()` where `f` is an inline lambda, the instructions for
`+` should have the line number of that expression (while previously
they instead had the line number of the last line of the lambda).

^KT-51738 Fixed
2022-05-02 19:28:10 +02:00
Ilmir Usmanov 7579be6c68 Generate CHECKCAST after ACONST_NULL in coroutines
If we do not do this, the state-machine builder will not know the type
of the ACONST_NULL, defaulting to Object, leading to VerifyError.
Alternatively, we could use LVT to deduce the type, but getting types
from LVT is something I got rid of long time ago, and I have no desire
to return it back.

Generating CHECKCAST hints the state-machine builder the type of the
variable avoiding the issue of VerifyError. However, this CHECKCAST
replaces StrictBasicValue.NULL_VALUE with BasicValue in
OptimizationBasicInterpreter. To preserve optimization on not-spilling
known nulls, introduce BasicValues, which represent typed nulls and
create BasicInterpreter, which is aware of them. This way we have the
best of two worlds - we do not spill known nulls, and we know the type
of ACONST_NULL.

 #KT-51718 Fixed
2022-03-30 14:27:29 +00:00
Mikhael Bogdanov 6b00b51e6d Generate fake variables for default lambdas during inline
#KT-51557 Fixed
2022-03-14 08:48:26 +00:00
Mikhail Glukhikh 53d6ac24e5 Switch kotlin version to 1.7
* Change 1.6 to 1.7 constants
* Fix SAFE_CALL_WILL_CHANGE_NULLABILITY for testData
* Change EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_WARNING to EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_ERROR
* Change NON_EXHAUSTIVE_WHEN_STATEMENT to NO_ELSE_IN_WHEN
* Fix testData for SafeCallsAreAlwaysNullable
* Change T -> T & Any in test dumps
* Change INVALID_CHARACTERS_NATIVE_WARNING -> INVALID_CHARACTERS_NATIVE_ERROR
* TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING -> TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR
2022-02-25 11:46:27 +00:00
Alexander Udalov c53d91bae1 JVM IR: adjust generation of linenumber for try-finally
Do not generate linenumber for the start of the finally block, because
that is usually where the only word 'finally' is located. Instead,
generate linenumber for the first expression inside the finally block.

Not generating this linenumber fixes an issue in code coverage tools
which would consider such finally uncovered. Although this might be
technically considered as designed, it makes more sense to NOT detect it
as uncovered because semantics of the finally block shouldn't really
differ whether it's executed normally or because an exception happened.
It's also beneficial for the tool support to behave like javac, which
doesn't generate the linenumber either.

 #KT-50973 Fixed
2022-02-24 16:33:40 +01:00
Xin Wang fdbcb64d39 JVM_IR: frame optimization for cast to IntProgression
#KT-29199
2022-02-03 17:45:06 +03:00
Xin Wang 9ae452e489 JVM_IR generate less bytecode for for-loops if possible(KT-22334). 2021-12-31 18:29:04 +03:00
Dmitry Petrov bcec952beb JVM_IR KT-50585 array constructor loop should end with IINC 2021-12-30 21:38:58 +03:00