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
ede6eb0b34
[IR] Print exception's class in error message from interpreter
2023-09-14 08:47:06 +00:00
Ivan Kylchik
2df5b48474
[IR] Report error from IR interpreter on field recursive initialization
...
#KT-59890
#KT-61802 Fixed
2023-09-14 08:47:06 +00:00
Ivan Kylchik
1843eeb16b
[FIR] Drop visualizer module
...
This module was created to compare type resolve in K1 and K2. But
overall, these tests contain a lot of bugs, and it is quite hard
to use it.
2023-09-13 12:55:14 +00:00
Ivan Kylchik
2cd504b675
[FIR] Drop old TODO from LightTreeRawFirDeclarationBuilder
...
There is no description and no information that we suppose
to fix.
2023-09-13 12:55:13 +00:00
Ivan Kylchik
5d88a1f1c3
[Native] Rename Lowerings to NativeLoweringPhases
...
This is done to unify the way how we name file
that contains lowerings in different backends.
2023-09-11 10:04:50 +00:00
Ivan Kylchik
386d69018d
[JVM] Rename JvmLower to JvmLoweringPhases
...
This is done to unify the way how we name file
that contains lowerings in different backends.
2023-09-11 10:04:50 +00:00
Ivan Kylchik
6048d52a97
[K2] Avoid field inlining during FIR2IR phase
...
Before const inlining for fields, we actually want to remember a given
field in `InlineConstTracker`. We are doing it already in const
evaluation. So we just need to ignore const inlining in
`CallAndReferenceGenerator` and delegate it to const evaluation.
#KT-60737
2023-09-07 19:12:18 +00:00
Ivan Kylchik
40c9f831e2
[Native] Drop IrUtils2 file
2023-09-05 11:21:51 +00:00
Ivan Kylchik
8142ae2579
[Native] Drop irCatch from IrUtils2
2023-09-05 11:21:51 +00:00
Ivan Kylchik
c2076a0227
[Native] Move hasNonConstInitializer from IrUtils2
...
This function could be useful for other backends.
2023-09-05 11:21:51 +00:00
Ivan Kylchik
ddde95bd78
[Native] Move irByte from IrUtils2
...
We already have similar functions in `ExpressionHelpers`. Makes
sense to keep them together.
2023-09-05 11:21:51 +00:00
Ivan Kylchik
d62323cdf1
[Native] Move addTopLevelInitializer from IrUtils2
...
This function is actually used only in `InteropLowering` and it
is too specific to be included into utils.
2023-09-05 11:21:51 +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
Ivan Kylchik
2657adc6dc
[Native] Move addFile from IrUtils2
...
This function is actually used only in `BackendPhases` and it is
too specific to be included into utils.
2023-09-05 11:21:50 +00:00
Ivan Kylchik
4fb29a5e12
[Native] Drop addArguments from IrUtils2
...
We can simplify single usage of this function
2023-09-05 11:21:50 +00:00
Ivan Kylchik
20165dd699
[Native] Drop defaultOrNullableType from IrUtils2
...
We can simplify most usages of `defaultOrNullableType`
2023-09-05 11:21:50 +00:00
Ivan Kylchik
583a5496d5
[Native] Drop irCall from IrUtils2
...
We can reuse the same function from common `ExpressionHelpers`
2023-09-05 11:21:50 +00:00
Ivan Kylchik
5c68ea2b64
[Native] Simplify irCatch from IrUtils2
2023-09-05 11:21:50 +00:00
Ivan Kylchik
8cc4db39d2
[Native] Drop copy from IrUtils2
...
It is not used anywhere
2023-09-05 11:21:50 +00:00
Ivan Kylchik
b3474ac730
[Native] Drop irBuilder from IrUtils2
...
We can reuse `createIrBuilder` function
2023-09-05 11:21:50 +00:00
Ivan Kylchik
9e750e900d
[Native] Drop createField from IrUtils2
...
We can call `IrFieldImpl` directly, the same way it is done
for other IR declarations in `CBridgeGen` file.
2023-09-05 11:21:50 +00:00
Ivan Kylchik
7e71e778c9
[Native] Drop stub from IrUtils2
...
It is not used anywhere
2023-09-05 11:21:50 +00:00
Ivan Kylchik
b10d330cfd
[Native] Drop getContainingFile from IrUtils2
...
We can reuse `fileOrNull` function from common `IrUtils`
2023-09-05 11:21:50 +00:00
Ivan Kylchik
a437e0378a
[Native] Drop irCallOp from IrUtils2
...
It is not used anywhere
2023-09-05 11:21:50 +00:00
Ivan Kylchik
4376e58acb
[Native] Drop createArrayOfExpression from IrUtils2
...
We can reuse the same function from common `IrUtils`
2023-09-05 11:21:50 +00:00
Ivan Kylchik
962172f96d
[Native] Drop irSetVar from IrUtils2
...
We can reuse `irSet` function
2023-09-05 11:21:50 +00:00
Ivan Kylchik
9ab053a3a6
[Native] Drop substitute from IrUtils2
...
We can reuse the same function from common `IrTypeUtils`
2023-09-05 11:21:50 +00:00
Ivan Kylchik
d0a5738499
[Native] Drop addChild from IrUtils2
...
We can reuse the same function from common `IrUtils`
2023-09-05 11:21:50 +00:00
Ivan Kylchik
3efe07d0cb
[Native] Drop getArgumentsWithIr from IrUtils2
...
We can reuse the same function from common `IrUtils`
2023-09-05 11:21:49 +00:00
Ivan Kylchik
abc061e17f
[IR] Restore and fix ifConstVal test
...
It was accidentally dropped after KT-55196 fix.
2023-09-05 11:06:43 +00:00
Ivan Kylchik
2537ff94b7
[Native] Move StringTable and its builder to separate file
2023-09-05 08:35:48 +00:00
Ivan Kylchik
86b4d36b54
[Native] Make StringTable and its builder internal
2023-09-05 08:35:47 +00:00
Ivan Kylchik
70697af6b9
[Native] Move proto utils from KonanIrLinker into separate utils file
2023-09-05 08:35:47 +00:00
Ivan Kylchik
66b9c2f260
[Native] Move FORWARD_DECLARATION_ORIGIN into KonanForwardDeclarationModuleDeserializer
2023-09-05 08:35:47 +00:00
Ivan Kylchik
cc906ad6d5
[Native] Move INVALID_INDEX into KonanPartialModuleDeserializer
2023-09-05 08:35:47 +00:00
Ivan Kylchik
79fa0d2648
[Native] Move KonanForwardDeclarationModuleDeserializer to a separate file
2023-09-05 08:35:47 +00:00
Ivan Kylchik
7d1c929fb5
[Native] Make KonanForwardDeclarationModuleDeserializer nested instead of inner
2023-09-05 08:35:47 +00:00
Ivan Kylchik
701dc72f70
[Native] Move KonanInteropModuleDeserializer to a separate file
2023-09-05 08:35:47 +00:00
Ivan Kylchik
6d0b936639
[Native] Make KonanInteropModuleDeserializer nested instead of inner
2023-09-05 08:35:47 +00:00
Ivan Kylchik
5661316d7a
[Native] Use FORWARD_DECLARATIONS_MODULE_NAME instead of hardcoded value
2023-09-05 08:35:47 +00:00
Ivan Kylchik
3fba699c49
[Native] Move KonanPartialModuleDeserializer to a separate file
2023-09-05 08:35:47 +00:00
Ivan Kylchik
13a39c82ae
[Native] Make KonanPartialModuleDeserializer nested instead of inner
2023-09-05 08:35:47 +00:00
Ivan Kylchik
bf7f2afe5d
[Native] Rename KonanIrlinker to KonanIrLinker
2023-09-05 08:35:47 +00:00
Ivan Kylchik
66650d2dcc
[Native] Drop IrSerializationUtil file
...
Most methods from there are unused
2023-09-05 08:35:47 +00:00
Ivan Kylchik
852d829d83
[Native] Drop KonanFileMetadataSource class
...
Replaced it with more common `DescriptorMetadataSource.File`
2023-09-05 08:35:47 +00:00
Ivan Kylchik
36373ddfa7
[Native] Drop unused CodegenStaticFieldMetadata class
2023-09-05 08:35:46 +00:00
Ivan Kylchik
d13d249640
[Native] Drop excess cast from isExternalObjCClass method
2023-09-05 08:35:46 +00:00
Ivan Kylchik
a35defc682
[Native] Replace KonanIrModuleFragmentImpl with IrModuleFragmentImpl
2023-09-05 08:35:46 +00:00
Ivan Kylchik
dfa60ee092
[IR] Drop TODO from IrModuleFragmentImpl
...
This TODO doesn't have any description, and it is already
hard to understand what the author meant.
2023-09-05 08:35:46 +00:00
Ivan Kylchik
6a9c50325e
[Generator] Add otherKind parameter to conversion methods
2023-08-24 08:59:49 +00:00
Ivan Kylchik
adce2c9a78
[WASM] Replace deprecated Char.toInt() with Char.code
2023-08-24 08:59:49 +00:00
Ivan Kylchik
ee973c0ede
[Generator] Generate Char class
2023-08-24 08:59:49 +00:00
Ivan Kylchik
38e434bc07
[Generator] Generate Boolean class
2023-08-24 08:59:49 +00:00
Ivan Kylchik
097535aeea
[Generator] Replace IntrinsicConstEvaluation string with const property
2023-08-24 08:59:49 +00:00
Ivan Kylchik
2b5f839fac
[IR] Minor: backend refactoring
2023-08-11 12:19:45 +00:00
Ivan Kylchik
55092da03b
[PSI2IR] Check that a given function has the right descriptor
...
The issue was discovered during work on IR serialization and
this is just a safety check.
#KT-56230
2023-08-11 12:19:45 +00:00
Ivan Kylchik
5f2de9dbff
[IR] Create primitive iterators in IrBuiltIns
...
This change is required to fix stdlib compilation with enabled
linking via signature. All primitive iterators are considered to be
builtins and are created during compile time as deserialized
declarations (at least in K1). But if we meet the definition of some
primitive iterator in code, for example, during stdlib compilation,
we will end up with two different descriptors (deserialized and lazy)
that describe the same entity. Because of that we have conflicts in
symbol table:
* For descriptors, we will end up with multiple IR declarations
that describe the same class, but with different descriptors. With
some magic compilation still works.
* For signatures, we will end up with only one IR declaration in the
table, but it will have wrong deserialized (instead of lazy)
descriptor.
In the end, this change allows us to initialize iterators in advance
with correct descriptor.
#KT-56230
2023-08-11 12:19:45 +00:00
Ivan Kylchik
782d5e86f6
[IR] Replace reference* with toIrSymbol in IrBuiltinsOverDescriptors
...
This change is a minor refactoring that introduces `toIrSymbol`
method for function and property descriptors, like it is done for
class descriptor.
2023-08-11 12:19:45 +00:00
Ivan Kylchik
7cbf3b28ca
[K2] Properly serialize annotation that has vararg with single argument
...
#KT-60163 Fixed
2023-08-08 07:01:48 +00:00
Ivan Kylchik
ecdb08952b
[IR] Restore compatibility with IDEA after moving toIrConst function
...
#KT-60744 Fixed
2023-07-31 09:01:19 +00:00
Ivan Kylchik
fe9de6875a
[FIR2IR] Use a fully expanded type when generating IrClassReference
...
#KT-60639 Fixed
2023-07-28 09:02:45 +00:00
Ivan Kylchik
7e5e2fe1e4
[FIR] Drop dependency on ir.serialization from fir-serialization
2023-07-28 09:02:44 +00:00
Ivan Kylchik
88191e8b1a
[IR] Add new test to check that nullable access to enum is not evaluated
...
Just a safety check. If an expression like `EnumClass.Value?.name` was
evaluated, we would consider it as breaking change.
2023-07-27 22:50:21 +00:00
Ivan Kylchik
d0da736b13
[FIR] Add the new test set to render diagnostics from IR const evaluator
2023-07-27 22:50:21 +00:00
Ivan Kylchik
87b3d69d1b
[FIR] Add new error diagnostic EVALUATION_ERROR
...
This diagnostic will be used to report errors from IR constant
evaluator.
2023-07-27 22:50:21 +00:00
Ivan Kylchik
84159596bd
[FIR] Pass diagnosticReporter in Fir2IrConfiguration
...
This parameter will be used to report diagnostics from constant
evaluator, in addition to report diagnostic from actualizer.
2023-07-27 22:50:21 +00:00
Ivan Kylchik
6e45c9d4c7
[Test] Drop convertToIr method from AbstractFirAnalyzerFacade
...
We are going to use `convertToIr` from `ModuleCompilerAnalyzedOutput`
without an intermediate wrapper.
2023-07-27 22:50:21 +00:00
Ivan Kylchik
3c9eb87c8d
[Test] Reuse buildFir... methods from firUtils.kt
2023-07-27 22:50:21 +00:00
Ivan Kylchik
34f8228441
[Test] Reuse runResolution and runCheckers from analyze.kt
2023-07-27 22:50:20 +00:00
Ivan Kylchik
d4a7b7a1f6
[Test] Drop unused parameters from FirAnalyzerFacade
2023-07-27 22:50:20 +00:00
Ivan Kylchik
1d1b0092a3
[Test] Make createModuleFragmentWithSignaturesIfNeeded to be called once
2023-07-27 22:50:20 +00:00
Ivan Kylchik
a56b462eb6
[IR] Reuse IR utils functions to find methods of Any in interpreter
2023-07-24 17:20:39 +00:00
Ivan Kylchik
1eca5d1a3b
[IR] Rewrite how interpreter works with the Unit result
...
This way interpreter works in more correct way. Every expression
produces some result, and if we don't need it, the interpreter will
discard it.
2023-07-24 17:20:39 +00:00
Ivan Kylchik
6204119219
[IR] Simplify logic of constructing unsigned number in interpreter
...
This way it is a little less "hacky". We are looking only for "data"
property, and as long as this property is declared in constructor, we
can safely assume we will get the correct one even if it is
renamed.
2023-07-24 17:20:39 +00:00
Ivan Kylchik
d795ce3582
[IR] Simplify logic of interpretCall
...
Drop excess call of `callStack.loadState(it)` when store state for
extension receiver. When we interpret lambda with extension receiver,
this receiver will be actually represented as a value parameter,
and it required some additional processing. Apparently, after all
interpreter's refactorings, this does not matter anymore and excess
call can be dropped.
2023-07-24 17:20:39 +00:00
Ivan Kylchik
30c00f7983
[IR] Specify explicitly that classes from Java can be interpreted
...
In early prototypes of interpreter, it was easier to assume that
all classes from Java can be interpreted and fix something if not.
Check for Java declaration was done by checking that the package name is
starting with "java". But this is actually wrong and can lead to errors
when some code is declared in "java" something package, but is not from
Java stdlib.
#KT-60467 Fixed
2023-07-20 09:40:42 +00:00
Ivan Kylchik
7fd601b336
[JVM_IR] Unify code between fake variables lowerings
...
#KT-58778 Fixed
2023-07-20 09:01:43 +00:00
Ivan Kylchik
1dec9fc675
[JVM_IR] Move methods that generate LN into LineNumberMapper class
2023-07-20 09:01:43 +00:00
Ivan Kylchik
b10f6907a7
[JVM_IR] Slightly rewrite SwitchGenerator to improve readability
2023-07-20 09:01:42 +00:00
Ivan Kylchik
ecd20b1348
[JVM_IR] Properly handle inlined local var located in regenerated object
...
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik
17e49fce75
[JVM_IR] Support basic fake var generation for IR inliner
...
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik
5a09ca6908
[JVM] Slightly rewrite inliner code to understand it more easily
2023-07-20 09:01:42 +00:00
Ivan Kylchik
286090a1db
[IR] Drop inlinePureArguments parameter from FunctionInlining
...
Replaced its usages with `alwaysCreateTemporaryVariablesForArguments`
2023-07-20 09:01:42 +00:00