Commit Graph

162 Commits

Author SHA1 Message Date
Artem Kobzar 7b9aed25da [K/JS] Add the ability to turn off polyfills generating 2022-10-19 12:52:23 +00:00
Alexander Korepanov 621e361366 [JS IR] Pass a js generation granularity param to IC infrastructure 2022-10-19 10:21:44 +00:00
Ilya Goncharov ca8b415726 [JS IR] Change names of ir-only arguments 2022-10-18 09:59:17 +00:00
Artem Kobzar 9a4a30c9bb [K/JS] Add flag for disabling signature uniqueness checks at klib generating phase 2022-10-14 13:08:58 +00:00
Sergej Jaskiewicz 227864c6ec [JS IR] Add a compiler option for generating name entries in sourcemaps 2022-10-14 10:09:39 +00:00
Artem Kobzar de880ce9aa [K/JS] Move ES modules logic to a new transformer with IC 2022-10-13 07:32:44 +00:00
Alexander Korepanov 7b2c125754 [JS IR] Update IC depends graph after intrinsics loading
- Remove unused params from compilerWithIC wrapper.
- Move JsIrBackendContext creation logic into separate function
- Introduce and use compiler interface for IC infrastructure

On dirty rebuild we may reload IR from stdlib,
such reloading may affect files with intrinsics and builtins.
As soon as we load only exported symbols, we must track dependencies
for files with intrinsics or builtins as for others.
This patch implements the logic which updates dependencies for
the stdlib files after loading of intrinsics and builtins.

^KT-54323 Fixed
2022-10-12 22:14:15 +00:00
Nikolay Krasko 20692c9837 Minor: cleanup code in cli-js and js.sourcemap 2022-10-03 11:08:29 +00:00
Ilya Goncharov c726360ad2 Change policy with legacy compiler backend
[JS] Remove incremental js jps test

[JS] Remove test of maven js archetype

[JS] Fix another one test

[JS] Fix tests for jps

[JS] Try to fix maven test data

[JS] Fix test data

[JS] Fix test data for ant

[JS] Fix jsExtraHelp test

[JS] Fix test run from not-Gradle build tools

[JS] Set flag without compiler error

[JS] Disable warnings and errors in legacy compiler called from Gradle

[JS] Proofread messages

[JS] Not proofread messages

KT-42326
2022-09-29 13:56:30 +00:00
Ilya Goncharov 4906f17d09 [JS IR] Fix js compiler arguments 2022-09-21 10:58:25 +00:00
Ilya Goncharov cab79d950f [Gradle, JS] outputName -> moduleName 2022-09-21 10:58:25 +00:00
Ilya Goncharov 4eedfe7f58 [Gradle, JS] Fix compilation after rebase 2022-09-21 10:58:24 +00:00
Ilya Goncharov 9685b0a86b [JS, IR] Wasm with outputDir and outputName 2022-09-21 10:58:21 +00:00
Ilya Goncharov 642fae1a5b [Gradle, JS] Migrate onto destinationDirectory and outputName 2022-09-21 10:58:20 +00:00
Ilya Goncharov d203dc35bf [JS IR] Add to IR keep possibility similar to legacy-dce one
It helps to:

- keep declarations even if they are not reachable and not exported
- not minify names of not exported declarations

Compiler argument: -Xir-keep=A,B

Can be used for top-level declarations or for member

^KT-54118 fixed
2022-09-20 16:06:17 +00:00
Ilya Goncharov bf8681296b [Gradle, JS] IR by default and report warnings for using legacy compiler
- just legacy - report warning about deprecation
- both - report warning about deprecation of legacy
- no compiler explicitly chosen - error about explicit setting compiler

warn from cli legacy compiler

nowarn flag - kotlin.js.compiler.nowarn

KT-42326
KT-53074
2022-09-16 09:48:41 +00:00
Alexander Korepanov 639af77b91 [JS IR] Invalidate IC cache after modifying language settings
^KT-54010 Fixed
2022-09-16 07:19:20 +00:00
Alexander Korepanov ef05a0d9ed [JS IR] Disable JS IR IC infrastructure when WASM is enabled 2022-09-16 07:19:19 +00:00
Alexander Korepanov 453faeaa45 [JS IR] Memory consumption optimization
- Remove IR after JS AST generation
 - Remove JS AST after/during JS code generation
