Commit Graph

72817 Commits

Author SHA1 Message Date
Alexander Udalov adb05ab076 JVM IR: write inherited multifile parts flag to kotlin.Metadata
This flag is unused at the moment, but might be used one day to support
proper incremental compilation for multifile classes.
2021-02-17 21:56:18 +01:00
sebastian.sellmair 35008df969 [Commonizer] Rename NativeDistributionCommonizer to LibraryCommonizer 2021-02-17 19:24:54 +00:00
sebastian.sellmair 4500b6ce74 [Commonizer] Implement :native:kotlin-klib-commonizer:api with support for library commonization
- Implement new Gradle module ':native:kotlin-klib-commonizer'
- Implement new NativeKlibCommonize task
- Implement CommonizerTarget.identityString
2021-02-17 19:24:54 +00:00
Dmitry Petrov 6d019d9544 JVM_IR indy-SAM on functional expression 2021-02-17 22:18:06 +03:00
Mikhael Bogdanov 134fda8bad Support Unit/V types in string-concat indy calls
unitComponent.kt test fails with JVM target 9+
2021-02-17 18:43:24 +01:00
Mikhael Bogdanov e3e7e6b740 Make indy-with-constants default for -jvm-target 9+
#KT-42522 Fixed
2021-02-17 18:43:23 +01:00
Mikhael Bogdanov 3d8e8dd3ba Fail on compilation errors in AbstractBytecodeTextTest 2021-02-17 18:43:23 +01:00
Mikhael Bogdanov 61fce74b76 Support new targets in KotlinBytecodeToolWindow
#KT-30222 Fixed
2021-02-17 18:43:23 +01:00
Sergey Shanshin 91f1cb88c1 Support serialization of java enum classes in IR
Fixes Kotlin/kotlinx.serialization#1334
2021-02-17 20:24:31 +03:00
Tianyu Geng 652207dcac FIR IDE: add AddModifierFix 2021-02-17 18:19:27 +01:00
Tianyu Geng 5793f77ece FIR IDE: AddModifierFix -> AddModifierFixMpp 2021-02-17 18:19:27 +01:00
Sergey Shanshin de06a69b12 Added external serializers in serialization plugin for IR backend
- added fallback support of external serializers in IR
- implemented calculations of properties default values in IR
- swapped check of shouldEncodeElementDefault and comparing the property with default value in IR. Now default value calculated only of shouldEncodeElementDefault returns false
2021-02-17 20:16:34 +03:00
Tianyu Geng 66f00a2eb5 FIR IDE: move AddFunctionBodyFix to fe-independent 2021-02-17 18:14:10 +01:00
Alexander Udalov 67e91b7ebd Minor, add workaround for KT-45008 2021-02-17 16:39:19 +01:00
Alexander Udalov 4d9cffccf2 Support structural equals/hashCode for type constructors of type parameters
Use the same logic as for type constructors of classes, based on the
fully-qualified name of the classifier, with special cases for error
types and local declarations, with an additional check that the type
constructors' declaration descriptors are structurally equal via
`DescriptorEquivalenceForOverrides`. The latter is required because type
parameters of overloaded functions must be different, even though their
full FQ name is the same.

This (hopefully) has no effect for the compiler, but is useful for
kotlin-reflect where `KType.equals` runs the type checker on the
underlying `KotlinType` instances, which eventually ends up comparing
type constructors. Descriptors and types in kotlin-reflect are cached on
soft references, so they may be suddenly garbage-collected and
recomputed, and we want copies of the same type parameter to be equal to
each other.

This fixes flaky codegen tests which started to fail after migration to
the new test infrastructure, where tests are now run in parallel in the
same process, thus with higher memory pressure and more soft references
being GC'd:

* `codegen/box/reflection/types/createType/typeParameter.kt`
* `codegen/box/reflection/supertypes/genericSubstitution.kt`

Also, add a new test to check that we do the instanceof check in
overrides of `AbstractTypeConstructor.isSameClassifier`.

 #KT-44850 Fixed
2021-02-17 14:41:07 +01:00
Alexander Udalov aaecb87d1b Tests: compute runtime classpath for JVM box tests manually
Taking just the `jvmClasspathRoots` is not correct because it also
contains stuff needed for resolve to work correctly, such as JDK (full
or mock), stdlib (full or mock), reflect. JDK is obviously not needed in
the classpath, and stdlib/reflect are available via the parent class
loader, which is specifically reused across all tests to make them run
faster.

Also, don't try to create class loader for Java-only modules in
`JvmBoxRunner.processModule`. This happens, for example, for all tests
which were moved from `boxAgainstJava`.
2021-02-17 14:41:07 +01:00
Dmitriy Novozhilov df42868874 [Inference] Fix subtyping on classes with same FQN but with different number of arguments
Such situations may appear if there are multiple classes with same
  names from different modules in dependencies
