Commit Graph

104647 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 0e92f98031 [FIR2IR] Allow symbolTable cache lookups if IR f/o builder mode is enabled
Without this change, the following test is failing:
- FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.Collections.testInheritFromHashtable

^KT-58861
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 9a109e98ce [FIR2IR] Raise an exception if declaration is found in symbol table but not in Fir2IrDeclarationStorage
^KT-61637 Fixed
^KT-61774
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 3f3c839c48 [FIR] Cache deserialized builtin functions
Apparently `FirBuiltinSymbolProvider` cached deserialized classes but
  created new fir functions for each invocation

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 36cb869ac2 [FIR2IR] Create fake one-time use properties for callable reference to synthetic properies
Previously fir2ir created real IR properties some getter and setter for
  such references, which lead to the situation that there might be a
  unbound fake override for synthetic property which wasn't stored in
  declaration storage (and code in FakeOverrideGenerator was a hack
  to cover this case)
In the same time K1 creates fake property for such cases, which is stored
  in IrPropertyReference along with original get... and set... functions
  as getter and setter of reference. And in this commit K2 does the same thing

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 7ea54ee87f [FIR2IR] Properly compute parent for fake overrides
^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 954ef58d35 [FIR2IR] Don't create calls to members of Nothing for data/value generated members
Without this change, the following tests will fail:
- `FirLightTreeBlackBoxCodegenTestGenerated.InlineClasses#testJavaPrimitiveTypeIC`
- `FirLightTreeBlackBoxCodegenTestGenerated.InlineClasses#testJavaPrimitiveTypeICGeneric`
- `FirPsiJvmIrTextTestGenerated.Classes.DataClasses#testKt31649`

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 9cf1d43465 [FIR2IR] Properly treat synthetic properties in Fir2IrDeclarationStorage
There is a difference in how FIR and IR treat synthetic properties (properties built upon java getter + optional java setter)
For FIR they are really synthetic and exist only during call resolution, so FIR creates a new instance of FirSyntheticProperty
  each time it resolves some call to such property
In IR synthetic properties are fair properties that are present in IR Java classes

This leads to the situation when synthetic property does not have a stable key (because FIR instance is new each time) and the only
  source of truth is a symbol table. To fix it (and avoid using symbol table as a storage), a pair of original getter and setter is
  used as a key for storage IR for synthetic properties. And to avoid introducing special cache of FirSyntheticPropertyKey -> IrProperty
  additional mapping level is introduced

- FirSyntheticPropertyKey is mapped to the first FIR synthetic property which was processed by FIR2IR
- this property is mapped to IrProperty using regular propertyCache

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov a3498bdd91 [FIR2IR] Cache generated IR functions for data/value classes in declarations storage
Previously, DataClassMembersGenerator saved generated functions only in
  symbol table, which led to the situation when there is a FIR function
  in scopes, IR function in symbol table but no record about their relation
  in Fir2IrDeclarationStorage

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 58e8dfc23b [FIR2IR] Remove or approve some of left usages of IrSymbol.owner 2023-09-15 11:51:57 +00:00
strangepleasures 8fb7ea1126 [KAPT4] KT-61333 Support REPORT_OUTPUT_FILES
Add extra logging
2023-09-15 11:05:05 +00:00
Pavel Kunyavskiy 9a9598c16b [Klib] Run prerelease checker in all backends
The checker also checks the metadata version, which
would be handled separately. Now it would never
emmit this error for klib-based backends.

^KT-61773
^KT-61596
^KT-55809
2023-09-15 09:48:42 +00:00
Alexander Udalov 9f9287fb2e IR: keep flexible type annotations when building fake overrides
#KT-61751 Fixed
2023-09-15 09:40:45 +00:00
Igor Chevdar 2b8bcfda94 [K/N][codegen] Build trampolines for abstract fake overrides
#KT-61924 Fixed
2023-09-15 09:26:54 +00:00
Igor Chevdar 1df93e1611 [box-tests] Added a reproducer for #KT-61924 2023-09-15 09:26:54 +00:00
Dmitrii Gridin 1b1e1d5b3f [Analysis API] DebugSymbolRenderer: unify error types
They are still can be different in the case of error inside
type argument (e.g. `kotlin/Array<out ERROR CLASS: Incomplete code>`)
2023-09-14 18:53:25 +02:00
Dmitrii Gridin 2d83509200 [Analysis API Fe10] add missing initializer for properties 2023-09-14 18:53:25 +02:00
Dmitrii Gridin bb470b5504 [Analysis API Fe10] fix isFromPrimaryConstructor 2023-09-14 18:53:25 +02:00
Alexander Udalov cadbc87dfd JVM IR: add flag to avoid loading dependency module headers
This is an addition to d16f33cf5b. Apparently there's another call site
of JvmIrCodegenFactory in intellij besides Evaluate Expression, namely
Android LiveEdit plugin, where it seems needed to collect all dependency
modules and resolve them via linker. LiveEdit also uses
shouldStubAndNotLinkUnboundSymbols = true, so we need to differentiate
between it and Evaluate Expression, hence the new flag. This new flag
will be set to true only for Evaluate Expression in intellij.

 #IDEA-329915
