Commit Graph

14386 Commits

Author SHA1 Message Date
Dmitry Petrov 041773fd25 JVM optimize out temporary variables in bytecode 2021-08-24 18:56:11 +03:00
Alexander Udalov 4f29c113b7 Remove KotlinCompilerVersion.IS_PRE_RELEASE
Now, milestones of major Kotlin releases (e.g. 1.6.0-M1) will NOT
generate prerelease binaries anymore.

The reason for that is it's proven to be quite a complicated process to
turn on IR_PRE_RELEASE after the release is branched, perform double
bootstrap and fix tests, and then do it again in reverse just before
release. With the new release cadence, we don't have that much time to
do it and verify that everything works as intended.

Note that this only removes the "global" prerelease flag. Compiler will
still generate prerelease binaries if a non-stable language version is
used. For example, Kotlin 1.6.0-M1 with `-language-version 1.7` will
generate prerelease binaries.
2021-08-24 16:23:42 +02:00
Alexander Udalov 8d4f26cf84 IR: use inlineClassRepresentation in getInlineClassUnderlyingType
Looking for the primary constructor manually doesn't work if it's
private in the other module on JVM, because private declarations are
skipped in IrLazyClass.
2021-08-24 12:28:31 +02:00
Mikhail Glukhikh 12726bde15 Deprecate smart cast on alien derived property #KT-48101 Fixed 2021-08-24 12:32:30 +03:00
Mikhail Glukhikh 3f8734f694 FIR: determine synthetic accessor modality more precisely
Related to KT-47542
2021-08-24 12:32:30 +03:00
Mikhail Glukhikh bbb76aae3f Provide more precise check for ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED
#KT-47542 Fixed
2021-08-24 12:32:30 +03:00
Steven Schäfer f05f9882ab IR: Handle annotation instantiations in constructor calls 2021-08-23 23:04:35 +02:00
Steven Schäfer 6d518c8e57 JVM IR: Mark annotation implementation classes as anonymous
And add tests to ensure that annotation implementation classes are
handled correctly in jvm-abi-gen.
2021-08-23 18:25:33 +02:00
Steven Schäfer 1b5214a2dc JVM: Fix usage of ClassBuilder API in AnonymousObjectTransformer 2021-08-23 18:25:33 +02:00
Steven Schäfer c9b0cc5b32 JVM: Only produce inline SAM wrappers in public inline scope 2021-08-23 18:25:33 +02:00
Dmitriy Novozhilov 40614507d3 [FE 1.0] Report warning about new IL operator resolve in initializers and default values
^KT-48361 Fixed
2021-08-23 16:20:41 +03:00
pyos a15a5aa429 JVM_IR: generate instance fields even when reification is needed
The inliner supports that, we just need to generate the reification
markers on GETFIELD to instance fields.
2021-08-23 14:27:51 +02:00
Ilmir Usmanov c01c356817 Do not extend LVT ranges during inplace arguments inlining
Otherwise, R8 does not transform kotlin-reflect, failing bootstrap.
Leaving end label the same is safe, since we do not remove labels during
transformation.
2021-08-23 11:51:30 +00:00
Dmitriy Novozhilov 27ac7dbf9a [Test] Unmute passing codegen tests 2021-08-23 14:29:12 +03:00
Mikhail Glukhikh 7b0e5927cb Report EXPERIMENTAL_ANNOTATION_ON_WRONG_TARGET without explicit @Target
#KT-48349 Fixed
2021-08-23 14:18:34 +03:00
Andrey Zinovyev 865fccdd29 [FIR] Add messages for JvmRecord diagnostics
Also fix some tests
2021-08-23 10:33:24 +00:00
Andrey Zinovyev a3049b35c2 [FIR] Add ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE diagnostic 2021-08-23 10:33:24 +00:00
Andrey Zinovyev 09a1d54865 [FIR] Add JVM_RECORD_EXTENDS_CLASS diagnostic 2021-08-23 10:33:23 +00:00
Andrey Zinovyev 8c2d37917f [FIR] Add DELEGATION_BY_IN_JVM_RECORD diagnostic 2021-08-23 10:33:23 +00:00
Andrey Zinovyev 3314c8faac [FIR] Add FIELD_IN_JVM_RECORD diagnostic 2021-08-23 10:33:23 +00:00
Andrey Zinovyev dbc1e31e67 [FIR] Add INNER_JVM_RECORD diagnostic 2021-08-23 10:33:22 +00:00
Andrey Zinovyev bf845b6066 [FIR] Add JVM_RECORD_NOT_VAL_PARAMETER diagnostic 2021-08-23 10:33:21 +00:00
Andrey Zinovyev e8405c41d1 [FIR] Report UNSUPPORTED_FEATURE if jvm records feature is not enabled 2021-08-23 10:33:21 +00:00
Andrey Zinovyev c7008892fd [FIR] Add NON_DATA_CLASS_JVM_RECORD diagnostic 2021-08-23 10:33:21 +00:00
Andrey Zinovyev 84f5d6b149 [FIR] Add JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS diagnostic 2021-08-23 10:33:20 +00:00
Andrey Zinovyev 3fee87a0f3 [FIR] Add ENUM_JVM_RECORD diagnostic 2021-08-23 10:33:20 +00:00
Andrey Zinovyev c8381e9b0f [FIR] Add NON_FINAL_JVM_RECORD diagnostic 2021-08-23 10:33:20 +00:00
Andrey Zinovyev 6b70aecad5 [FIR] Add LOCAL_JVM_RECORD diagnostic 2021-08-23 10:33:19 +00:00
Ilya Chernikov 47ea5330ff IR: Allow references to script constructor in module
aso add test checking (somewhat confusing) semantic of
script nested classes.
2021-08-23 12:49:45 +03:00
Ilya Chernikov e7cbc9a0fb IR: Process script with LDL as if it is a function body
#KT-46645 fixed
#KT-48025 fixed
2021-08-23 12:49:43 +03:00
Victor Petukhov d730db094a Don't look at raw type's arguments while enhancing super types
^KT-48172 Fixed
2021-08-20 13:10:45 +03:00
Dmitry Petrov a3bb9dde45 JVM_IR KT-48295 don't upcast field receiver with super qualifier 2021-08-20 12:27:43 +03:00
pyos 858bd47c45 JVM_IR: use substituted return type when lowering inline references
#KT-48267 Fixed
2021-08-20 06:41:03 +02:00
Mads Ager 0b84de31b7 [JVM IR] Generate line number for exception store for finally.
^KT-46451 Fixed
2021-08-20 00:59:55 +02:00
Victor Petukhov a1519b7b4e Be able to infer a type variable based on several builder inference lambdas
^KT-48329 Fixed
2021-08-20 01:28:12 +03:00
Victor Petukhov bf1e68a53f Resolve calls using the builder inference despite the presence of the annotation if there are uninferred type variables
^KT-48194 Fixed
2021-08-20 01:28:11 +03:00
Victor Petukhov 55811c8851 Don't use builder inference if possible
The builder inference is running only if there are still uninferred type variables

