Commit Graph

3752 Commits

Author SHA1 Message Date
Zalim Bashorov 521a272acb [Wasm] Pass js stack value directly when replacing a wasm exception with JS one
In this case, we don't need to convert a value to and from wasm String.
2023-04-17 16:15:22 +00:00
Zalim Bashorov 6bfd1e7e9f [Wasm] Stop using unsigned numbers in ScopedMemoryAllocator
It turned out that using unsigned numbers is heavy both in terms of size and performance.
We can consider switching back (KT-58041) as soon as we implement unsigned numbers and operations using wasm built-in capabilities (KT-58039).
2023-04-17 16:15:22 +00:00
Filipp Zhinkin 368f21461c KT-55091 Optimize Sequence::toSet/toList implementation
Sequence::toSet and Sequence::toList both create a
collection, fill it with elements, and then try to optimize a result
by returning empty, singleton, or the allocated collection depending on
the elements count.
Instead of allocating the collection and then trying to return
an optimized instance it is worth checking the sequence's size
beforehand and return empty/singleton collection when possible.

Proposed change optimize performance of aforementioned functions and
also reduce allocation rate when a sequence consists of 0 or 1 elements.

^KT-55091 fixed
2023-04-17 08:58:20 +00:00
Alexander Korepanov e8be3043cc [JS IR] Allow restriction of function argument by external type
Add a special annotation @JsExternalTypeArgument for
 marking function parameters. The marked parameter
 accepts an argument with an external type only.

^KT-57479 Fixed
2023-04-17 08:21:10 +00:00
Abduqodiri Qurbonzoda 8629c92c62 Update copyright of generatedUnicodeData files 2023-04-12 23:28:12 +00:00
Iaroslav Postovalov fb80c0cb0d Override toString function in stdlib delegates
Co-authored-by: ilya-g <ilya.gorbunov@jetbrains.com>
2023-04-11 14:46:29 +00:00
Abduqodiri Qurbonzoda c961c15729 Commonize AssertionError(message, cause) constructor 2023-04-11 13:32:54 +00:00
Filipp Zhinkin d0847f2519 KT-57617 Delegate iterators of reversed list views to underlying list iterators
Improve the performance of reversed list view iterators by delegating to
underlying list iterators instead of using implementations provided by
the AbstractList.
Latter use AbstractList::get(index: Int) to implement next() and
previous() methods and depending on the underlying list's implementation
it may lead to worse performance.

The change also improves reversed list views test coverage.
2023-04-11 08:16:21 +00:00
Abduqodiri Qurbonzoda b65a68ca0d [K/N and WASM] Internalize NoWhenBranchMatchedException and UninitializedPropertyAccessException
As a part of efforts to stabilize Native stdlib.

