Commit Graph

452 Commits

Author SHA1 Message Date
Dmitriy Dolovov 4b1f739c89 [PL] Don't use trove4j in partial linkage 2023-02-23 11:40:19 +00:00
Alexander Udalov d2938e732a IR: remove IrTypeOperatorCall.typeOperandClassifier 2023-02-22 22:40:34 +00:00
Alexander Korepanov 9324cf3360 [JS IR] Support function type interfaces in incremental cache infrastructure
The patch removes logic of generating extra IrFiles (fake file) into
 IrModuleFragment for the function type interfaces during klib deserialization,
 because IC infrastructure can not process files which do not exist in klib.

 Instead of adding extra IrFiles during deserialization, the empty files
 with required packages are added into Kotlin/JS stdlib physically.
 These files are used as containers for function type interface declarations.

 Since Kotlin/WASM uses the same klib loading infrastructure as Kotlin/JS,
 the the empty files are added into Kotlin/WASM stdlib as well.

 The patch also adds a check that IrModuleFagment has files only from klib.

^KT-55720 Fixed
2023-02-03 12:23:48 +00:00
Nikita Bobko 711f36675c CompatibilityMode cleanup
Review: https://jetbrains.team/p/kt/reviews/8401

- Drop unused variables
- Replace `assert` with `require` because `assert` isn't reliable which
  makes hard to do any judgements about the code (`-ea` flag must be
  passed to the VM for the `assert` to be active. And it's hard to know
  when we the flag is passed). If `assert` was here for the performance
  reasons then a comment should have been left.
- Add the assert message for clearity

Because I'm evaluating what will break if KotlinAbiVersion is bumped.
And when the code around KotlinAbiVersion is clean it's easier to do the
evaluation.
2023-02-01 15:13:34 +01:00
Nikita Bobko 44b1cf6c46 Add docs for different metadata versions and proto files
Review: https://jetbrains.team/p/kt/reviews/8401
In scope of KT-55082
2023-02-01 15:13:34 +01:00
Nikita Bobko 62b27b4613 Cleanup: drop KlibIrVersion
Review: https://jetbrains.team/p/kt/reviews/8401
In scope of: KT-55082

Because this version isn't used for anything. We have KotlinAbiVersion
to version the IR format.
2023-02-01 15:13:34 +01:00
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