Commit Graph

533 Commits

Author SHA1 Message Date
Dmitriy Dolovov cb5a052227 [IR] Distinguish IrModuleDeserializers with and w/o underlying KLIBs
Fixes #KT-50591
2022-01-11 21:53:06 +03:00
Irene Dea d444978ebf Add support for attribute serialization. 2022-01-08 15:25:07 +03:00
Roman Artemev 723ef8f1fb [KLIB] Deserialize backing field initializers of const in IB-only mode
Missing const initializer leads to crash in property accessors inline
lowering during IC recompilation on JS.

 - fix #KT-50512
 - add test for JS IR IC
2021-12-27 23:43:43 +03:00
Ilya Kirillov 49e9c47071 Move DynamicTypeDeserializer.id from IR module to common module
So, it can be used from cls-psi-stub-builder module
2021-12-27 16:23:06 +03:00
Roman Artemev 7341a17a5d [IR] Cleanup ir serialization 2021-12-24 16:50:44 +03:00
Roman Artemev 4babc30624 [IR] Remove Persistent IR 2021-12-24 16:50:42 +03:00
Anton Bannykh 434c23a343 [JS IR] IC: avoid conflicts in local declaration signatures 2021-12-22 10:13:07 +03:00
sebastian.sellmair 2e55b82ba3 [MPP] Introduce allModulesProviding(Expects|Actuals)For filters
This new filters will also take care of filtering out descriptors
that are provided by 'regular' dependencies instead of 'dependsOn'
dependencies.

^KT-50120
2021-12-21 21:31:44 +00:00
Vyacheslav Gerasimov f7a9065b75 Build: Use intellij maven repo instead of downloaded IDEA
#KTI-82
2021-12-16 21:48:23 +03:00
Roman Artemev fb84287ae0 [KLIB] Compute relative path instead of absolute if relative base is provided
- normalize  path if required
 - path it in JS/Native
 - path null for JVM (temporary)
 - fix build
2021-12-15 21:13:52 +03:00
Roman Artemev 002d6723ac [KLIB] Fix partially-linked mode
- don't mark super classes as unlinked if its type argument is
 - check IrCall type as well
2021-12-08 20:18:15 +03:00
Anastasiya Shadrina cd2fbfed2e [IR] Add context receivers count to KotlinIr.proto 2021-12-02 20:24:47 +03:00
Anastasiya Shadrina 403ec7a5b1 [BE] Mangle context receiver params 2021-12-02 20:24:09 +03:00
Roman Artemev 53a65f818f [KLIB] Support partially linked klibs in Ir linker
Now it's possible to compile against klib even if in there are
references to declarations from other klibs which are no longer existed

 - add switch flag to turn on/off that mode
 - pass switch flag from JS CLI to JS Linker
2021-11-19 01:16:35 +03:00
Roman Artemev 8381badcc4 [KLIB] Make IrModuleDeserializer constructor nullable 2021-11-19 01:16:30 +03:00
Roman Artemev 918ed1f077 [KLIB] Refactored IrSymbolDeserializer.kt
- extract function which creates a new symbols in linker
2021-11-19 01:16:29 +03:00
Roman Artemev df9d039c03 [KLIB] Don't use module descriptor to compute library in error reporter 2021-11-19 01:16:28 +03:00
Roman Artemev d809e260cb [KLIB] Support DefinitelyNotNull type in KLIB
- add proto message
 - serialize/deserialize
2021-10-28 18:03:11 +03:00
Dmitry Petrov af18b10da9 JVM_IR KT-49203 generate stubs for not found classes 2021-10-15 12:15:49 +03:00
Georgy Bronnikov a9ce25cf33 JVM_IR: only serialize inline functions themselves with -Xserialize-ir=inline 2021-10-11 11:53:30 +03:00
Dmitry Petrov 146f0f4904 JVM_IR KT-41214 emit PermittedSubclasses on JDK17+ 2021-10-09 17:07:35 +03:00
Roman Artemev 5a64f64ba3 [KLIB] Propagate default arguments in expect-actual resolution
- refactor code a bit
 - fix KT-45542
2021-10-08 16:07:04 +03:00
Roman Artemev e6de812788 [IR] Implement checker for friendship of modules in fake override builder
- pass corresponding information to FO builder
 - implement check
 - fix KT-47192 and KT-48673
2021-10-07 16:00:49 +03:00
Roman Artemev ba759fb61b [IR] Fix compatibility mode
- pass corresponding flag to mangler
 - properly handle local declarations in field initializers
 - fix KT-48912
2021-10-06 03:47:20 +03:00
Alexander Udalov b6ebed0c96 IR serialization: cleanup/optimize DescriptorExportCheckerVisitor
Check if visibility is public API first, then check if declaration is
annotated with `@PublishedApi`. This is needed because loading
annotations and iterating over them can be slow.
2021-10-05 12:18:07 +02:00
Igor Chevdar 0cece79856 [K/N][IR][codegen] Use LazyIr for cached libraries
It's not that simple because we still need inline functions bodies
and classes fields which aren't present in Lazy IR. To overcome this,
save additional binary info for a cached library and then use it when needed
2021-10-05 10:47:52 +05:00
Georgy Bronnikov 8a459821d0 JVM_IR: avoid double encoding of byte strings
IrLibraryFile, ingerited from Klib code, needed types, bodies, strings,
signatures encoded as byte strings.
When we store this data as class annotations, it is better to store it
as protobuf structs, to avoid re-encoding byte streams twice.
2021-10-01 00:58:06 +03:00
Roman Artemev 2ca74174d3 [JS IR] Nullify body of declaration on it shouldn't be loaded 2021-09-30 14:30:13 +03:00
Vyacheslav Gerasimov ab146bd6d4 Build: Fix deprecated Gradle configurations usages
for migration to Gradle 7+ #KTI-559
2021-09-26 18:28:44 +03:00
Georgy Bronnikov 64e2911b58 JVM_IR: special case for raw types in DescriptorMangleComputer 2021-09-21 21:16:02 +03:00
Kristoffer Andersen 247cbffbac [EE-IR] Fragment Compiler Entrypoint in IR Backend
This commit introduces a new entrypoint for the IR backend, and starts
the work of accomodating the evaluator in psi2ir.

