Commit Graph

148 Commits

Author SHA1 Message Date
Alexey Andreev 95566b1374 JS: fix serialization of fileId in case of incremental compilation 2017-09-26 13:56:19 +03:00
Ilya Chernikov 3aabeca191 Fix maven and android tests after modularizing and rebasing 2017-09-20 11:51:21 +02:00
Alexander Podkhalyuzin 3f8170d369 Clean idea files generated on the gradle import, add them to .gitignore 2017-09-19 23:58:27 +02:00
Ilya Chernikov deda50dbbb Continue switching projects to improved dsl: sourceSets and test running 2017-09-19 21:37:26 +02:00
Ilya Chernikov 61dfb75e0e Implement Gradle Kotlin DSL build 2017-09-19 21:37:06 +02:00
Stanislav Erokhin c8ee424f67 Rename isHeader to isExpect in descriptors 2017-09-15 18:25:41 +03:00
Zalim Bashorov 30c7f633bd KJS: don't load declarations marked by PlatformDependent annotation
#KT-17450 Fixed
2017-09-13 02:18:43 +03:00
Alexey Andreev 1260146d25 Use local aliases for char boxing and unboxing in JS BE 2017-09-04 15:33:12 +03:00
Alexey Andreev 7646c2fc72 Use local aliases for Kotlin runtime functions in JS BE 2017-09-04 15:33:11 +03:00
Alexey Andreev 8c256b24dc Avoid duplication of imports introduced during JS inlining 2017-09-04 15:33:10 +03:00
Alexey Andreev 901346243d JS: fix inlining of function that calls functions from other modules 2017-09-04 15:33:08 +03:00
Alexey Andreev df782eaadd Fix incremental compilation to JS with new inliner 2017-09-04 15:33:06 +03:00
Alexey Tsvetkov 46a3a59b81 Fix missing lookups from deserialized JS descriptors 2017-08-10 21:19:42 +03:00
Alexey Andreev 5a9adcca2d Improve performance of JS tests
* Do not read protos for descriptors of stdlib and kotlin-tests
  repeatedly
* Parse libraries lazily in inline, so that when no inline function
  exist in a test, we won't parse huge kotlin.js file
* Speed-up source map parser
2017-07-11 11:06:52 +03:00
Mikhail Glukhikh dfe2c16bc7 More cleanup: lift return / assignment out 2017-07-10 12:59:58 +03:00
Alexey Andreev a0e1bde594 Allow to embed source files into JS source maps 2017-06-26 18:15:28 +03:00
Alexey Andreev 13ab63ae09 Generate relative paths in JS source maps
Also, add CLI options to manipulate prefixes of path

See KT-4078
2017-06-20 17:40:32 +03:00
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