Commit Graph

121 Commits

Author SHA1 Message Date
Mikhail Glukhikh 6f957c7b31 Provide more accurate clash check in JsDeclarationTable 2020-06-16 19:17:26 +03:00
Mikhail Glukhikh 63394858ac Minor typo fix 2020-06-16 19:17:08 +03:00
Mikhail Glukhikh 41306d25fd JsDeclarationTable: drop descriptors in assertion 2020-06-16 19:16:59 +03:00
Roman Artemev 5eae262264 [PLUGIN API] Implement custom linkage for plugin extensions 2020-06-03 12:17:14 +03:00
Roman Artemev f9c2c846f7 [IR] Move IrProvider and 'IrDeserializer' into separate package 2020-06-03 12:17:14 +03:00
Leonid Startsev 7c8c5b057f Extensible mechanism for plugin metadata during descriptor serialization
A mechanism that allows kotlinx.serialization plugin to preserve the
correct (program) order of properties after serializing/deserializing
descriptors to kotlin metadata, which is needed for correct and stable
json serialization of class hierarchies in incremental/multi-module scenario.
It uses protobuf extensions.
2020-06-01 17:48:16 +03:00
Alexander Gorshenev a112f8acb6 Moved symbol table emptiness assertion to later places,
so that the assert doesn't trigger in the plugin context
2020-05-31 06:00:33 +03:00
Alexander Gorshenev 46e3649bd0 Moved all things related to fake overrides to a single directory 2020-05-31 06:00:32 +03:00
Alexander Gorshenev 06abbe468b Signature based fake override validation 2020-05-31 06:00:32 +03:00
Alexander Gorshenev 024385cbbd Construct fake overrides after IR deserialization 2020-05-31 06:00:32 +03:00
Roman Artemev e6c855111e [KLIB] Add flag to select between per-file and monolithic layout 2020-05-26 14:41:49 +03:00
Roman Artemev 257c4c5604 [PLUGIN API] Extract IrPluginContext into separate interface
- Isolate ir infrastructure implementation details behind special interface
2020-05-25 13:26:35 +03:00
Kevin Most 4f26ac9a04 Fix "Koltin" typos throughout codebase (#3383)
* Fix "Koltin" typos throughout codebase

* Update K2MetadataKlibSerializer.kt
2020-05-20 15:12:32 +03:00
Alexander Udalov 012ffa2993 Support new scheme of compilation of OptionalExpectation annotations
Instead of generating these annotation classes as package-private on
JVM, serialize their metadata to the .kotlin_module file, and load it
when compiling dependent multiplatform modules.

The problem with generating them as package-private was that
kotlin-stdlib for JVM would end up declaring symbols from other
platforms, which would include some annotations from package
kotlin.native. But using that package is discouraged by some tools
because it has a Java keyword in its name. In particular, jlink refused
to work with such artifact altogether (KT-21266).

 #KT-38652 Fixed
2020-05-12 19:28:57 +02:00
Roman Artemev 9f99094780 [IR] Clean up linker interface 2020-05-12 14:29:54 +03:00
Roman Artemev 1e9c9ef7e0 [IR] Clean up linker code 2020-05-12 14:29:54 +03:00
Roman Artemev 559b654a4f [IR] Provide new plugin API to access declaration via FqName in the safe way 2020-05-12 14:29:53 +03:00
Roman Artemev 3c50b47333 [IR] Add new API into IrBuiltIns to access functional interfaces 2020-05-12 14:29:53 +03:00
Roman Artemev a477aa7289 [KLIB] Pass IrFunctionFactory from outside 2020-05-12 14:29:53 +03:00
Georgy Bronnikov 82d55e1a67 Minor: remove unused parameters, reformat code 2020-04-28 18:19:46 +03:00
Roman Artemev a9788f9506 [KLIB] Create an abstract class for module deserializer
- Introduce Ir-based Functional interface factory
 - Switch from LazyIr to pure
 - Use kotlin library to access raw bytes
 - Link dirty files against IC cache and dependencies instead of LazyIr
 - Move `DescriptorByIdSignatureFinder` from K/N to common
 - Support inline-bodies only MODE
2020-04-14 11:12:08 +03:00
Georgy Bronnikov 166b506f63 IR: only require all type parameter references to be local with new inference 2020-04-13 14:34:57 +03:00
Alexey Tsvetkov 1c38466a22 Pass LookupTracker to deserialized scopes in JS KLIB compiler
Before this change, deserialized scopes were not tracking lookups properly,
because lookup tracker was not passed from compiler configuration correctly.
Because of that, lookups from dependencies were not tracked,
so multi-module IC was not working (chages were passed between modules,
but affected source files were not invalidated).
2020-04-10 05:35:45 +03:00
Alexander Gorshenev 97be5617ca Renamed -Xklib-mpp to -Xexpect-actual-linker to reduce user confusion 2020-04-08 05:23:12 +03:00
Roman Artemev 7034edac4c [JS IR] Move signature consistency checker into appropriate place 2020-03-10 11:12:08 +03:00
Dmitry Savvinov b8b1dd753c Add builtins_platform property to klib manifest 2020-03-05 17:27:38 +03:00
Leonid Startsev a2c24e696f Leverage existing psi2ir function declaration generator in plugin
This seems to be the only reasonable way to provide function declarations with
_correctly_ substituted type parameters without rewriting logic from scratch;
correctly scoped type parameters in IR are now required in serialization
plugin by all backends.

Also fix some missing upper bounds.
2020-03-05 16:40:55 +03:00
Roman Artemev 6a37955a36 [KLIB] Implement new linker based on IdSignature
- Remove klib dependency on metadata and uniqID
 - Refactored proto format to make it more effective and compact
  -- Use special encoding for some types of data (coordinates, flags, types)
  -- Remove symbols table
  -- Use packed proto list if it is possible
 - Remove extension from metadata
 - Remove special ids for function interfaces
 - Fix klib IO
 - Fix incremental cache
 - General code clean up
2020-02-14 18:22:16 +03:00
Roman Artemev 31d73c5d79 [Psi2Ir] Move to new linkage scheme based on IdSignature
Now SymbolTable operates with two types of symbols (public and private)
In case of Public symbol IdSignature is used as table key
Private one uses descriptor as the key in similar scheme as before
2020-02-14 18:22:16 +03:00
Roman Artemev 0254734bb5 [IR] Refactored Kotlin Mangler API
- Implement abstract Ir-based, Descriptor-based
 mangler computers and export checkers and corresponding platform
 specializations
 - Add runtime verifier which check whether all types of mangler
 produces the same type of data

Note: code migration is not finished yet
2020-02-14 18:22:15 +03:00
Dmitriy Dolovov ef199f8e45 Mark obsolete createKotlinLibrary() call as @Deprecated 2020-02-01 17:07:18 +07:00
Alexander Udalov f4912ed433 Minor, simplify JS-related build files a bit
* remove test roots in modules which have no tests
* 1.8 is already the default JVM target in the project
* replace compilation dependency on kotlin-reflect with runtime
2020-01-29 18:03:22 +01:00
Alexander Udalov d27bb76fd0 Remove dependency of serialization.js on cli
To break up compilation dependency of JS IR/WASM backends on JVM
backend.

 #KT-35854 Fixed
2020-01-29 18:03:22 +01:00
Georgy Bronnikov e351d560d6 IR: remove KotlinIrLinker.checkAccessibility
This sanity check conflicted with cases where visibility test is
suppressed in the frontend.
2020-01-28 12:19:44 +03:00
Alexander Gorshenev 8b036ace26 Moved several more components to resolveSingleFileKlib 2020-01-27 20:21:32 +03:00
Alexander Gorshenev 7390e74bbd Initial implementation of klib components 2020-01-27 20:21:32 +03:00
Alexander Gorshenev dfa509ec5b This reverts commits
afb2e9f38d.
    8c4fa6446d.
    f3bc533073.
    ccf084b1a5.
2020-01-27 15:30:16 +03:00
Alexander Gorshenev 8c4fa6446d Moved several more components to resolveSingleFileKlib 2020-01-27 14:24:14 +03:00
Alexander Gorshenev ccf084b1a5 Initial implementation of klib components 2020-01-27 14:24:14 +03:00
Alexey Tsvetkov 2d598d50d7 Expand compilation scope for IC before backend is run
Sometimes IC raises compilation errors when rebuild succeeds.
This happens because IC uses serialized decriptors
for non-dirty files. Serialized descriptors can be different
from source file descriptors. For example, a source file
may contain an implicit return type or an implicit visibility
for overridden methods, but serialized descriptors always
contain explicit return types & methods' visibilities.

These problems can be solved by expanding a scope of incremental compilation
just after the analysis, but before error reporting & code generation.
In other words, we need to compare descriptors before error reporting and code generation.
If there are new dirty files, current round of IC must be aborted,
next round must be performed with new dirty files.

This commit implements IC scope expansion for JS Klib compiler

    #KT-13677
    #KT-28233
2020-01-21 16:36:36 +03:00
Svyatoslav Kuzmich fbf71be30c [JS IR BE] Support mode of linking multiple klibs without .kt files 2020-01-14 18:00:29 +03:00
Svyatoslav Kuzmich 31c84e9ac4 [JS IR] Build stdlib using compiler from repo
Previously JS IR versions of stdlib and kotlin-test were build
by default using compiler previously built on a buildserver.

It had some issues:
 - This required us to advance bootstrap every time we made any
   incompatible IR changes. This happens often since IR ABI is
   not quite stable yet.

 - We never tested the exact combination of compiler and stdlib we publish

   We tested:
    - new compiler with new stdlib build by new compiler (in box tests)
    - old compiler with new stdlib build by old compiler (in stdlib tests)

   We published:
    - new compiler with new stdlib build by old compiler

After this change JS IR compiler tests, builds and publishes
single configuration:

    new compiler with new stdlib build by new compiler

JS IR stdlib and kotlin-test are now built using JavaExec of CLI instead
of Gradle plugin to avoid troubles of loading a freshly built plugin.

This also allows to have a granular dependencies: we don't rebuild klib
if we changed a lowering in a compiler backend, but we do rebuild it if
we changed IR serialization algorithm.
2019-12-25 13:44:57 +03:00
Alexander Udalov 0cb48999ff JVM IR: retain optional annotations as package private classes
Similarly to how it's done in the old backend (see
PackageCodegenImpl.generateClassesAndObjectsInFile and
AnnotationCodegen.genAnnotation)
2019-12-18 20:25:11 +01:00
Alexander Gorshenev ffa368e0a7 Reconciled -Xklib-mpp with commonizer 2019-12-18 19:29:56 +03:00
Alexander Gorshenev dc8240c24e Expect/actual support in klibs under -Xklib-mpp 2019-12-18 19:29:56 +03:00
Roman Artemev 0f71460833 Add missed comment 2019-12-17 18:04:52 +03:00
Roman Artemev cad3cb1bbe [KLIB] Fix references to type made from TypeParameter in KotlinMangler
- promote ABI version
2019-12-17 17:56:07 +03:00
Svyatoslav Kuzmich 3df8393ede [JS IR] Properly report compiler errors
Report compiler errors using message collector
Instead of crashing with stack trace
2019-12-17 15:33:43 +03:00
Dmitriy Dolovov 18117ed1f3 [Commonizer] Serialize commonized metadata for KLIB writer
- introduce EmptyDescriptorTable
- wipe out unused BindingContext from KlibMetadataSerializer
2019-12-12 14:52:02 +03:00
Roman Artemev ca0bff75cd [KLIB] Keep order of constant properties depending on backend
- Fix K/N performance regression
2019-12-03 16:20:52 +03:00