Commit Graph

131 Commits

Author SHA1 Message Date
Alexander Udalov 7febd846e8 Export 'intellij-core' in module 'frontend'
Remove intellij-core from dependencies of modules which already depend
on frontend or any module that exports frontend (such as frontend.java)
2017-06-06 14:29:26 +03:00
Alexander Udalov cbaa676c3d Move some declarations between 'descriptors' and 'deserialization'
- Move the following from 'deserialization' to 'descriptors':
  NotFoundClasses.kt
  AdditionalClassPartsProvider.kt
  ClassDescriptorFactory.kt
  PlatformDependentDeclarationFilter.kt
  findClassInModule.kt
- Move the following form 'descriptors' to 'deserialization':
  BuiltInSerializerProtocol.kt
  builtInsPackageFragmentProvider.kt
- Extract a marker interface from BuiltInsPackageFragment and move its
  implementation to 'deserialization'
- Change the type of parameters in PlatformDependentDeclarationFilter
  and AdditionalClassPartsProvider to ClassDescriptor

This will help in getting rid of the circular dependency of
'descriptors' <-> 'deserialization'
2017-06-06 14:29:18 +03:00
Alexey Andreev 5715803b96 Fix incremental recompilation of JS source maps
Note that this breaks binary compatibility.
It should be OK, since nobody is using incremental compilation API
for now.
2017-05-30 12:48:59 +03:00
Alexey Andreev e9a2c8c0f1 Prevent JS AST nodes of several types to be shared 2017-05-30 12:48:47 +03:00
Alexey Andreev 9e89213d66 Prototyping DCE tool for JS 2017-05-26 18:20:15 +03:00
Denis Zharkov 63c5d85cf4 Optimize memory footprint for generated protobuf code
The problem was that an overload of CodedOutputStream.newInstance
without size uses 4000 as a default value, thus allocating
a 4k-sized byte array.
At the same time the array remained effectively unused
in the most cases since it only used for storing data
for unknown fields.

Because such arrays are being created for each read of
protobuf message, during compilation of IntelliJ project
it was producing 25% of redundant memory traffic.

Of course these arrays were all in the young gen, but still
they have some effect on GC
2017-05-17 14:34:11 +03:00
Alexey Andreev 3fb15a4423 Fix iml file of js.serializer module 2017-04-25 13:31:26 +03:00
Alexey Andreev a055a038a8 JS: minor fixes after rebasing
Multiple minor fixes after rebasing incremental compilation related
branch to actual master
2017-04-24 18:39:02 +03:00
Alexey Andreev 1c2120d7e2 JS: avoid repeated export of the same declaration 2017-04-24 18:30:42 +03:00
Alexey Andreev dd43d0a9e0 JS: don't use wrapper messages for string, int and double literals. This allowed to decrease binary AST size of stdlib from 2659138 bytes to 2642908 bytes 2017-04-24 18:30:41 +03:00
Alexey Andreev f4a9b99e4d JS: fix incremental generation of source maps 2017-04-24 18:30:38 +03:00
Alexey Andreev 22f24d13b9 JS: transform coroutines before serializing AST to binary format 2017-04-24 18:29:49 +03:00
Alexey Andreev 02ca374dc9 JS: fix inlining in incremental compilation 2017-04-24 18:29:48 +03:00
Alexey Andreev c85108602a JS: add tests for recompilation of only some files in a project 2017-04-24 18:29:46 +03:00
Alexey Andreev 49dacfcd76 JS: add metadata to AST serialization/deserialization 2017-04-24 18:29:19 +03:00
Alexey Andreev 8d2eb344ff JS: add AST deserializer 2017-04-24 18:29:18 +03:00
Alexey Andreev 4d3a86a183 JS: add AST serializer 2017-04-24 18:29:17 +03:00
Alexey Andreev 83df21329f JS: add protobuf declarations for JS AST 2017-04-24 18:29:17 +03:00
Alexander Udalov 30dfd5cc1b JS: support '-Xskip-metadata-version-check' to allow pre-release libraries 2017-03-20 17:22:29 +03:00
Alexander Udalov 7c22113c34 Refactor serialization of package FQ name extension
Instead of requiring to pass it in SerializerExtensionBase's
constructor, pass it always in serializePackage. This is more
straightforward and helps in a situation where one SerializerExtension
instance is used for the whole module, not one per-package
2017-03-06 11:03:24 +03:00
Alexander Udalov 25c1828288 JS: write and load pre-release flag on binaries 2017-03-03 13:33:51 +03:00
Alexander Udalov b52b90c182 Extract serialization of packageFqName extension to SerializerExtensionBase 2017-03-03 13:33:51 +03:00
Alexander Udalov bafa0ec1ee Minor, don't throw exception on empty proto message 2017-03-03 13:33:50 +03:00
Alexander Udalov 5a00a97cf1 Extract common parts from deserialization of built-ins and JS 2017-03-03 13:33:50 +03:00
Alexander Udalov a36e457c12 Introduce PackageFragment protobuf message for kjsm/builtins/common metadata 2017-03-03 13:33:50 +03:00
Alexander Udalov 57877bb007 Add default value to js_code_binary_version in js.proto
By default, assume the version is 1.0.0
2017-03-03 13:33:49 +03:00
Alexander Udalov 167155388d Rename JsBinaryVersion -> JsMetadataVersion
For consistency with JvmMetadataVersion
2017-01-30 16:05:46 +03:00
Alexander Udalov 933bcb3511 JS: do not require "id" in the File protobuf message 2017-01-30 15:55:20 +03:00
Alexander Udalov ef42e3e4aa JS: write full version (major.minor.patch) to .meta.js 2017-01-30 11:31:02 +03:00
Alexander Udalov 1045689911 JS: simplify KotlinJavascriptSerializationUtil
Inline recently introduced SerializerCallbacks
2017-01-30 11:31:02 +03:00
Alexander Udalov 63c24c56ec JS: serialize .kjsm package-wise, adapt decompiler & stub builder
Instead of multiple .kjsm files for different classes and .kotlin_string_table,
.kotlin_file_table, .kotlin_classes files for each package, serialize the
contents of each package to a single foo/bar/baz/baz.kjsm file. The short name
of the file is the last segment in the FQ name of the package, or
"root-package" if the package is root.