^KT-48193 Fixed
2021-08-20 01:28:10 +03:00
Ilmir Usmanov b5fa129540 Loosen tail-call optimization check for functions returning Unit
Do not check, that all Unit predecessors are POPs. This is safe for the
same reason, as it is safe to allow some of ARETURN sources not be
suspension point results.
To elaborate, before Unit, the stack is empty. This is because if there
are multiple paths to Unit and at least one of them comes from POP after
suspension point (we are interested in this case only - otherwise, the
call is not tail-call), in path from said POP the stack is empty, since
after suspension point the stack contains only one element. Thus, the
stack in other paths leading to Unit has to be empty, otherwise, merge
operation is not possible and ASM will report error during analysis.
Since the stack is empty in all paths, we can hoist Unit and following
ARETURN to predecessors, effectively turning path from suspension point
to tail-call.
2021-08-19 16:05:21 +00:00
Mads Ager d33b70af1a [JVM IR] Ensure an instruction for the line number for a break.
This ensures that the debugger always has a bytecode offset for
the line number of a break/continue so that you step there and
so that you can set breakpoints there.

The `nop` instruction is optimized out if it has no line number
information.

^KT-46450 Fixed
2021-08-19 15:40:44 +02:00
Andrey Zinovyev 894a446585 [FIR] Add missing messages for jvm diagnostics and fix some tests 2021-08-19 15:25:51 +03:00
Andrey Zinovyev 3b21759697 [FIR] SUPER_CALL_WITH_DEFAULT_PARAMETERS diagnostic 2021-08-19 15:25:50 +03:00
Andrey Zinovyev 24fbe0f072 [FIR] UPPER_BOUND_CANNOT_BE_ARRAY diagnostic 2021-08-19 15:25:49 +03:00
Andrey Zinovyev 4661656b8c [FIR] JVM_PACKAGE_NAME* diagnostics 2021-08-19 15:25:47 +03:00
Andrey Zinovyev ae558c0290 [FIR] Add DEPRECATED_JAVA_ANNOTATION diagnostic 2021-08-19 15:25:46 +03:00
Andrey Zinovyev f9b601edae [FIR] @JvmOverloads related checkers 2021-08-19 15:25:44 +03:00
Andrey Zinovyev 17ae69416c [FIR] Add SYNCHRONIZED_* diagnostics 2021-08-19 15:25:43 +03:00
Andrey Zinovyev 7ba8e0d9cc [FIR] Add VOLATILE_ON_VALUE/VOLATILE_ON_DELEGATE diagnostic 2021-08-19 15:25:43 +03:00
Andrey Zinovyev f90b534c4c [FIR] Add STRICTFP_ON_CLASS diagnostic 2021-08-19 15:25:41 +03:00
pyos d3de0109ca Add tests for KT-48180 2021-08-18 18:39:33 +02:00
pyos 47d0211370 FE: do not enhance ? in jspecify NullMarked scope
No clue whether this should be done for `@TypeQualifierDefault` since it
appears to have no specification whatsoever.

 #KT-48262 Fixed
2021-08-18 16:41:00 +03:00