Ivan Kylchik
d7d42134df
[JVM] Don't analyze KtCodeFragment's file twice
...
We could get several files from the IDE to analyze. For example, some
code fragment and a file with context information. This additional
file, in fact, can be a file where a code fragment is defined, and we
can accidentally analyze a single file twice that leads to errors.
2023-11-16 15:59:48 +00:00
Ivan Kylchik
d6f0530215
[JVM] Use getContextContainingFile method in CodegenBinding
2023-11-16 15:59:48 +00:00
Alexander Udalov
6a0a64eb6d
JVM: remove usages of trove4j
...
#KTI-1135
2023-11-10 21:56:34 +00:00
Ivan Kochurkin
1827df82c4
Removed useless as casts from compiler code
...
It allows compiling code with K2 and enabled `-Werror`
2023-10-24 20:59:56 +00:00
Dmitriy Novozhilov
704e2ef5c5
Suppress K2 specific warnings in the codebase
...
^KT-62472
2023-10-18 07:59:27 +00:00
Alexander Udalov
9fd1445631
JVM: use metadata version 1.9 for .kotlin_module if LV=2.0
...
See the comment in the code for more info.
No proper test added because the compiler test infrastructure lacks the
ability to run old compiler versions, however I've verified manually
that the change fixes the issue.
#KT-62531 Fixed
2023-10-16 12:45:47 +00:00
Ivan Kylchik
a30d0aeeb0
[JVM] Replace AbstractInsnNode.getType with new util function
...
This change speeds up backend by approximately 0.96%.
2023-10-13 08:50:47 +00:00
Ivan Kylchik
67460962c3
[JVM] Use HashSet instead of SmartSet in MaxStackFrameSizeAndLocalsCalculator
...
This change speeds up backend by approximately 0.25%.
2023-10-13 08:50:47 +00:00
Ivan Kylchik
05b364a5f1
[JVM] Simplify equals method in StrictBasicValue
2023-10-13 08:50:47 +00:00
Ivan Kylchik
96a2da4906
[JVM] Split mergeControlFlowEdge into full and fast versions
...
This is needed because for `FastStackAnalyzer` we actually
will use only `fast` version, that can potentially improve overall
performance.
2023-10-12 13:04:43 +00:00
Ivan Kylchik
07c7792693
[JVM] Drop toArray call where iterator can be used
2023-10-12 13:04:43 +00:00
Ivan Kylchik
2387fe302c
[JVM] Use reference comparison for objects defined in StrictBasicValue
2023-10-12 13:04:43 +00:00
Ivan Kylchik
c1c04376cf
[JVM] Replace open functions in FastAnalyzer with constructor args
2023-10-12 13:04:43 +00:00
Ivan Kylchik
99655cfa15
[JVM] Make newFrame constructor's parameter for FastAnalyzer
2023-10-12 13:04:43 +00:00
Ivan Kylchik
cfe38470af
[JVM] Use composition instead of inheritance in FixStackAnalyzer
...
This way we will be able to pass `createFrame` argument
directly to `FastAnalyzer`.
2023-10-12 13:04:43 +00:00
Ivan Kylchik
2327800a95
[JVM] Make BoxingInterpreter an abstract class instead of open
...
This way, it is a little bit easier to fit the semantics of this
class in the head.
2023-10-12 13:04:43 +00:00
Ivan Kylchik
38dd75c6c8
[JVM] Drop boxingInterpreter constructor parameter from BoxingFrame
2023-10-12 13:04:43 +00:00
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