There are two main reasons for this change:
1) Such structure takes less space, is more IO-friendly and will not cause
   multiple exceptions as the old one, where we sometimes tried to read
   non-existing files
2) This is exactly the same format that is used to serialize built-in
   declarations (.kotlin_builtins) at the moment, which will allow us to reuse
   some code

Also write a separate Header protobuf message to the beginning of the .kjsm
file. This will be used as arguments of the kotlin.Metadata annotation are used
in the JVM-specific parts of the compiler: to be able to provide some general
information about the binary file without parsing the whole protobuf data.

This commit breaks decompiled text & stub builder consistency tests. This is OK
because they're removed in a future commit.

Fixes EA-79605, EA-81947, EA-84277 and maybe EA-86787

 #KT-10894 Fixed
 #KT-14124 Fixed
 #KT-15755 Fixed
2017-01-30 11:31:02 +03:00
Alexander Udalov 4b81dfb7c1 JS: improve binary representation format of metadata in .meta.js
Instead of writing many different files and serializing this "virtual file
system" to a byte array in a protobuf message, just write the needed stuff
directly, as fields in the Library message. Make it consist of many Part
messages, where the Part message is equivalent to the BuiltIns message in
builtins.proto. The next step would be to combine Library.Part and BuiltIns,
which will allow us to simplify some serialization-related code soon.

In this commit, no changes happened to the .kjsm format. But since the code
that serialized the abovementioned files was shared, a temporary abstraction
over two serialization formats was made, see SerializerCallbacks.

This commit temporarily breaks .kjsm decompiler and stub builder
2017-01-30 11:31:01 +03:00
Alexey Andreev cc67f6c9f7 JS: add support of JsQualifier annotation. See KT-15905 2017-01-25 13:52:18 +03:00
Sergey Mashkov a3f5d8e68a KT-15673 Couldn't use header function in 3rd module 2017-01-13 15:34:14 +03:00
Alexey Andreev e6501591fa JS: serialize type of local anonymous class as its denotable supertype. See KT-14888 2016-12-15 19:05:32 +03:00
Alexey Andreev d40e923722 KT-12877: minor fixes and cleanup 2016-12-03 17:15:10 +03:00
Alexey Andreev 0238b182cc KT-12877: add JsNonModule with support on front-end 2016-12-03 17:15:07 +03:00
Alexey Andreev ac703dfda6 KT-12877: serialize information about file annotations. For each top-level declaration store containing file. Use this information to properly handle file-targeted JsModule. 2016-12-03 17:14:29 +03:00
Alexander Udalov 1d71c19b42 Serialize .kotlin_metadata binary files per source file
Do not serialize everything in the same package to the same file (as is done
for built-ins) because this approach is unfriendly to incremental compilation,
which is going to be supported in the future. Instead, similarly to JVM
serialize each class to its own file, and each source file with top-level
callables/typealiases to its own file.

E.g. if a file named test.kt contains a class Foo and some
functions/properties, the output will contain two files: TestKt.kotlin_metadata
and Foo.kotlin_metadata. Each one of this files contains the serialized
BuiltIns message (see builtins.proto)
2016-11-25 20:50:10 +03:00
Alexander Udalov c0b5fd193a Refactor DeserializedPackageFragment and subclasses
Push loadResource and loadResourceSure down to KotlinJavascriptPackageFragment,
as it's no longer needed in BuiltInsPackageFragment
2016-11-22 18:19:02 +03:00
Alexander Udalov 0e9f29fdba Make ClassDescriptor#classId nullable
Local classes or anonymous objects do not have a class id. Use "!!" almost
everywhere to make assertion explicit
2016-10-25 15:42:32 +03:00
Alexander Udalov c0147860bd Allow multiple ClassDescriptorFactory instances in deserialization 2016-10-25 15:42:32 +03:00
Alexander Udalov 88af36001c Introduce DeserializationConfiguration
Will be used soon to deliver the language/API-version-related behavior to the
deserialization
2016-10-12 12:19:17 +03:00
Alexey Andreev 7dbada0d06 JS: repair serialization of type aliases 2016-09-19 12:30:32 +03:00
Denis Zharkov 86c1dbe7b5 Fix decompilation of types based on local classifiers
If deserializing a type with arguments based on a local class for
decompiler, then just return Any type (without arguments).

Previously Any constructor was used with serialized arguments, that lead
to exception

Note that in case of deserialization for compiler nothing changes about
local-classes-based types (LocalClassifierResolverImpl is just inlined)

 #KT-13408 Fixed
2016-09-05 17:54:36 +03:00
Stanislav Erokhin 6556cde329 Introduce new type checker. 2016-07-21 16:07:16 +03:00
Alexander Udalov 601dc96a34 Minor, rename protobuf field according to style guide 2016-06-27 20:18:57 +03:00
Alexander Udalov 4c8e8b099a Update protobuf from 2.5.0 to 2.6.1 2016-06-27 20:14:00 +03:00
Alexey Andreev 97605a97da KT-3008: multiple minor fixes after code review 2016-06-27 15:33:28 +03:00
Alexey Andreev 64cd0b70d7 KT-3008 Minor refactoring and clean up 2016-06-27 15:33:27 +03:00