Commit Graph

66577 Commits

Author SHA1 Message Date
Dmitriy Novozhilov e6d8e67a3a [FIR] Generify ComponentArray 2020-04-28 21:05:06 +03:00
Dmitriy Novozhilov a4a58a9d74 [FIR] Get rid of FirSession.service 2020-04-28 21:05:06 +03:00
Leonid Startsev 52933e161e Use AssociatedObjects on JS too
because JS IR now supports them
2020-04-28 20:51:24 +03:00
Steven Schäfer 905a8ca0d0 Reflect: Handle methods with inline class default parameters 2020-04-28 19:49:35 +02:00
Pavel Kirpichenkov 86d6470ced Update test data forgotten in 36a57973
KT-38544
2020-04-28 20:26:11 +03:00
Anton Bannykh 2992d49a1d JS IR: fix findAssociatedObjects for primitive type KClass'es 2020-04-28 19:08:44 +03:00
Dmitry Petrov 878e838f0b JVM: Suspend converted references inherit AdaptedFunctionReference 2020-04-28 18:56:37 +03:00
pyos deecb6a28e JVM: move synthetic line number generation to the inliner
This makes the behavior of JVM and JVM_IR the same without having to
deal with PSI nodes.
2020-04-28 17:21:07 +02:00
pyos 91b6daeacc JVM: fix debug info for script file classes 2020-04-28 17:21:07 +02:00
Georgy Bronnikov 1e8a660fda IR: use default parameters in Ir...Impl constructors 2020-04-28 18:19:46 +03:00
Georgy Bronnikov 9561cc8270 JVM_IR: JvmNameProvider 2020-04-28 18:19:46 +03:00
Georgy Bronnikov 52df54ae49 IR: add NameProvider 2020-04-28 18:19:46 +03:00
Georgy Bronnikov 82d55e1a67 Minor: remove unused parameters, reformat code 2020-04-28 18:19:46 +03:00
Alexander Podkhalyuzin 6372c01e49 Added missing specificity comparator to FIR
This is required to correctly resolve overloading in cases when we
need to find most specific alternative in Java between int and Integer.
2020-04-28 17:34:42 +03:00
Steven Schäfer b6b8dd1eab JVM IR: Avoid unnecessary CHECKCASTs in enum classes 2020-04-28 16:31:13 +02:00
Steven Schäfer cb3a4727cf JVM IR: Optimize field initializers in secondary constructors 2020-04-28 16:27:54 +02:00
Mads Ager fed6272de4 [JVM_IR] Use ifne and ifeq for integer zero comparisons. 2020-04-28 16:27:10 +02:00
Anton Bannykh e8a6ddceaa JS IR: hide runtime helpers from users 2020-04-28 16:40:07 +03:00
Mikhail Glukhikh 9f20e65595 FIR resolve completion: extract prepareQualifiedTransform 2020-04-28 16:32:07 +03:00
Mikhail Glukhikh eecf33a31d FIR resolve completion: add delegated completion for variable access 2020-04-28 16:32:07 +03:00
Mikhail Glukhikh 4866e7a988 FIR resolve completion: move transformFunctionCall upper 2020-04-28 16:32:06 +03:00
Mikhail Glukhikh d910a4cf23 FirCallResolver: perform completion for var access with ILT receiver
#KT-38473 Fixed
2020-04-28 16:32:06 +03:00
Mikhail Glukhikh b0b198119d FIR resolve completion: transform receivers for variable accesses 2020-04-28 16:32:06 +03:00
Mikhail Glukhikh ab79e60b63 FIR2IR: consider integer literal type as error type 2020-04-28 16:32:06 +03:00
Leonid Startsev 205f29128a Updated testdata to a new generation strategy
Fix IR generation problems

(partially reverts cd931796bc)

Regenerate diagnostic testdata according to runtime changes
2020-04-28 15:48:14 +03:00
Dmitry Gridin a11e6b2eed KotlinChangePackageRefactoring: fix formatting for long qualifier names
#KT-38627 Fixed
2020-04-28 12:37:18 +00:00
Dmitry Gridin db5751616a MoveKotlinDeclarationsProcessor: fix formatting for long qualifier names
#KT-35338 Fixed
2020-04-28 12:37:17 +00:00
Dmitry Gridin 2b8bb30744 Change signature: fix formatting for long qualifier names
#KT-12878 Fixed
2020-04-28 11:58:16 +00:00
Sergey Igushkin 8336119557 Kotlin/Native 1.4-M3-dev-15453 2020-04-28 14:19:12 +03:00
Alexander Udalov 94346e8a03 Add JVM target bytecode version 14
#KT-38413 Fixed
2020-04-28 13:00:23 +02:00
Alexander Udalov 098a935aa7 Fix exponential string table size of anonymous classes during inlining
When we inline an anonymous object which captures something such as
crossinline values or reified parameters, we copy and transform its
metadata in `AnonymousObjectTransformer.transformMetadata`. Basically we
read the metadata of the original class, add a minor protobuf extension
and write it to the new class.

This also includes copying the string table. We read the string table
into `JvmNameResolver` (a representation of string table used in
deserialization), then construct a `JvmStringTable` (a representation
used in _serialization_) and then write it back.

