Commit Graph

85897 Commits

Author SHA1 Message Date
Ilmir Usmanov 5fd08b3ee5 Document coroutines codegen: simple lambda example 2021-09-15 22:28:32 +02:00
Ilmir Usmanov 25edda02f4 Document coroutines codegen: introduction 2021-09-15 22:28:32 +02:00
Roman Golyshev 642591770e [FIR] Calculate lazy initializers in properties with backing fields
More tests should be added in the future
2021-09-15 18:33:43 +00:00
Roman Golyshev bb2b0107c6 [FIR] Render backing fields by FirRenderer 2021-09-15 18:33:43 +00:00
pyos 36b02082a6 FIR: try to load as Java class if KotlinClassFinder returns null
The IDE implementation of KotlinClassFinder does not always return the
class file contents.
2021-09-15 19:15:17 +03:00
Abduqodiri Qurbonzoda f1befc0108 Format Other_Uppercase/Other_Lowercase property as an identifier in docs 2021-09-15 17:31:52 +03:00
Mikhail Glukhikh b5e37cb201 Unmute now passing FIR visualizer test #KT-44811 Fixed 2021-09-15 17:11:56 +03:00
Dmitriy Novozhilov 37b427c656 [FIR] Combine type attributes in typealias expansion
^KT-48651 Fixed
2021-09-15 17:11:31 +03:00
Dmitriy Novozhilov 0f6b6dbca3 [FIR] Cleanup and reorganize utils in :compiler:fir:checkers 2021-09-15 17:11:31 +03:00
Dmitriy Novozhilov 9d09b9605f [FIR] Cleanup and reorganize utils in :compiler:fir:java 2021-09-15 17:11:30 +03:00
Dmitriy Novozhilov 7a347b11e3 [FIR] Use StandardClassIds instead of StandardNames everywhere it's possible 2021-09-15 17:11:30 +03:00
Dmitriy Novozhilov 5c2a3bb78e [FIR] Move duplicating names and classIds to StandardClassIds 2021-09-15 17:11:29 +03:00
Dmitriy Novozhilov 4793674eae [FIR] Move all CFA utils to separate package
Root org.jetbrains.kotlin.fir.analysis.cfa now contains only specific
  control flow analyzers
2021-09-15 17:11:28 +03:00
Dmitriy Novozhilov bce62430ce [FIR] Split CfaUtils to multiple files 2021-09-15 17:11:27 +03:00
Elena Lepilkina bdb61ec5d7 [K/N] Run inline property accessors later to inline all cases including devirtualized 2021-09-15 12:29:03 +00:00
Svyatoslav Scherbina b32ab48596 Native: add tests for autorelease optimization in ObjCExport
The compiler should do its best to avoid putting objects to autorelease
pools.
2021-09-15 11:48:17 +00:00
Svyatoslav Scherbina 8c923f6504 Native: optimize autorelease in ObjCExport calls to Kotlin
Use objc_autoreleaseReturnValue to eliminate the autorelease operation
for return value if the caller is optimized (usually it is).

This required moving autorelease operation from Kotlin -> ObjC ref
conversion to bridge epilogue.

To achieve this, also make ObjCExport Kotlin ref -> ObjC ref dynamic
converters return retained reference (instead of autoreleased one).
To reflect this, rename the corresponding entities in the code.
2021-09-15 11:48:16 +00:00
Svyatoslav Scherbina 75a3070067 Native: implement autoreleaseAndRet for ObjCExportCodeGenerator
This operation is equivalent to "autorelease and then return",
but it supports Obj-C runtime autorelease optimization for return value:
if the caller is optimized (which is usually true), then no autorelease
will happen at runtime.
2021-09-15 11:48:15 +00:00
Svyatoslav Scherbina e00fd6b9b3 Native: allow subclassing FunctionGenerationContext
This allows one to have domain-specific generator without polluting
the global namespace.

Also introduce builders and do minor refactoring.
2021-09-15 11:48:15 +00:00
Svyatoslav Scherbina be1acc8103 Native: eliminate autorelease in ObjCExport set/getAssociatedTypeInfo 2021-09-15 11:48:14 +00:00
pyos 8724bc9525 Add test for KT-48478 2021-09-15 13:23:11 +02:00
pyos 72752b64c5 Revert "JVM_IR: assume function reference adapters are tail-call"
This reverts commit 537ce05bc9.

 #KT-48478 Fixed
2021-09-15 13:23:11 +02:00
pyos 0864f9faf8 JVM_IR: mark inline lambda functions with a special origin
Keeping the origin as LOCAL_FUNCTION_FOR_LAMBDA was a mistake as this
tells codegen nothing. Changing the origin in allows, for example,
removing the hack that detaches inline lambdas from the IR tree before
verification and codegen, or treating inline lambdas and inline
anonymous functions the same way.

This includes fake functions created for inline callable references.

 #KT-48319 Fixed
 #KT-47279 Fixed?
