Commit Graph

596 Commits

Author SHA1 Message Date
Nikita Bobko 73149fdf0b Cleanup: Use concrete subclass instead of BinaryVersion when possible
Review: https://jetbrains.team/p/kt/reviews/8401

BinaryVersion is a problematic class, because it doesn't represent any
logical entity in the codebase, it's just a way to reuse common logic
for Kotlin versions. But unfortunately, BinaryVersion is used in a lot
of API definitions, which makes code hard to read because it's not
obvious which subclasses are supposed to be passed in the particular
API.
2023-02-01 15:13:34 +01:00
Roman Efremov 14b4cdc7c4 Write "hasEnumEntries" flag into metadata when feature enabled
^KT-53929 Fixed
2023-01-23 12:53:04 +01:00
Sergej Jaskiewicz 1f76d39e66 [IR] Make IrTypeArgument a sealed interface 2023-01-20 10:58:28 +00:00
Mikhail Glukhikh 89dd28226b BinaryVersion: introduce isCompatibleWithCurrentCompilerVersion 2023-01-16 18:12:55 +01:00
Alexander Korepanov 155777e3fa [JS IR] Detect broken cross-module references
The patch adds an error if the module can not find the cross-module reference.

 The patch removes the DCE optimization which eliminates implement() intrinsic,
 because it leads to a broken cross-module reference and
 broken JS code with implement() call, albeit in an unreachable block.
2023-01-09 09:23:26 +00:00
Svyatoslav Scherbina 0f63cfecbd Introduce KlibMetadataHeaderFlags
This class lists possible flags for KlibMetadataProtoBuf.Header, and
helps avoid using magic constants in the source code.
2023-01-06 16:57:38 +00:00
Alexander Korepanov 3744fbb31b [JS IR] Write IrFile fingerprints to KotlinJs klib manifest
The file fingerprints are going to be used for
 a cache invalidation in JS IR incremental cache.

 It should reduce an incremental rebuild time in JS BE.

 CityHash128 is used as IrFile fingerprint.
2023-01-03 12:30:23 +00:00
Dmitriy Dolovov 4428971401 [LazyIR] Exclude INVISIBLE_FAKE callable members from class declarations
Fixes KT-55509
2023-01-02 07:38:53 +00:00
Alexander Udalov 5dd1777624 IR: minor, deprecate nameForIrSerialization, use name instead 2022-12-15 12:31:11 +00:00
Sergej Jaskiewicz 1539d7ef1a [klib] Bring package names in sync with the directory layout
Basically, some package names were Native-specific, whilst the packages
themselves were not Native-specific at all. This was already reflected
in the directory layout, but not in the package names.
This is fixed here.