2023-09-14 15:45:47 +00:00
Ilmir Usmanov f16ea9dfbb JVM: Reduce number of comparison on bytecode analysis merge
operations. Since these methods are hot - they are call on each branch,
even such primitive optimizations should give measurable speedup.
2023-09-14 15:35:51 +00:00
Ilmir Usmanov 5e2d3737f5 JVM: Do not traverse all suspension point when looking for end label
when extending local variable range.
2023-09-14 15:35:51 +00:00
Ivan Kylchik 95872bd13c [JVM] Reuse findMergeNodes in FastStoreLoadAnalyzer 2023-09-14 15:02:03 +00:00
Ivan Kylchik 617e7d1a36 [JVM] Store VarInsnNode in StoreData instead of AbstractInsnNode
This way we can avoid some casts.
2023-09-14 15:02:03 +00:00
Ivan Kylchik 140ccccae3 [Minor] Drop unused method from CompositeMethodTransformer 2023-09-14 15:02:03 +00:00
Ivan Kylchik f9868f757b [JVM] Simplify StoreLoadInterpreter and StoreLoadFrame 2023-09-14 15:02:03 +00:00
Ivan Kylchik 0e9d884b0b [JVM] Slightly rewrite mergeControlFlowEdge in FastStackAnalyzer
This change is supposed to show how similar
`mergeControlFlowEdge` methods are, and maybe
we should combine them.
2023-09-14 15:02:03 +00:00
Ivan Kylchik 6f8e243f0b [JVM] Avoid inheritance from FastMethodAnalyzer
This way it is easier to analyze code.
2023-09-14 15:02:03 +00:00
Ivan Kylchik 5f27e1a6b2 [JVM] Make FixStackAnalyzer inherit FastStackAnalyzer 2023-09-14 15:02:02 +00:00
Ivan Kylchik f49f6656b9 [JVM] Move private extension methods into FixStackFrame 2023-09-14 15:02:02 +00:00
Ivan Kylchik 2c4c3a73b8 [JVM] Move initLocals method into FastAnalyzer 2023-09-14 15:02:02 +00:00
Ivan Kylchik 83c75c1edf [JVM] Unify initLocals method in Fast...Analyzer classes 2023-09-14 15:02:02 +00:00
Ivan Kylchik 02d8a62cb0 [JVM] Fully move analyze method into FastAnalyzer 2023-09-14 15:02:02 +00:00
Ivan Kylchik abe727fdd7 [JVM] Extract common code from Fast...Analyzer into analyzeInner 2023-09-14 15:02:02 +00:00
Ivan Kylchik e0dd3a33c0 [JVM] Extract unique code in Fast...Analyzer into analyzeInstruction 2023-09-14 15:02:02 +00:00
Ivan Kylchik bf53268453 [JVM] Move computeExceptionHandlers into base FastAnalyzer 2023-09-14 15:02:02 +00:00
Ivan Kylchik 98cc2c839f [JVM] Create base FastAnalyzer class for all Fast...Analyzer 2023-09-14 15:02:02 +00:00
Ivan Kylchik 7853256c02 [JVM] Drop some excess toArray calls on instructions 2023-09-14 15:02:02 +00:00
Ivan Kylchik d8e682ab30 [JVM] Drop insnsArray from Fast...Analyzer classes
We are using useless `toArray` can that we can avoid.
2023-09-14 15:02:02 +00:00
strangepleasures cf01d2970f [SLC] [KAPT] KT-61916 Fix generation of annotations in annotation arguments 2023-09-14 13:21:07 +00:00
Artem Kobzar 878452bd2b [K/JS] Implement file merging for clashed file during per-file compilation 2023-09-14 13:14:15 +00:00
Ilya Muradyan 337054ba92 Scripting: Remove deprecated MavenRepositoryCoordinates class 2023-09-14 12:14:32 +00:00
Ilya Muradyan f1f12bc192 Scripting: Reuse AetherSession if repositories didn't change
Repository system will be not reconstructed on subsequent calls
2023-09-14 12:14:32 +00:00
Ilya Muradyan b1347d7616 Scripting: Unify artifacts resolution for partial and non-partial cases 2023-09-14 12:14:32 +00:00
Ilya Muradyan 841cc8eb43 Scripting, KT-61727: Make it possible to resolve multiple artifacts at once
For MavenDependenciesResolver it improves performance drastically
depending on how strong transitive dependencies of the roots interfere

^KT-61727 Fixed
2023-09-14 12:14:32 +00:00
Kirill Rakhman 0d628c9e59 [FIR] Inline FirExpression.coneTypeSafe und use resolvedType
The call-sites don't actually need to handle unresolved expressions,
they only need safe-casts to ConeClassLikeType or
ConeIntegerLiteralType.

#KT-61367
2023-09-14 10:03:03 +00:00
Kirill Rakhman a4fff7c7c0 [FIR] Inline FirExpression.coneTypeUnsafe
#KT-61367
2023-09-14 10:03:03 +00:00
Kirill Rakhman 126f2c9440 [FIR] Skip published visibility computation for local functions
This fixes an exception caused by annotations being unresolved during
 status computation.

#KT-61367
2023-09-14 10:03:02 +00:00
Kirill Rakhman f0112040fc [FIR AA] Unmute passing test 2023-09-14 10:03:02 +00:00
Kirill Rakhman aebb3bf0ee [FIR AA] Use resolvedType instead of coneTypeOrNull where applicable
#KT-61367 Fixed
2023-09-14 10:03:02 +00:00
Kirill Rakhman 6d8091f0ff [FIR] Add workaround for unresolved array literal type #KT-61843
#KT-61367
2023-09-14 10:03:02 +00:00
Kirill Rakhman 462687ed66 [FIR] Don't resolve call in annotation arguments phase if receiver type isn't resolved
This prevents exceptions from being thrown during resolution of red code
because FirExpression.resolvedType is called but during annotation
arguments phase we don't have return types for implicitly typed
declarations.

#KT-61367
2023-09-14 10:03:02 +00:00