Commit Graph

5956 Commits

Author SHA1 Message Date
Ivan Kylchik 6d57cbe23c [JVM] Reorganize positions of methods in FastAnalyzer 2023-10-12 13:04:43 +00:00
Ivan Kylchik 895afc736d [JVM] Drop I : Interpreter<V> type parameter from FastAnalyzer 2023-10-12 13:04:43 +00:00
Ivan Kylchik 87c46db3d5 [JVM] Drop getFrame and setFrame methods from FastAnalyzer 2023-10-12 13:04:43 +00:00
Ivan Kylchik f7f253d2bf [JVM] Move isTcbStart computation in FastAnalyzer 2023-10-12 13:04:43 +00:00
Ivan Kylchik 53d9b3c54f [JVM] Combine all mergeControlFlowEdge methods
This is just a refactoring commit. All fast analyzers are doing the
same thing in `mergeControlFlowEdge`, so we extract it in common
`FastAnalyzer`. The only exception is `FastStackAnalyzer`.
There was no `isMergeNode` check, but this is an optimization
that allows us to reuse a frame and not copy it.
2023-10-12 13:04:42 +00:00
Ivan Kylchik 68e4a7a318 [JVM] Combine all analyzeInstruction methods 2023-10-12 13:04:42 +00:00
Ivan Kylchik 58473b94a7 [JVM] Reuse visitNopInsn method in all Fast...Analyzer classes 2023-10-12 13:04:42 +00:00
Ivan Kylchik ed95ebc585 [JVM] Move visit...Insn methods in FastAnalyzer
They are actually the same.
2023-10-12 13:04:42 +00:00
Ivan Kylchik 7845e6bb0a [JVM] Drop visitControlFlowExceptionEdge method from FastStackAnalyzer
There is no class that overrides this method.

Also replaced `newValue` call with `newExceptionValue`. Under the hood,
`newExceptionValue` still calls `newValue` if the interpreter doesn't
redefine it. And it kind of makes sense to call `newExceptionValue`
here because we are handling try-catch block.
2023-10-12 13:04:42 +00:00
Ivan Kylchik e9019e9fb3 [JVM] Drop StoreLoadInterpreter class 2023-10-12 13:04:42 +00:00
Ivan Kylchik 364faa9506 [JVM] Drop StoreLoadValue interface 2023-10-12 13:04:42 +00:00
Ilya Kirillov f11cb277cd Remove obsolete @OptIn(ExperimentalStdlibApi::class) annotations
They were added when `buildList`, `buildMap` and `buildSet` were experimental.

^KT-62510
2023-10-12 10:41:00 +00:00
Alexander Udalov 9943c7078c JVM: add more flags to JvmBackendConfig
And use them instead of CompilerConfiguration, to reduce dependencies of
backend on the whole compiler (as opposed to just backend)
configuration.
2023-10-02 14:58:24 +00:00
Alexander Udalov 72b5123fc8 JVM: reduce usages of GenerationState in favor of JvmBackendConfig
To help in decoupling JVM IR from the old JVM backend.
2023-10-02 14:58:23 +00:00
Dmitriy Novozhilov 9e5ee3afa0 [FE] Add isLocal name to ClassId constructor calls where it needed 2023-09-21 12:40:44 +00:00
Nikolay Lunyak ec9cb8beb6 [FIR] Rename JvmNames -> JvmStandardClassIds
This is more consistent with the code of
the common compiler checkers.

It would be nice to refactor the contents
of this object further, but it's out
of scope of the current branch.

^KT-54596
2023-09-19 22:14:09 +00:00
Nikolay Lunyak 986f1624ec [FIR] Remove jvm-specific annotations from common compiler code
^KT-54596 Fixed
2023-09-19 22:14:09 +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
Ivan Kylchik 5cd96831dc [Native] Move isRestrictedSuspendFunction from IrUtils2
This function is also helpful for JVM backend.
2023-09-05 11:21:50 +00:00
Iaroslav Postovalov 059046a2b1 [JVM] Micro-optimize method signature mapping
This commit optimizes functions related to method signature mapping on
the JVM backend. The most significant change is avoiding re-allocations
in StringBuilder when building internal names. The commit also includes
minor optimizations, such as removing redundant allocations of strings
and other objects.
2023-09-01 20:26:17 +00:00
Alexander Udalov dc2deea04c JVM: remove unnecessary check in StrictBasicValue.equals
Types are already checked for equality several lines below.
2023-08-30 15:35:43 +00:00
Alexander Udalov 12bbdebed2 JVM IR: support value classes only when feature is enabled
Remove NeedsToVisit because it doesn't really help with performance, and
it significantly increases code complexity.
2023-08-30 15:35:43 +00:00
strangepleasures ece40ca775 Lazy evaluation of an error prefix in MethodInliner (performance optimization) 2023-08-30 09:51:54 +00:00
Vladislav Grechko f11c96cba2 Use handwritten tokenizer for SMAP parsing
SMAP parsing is a hot spot. Handwritten tokenization significantly boosts the performance.

See ^KT-61527
2023-08-29 21:28:50 +00:00
Vladislav Grechko d97e8ae456 Use Enum.entries instead of deprecated Enum.values() 2023-08-29 16:30:57 +00:00
Ilmir Usmanov e333716fbe JVM: Optimize isPrimitiveBoxing and isPrimitiveUnboxing
Precompute internal names and method descriptors instead of computing
on every access.
2023-08-29 12:15:31 +00:00
Bogdan Mukvich 7b00323b89 [Build] Update guava
Fix some reports from "Show Vulnerable Dependencies"

^KTI-1342
2023-08-25 14:10:37 +00:00
strangepleasures 2423b7b62f [KAPT4] KT-51982 Implement generation of @Metadata annotations in Java stubs
Also adds rendering of @Metadata annotations in Kapt3 and Kapt4 tests
(currently disabled for a few tests).

Co-authored-by: Alexander Udalov <alexander.udalov@jetbrains.com>
2023-08-17 21:43:54 +00:00
Alexander Udalov 2823fff63d K2: report DUPLICATE_CLASS_NAMES error in JVM backend
It was already reported in the K2+PSI mode, but not LT because
BuilderFactoryForDuplicateClassNameDiagnostics relied on PSI, and did
not do anything if PSI was missing.

No tests were added because it fixes the already existing test
`compiler/testData/cli/jvm/fileClassClashMultipleFiles` after the
project is migrated to 2.0.

 #KT-59586
2023-07-31 18:51:00 +00:00
Alexander Udalov 96ddd9bbf3 K2: report INLINE_CALL_CYCLE error in JVM backend
This fixes the following
FirLightTreeDiagnosticsTestWithJvmIrBackendGenerated tests:

  testPropertyInlineCycle
  testInlineCycle
  testSuspendInlineCycle
  testIndirectInlineCycle

 #KT-59586
2023-07-29 01:14:29 +02:00
Alexander Udalov 72d048bd62 JVM: introduce JvmBackendConfig
Move language version settings, compiler configuration and different
flags there, and use this config everywhere in both backends instead of
GenerationState.

This will hopefully make GenerationState less of a "god object" and
remove the need to have it available everywhere, in particular in JVM IR
lowerings code, in the future.

Also, future refactorings will make it easier to inject backend-specific
behavior into common code, so that we would not need to handle support
of new features in the old backend.
2023-07-28 12:19:32 +00:00
Alexander Udalov 971b4e63e7 JVM: support enumEntries intrinsic for Java & old Kotlin enums
#KT-59710 Fixed
2023-07-25 09:55:43 +00:00