NFC, just an automatic rename of packages with fixes of imports.
2022-12-01 21:46:43 +00:00
Ilya Chernikov 0fbc099d32 FIR JS: Refactor Klib serialization for FIR support 2022-11-12 14:34:07 +01:00
Ilya Chernikov 8bf108dc17 FIR JS: Prepare JS/KLib infrastructure for FIR integration
rearrange declarations, abstract things that should be done differently
with FIR, etc.
2022-11-12 14:34:07 +01:00
Alexander Korepanov dbf31b206c [Common IR] Move local class from function to avoid a leak 2022-11-01 13:46:39 +00:00
Dmitriy Dolovov f7d2dfd729 [IR] Linker: Small improvements 2022-10-20 10:18:57 +02:00
Dmitriy Dolovov f846ecf7d7 [IR] Partial linkage: Avoid overriding of private callable members
^KT-53608
2022-10-20 10:18:55 +02:00
Dmitriy Dolovov 84b3e7bfbe [IR] Minor: Code cleanup 2022-10-20 10:18:55 +02:00
Dmitriy Dolovov 71d51801ce [IR] Partial linkage fix: Implement abstract fake overrides in non-abstract classes so that there are no call sites that still refer to abstract fake overrides
^KT-53663
2022-10-20 10:18:54 +02:00
Dmitriy Dolovov 859c465b9e [IR] Rename IrFakeOverride[Function|Property] to Ir[Function|Property]WithLateBinding
^KT-53663
2022-10-20 10:18:54 +02:00
Dmitriy Dolovov 12c6015d5e [IR] Partial linkage: report the exact IR element where unlinked symbols are used 2022-10-20 10:18:52 +02:00
Dmitriy Dolovov 2f9d6f6c44 [IR] Partial linkage: Rename UnlinkedDeclarationsSupport to PartialLinkageSupport 2022-10-19 13:46:22 +00:00
Dmitriy Dolovov 15635482aa [IR] Partial linkage: Enable it by just passing a boolean flag to IR linker constructor 2022-10-19 13:46:22 +00:00
Dmitriy Dolovov a0fdf08b56 [IR] Partial linkage: unify UnlinkedDeclarationsSupport for JS and Native backends 2022-10-19 13:46:21 +00:00
Pavel Kunyavskiy 95eaf3d234 [K/N] Add lowered suspend function mangling to avoid clashes 2022-09-30 08:48:59 +00:00
Dmitriy Dolovov e4556ecc0d [IR] User-friendly message about unexpected unlinked symbols
^KT-53649
2022-09-13 17:12:13 +00:00
Nikita Bobko 2a4f3f41aa 2/5 Replace source dependency on kotlin-reflect with binary dependency
Review: https://jetbrains.team/p/kt/reviews/6753

Meaningful semantic change was splitted into 5 commits to simplify the
change review. Sinle commit would be too big.

Why replace source to binary: to get rid of kotlin-reflect in Kotlin
plugin artifact KTIJ-22276

Note: Kotlin Maven artifacts (./gradlew publish) changed their
dependency on kotlin-reflect
2022-08-22 15:43:49 +02:00
Nikita Bobko 0874fb71c6 Replace all kotlin-reflect-api dependencies with kotlin-reflect
Review: https://jetbrains.team/p/kt/reviews/6753

Why: I'm going to replace source dependency on kotlin-reflect with
binary dependency. Normalize reflect dependency before global
processing.
2022-08-22 15:43:11 +02:00
Vsevolod Tolstopyatov 1b6a43ba69 Update IR serialization to reflect changes in IrSyntheticBodyKind for enum entries
#KT-48872
2022-08-12 09:35:19 +00:00
Igor Chevdar 7e79b2b500 [K/N][IR][codegen] Preliminary support of per-file caches 2022-08-06 17:40:23 +00:00
Dmitriy Dolovov 532b9e2c5f [Native][IR] Partial linkage support for cached inline functions
- Support partial linkage for declarations from inline functions that are lazily deserialized from a KLIB with static cache
- Linker API: Split IrModuleDeserializer.deserializeIrSymbol() into deserializeIrSymbolOrFail() and tryDeserializeIrSymbol()
- Linker API: Refactor KotlinIrLinker.handleSignatureIdNotFoundInModuleWithDependencies() to deserializeOrReturnUnboundIrSymbolIfPartialLinkageEnabled()

^KT-52478
2022-07-18 17:29:50 +02:00
Dmitriy Dolovov 6a227236f8 [IR] Fix location in logging warnings about unlinked symbols 2022-07-18 17:29:50 +02:00
Dmitriy Dolovov f9d7f54838 [IR] Fix unlinked type for variables 2022-07-18 17:29:50 +02:00
Dmitriy Dolovov 2cf5d26edc [IR] JsIrLinker: Drop excessive maybeWrapWithBuiltInAndInit() function
^KT-52478
2022-07-18 17:29:50 +02:00
Igor Chevdar 747bff4036 [K/N][caches] Fixed parents for deserialized on demand inline function
#KT-52974 Fixed
2022-07-10 17:56:37 +00:00
Dmitriy Novozhilov 83d0a3e7a3 [FIR] Extract FirPluginKey into :core:compiler.common and rename it to GeneratedDeclarationKey
This is needed to avoid dependency on :compiler:fir:fir2ir module in
  backend parts of compiler plugins. It will allow to publish those
  parts into jars for IDE, where they are needed for working of debugger
  and bytecode toolwindow
