Commit Graph

2845 Commits

Author SHA1 Message Date
Dmitriy Novozhilov da581f38e1 [Test] Require specifying parser for FIR test. Unify names for FIR tests
Now all tests with `Fir` in name are named accordingly to parser which
  is used in them -- `FirPsi` or `FirLightTree`. This is needed to keep
  consistency between different types of tests, because there is no
  single default in parser mode between different scenarios of using FIR
2023-02-24 11:15:26 +00:00
Alexander Korepanov 3c9d653595 [JS IR] Ignore unbound symbols in IC infrastructure
The IR linker is responsible for detecting unbound symbols,
 if it skips them for some reason, IC infrastructure must not fail
 with unbound symbols exceptions. Anyway, the IR validator
 verifies later if there are unbound symbols in
 reachable IR and generates the corresponding error.

^KT-56602 Fixed
2023-02-21 14:46:44 +00:00
Alexander Korepanov c82b4f6fe5 [JS IR] Append source mapping URL every time on writing JS code
Source mapping URL is not saved in JS module cache anymore,
 because it was a wrong url pointed to the source map from the cache.
 Instead, the URL is appended every time on writing the output JS code.

^KT-56469 Fixed
2023-02-08 11:04:43 +00:00
Ivan Kochurkin d401ff7b09 [FIR & IR] Implement JS MPP test infrastructure
^KT-55295 Fixed
2023-02-07 14:16:29 +00:00
Nikita Bobko 62b27b4613 Cleanup: drop KlibIrVersion
Review: https://jetbrains.team/p/kt/reviews/8401
In scope of: KT-55082

Because this version isn't used for anything. We have KotlinAbiVersion
to version the IR format.
2023-02-01 15:13:34 +01:00
Svyatoslav Kuzmich bebb9b1392 [Wasm] Move compiler tests to :wasm:wasm.tests module
They don't belong in K/JS test module.
2023-01-31 13:12:12 +00:00
Zalim Bashorov 6a73650b35 [Wasm] SpiderMonkey.kt -> WasmVM.kt 2023-01-27 17:57:50 +01:00
Zalim Bashorov b02279de14 [Wasm] Run wasm test using all available VMs: V8 & SpiderMonkey for now
Also, add a new directive, `WASM_FAILS_IN`, to specify VMs where a test is expected to fail for now.

#KT-56166 Fixed
2023-01-27 17:57:50 +01:00
Ilya Goncharov 1150ec6882 [JS] Implementation dependencies for JS klibs
^KT-56158 fixed
2023-01-27 13:31:59 +00:00
Alexander Korepanov 0785b45426 [JS IR] Write JS files before verification of dirty JS in IC tests 2023-01-24 09:35:16 +00:00
Alexander Korepanov 1ec88ff560 [JS IR] Enable IR dump for IC invalidation tests
Support 'fd.kotlin.js.debugMode' property in IC invalidation tests.
2023-01-24 09:35:15 +00:00
Ilya Goncharov 7ae85ed68e [JS IR] Module descriptors depends on each other 2023-01-23 16:16:48 +00:00
Roman Efremov 14b4cdc7c4 Write "hasEnumEntries" flag into metadata when feature enabled
^KT-53929 Fixed
2023-01-23 12:53:04 +01:00
Sergey Bogolepov c22285f824 [IR] Remove unused Ir.irModule property
It is required for the Native backend refactoring
where `Context` does not contain a reference for any
particular IrModuleFragment.
2023-01-20 13:33:06 +00:00
Artem Kobzar 71486a321c [K/JS] Add support of compilation with ES-classes 2023-01-17 18:14:17 +00:00
Alexander Korepanov a4192c38f2 [JS IR IC] Remove JS files of the deleted modules from the out directory 2023-01-17 15:48:37 +00:00
Alexander Korepanov 75931fb9c8 [JS IR IC] Do not read non modified JS into memory
Optimizaion: instead of reading all non modified JS files
 from the cache into the memory at once, the patch allows
 copying non-modified JS files from disk one by one
 during the compilation output writing routine.
2023-01-17 15:48:36 +00:00
Svyatoslav Kuzmich d14d4c8510 [Wasm] Support JsModule and JsQualifier 2023-01-13 21:58:34 +00:00
Svyatoslav Kuzmich fd67464d14 [Wasm] Test infra: support _commonFiles and additional .mjs
Use custom `evalToBoolean` as `eval` and `unsafeCast` are not
 available in Wasm stdlib
2023-01-13 21:58:33 +00:00
Svyatoslav Kuzmich 80e07d628b [Wasm] Use ModuleKind.ES
As the only JS-interop module kind Wasm supports
2023-01-13 21:58:32 +00:00
Anton Bannykh 698be0fddd JS IR: custom JS AST serialization 2023-01-11 15:56:57 +00:00
Nikolay Lunyak 5ae9444745 [FIR JS] Add a test runner for FIR JS with old diagnostic tests 2023-01-09 08:57:07 +00:00
Svyatoslav Kuzmich dd53998c2d [Wasm] Add uninstantiated MJS wrapper
It allows