2022-09-05 11:15:55 +00:00
Artem Kobzar 87038e7d8a [K/JS] feat: add logic under the flag for strict implicit export generating inside d.ts files. 2022-08-09 16:48:59 +00:00
Sergej Jaskiewicz 9bc057afb2 [JS IR] Generate the correct relative paths in source maps 2022-07-21 12:18:45 +00:00
Dmitriy Novozhilov 928416c9c5 [CLI] Introduce new compiler arguments for registering compiler plugins
With new syntax each plugin should be registered in separate argument with syntax
`-Xcompiler-plugin=classpath1,classpath2[=argument1=value1,argument2=value2]`
2022-07-20 09:07:26 +00:00
Mikhael Bogdanov 41d6f0dca4 Remove ir.tree.impl from build 2022-06-20 11:42:52 +00:00
Sergej Jaskiewicz 53233c487e [JS] Factor out source map path rewriting 2022-06-16 10:02:05 +00:00
Sergej Jaskiewicz 0320d49ddc [JS IR] Generate sourcemaps for JS IR tests 2022-06-16 10:02:04 +00:00
Alexander Korepanov 9e780afdca [JS IR] Rework incremental cache invalidation
Replace loading the whole world IR with loading only exported (reachable) IR.

 For that purpose the direct and inverse dependency graph is used.
 It is stored in a cache directory and the cache updater keeps it up to date.
 If after loading it is found that other files must be also implicitly rebuilt
 (see rebuilt reasons below), IR for that files also will be loaded.
 This algorithm repeats until the number of implicitly rebuilt files is not 0.

 More rebuilt reasons (dirty state) have been added:
  - added file: this is a new file;
  - modified ir: ir of the file has been updated;
  - updated exports: exports from the file have been added or removed
    (e.g. a function has been used from another file);
  - updated inline imports: imported inline function has been modified
    (transitively);
  - removed inverse depends: a dependent file has been removed;
  - removed direct depends: a dependency file has been removed;
  - removed file: this file has been removed.

 Incremental cache tests has been refactored:
  - The supporting of all rebuilt reasons (dirty states) has been added;
  - New file name format "*.$suffix.kt" for the test steps has been allowed,
    so the syntax highlight works now;
  - Explicit stdlib dependency usage has been removed.
2022-06-13 20:04:05 +00:00
Igor Yakovlev f996278171 [WASM] Support for mjs universal launcher 2022-06-07 20:59:03 +00:00
Sergej Jaskiewicz e03747ea7d [JS IR] Introduce the GENERATE_INLINE_ANONYMOUS_FUNCTIONS feature flag 2022-06-01 09:02:31 +00:00
Igor Yakovlev 3d3526e3d0 [WASM] Workaround for compiled wasm runs under node 2022-05-20 16:33:58 +02:00
Svyatoslav Kuzmich 84ed3ff5b0 [Wasm] Don't generate wat format by default in box tests
Gives ~15% tests speedup
Use kotlin.wasm.debugMode=1 to enable old behaviour
2022-05-20 13:34:28 +00:00
Mikhail Glukhikh 08ba89b4ec CLI K2: report an error for JS/Native/Metadata #KT-52035 Fixed 2022-04-28 13:25:48 +00:00
Igor Laevsky 3de1235fda [WASM] Add command line option to enable/disable assertions 2022-04-26 20:41:52 +00:00
Artem Kobzar 7ef14fc11b chore: use CompositeBlock instead of GlobalBlock. 2022-04-11 10:37:14 +00:00
Igor Laevsky 81eae94821 [Wasm] Disable range checks for arrays. Add cli argument to enable them back. 2022-04-05 18:00:32 +00:00
Alexander Korepanov 9952d43252 [JS IR] IC improvements
- Reuse a built fragment
  - Use cache for saving built JS code
2022-04-04 17:42:04 +00:00
Ilya Goncharov c67c1a69b9 rra/ilgonmic/reducing-size
[JS IR] Fix review remarks

- Fix translation mode from flags calculation
- comment why not top level could be safely inlined

[JS IR] Add test on exportness of internal val

Revert "[Gradle, JS] Disable minimizing names in production by default"

This reverts commit 700ff8634a73f155a2f0eaf963778216d6877075.

[JS IR] Adopt reserved names

Revert "[JS IR] Reserve interop names"

This reverts commit 63f30becaf1a45750ff85aea3753aae9a85985f4.

Revert "[JS IR] Clear minimized namer states"

