Commit Graph

366 Commits

Author SHA1 Message Date
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
Roman Artemev 9bfe502afd [JS IC] Fix signature finding in some cases
Found in KFSAD
2021-08-06 20:49:13 +03:00
Roman Artemev 11f70412e7 [KLIB] Don't resolve delegated symbol where it could be existed 2021-08-06 20:49:12 +03:00
Roman Artemev 6ca87dc43f [KLIB] Drop useless set 2021-08-06 20:49:10 +03:00
Roman Artemev aeea7147fe [JS IC] Simplify code a bit more 2021-08-06 20:49:09 +03:00
Roman Artemev 28cf9898ef [KLIB] Simplify file symbol resolve 2021-08-06 20:49:08 +03:00
Roman Artemev 6cd0d81561 [JS IC] Drop redundant enqueue 2021-08-06 20:49:07 +03:00
Roman Artemev b1eeb1fb27 [JS IC] Don't persist temporary copies of inline functions
- drop special `IrValueParameterPublicSymbol`
 - drop special `IrAnonymousInitializerPublicSymbolImpl`
 - drop hacky `useGlobalSignatures`
2021-08-06 20:49:06 +03:00
Roman Artemev b1251c1716 [JS IC] Drop special IdSignatureSerializer for IC 2021-08-06 20:49:04 +03:00
Roman Artemev 4a601ebf95 [JS IC] Eradicate GlobalScopeLocalDeclaration from code
- Normalize proto names
2021-08-06 20:49:03 +03:00
Roman Artemev 74d8e16d09 [JS IC] Eradicate GlobalFileLocalSignature from code
- Reduce usage of global maps
2021-08-06 20:49:02 +03:00
Roman Artemev 3d3c70141c [JS IC] Properly handle type parameters of Functional interfaces
- drop redundant `IrSymbolTable` and `IrIcModuleDeserializerWithBuiltIns`
2021-08-06 20:48:59 +03:00
Alexander Udalov 91c39ed01c Build: remove obsolete compiler arguments
These compiler arguments enable features which are enabled by default in
the current Kotlin anyway.

The only exception is in :compiler:cli which uses an old language
version.
2021-07-27 13:35:38 +02:00
Anton Bannykh c6ab195a87 JS IR IC: invalid loops references exist after lowerings 2021-07-23 17:10:04 +03:00
Roman Artemev 0310f7cb0b [JS IC] Lot of fixes after rebase 2021-07-22 21:56:57 +03:00
Anton Bannykh e03cb372b7 KLIB: don't fail on invalid loops
Temporarily disable assert because this happens in lowered IR
2021-07-22 21:56:52 +03:00
Anton Bannykh 3833c833ef KLIB: changes in the .proto and linker required for the JS IC
The original behaviour is preserved. All changes should be behind the flags.
2021-07-22 21:56:51 +03:00
Ilya Chernikov db61665ab8 [minor] IR: clean unnecessary ObsoleteDescriptorBasedAPI opt-ins 2021-07-21 18:05:42 +03:00