Merge-request: KT-MR-9531
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-04-10 21:10:51 +00:00
Ilya Gorbunov f8d001c21f KT-57298 createParentDirectories: handle already existing directory symlink 2023-04-08 15:21:12 +00:00
Ilya Gorbunov 912b65060e KT-55610 Deprecate k.j.Volatile annotation in Common and JS
Use k.c.Volatile in common AbstractMap instead
2023-04-08 15:07:56 +00:00
Ilya Gorbunov b8da3e69ce KT-55268 Make k.c.Volatile stable 2023-04-08 15:07:56 +00:00
Ilya Gorbunov 2dbff89098 Split tests for MutableList.shuffle and Iterable.shuffled 2023-04-08 14:47:30 +00:00
Ilya Gorbunov f13e127b0f KT-57607 Add test for MutableList.addAll at index
Also improve other operations test coverage
2023-04-08 14:47:30 +00:00
Zalim Bashorov 155eb9b77a [Wasm, stdlib] extract Any::identityHashCode to workaround the bug in FunctionDescriptorFactory
A fix is on its way -- KT-MR-9426.
2023-04-05 20:50:53 +02:00
Zalim Bashorov 9760e3ee1e [Wasm] Introduce check and error specialized for String to reduce output size 2023-04-05 20:50:52 +02:00
Zalim Bashorov 295acdf2af [Wasm] Rewrite lazy initialization without by lazy and lateinit to reduce overhead 2023-04-05 20:50:52 +02:00
Zalim Bashorov 1a8a4fa65d [Wasm] Don't use by lazy inside Throwable 2023-04-05 20:50:52 +02:00
Zalim Bashorov 67357fa5d4 [Wasm] Replace heavyweight stackTraceToString with "pure" JS stack 2023-04-05 20:50:52 +02:00
Zalim Bashorov 14af47bbd9 [Wasm] Introduce utilities to get package and name of class directly from metadata and use it in some places 2023-04-05 20:50:52 +02:00
Zalim Bashorov a9b553f16e [Wasm] Don't use by lazy to keep some JS values used by adapters 2023-04-05 20:50:52 +02:00
Zalim Bashorov 2ef47901d0 [Wasm] Introducing private identityHashCode shared between Any's hashCode and toString
It splits the dependency of toString from hashCode that prevents keeping hashCode when toString is used.
2023-04-05 20:50:51 +02:00
deotime 7aaba3b78a [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib (#5116)
* Fix performance of ArrayList.addAll methods in JS stdlib: extend the backing array and copy elements manually
* Update expected reachable nodes after DCE in test data

---------

Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
2023-04-05 20:18:11 +02:00
Alexander Korepanov 4813b659ab [JS IR] Control an inheritance of non-external entity from external
Add a special annotation @JsExternalInheritorsOnly for marking
 external interfaces and classes. The marked interface or class
 can’t be a parent for non external interfaces, classes or objects.

^KT-57423 Fixed
2023-04-05 09:00:45 +00:00
Igor Yakovlev 49beec33b4 [Wasm] Replace ClassId and InterfaceId with single TypeId 2023-04-04 18:39:18 +00:00
Igor Yakovlev 5a46cb1c40 [Wasm] Fix invalid float and double sign parser for '-Infinity' value 2023-04-04 18:39:18 +00:00
Igor Yakovlev b8f797af00 [Wasm] Support for Associated Objects feature 2023-04-04 18:39:17 +00:00
Abduqodiri Qurbonzoda 352316ba9f [K/N] Add @SinceKotlin for ObjC annotations #KT-57197 2023-04-03 12:21:31 +00:00
Svyatoslav Kuzmich 46a6695072 [Wasm] WebIDL: Make getters and setters not inline 2023-03-29 11:08:30 +00:00
Svyatoslav Kuzmich 0c7d625123 [Wasm] Suppress warning of unused parameter in WebIDL js(code) functions 2023-03-29 11:08:30 +00:00
Svyatoslav Kuzmich c466f926b0 [Wasm] Deprecate Dynamic in favour of JsAny
Remove extension methods created to compile
Kotlin/JS-like WebIDL bindings

^KT-57060 Fixed
2023-03-29 11:08:30 +00:00
Svyatoslav Kuzmich 0e54ec5ef6 [Wasm] Stop using Dynamic in WebIDL generated code 2023-03-29 11:08:29 +00:00
Svyatoslav Kuzmich cafc27aae9 [Wasm] Add JsAny.unsafeCast
Replacement for Dynamic.unsafeCast, but limited to JsAny types where
it makes sense.
2023-03-29 11:08:29 +00:00
Svyatoslav Kuzmich e32611d2f2 [Wasm] Make Promise methods generic instead of using Dynamic
Copy full Promise implementation from Kotlin/JS,
and specify JsAny? upper bounds
2023-03-29 11:08:29 +00:00
Svyatoslav Kuzmich 635671d623 [Wasm] Stop using Dynamic in kotlin-test 2023-03-29 11:08:28 +00:00
Artem Kobzar c6e4858bc9 [K/JS] Remove the ability to run Legacy JS backend from the Gradle Plugin 2023-03-28 12:47:04 +00:00
Dmitriy Novozhilov a64d8e8a31 [Stdlib] Deprecate and make open Number.toChar()
^KT-46465 Fixed
2023-03-27 10:46:13 +00:00
Dmitriy Novozhilov 90ec84d7b7 [Stdlib] Update copyrighting in generated stdlib sources 2023-03-27 10:46:11 +00:00
Abduqodiri Qurbonzoda 9076e5b112 [K/N] Mark BitSet usages in stdlib with @ObsoleteNativeApi 2023-03-23 14:48:23 +00:00
Ilya Gorbunov 9892a49c4b KT-54452 Use js-ir sources for building stdlib-js sources.jar and API docs 2023-03-22 05:57:14 +00:00
Anton Bannykh b0de442d76 JS IR: fix throwable descendants
^ KT-43490 fixed
2023-03-21 12:32:41 +00:00
Vyacheslav Gerasimov 76c54a8ff3 Build: Fix usages of apis deprecated in Gradle 8 2023-03-20 19:45:39 +00:00
Vsevolod Tolstopyatov 33d13474c5 Make EnumEntries implementation eager
* Addresses the recent design changes of the corresponding language feature
* Also rework JS/Wasm enumEntries implementation with the function that accepts array instead of fabric function


^KT-57318


Co-authored-by: Artem Kobzar <Artem.Kobzar@jetbrains.com>

Merge-request: KT-MR-9204
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-03-20 10:18:28 +00:00
Artem Kobzar 948c511284 [K/JS] Rework ES modules part with squashed JsImport and right renaming strategy inside import/export statements 2023-03-16 10:28:39 +00:00
Svyatoslav Kuzmich 76b4498399 [Wasm] IDL bindings improvements
- Generated types extend JsAny
- Use JsAny instead of Dynamic
- Use JsArray instead of Array
- Use JsNumber, JsString and JsBoolean in JsAny context
- Refactor dictionary constructor functions
2023-03-16 09:12:08 +00:00
Svyatoslav Kuzmich 1208a26fc4 [Wasm] Use JsAny, JsHandle and other Js* types in stdlib and kotlin-test 2023-03-16 09:12:07 +00:00
Svyatoslav Kuzmich d6886d69ec [Wasm] Add internal JsPrimitive annotation
Before external classes could only represent JS object types and are
type-checked with `instanceof`.
@JsPrimitive allows external classes to represent primitive types with
`typeof` checks.
2023-03-16 09:12:07 +00:00
Svyatoslav Kuzmich a99ea1d3ce [Wasm] Support enumValues and enumValueOf functions
^KT-57276 Fixed

Merge-request: KT-MR-9169
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2023-03-13 14:13:31 +00:00
Artem Kobzar ab7b429298 [K/JS] Add ability to use is checks on external objects 2023-03-10 11:33:30 +00:00
Ilya Chernikov 1d72681e4e K2: Fix stdlib test use of assertEquals
fixes test compilation according to the workaround
described in #KT-56717
2023-03-08 09:38:48 +00:00