Commit Graph

5941 Commits

Author SHA1 Message Date
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
Alexander Udalov 874d1c514a JVM: support enumEntries intrinsic for Kotlin enums
Implementation is very similar to the `enumValues` intrinsic.

Java enums and old (pre-1.9) Kotlin enums will be supported in a
subsequent commit.

 #KT-59710
2023-07-25 09:55:43 +00:00
Ivan Kylchik 5a09ca6908 [JVM] Slightly rewrite inliner code to understand it more easily 2023-07-20 09:01:42 +00:00
Ivan Kochurkin 20c53fc15d Unify JvmSignatureSerializer 2023-07-12 13:11:25 +00:00
vladislav.grechko e4f1c10bc1 [JVM_IR] Do not compile-time evaluate apiVersionIsAtLeast in stdlib
Function `apiVersionIsAtLeast` was introduced to be able to have
different inline function content inlined to user code call sites
depending on their api version settings. Thus, it should not be
compile-time evaluated when being called in the body of inline stdlib
function.

^KT-59452: Fixed
2023-06-19 16:24:57 +00:00
Abduqodiri Qurbonzoda fd4d4f516f Fix data class hashcode generation
It considers Boolean hashCode equal to 1/0 for true/false,
which is different from actual hashCode of the Boolean type.
2023-06-14 08:19:47 +00:00
Alexander Udalov b8785fbd90 K2: do not support disabling NoSourceCodeInNotNullAssertionExceptions
Disabling of this language feature (see KT-57570) was not supported in
the (default) light tree mode, and after this change it will not be
supported in the PSI mode as well. This makes the behavior more
consistent and allows us to remove the directive
IGNORE_BACKEND_K2_LIGHT_TREE in the future (KT-56757).
2023-06-06 10:06:39 +00:00
Alexander Udalov ad1dfd5cb9 JVM: change logic of applying KT-57570 behavior a bit
If `-Xno-unified-null-checks` is specified, do not throw exceptions, but
rather revert to the old behavior, with source code in exception
messages.

Note that `-Xno-unified-null-checks` is a flag which enables behavior of
Kotlin 1.3. It can be removed once we no longer support API version 1.3.
2023-05-24 11:29:51 +00:00
Alexander Udalov fb900d2e2a JVM: remove most usages of JvmTarget.JVM_1_6 2023-05-19 13:24:00 +00:00
Alexander Udalov fc0ce415d7 JVM: remove source code from not null assertion message text
This is implemented under a LanguageFeature which will be enabled later,
when behavior change described in KT-57570 is approved.

 #KT-57570
2023-04-28 10:26:15 +00:00
Roman Golyshev d4cffb8a5a [213] Switch to 213 platform
KTI-1114
2023-04-21 13:19:04 +00:00
Pavel Mikhailovskii 3bb66e8432 KT-57714 Fix remapping of signatures with reified type parameters 2023-04-19 07:20:51 +00:00
Ilmir Usmanov b36e1f1a5b Do not reference object's toString result in exception messages
Since we put object's hash code in toString, we end up in putting
non-stable hash code to constant table, which leads to unstable
binaries.

 #KTI-1193 Fixed
2023-04-04 13:41:03 +00:00
Ivan Kylchik 71487e534b Reuse some available variables in JVM backend 2023-03-14 20:47:40 +00:00
Ivan Kylchik 32a7633c06 Support smap creation for functions inlined with IR inliner 2023-03-14 20:47:38 +00:00
Evgeniy.Zhelenskiy 3b5ad0681f [IR] Fix compiler bugs with MFVC to let KorGE run
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2023-03-13 13:09:56 +00:00