* Custom imports
* Ability to skip initializer
2022-12-28 12:13:52 +01:00
Svyatoslav Kuzmich 3bbd8c291a [Wasm] Add @WasmImport annotation
Imports top-level function from given module
2022-12-28 12:13:18 +01:00
Alexander Korepanov 48daf0befe [JS IR] Take into account file annotations for calculating symbol hashes
^KT-55367 Fixed
2022-12-20 16:04:14 +00:00
Dmitriy Novozhilov 5d6cb2b691 [Test] Use IrPluginContext for searching declarations for DUMP_EXTERNAL_CLASS check 2022-12-09 12:02:07 +00:00
Zalim Bashorov 49c3ba33f1 [Wasm] Add a basic end-to-end sourcemap generation in wasm backend
More constructions/instructions will be supported separately.
2022-12-08 12:44:26 +00:00
Alexander Korepanov 9edaebf235 [JS IR] Enable DTS generation in IC
^KT-54398 Fixed
2022-12-07 18:05:53 +00:00
Alexander Korepanov 0a35d84193 [JS IR] DTS generation refactoring
Keep a DTS fragment in JsIrProgramFragment
 for each file and build the module DTS from them.
2022-12-07 18:05:52 +00:00
Zalim Bashorov fb4dcc6a6a [Sourcemap] Introduce getCurrentColumn and stop using TextOutput directly
The general goal is remove dependency on TextOutput and
make it simpler to use for wasm backend.
2022-12-07 12:03:54 +00:00
Alexander Korepanov c31705240a [JS IR] Support a module friendship in IC infrastructure
^KT-55097 Fixed
2022-12-02 13:50:36 +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
Alexander Korepanov 693258ae91 [JS IR] Invalidate all klib dependencies after removing it
Without the invalidation, broken JS code
 (with broken cross-module references) may appear.

 ^KT-54911 Fixed
2022-11-28 20:46:40 +00:00
Alexander Korepanov ca19d71a00 [JS IR] Commit cache header after lowering
Commiting cache header before lowering may
 break caches in case of lowering errors.

^KT-54912 Fixed
2022-11-28 20:46:40 +00:00
Alexander Korepanov 8cde0a81bc [JS IR] Use topological order for loading klibs in JS IR IC
Generally, the library order doesn't matter.

 However, after lowering we need to post process
 lowered klibs in topological order:
  - commit incremental cache artifacts,
  - produce JS AST.

 The patch uses an ability of the Kotlin library resolver to load klibs
 in topological order and drops its reimplementation from IC infrastructure.

 There is one side effect:
   klibs which are not reachable from the main module, will produce their JS.
   This should be more correct than just ignoring them.
2022-11-28 20:46:39 +00:00
Alexander Korepanov ec6a7094e6 [JS IR] Manage cache root dir from IC cache updater
- pass cache root directory instead of dir list
 - manage klib cache dirs from cache updater
2022-11-28 20:46:39 +00:00
Anton Bannykh e42385dfb0 JS tests: split fir, ir, and legacy tests
Also split write FIR output to separate folders
2022-11-23 11:01:13 +00:00
Anton Bannykh f99d480bf8 JS: move DCE test output to build/ dir 2022-11-23 11:01:13 +00:00
Anton Bannykh 56765461a0 WASM: move output to build/ dir 2022-11-23 11:01:12 +00:00
Sergej Jaskiewicz 932e1a3c1d [JS] Re-run stepping tests if they fail because of a Node crash
KT-54283
2022-11-18 10:37:58 +00:00
Anton Bannykh e6801abce8 JS IR: move IC tests output to build/ dir 2022-11-17 09:24:54 +00:00
Svyatoslav Kuzmich 78bd6dbdcd [Wasm] Allow implementing function interfaces 2022-11-14 11:23:18 +01:00
Ilya Chernikov b28dd95621 FIR JS: rename test classes for uniformity 2022-11-12 16:28:25 +01:00
Ilya Chernikov 78ca733c38 FIR JS: add K2 variants of all other JS tests
except tests that are not possible to add without some modifications in
the test infra. See todos on the commented-out test declarations
2022-11-12 16:28:24 +01:00
Ilya Chernikov 5baf4a55c1 FIR JS: fix nodejs box tests infrastructure 2022-11-12 16:28:24 +01:00
Ilya Chernikov fa0cda6236 FIR JS: enable full JS box tests with FIR 2022-11-12 14:34:07 +01:00
Ilya Chernikov 8bf108dc17 FIR JS: Prepare JS/KLib infrastructure for FIR integration
rearrange declarations, abstract things that should be done differently
with FIR, etc.
2022-11-12 14:34:07 +01:00
Zalim Bashorov 89ba1b515e [Wasm, test] Use "dynamic import" to catch exception thrown during JS & Wasm modules initialization 2022-11-11 16:22:10 +01:00
Zalim Bashorov 5511377c2c [Wasm, tests] Cleanup and improvements in wasm test infra
- Remove no longer necessary separate generation to run inside browsers
- Generate index.html in DEBUG mode instead of SUPER_DEBUG
- Print link to index.html using IDEA builtin server (0.0.0.0:63342)
- Small improvements in generated index.html
2022-11-11 16:21:54 +01:00
Sergej Jaskiewicz 6d58d9cb8d [JS] Attempt to fix OOM in Node.js
But there are still segfaults, see
https://github.com/nodejs/node/issues/45410
2022-11-10 23:17:42 +00:00