2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov 0b22c30ab1 [FIR] Fix dispatch receiver type for members of builtin functional types 2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov e5ab684127 [FIR] Support methods of cone type contexts with annotation markers 2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov 57d29009ee [FIR] Fix TODOs and cleanup ConeTypeContext and ConeInferenceContext 2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov 373bc578fb [FIR] Implement capturing of cone types same as for kotlin types 2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov 5ce36a528e [FE] Prohibit sealed fun interfaces
#KT-44947 Fixed
2021-02-17 13:54:10 +03:00
Dmitriy Novozhilov cdf7de5524 [FE] Change message for sealed interfaces with language target < 1.5 2021-02-17 13:51:14 +03:00
Dmitriy Novozhilov 8521d844e2 Advance bootstrap to 1.5.20-dev-814 2021-02-17 12:01:06 +03:00
Georgy Bronnikov 83343f3a7a IR: get rid of some type checks in JvmBackendContext 2021-02-17 11:05:22 +03:00
Georgy Bronnikov 68cabba698 IR: preserve signatures when copying IrFiles in performByIrFile 2021-02-17 11:05:22 +03:00
Georgy Bronnikov db18ffc764 IR: only worry about threads in JvmIrSignatureDescriptor
General IdSignatureDescriptor is used from other backends, which have no
multi-threaded backend for now and do not need to carry the associated
runtime costs.

So IdSignatureDescriptor keeps the thread-unsafe caching of signature
builder.
2021-02-17 11:05:22 +03:00
Georgy Bronnikov cacfe53065 IR: move performByIrFile to a separate .kt 2021-02-17 11:05:22 +03:00
Georgy Bronnikov 4c701cf44c IR: make extractedLocalClasses a JS-only field 2021-02-17 11:05:22 +03:00
Georgy Bronnikov 445f6eac3d IR: IrBasedDescriptor fix 2021-02-17 11:05:21 +03:00
Georgy Bronnikov c081bc8d7e Fir concurrent maps 2021-02-17 11:05:21 +03:00
Georgy Bronnikov 9cdad272de Fir threadLocal 2021-02-17 11:05:21 +03:00
Georgy Bronnikov ec2dc9c0fa IR: synchronize on SymbolTable operations 2021-02-17 11:05:21 +03:00
Georgy Bronnikov c9d0448fd1 IR: use threadLocal 2021-02-17 11:05:21 +03:00
Georgy Bronnikov 56a26113cd IR: threadLocal
To be used for per-file state in global structures during parallel
lowering.
2021-02-17 11:05:20 +03:00
Georgy Bronnikov 57167922e2 IR: make lazyVar synchronized 2021-02-17 11:05:20 +03:00
Georgy Bronnikov 4e9bedc2fc JVM_IR: use ConcurrentHashMap
Replace mutable maps and sets accessed from by-file lowerings with
ConcurrentHashMap, so that lowerings can operate on them in parallel.
2021-02-17 11:03:27 +03:00
Georgy Bronnikov 23da2bde67 IR: fixes for IR by-file copying 2021-02-17 11:03:27 +03:00
Georgy Bronnikov 54a76977db IR: fix fake override computation
Due to IR copying in performByIrFile, we need to only distinguish
overrides up to their fqName.
2021-02-17 11:03:27 +03:00
Georgy Bronnikov d154c8d8e6 IR: copy each file before lowering.
Avoid inter-file dependencies while lowering.
2021-02-17 11:03:27 +03:00
Georgy Bronnikov 103f82c95c IR: an option to automatically select the number of lowering threads 2021-02-17 11:03:27 +03:00
Georgy Bronnikov 52b3cb362b IR: thread pool in PerformByIrFilePhase 2021-02-17 11:03:27 +03:00
Georgy Bronnikov eae416d739 IR: Handle exceptions from by-file lowering thread 2021-02-17 11:03:27 +03:00
Georgy Bronnikov bea5d955d4 JVM_IR: perform file lowerings in parallel
Selected by -Xir-run-lowerings-in-paralled compiler flag.
2021-02-17 11:03:26 +03:00
Anton Bannykh c06b345f3c Hide stageController into the IrFactory 2021-02-17 10:42:50 +03:00
Anton Bannykh 97080c49fc Persistent IR generator
Goal:
- avoid hand-writing the boilerplate
- easier PIR evolution

Output is reasonably close the hand-writtern version
2021-02-17 10:42:50 +03:00
Anton Bannykh 8a0ce20d43 PIR: minor restructuring 2021-02-17 10:42:50 +03:00
pyos 1310a65f0c JVM: rename this$0 when regenerating nested objects too
In the old backend, this was unnecessary because nested objects would
reference their lambdas' captures through the original this$0. On
JVM_IR, using loose capture fields means a name/descriptor clash can
occur on any level of nesting, not just the top.
2021-02-17 07:56:03 +01:00
Nikolay Krasko ec89cb2313 Ignore hanging KotlinAndroid36GradleIT.testAndroidMppSourceSets()
Ignore till the proper investigation.
Probably caused in https://github.com/JetBrains/kotlin/compare/b262d09a81bf20ffd71db18a0c24ac4f61fa151c...5c7aadece929f79a39bf0ad20549e30d5e391a7c.
2021-02-17 00:26:19 +03:00
Ilmir Usmanov ec569a4c89 Minor. Suppress errors in tests 2021-02-16 20:59:25 +01:00