The evaluator expects a certain class and method structure of the
compiled fragment, but PSI is only supplied for the actual fragment.

So, to that end, this commit introduces a new "front end" of psi2ir
that "synthesizes" the module, class and method structure around the
fragment before calling into the existing psi2ir pipeline to obtain
the IR for the fragment.

The primary complication so far is handling the captured variables of
the fragment: they are mapped to parameters of the method surrounding
the fragment, and passed as arguments on evaluation. Hence, the IR
translation of the fragment needs to remap captured variables to the
appropriate parameter, in essentially all places they can be referred
to in the fragment (and hence in psi2ir). This commit introduces a
decorated symbol table that intercepts symbol look-ups and remaps as
appropriate.

Other cases that dispatches based on descriptor (see
`CallGenerator.kt`) needs other metadata to generate correct code.

It also introduces a shim in DeserializedContainerSource in the psi2ir
pipeline to facilitate facade class generation for the code that is
being debugged (which are generated as "external ir declarations").

Finally, in passing we resolve a small leftover from previous
refactoring that left an asssertion re. allowing IR to _assign_ to
parameters of methods.
2021-09-21 18:18:30 +02:00
Roman Artemev 78cd45f937 [KLIB] Resolve deserialization on for each file separately
Needs for IC
2021-09-07 20:41:28 +03:00
Roman Artemev 28ffcf1e81 [KLIB] Fix typo 2021-09-07 20:41:26 +03:00
Mikhail Glukhikh ed035d99ab Migrate -Xopt-in to -opt-in in Gradle Kotlin scripts 2021-09-03 15:40:47 +03:00
Ilmir Usmanov 1f8dd45c2b Remove experimental coroutines support. Part 2 2021-08-30 14:21:57 +03:00
Roman Artemev 76690c081a [KLIB] Provide required API for IC invalidation 2021-08-24 01:09:16 +03:00
Roman Artemev 7d8c86caf1 [KLIB] Add API to access file's part of data as ByteArray
It requires for computing fingerprint of IrFile in IC infra
2021-08-24 01:09:12 +03:00
Roman Artemev e4c2d4937f [KLIB] Extract signature deserialization into separate class 2021-08-24 01:09:11 +03:00
Dmitriy Dolovov 4edc1239ac [IR] Use only ASCII-printable chars in IR linker error reports
^KT-44626
2021-08-17 07:53:46 +00:00
Dmitriy Dolovov af12d61388 [IR] Enhance error reporting for IR linking issues
^KT-44626

Support correct error reporting both with native static caches and without native static caches.
2021-08-17 07:53:45 +00:00
Dmitriy Dolovov c1fb40a436 [IR] Enhance error reporting for IR linking issues
^KT-44626

Typical use case:
- There are two KLIB libraries: A and B.
- Library A has two versions: A.v1 (older) and A.v2 (newer).
- A.v2 is ABI-incompatible with A.v1.
- B depends on A and was compiled against A.v1.
- An attempt to build the application with A.v2 and B fails with weird error message. It's unclear for end user what's wrong and what needs to be done to fix the issue.

The fix improves error reporting for the following particular cases:
- A symbol that is gone (KT-41378)
- A class that became a typealias (KT-47285, KT-46697)
- A typealias that became a class (KT-46340)
2021-08-10 14:02:40 +03:00
Georgy Bronnikov 13cf9329b2 IR: always serialize constant initializers for fields. 2021-08-10 00:37:42 +03:00
Georgy Bronnikov 307de0be89 IR: always update deserializedSymbols in referenceLocalIrSymbol
The symbol created in deserializeIrSymbolToDeclare might be discarded
when an existing declaration is used in deserialization (as it happens
when deserializing IR bodies for JVM declarations).
2021-08-10 00:37:37 +03:00
Georgy Bronnikov fb801bdc33 IR: fix mangling of toplevel properties 2021-08-10 00:37:36 +03:00
Georgy Bronnikov 1d2d1f9e8d IR: change mangling for flexible types in DescriptorMangleComputer
This reverts commit 4af2aaedb1.
2021-08-10 00:37:24 +03:00
Tianyu Geng 684ef871ee FIR: unify common special names scattered around the code base 2021-08-06 22:57:17 +03:00
Roman Artemev 2574c00dd9 Add index() to LocalSignature for more clear access 2021-08-06 20:49:20 +03:00
Roman Artemev 5a7298808e [JVM KLIB] Fix Type Parameter resolve 2021-08-06 20:49:19 +03:00
Roman Artemev 67f814c99f [JS IC] Don't serialize IrTypeAbbreviation in IC cache 2021-08-06 20:49:15 +03:00
Roman Artemev d174e8c3d2 small optimization 2021-08-06 20:49:14 +03:00