Commit Graph

3658 Commits

Author SHA1 Message Date
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
Ilmir Usmanov 945cdc8884 Minor. Ignore tests in JS_IR_ES6, regenerate tests 2023-01-19 17:04:31 +01:00
Ilmir Usmanov d18672bfb1 Wrap continuation with ContinuationImpl on callable references
in startCoroutineUninterceptedOrReturn. Otherwise, the coroutine will
not be interceptable later.

Add a test, which checks, that intercepted continuation is released.

 #KT-55869
2023-01-19 00:35:36 +00:00
Pavel Kunyavskiy 2843c0ad1e [K/N] Fix cleaning stack-local primitive array
^KT-55984
2023-01-18 11:52:43 +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
Alexander Korepanov c502cae437 [JS IR IC] Calculate symbol hashes on demand
Optimization: often we don't need all hashes for all available symbols.
 This patch allows the calculation of the symbol hash only on demand.

 This patch also allows cycles for the inline function dependency
 graph in the IC infrastructure. Note that the inline function cycles
 may crash the inliner, however it is not the IC infrastructure
 responsibility to check the cycles.
2023-01-17 15:48:36 +00:00
Alexander Korepanov a5c8e30bb1 [JS IR] Use a copy of an original inline function for inlining
If inline function A calls another inline function B,
 we must use the original version of inline function A for inlining,
 which doesn’t have inlined function B. Because during the inlining
 process, we remap all occurrences of inline function A
 to a temporary copy of function A, and if the function B
 somehow uses function A (e.g. callable reference),
 the built IR will have a reference to the temporary function,
 not the original one. All these things lead to broken cross-module references.

 This patch saves the original versions of all inline functions
 before inlining and provides them during the inline process.

^KT-55930 Fixed
2023-01-16 11:01:03 +00:00
Pavel Kunyavskiy fc95b88eef [K/N] Tests for volatile
^KT-54944
2023-01-16 08:34:23 +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
Sergej Jaskiewicz 4a2a77d9b9 [K/N] Make classes generated from λs that use generic parameters generic
Previously, a function reference that used generic parameters from its
outer scope was lowered into a top-level non-generic subclass of
`FunctionN`, with `FunctionN` type arguments referencing type parameters
not present in the scope anymore. This sometimes resulted in generating
malformed mangled names.

From now on the generated subclass of `FunctionN` is generic. The needed
type arguments are passed upon instantiation, when the relevant generic
parameters are present in the scope.
2023-01-12 15:32:50 +00:00
Anton Bannykh 698be0fddd JS IR: custom JS AST serialization 2023-01-11 15:56:57 +00:00
Vyacheslav Gerasimov 417fef0d58 Build: Change node directory in :js:js.tests project to build/node
#KTI-1087
2023-01-11 11:58:40 +00:00
Svyatoslav Kuzmich 1564de5859 [Wasm] Support external vararg
Initial implementation copies Wasm array to JS array and spreads it
2023-01-11 10:35:36 +00:00
Alexander.Likhachev 202fe9e41e [Build] Fix configuration cache issue on running :js:js.tests:test
#KT-55839 Fixed
2023-01-10 19:08:09 +00:00
Artem Kobzar 642bbd38ba [K/JS] Move global interface id state into an object to prevent interface ids reinitialization ^Fixed KT-55758 2023-01-09 20:56:19 +00:00
Alexander Korepanov 5f10e605a9 [JS IR] Don't check an interface method default impl during JS translation
We do not need to check a default implementation of the interface during
 the translation to JS because it must be checked before.

 Moreover, this check breaks the produced JS code
 if IR is partial loaded, e.g. during the incremental rebuild.

^KT-55716 Fixed
2023-01-09 09:46:17 +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
Abduqodiri Qurbonzoda 4af0f110c7 Fix 'Test: stdlib-js public kotlin api test' IDEA run configuration
Moving tests to another package made the IDEA run configuration obsolete.
To prevent this problem in the future a separate task (jsStdlibApiTest)
was introduced. The task is run in TC and will fail if the tests are missing.

Merge-request: KT-MR-8128
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-01-07 12:30:52 +00:00
Igor Yakovlev f7940a2d46 [Wasm] Fix invalid cast generation for inline classes 2023-01-04 17:16:04 +00:00
Artem Kobzar 97be632c9a [K/JS] Add @ts-ignore for the case when there is a class with a private primary constructor (or excluded from export) which has an exported subclass ^Fixed KT-52563 2023-01-04 15:21:40 +00:00
Alexander Udalov 3c4b5529af Update year to 2023 in COPYRIGHT_HEADER.txt
This commit is the result of changing the year to 2023 in
COPYRIGHT_HEADER.txt and running all `generate*` tasks in
`generators/build.gradle.kts`.
2023-01-02 22:52:15 +01:00
Igor Yakovlev fc80104d55 [Wasm] Fix external functions import clashing 2022-12-29 11:57:47 +00:00
Igor Yakovlev 3be3ae4895 [Wasm] Fix invalid boxing for non-primitive typed vararg 2022-12-29 11:57:46 +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
Vyacheslav Gerasimov 719cdce609 Build: Make mochaTest a VerificationTask to allow skipping it with flag
#KTI-1076
2022-12-22 18:45:41 +01:00
Vyacheslav Gerasimov 7348e34fd0 Build: Run only jsTests before mocha tests
Only js tests produce mocha tests to run
2022-12-22 18:45:40 +01:00
Svyatoslav Kuzmich d788adcbb5 [Wasm] Move non-recursive function types out of rec group
This fixes linking with other wasm modules with non-rec types
2022-12-21 20:20:13 +00:00
Artem Kobzar cd0ae20c38 [K/JS] Capture stackTrace before the init function call ^Fixed KT-55315 2022-12-20 18:15:02 +00: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
Alexander Korepanov 4136189114 [JS IR] Check all signatures of dependent file in IC graph
It is important to check all signatures, because signatures
 can be simultaneously moved between files and modified.
2022-12-20 16:04:14 +00:00
Igor Chevdar 0f2ebeea15 [tests] Added a test for KT-55494 2022-12-16 18:32:42 +00:00
Sergej Jaskiewicz 9c6f92d697 [test] Add a test for KT-55318 2022-12-13 17:01:00 +00:00
Evgeniy.Zhelenskiy f09fb5ed09 [IR] Enable tests for inline classes secondary constructors with body for not JVM
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55333
2022-12-11 22:06:47 +01:00
Vyacheslav Gerasimov ba81bd052f Build: Include missing tests in jsTest, jsIrTest, jsFirTest tasks
Some tests were included only in common :js:js.tests:test task and
 missing in specialized test tasks (jsTest, jsIrTest, jsFirTest)
2022-12-09 20:42:08 +01:00
Vyacheslav Gerasimov 7d0935a8c5 Build: Refactor :js:js.tests:runMocha task
Introduce separate mochaTest task without dependency on test task
2022-12-09 20:42:07 +01: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
pyos 0d46dfc1ba FIR: fix substitution of type arguments in SAM type aliases
^KT-54730 Fixed
2022-12-07 22:09:20 +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 d21cbfe02e [JS IR] Take into account the declaration annotations in IC hash
So the annotation modifications invalidate the caller.
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 d8ab9498ab [JS IR] Fix inline functions call graph in IC
Add a dependency for inline function references,
 because in some cases the references may be inlined.

^KT-55144 Fixed
2022-12-02 13:50:37 +00:00