2022-06-07 14:12:25 +00:00
Georgy Bronnikov ad625a4631 Fir2Ir: deal with Java fields in FirIrProvider 2022-05-19 12:02:43 +02:00
Georgy Bronnikov 0ef474a8d3 Do not set parent for deserialized IR declarations 2022-05-19 12:02:42 +02:00
Georgy Bronnikov 0012ba79e1 Fir2Ir: rework FirIrProvider 2022-05-19 12:02:41 +02:00
Dmitriy Dolovov 8de4eb798c [IR] Fix removal-of-abstract-fun IR linkage case
^KT-50771
2022-05-18 18:05:09 +03:00
Igor Chevdar f62e4e7b97 [klibs] Refactored BasicIrModuleDeserializer 2022-04-28 19:11:14 +00:00
Igor Chevdar 31eedebec6 [klibs] Added deserialization strategy: on-demand
With on-demand strategy only file header is deserialized
2022-04-28 19:11:13 +00:00
Igor Chevdar 231fe42c0a [klibs] Fixed a bug in the signature-to-descriptor searcher
#KT-51927 Fixed
2022-04-14 07:33:56 +00:00
Pavel Kunyavskiy 7ba4d9e1f0 Rework nullability in IR 2022-03-30 06:27:59 +00:00
Evgeniy.Zhelenskiy 28bf83ceac [IR] Unite inline class and multi-field value class representation
#KT-1179
2022-03-24 11:38:43 +00:00
Victor Petukhov b5933c70e2 [FE 1.0] Refactor error utils: split error entities and introduce error type and error scope kinds 2022-03-23 21:13:33 +00:00
Sergey Bogolepov 2f46a45bfd [IR] Deserialize annotation classes as open
Compiler backend relies on the fact that all annotation classes have
OPEN modality. This is not the case for libraries that were compiled
before 1.6.20. 948dc4f3 fixes compatibility for Lazy IR, here we do the
same for IR deserializer.

^KT-51302 fixed
2022-02-17 11:12:57 +00:00
Roman Artemev 412194dd75 [KLIB] Fix DNN type key in serializer 2022-02-11 18:24:32 +00:00
Dmitry Petrov 1fd2b9c9d9 IR fix DNN type mangling 2022-02-11 18:24:32 +00:00
Alexander Udalov 6379fe4c4c JVM IR: link via descriptors instead of signatures by default
Doing so speeds up psi2ir ~2 times, and thus improves total compiler
performance by about 6-8%.

Unless JVM IR is in the mode where linking via signatures is the only
way (-Xserialize-ir, -Xklib), signatures are actually not needed at all,
SymbolTable can use the frontend representation (descriptors for FE1.0,
and hopefully FIR elements for K2) as hash table keys. The only catch is
that since other backends still need to work with signatures, all the
common IR utilities, such as irTypePredicates.kt, need to work correctly
for IR elements both with signatures and without.

Also, introduce a fallback compiler flag -Xlink-via-signatures, in case
something goes wrong, to be able to troubleshoot and workaround any
issues.

 #KT-48233
2022-02-03 02:48:05 +01:00
Igor Chevdar 949e222305 [IR] Fixed a problem with signature search
The function findDescriptorBySignature should return null if no such signature has been found
letting the caller to handle this correctly. Fixes https://youtrack.jetbrains.com/issue/KT-50976
2022-02-02 22:46:16 +05:00
Georgy Bronnikov d2418a1329 IR: never attach return type to signatures of fake overrides
Cases that necessitate the return type hack (see KT-46042) always
involve exactly two methods, exactly one of which is a fake override. It
is sufficient to mark one of them.
2022-01-27 01:02:25 +03:00