There's a few optimizations in the string table representation in JVM
metadata which allow to store less strings and thus take less space. See
`StringTableTypes.Record` in `jvm_metadata.proto` for more information.
One of the optimizations `Record.range` allows to avoid storing the same
record many times in a sequence. For example, if we have N different
strings in the string table but none of them require any operation (such
as substring, char replacement, etc.), then we only store the record
with all default values (no operation, no predefined string, etc.) and
set its `range` to N. Upon reading such optimized record list in
`JvmNameResolver`, we "expand" it back to normal, so that we could index
it quickly and figure out what operation needs to be performed on each
string from the string table.

The problem was that when we expanded this list, we didn't set the range
of the expanded record entry to 1. So each record in
`JvmNameResolver.records` still has its original range. It doesn't cause
any problems most of the time because the range in this expanded list is
almost unused. However, when copying/transforming metadata for anonymous
objects, we mistakenly passed this expanded list with incorrect ranges
to `JvmStringTable`. So the metadata in the copied anonymous object
ended up being incorrect: each record now was present the number of
times equal to its range. Copying such metadata once again led to
another multiplication of the record list size. Multiple copies resulted
in exponential increase in memory consumption and quickly led to OOM.

For the fix, we now take the original, unexpanded list of records when
creating `JvmStringTable` out of `JvmNameResolver` for transformation of
anonymous object metadata.

Note that another possible fix would be to make range for each record in
`JvmNameResolver.records` equal to 1. This is undesirable though, since
then we'd need to copy each `JvmProtoBuf.StringTableTypes.Record`
instance, of which there could be many, and use some memory for no
apparent gain (since ranges in that expanded list are now not used at
all).

 #KT-38197 Fixed
2020-04-28 12:59:52 +02:00
Mikhail Glukhikh 65065a15a3 FIR DFA: stabilize type order 2020-04-28 13:12:15 +03:00
Pavel Kirpichenkov 36a57973b5 [NI] CST: remove max depth offset from recursion detection
Recursive type with several recursive anscestors can create a number of identical
common supertype calculations, growing exponentially on every step of recursion.
Previously the number of calculations was limited by D + 3, where D is a type depth.
Since the limit is dynamic, it seems that extra +3 offset can be dropped thus
reducing the number of recursions. The proper solution is to detect such a recursion
and fold recursive type preemtively, but for now this may improve performance in some use cases.

^KT-38544 In progress
2020-04-28 12:53:09 +03:00
Pavel Kirpichenkov dfc86dbf63 [NI] Avoid type rendering in member scope for intersection type
KT-38544
2020-04-28 12:53:09 +03:00
Dmitry Petrov 802372ceff PSI2IR: suspend conversion on arbitrary arguments 2020-04-28 12:41:56 +03:00
Sergey Igushkin e3d33cdc10 Drop Gradle < 6.0 support for Kotlin MPP Gradle plugin
This is required due to issues with dependency resolution of the
kotlinx library modules published in a way that their root MPP module
contains the JVM artifacts so that consumers that can't read Gradle
module metadata get the JVM JAR and POM. Gradle 6.0+ fails to resolve
those modules in a variant-aware way, always choosing the JVM artifacts.

To avoid issues on the consumer side when these dependencies are used,
we decided to drop support for Gradle < 6.0 in the MPP plugin.

Issue #KMM-233 Fixed
2020-04-28 09:33:17 +00:00
Andrey Uskov 89777f8bf3 Move GradleQuickFixTest checks in EDT Thread 2020-04-28 11:53:30 +03:00
Andrey Uskov aa6801569a Fix compilation of ExternalSystem tests in legacy branches 2020-04-28 11:53:28 +03:00
Dmitry Savvinov 3b7fbeb71b Fallback to M2-implementation of dependsOn in AS + M3
^KT-33809
2020-04-28 10:42:56 +03:00
Dmitriy Dolovov 151890dde5 Add test for overloading expect MemberDescriptors discrimination
Issue #KT-38298
2020-04-28 13:16:23 +07:00
Dmitriy Dolovov 90e888a1b6 Discriminate overloading expect MemberDescriptors
Issue #KT-38298
2020-04-28 13:16:18 +07:00
Mikhail Glukhikh 34ae35b2aa Move FirJvmClassCodegen inside fir:fir2ir:jvm-backend #KT-38156 Fixed
This removes dependency of IR JVM backend from FIR
2020-04-28 07:35:13 +03:00
Mikhail Glukhikh dbd4cecff6 FIR serializer: accept FirClass instead of IrClass to get rid of IR deps 2020-04-28 07:35:12 +03:00
Mikhail Glukhikh 8d85e7a401 FIR serializer: add forgotten type alias serialization 2020-04-28 07:35:10 +03:00
Mikhail Glukhikh a545ec41a0 FIR serializer: consider exotic types as errors (breaks 4 BB tests) 2020-04-28 07:35:09 +03:00
Mikhail Glukhikh ec7522c675 FIR serializer: introduce nonSourceAnnotations 2020-04-28 07:35:08 +03:00
Mikhail Glukhikh 7adb4eb872 FIR serializer: extract annotation argument visiting to separate object 2020-04-28 07:35:07 +03:00
Mikhail Glukhikh 394fa7affc FIR serializer: add bad test data changes 2020-04-28 07:35:06 +03:00
Mikhail Glukhikh f98c73cb30 [FIR] Support FirMetadataSource.File in FIR2IR & serializer (KT-38156) 2020-04-28 07:35:04 +03:00
Mikhail Glukhikh 95a17eadb2 FIR serializer: refactor typeProto + add some suspend types support 2020-04-28 07:35:02 +03:00