This reverts commit ef7f19fa8a928021e8bdfbee7fbb5285fc74b7ab.

[JS IR] Clear minimized namer states

[JS IR] Reserve interop names

[JS IR] Separate arguments for users

[JS IR] Minimized member names in tests

[Gradle, JS] Disable minimizing names in production by default

[JS IR] Fix extra helps

[JS IR] Move mangling of signatures to linking namer

[JS IR] Add key and minimized name generator

[JS IR] cross module dependencies minimized

[JS IR] Minimize names

[JS IR] Cross module by index

[JS IR] Fix warning

[JS IR] Fix inlining accessors

[JS IR] Bridges for property accessors

[JS IR] Special case of jsFunctionSignature with property accessors

[JS IR] Inline property accessor for non top level properties

[JS IR] Reduce crossModule size

Merge-request: KT-MR-5785
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>

^KT-51735 fixed
^KT-50504 fixed
2022-03-28 10:39:15 +00:00
Alexander Korepanov 69295f2cf0 [JS IR] IC invalidation refactoring
- Huge refactoring for IC
  - Update hash combination logic
  - Introduce value class for IC hashes
  - Calc md5 directly by function IR
  - Split IC logic by classes
  - Move JsIrLinkerLoader into separate file
  - CacheUpdateStatus is a sealed class
  - Render TYPE_PARAMETER reified flag

^KT-51081 Fixed
^KT-51084 Fixed
2022-03-15 05:34:19 +00:00
Alexander Korepanov 43a0876c26 [JS IR] IC invalidation performance improvements
- Cache signature readers and deserializers
 - Cache inline function hashes
 - IC refactoring
 - [gradle] Use hash of module path for cache dir; Fix KT-51238

^KT-51238 Fixed
2022-02-16 13:41:53 +00:00
Svyatoslav Kuzmich 4636f71076 [Wasm] Loader improvements
- Output ES modules instead of plain files
- Support -Xwasm-launcher=d8 for d8 shell used in tests and benchmarks.
- Reuse launcher generation logic in CLI and box tests runners.
- Create separate output directory for each box since
  there are multiple output files generated for each test.
- Stop using absolute paths in generate JS files
  to simplify running generated code on different machine
- Remove ">>>" from println output


Merge-request: KT-MR-5729
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2022-02-10 22:59:44 +00:00
Ilya Goncharov 77b367fe96 rra/ilgonmic/ic-to-compiler
[JS IR] Fix compilation in tests

[JS IR] Fix test after migrating IC to compiler

[JS IR] Fix memory leak

[JS IR] Move js ic to compiler

Merge-request: KT-MR-5673
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>
2022-02-07 11:40:16 +00:00
Ilya Goncharov a2167200d6 [JS IR] IR module to name
Merge-request: KT-MR-5672
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>
2022-02-03 17:28:46 +00:00
Igor Laevsky 4e84e14d34 [Wasm] Don't squish modules together 2022-02-03 18:19:30 +03:00
Igor Yakovlev 1446914ba9 [WASM] Run box tests with dce and non-dce modes 2022-02-02 16:44:47 +03:00
Igor Yakovlev 2ec0411a7f [WASM] DCE implementation 2022-01-26 23:40:41 +03:00
Dmitriy Novozhilov dd953908df [FE 1.0] Add compiler flag for rendering internal diagnostic names in error messages 2022-01-23 11:14:56 +03:00
Alexander Korepanov 59173baf5a [JS IR] Pass forward -Xir-property-lazy-initialization option
Pass forward -Xir-property-lazy-initialization option
for the incremental cache.

^KT-50175 Fixed
2022-01-19 13:28:47 +00:00
Andrey Uskov 2adc851f1b Don't use global state for keeping incremental compilation state
Previously IC state was stored in System properties. As result parallel
compilation might cause incorrect state of IC, what led to corruption
of kotlin_module files. Now IC state is stored via CompilerArguments
and CompilerConfiguration
#KT-46038 Fixed
2022-01-12 13:37:46 +03:00
Igor Yakovlev 82455c849d [WASM] Lazy properties initialization 2022-01-05 13:12:32 +01:00
Roman Artemev 353bfe9018 [JS IR] Cleanup pir IC code 2021-12-24 16:50:40 +03:00
Anton Bannykh 4c33cb8016 [JS IR] IC: support per-module in K2JsIrCompiler 2021-12-22 10:14:33 +03:00