Commit Graph

83 Commits

Author SHA1 Message Date
Alexander Udalov 1418423423 Remove unsafe cast function usages from JVM backend modules 2022-12-06 19:44:55 +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
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 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 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
Alexander Udalov ec9d929532 Remove dependency of fir2ir:jvm-backend on backend.jvm.entrypoint
Extract JvmIrDeserializer(Impl), similarly to the existing
JvmIrSerializer(Impl). Remove `allowErrorNodes` which is always false
anyway.
2022-06-13 12:35:51 +00:00
Georgy Bronnikov 12d34589d8 Psi2Ir, Fir2Ir: always include return type into signature mangle of a function 2022-05-19 12:02:42 +02:00
Georgy Bronnikov 0ef474a8d3 Do not set parent for deserialized IR declarations 2022-05-19 12:02:42 +02: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
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
Georgy Bronnikov f0fb0cbefe IR: remove IdSignatureBuilder.isKotlinPackage() 2022-01-27 01:02:23 +03:00
Georgy Bronnikov f4ddbb5e71 JVM_IR: remove DeclarationStubGenerator from deserializeLazyDeclarations.kt
No descriptor references remain.
2022-01-27 01:02:21 +03:00
Georgy Bronnikov 633e3a82e2 JVM_IR: record file facade fq name in serialized IR
This is needed to distinguish between file level privates by signature.
2022-01-27 01:02:20 +03:00
Georgy Bronnikov c0f6508ff9 JVM_IR: do not compute stored file signature when not needed 2022-01-27 01:02:19 +03:00
Georgy Bronnikov 10c3429ce6 IR: remove dead code 2022-01-27 01:02:19 +03:00
Georgy Bronnikov 044acbb5ef JVM_IR: do not use return type in Java property mangles
Another case of discrepancy between IR-based mangles and
descriptor-based mangles.
2022-01-27 01:02:16 +03:00
Georgy Bronnikov 4d2bcf7e66 IR: compute file local signatures from descriptors 2022-01-27 01:02:16 +03:00
Georgy Bronnikov b6ddd758ec IR: fix deserialization of publicly visible type parameters 2022-01-27 01:02:15 +03:00
Georgy Bronnikov 3cc883cf7b IR: use DescriptorBySignatureFinder in DeclarationStubGenerator
Duplicating code that was used for the same purpose in
DeclarationStubGenerator is removed.
2022-01-27 01:02:14 +03:00
Dmitriy Dolovov 99300bd885 [IR] IrModuleDeserializerKind API cleanup
Related to #KT-50591
2022-01-12 11:05:12 +03:00
Dmitriy Dolovov cb5a052227 [IR] Distinguish IrModuleDeserializers with and w/o underlying KLIBs
Fixes #KT-50591
2022-01-11 21:53:06 +03:00
Roman Artemev 7341a17a5d [IR] Cleanup ir serialization 2021-12-24 16:50:44 +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
Georgy Bronnikov a9ce25cf33 JVM_IR: only serialize inline functions themselves with -Xserialize-ir=inline 2021-10-11 11:53:30 +03:00
Georgy Bronnikov 4caa71538d JVM_IR: introduce modes for IR serialization
Instead of a Boolean flag -Xserialize-ir, use modes: none,inline,all.
In "inline" mode, only information needed to deserialize bodies of inline
functions is serialized.
In the "all" mode, all declarations are serialized completely.
2021-10-11 11:53:29 +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 6e93006a94 JVM IR: slightly optimize keepTrackOfOverridesForPossiblyClashingFakeOverride
Collecting all outer classes into a hash set and looking up classifiers
in that set for each type of each fake override is noticeably slow.
Instead, check that function types reference any type parameter whose
container is a class; if the function is not local, it means such type
parameter belongs to one of the outer classes.

 #KT-42020
2021-10-05 12:16:24 +02: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 78cd45f937 [KLIB] Resolve deserialization on for each file separately
Needs for IC
2021-09-07 20:41:28 +03:00
Roman Artemev 5a7298808e [JVM KLIB] Fix Type Parameter resolve 2021-08-06 20:49:19 +03:00
Roman Artemev b1251c1716 [JS IC] Drop special IdSignatureSerializer for IC 2021-08-06 20:49:04 +03:00
Roman Artemev 0310f7cb0b [JS IC] Lot of fixes after rebase 2021-07-22 21:56:57 +03:00
Ilya Chernikov dee0487185 IR: Refactor IrBuiltIns to abstract it from descriptors 2021-07-16 02:24:18 +03:00
Georgy Bronnikov 8c3386b607 IR: set file in declarationTable when serializing IR 2021-07-14 21:20:46 +03:00
Georgy Bronnikov da946e464f Fix compilation after rebase: add debugInfo to JvmIr.proto 2021-07-14 21:20:43 +03:00
Georgy Bronnikov f4d358069c Fixes after rebase, not related to IrLibraryFile 2021-07-14 21:20:42 +03:00
Georgy Bronnikov 08b950fc2a JVM_IR: Supply fake file name to signatures of file local declarations 2021-07-14 21:20:41 +03:00
Georgy Bronnikov fa4efd3303 JVM_IR: fix deserialization of Java static field symbols 2021-07-14 21:20:35 +03:00
Georgy Bronnikov 7bbc04b6a2 JVM_IR: reconstruct fake overrides after IR deserialization.
We need to keep track of local signatures for deserialized symbols.
2021-07-14 21:20:29 +03:00
Georgy Bronnikov a63cc95a2a JVM_IR: untangle backend.jvm and serialization.jvm (again) 2021-07-14 21:20:28 +03:00
Georgy Bronnikov 96ce124268 JVM_IR: serialize fake overrides in IR 2021-07-14 21:20:21 +03:00
Georgy Bronnikov 6b80c00cc6 JVM_IR: deserialize lazy declarations 2021-07-14 21:20:14 +03:00
Georgy Bronnikov ab3d6490ed JVM_IR: save auxTables as byte strings 2021-07-14 21:20:09 +03:00
Georgy Bronnikov b2617199bc JVM_IR: call serialization for IR.
Serializer for IR is called when -Xserialize-ir flag is set.
2021-07-14 21:20:04 +03:00
Georgy Bronnikov 9efd0d7589 JVM_IR: JvmIrSerializer 2021-07-14 21:20:02 +03:00
Alexander Udalov 173e194dac Remove dependency on JVM specifics in serialization.common
Move handling of EnhancedNullability to JVM subclasses in
serialization.jvm. Looks like this was possible because of accidental
dependency of frontend on compiler.common.jvm introduced in 564d382b9d.

Also fix a minor typo in the file name typeEnhancementUtils.kt.
2021-07-13 01:54:41 +02:00
Alexander Udalov 7a42f603f2 JVM IR: rename mangler implementation classes 2021-07-13 01:54:41 +02:00
Alexander Udalov 2834c22a85 IR: add BackendContext.typeSystem and JvmIrTypeSystemContext
To be able to override JVM-specific behavior of IrTypeSystemContext in
JVM IR, for things like JVM flexible types.
2021-07-01 19:35:44 +02:00
Roman Artemev b5c28c1912 [KLIB] Introduce compatible mode for klibs.
Based on library ABI version linker could decide which signature mode
to be used to guarantee backward compatibility.
2021-07-01 17:40:36 +03:00