2021-09-15 13:23:11 +02:00
pyos 6b58c3d035 JVM_IR: mark inlined callable references with a different origin
Makes them easier to find.
2021-09-15 13:23:11 +02:00
Ilya Kirillov 81336820e2 FIR IDE: regenerate diagnostics 2021-09-15 11:32:59 +02:00
Ilya Kirillov 585eb9a4f0 FIR IDE: regenerate analysis api tests 2021-09-15 11:32:49 +02:00
Ilya Kirillov 5b38bd2be2 FIR IDE: fix generators after changing analysis api packages 2021-09-15 11:32:47 +02:00
Ilya Kirillov 99a65527b7 FIR IDE: fix symbol light classes imports after package changes 2021-09-15 11:32:45 +02:00
Ilya Kirillov 42f0536904 FIR IDE: move analysis api fir testdata to the analysis directory 2021-09-15 11:32:43 +02:00
Ilya Kirillov 4d52b354af FIR IDE: move analysis api fir generator to the analysis directory 2021-09-15 11:32:33 +02:00
Ilya Kirillov b43e664985 FIR IDE: move analysis api fir test sources to the analysis directory 2021-09-15 11:32:32 +02:00
Ilya Kirillov 5e9f807c78 FIR IDE: move analysis api fir main sources to the analysis directory 2021-09-15 11:32:30 +02:00
Ilya Kirillov 989f3248e4 FIR IDE: move low level api testdata sources to the analysis directory 2021-09-15 11:32:28 +02:00
Ilya Kirillov 633b0fa612 FIR IDE: move low level api test sources to the analysis directory 2021-09-15 11:32:25 +02:00
Ilya Kirillov b70f4f581e FIR IDE: move low level api main sources to the analysis directory 2021-09-15 11:32:22 +02:00
Ilya Kirillov 0c04ff98c3 FIR IDE: move analysis api to the analysis directory 2021-09-15 11:31:30 +02:00
Tianyu Geng 0996513f82 FIR: remove unused private property 2021-09-15 12:11:41 +03:00
Tianyu Geng dfc36ec614 FIR checker: ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_(ANNOTATION|FUNCTION) 2021-09-15 12:11:41 +03:00
Tianyu Geng e95de0a778 FIR checker: report type mismatch for named vararg arguement
ProhibitAssigningSingleElementsToVarargsInNamedForm is enabled from 1.3
so there is no need to make FIR accepting single element passed through
named arguments.

In addition, we may want to report only
ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_FUNCTION and not arg
type mismatch. But FE1.0 is reporting both so I am following it. If we
want to remove the redundant report, we will probably want to remove
FirNamedVarargChecker and report during resolution as a cone diagnostic.
2021-09-15 12:11:36 +03:00
Tianyu Geng 3708290ca3 FIR checker: fix NON_VARARG_SPREAD 2021-09-15 12:11:35 +03:00
Tianyu Geng ef80a8ebf6 FIR checker: createPrimitiveArrayType -> createPrimitiveArrayTypeIfPossible 2021-09-15 12:11:33 +03:00
Tianyu Geng b8b9502db4 FIR checker: fix ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_ANNOTATION
Currently this checker is missing `arrayOf` calls inside annotation.
2021-09-15 12:11:28 +03:00
Alexander Udalov 3ef9649344 Minor, fix test data of localVariables/suspend/mergeLvt.kt
It was incorrectly adapted (by me) in d07070e184.
2021-09-15 00:07:49 +02:00
Tianyu Geng 3c84fbcab1 IR: make calls with explicit singleton receiver tailrec [KT-48602] 2021-09-14 23:48:52 +03:00
Tianyu Geng 8525b4932b FIR Checker: check tailrec
Difference from FE1.0
* KT-4285: calls to virtual method with default argument should be
  reported as not tailrec. FE1.0 is missing such cases.
* KT-48600: calls inside lambda should be reported as not tailrec. FE1.0
  also misses such cases.
2021-09-14 23:48:50 +03:00
Alexander Udalov 5df316a129 Minor, rename module backend.jvm:backend.jvm.entrypoint -> backend.jvm.entrypoint 2021-09-14 22:29:13 +02:00
Alexander Udalov 7efc9dac9b JVM IR: extract lowerings to a separate module
Together with extracting codegen to a separate (unrelated) module in the
future, hopefully it'll speed up the build of JVM IR by making it more
parallel, and helping incremental compilation to avoid recompiling code
that depends on lowerings because of `implementation` dependency.
2021-09-14 22:29:12 +02:00
Alexander Udalov eee8b033a6 JVM IR: minimize usages of jvmPhases outside backend.jvm 2021-09-14 22:29:12 +02:00
Alexander Udalov b4c84aa2a6 JVM IR: move out bridge/collection lowering caches to separate files
Both BridgeLoweringCache and CollectionStubComputer are not tecnically
part of the lowerings, so they shouldn't be in the "lower" package.
2021-09-14 22:29:12 +02:00
Alexander Udalov 08cc789123 JVM IR: move out common utilities from lowerings
The main idea is to remove dependencies on lowerings from other
backend.jvm code (mainly codegen), with the hope of extracting lowerings
and codegen to separate unrelated modules in the future.

To achieve this, code which is used both in lowerings and codegen is
moved to the "common" code, mainly JvmIrUtils/JvmIrTypeUtils.
2021-09-14 22:29:12 +02:00