Commit Graph

262 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
Abduqodiri Qurbonzoda 8629c92c62 Update copyright of generatedUnicodeData files 2023-04-12 23:28:12 +00:00
Abduqodiri Qurbonzoda c961c15729 Commonize AssertionError(message, cause) constructor 2023-04-11 13:32:54 +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
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
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
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
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
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
Svyatoslav Kuzmich 4be359ba02 [Wasm] Add @SinceKotlin("1.9") to js(code) 2023-03-03 19:39:12 +00:00
Svyatoslav Kuzmich 3566d918d2 [Wasm] Deprecate @JsFun with warning
kotlin.js.js("code") should be used instead
2023-03-03 19:39:11 +00:00
Svyatoslav Kuzmich 7175b9f31c [Wasm] Migrate usages of @JsFun to js("code") 2023-03-03 19:39:10 +00:00
Svyatoslav Kuzmich 71e6b19760 [Wasm] Support restricted version of js("code") (KT-56955) 2023-03-03 19:39:09 +00:00
Svyatoslav Kuzmich eb8c47343a [Wasm] Don't use js("code") in browser API
Use internal newJsObject to create new objects instead.

This is a preparation for restricted js("code") support (KT-56955)
2023-03-03 19:39:09 +00:00
Vyacheslav Gerasimov 34fcbb32ff Revert "[Build] Fix compilation of kotlin-js(-ir) libraries in 1.9.0 (stdlib and test)"
This reverts commit d39fd9416a.
2023-03-03 15:06:23 +00:00
Artem Kobzar d39fd9416a [Build] Fix compilation of kotlin-js(-ir) libraries in 1.9.0 (stdlib and test) 2023-02-18 13:26:53 +00:00
Alexander.Likhachev 18752fc1ad Revert "[Build] Add a temporary workaround for KT-56357"
This reverts commit ca60a4fcf9.
2023-02-17 15:03:53 +01:00
Yahor Berdnikau 6f8422eab3 Revert "[Build] Temporary disable hmpp metadata tasks with CoCa"
This reverts commit e42bed07fa.
2023-02-08 16:27:27 +00:00
Yahor Berdnikau 8d41c87b6b Revert "[Build] Add configuration cache compatibility workaround for MetadataDependencyTransformationTask"
This reverts commit a5f48e295e.
2023-02-08 16:27:27 +00:00
Alexander Korepanov 9324cf3360 [JS IR] Support function type interfaces in incremental cache infrastructure
The patch removes logic of generating extra IrFiles (fake file) into
 IrModuleFragment for the function type interfaces during klib deserialization,
 because IC infrastructure can not process files which do not exist in klib.

 Instead of adding extra IrFiles during deserialization, the empty files
 with required packages are added into Kotlin/JS stdlib physically.
 These files are used as containers for function type interface declarations.

 Since Kotlin/WASM uses the same klib loading infrastructure as Kotlin/JS,
 the the empty files are added into Kotlin/WASM stdlib as well.

 The patch also adds a check that IrModuleFagment has files only from klib.

^KT-55720 Fixed
2023-02-03 12:23:48 +00:00
Svyatoslav Kuzmich abf70a586c [Wasm] stdlib API: make kotlin.assert internal
Being disabled by default
 and not well-documented, these functions cause confusion among early
 adopters as to why their code don't work properly.

Assert APIs need a proper design across Kotlin platforms.
 Since APIs are not available in common code and K/JS, it is premature
  to have such a general feature in a new experimental platform.

Compiler tests:
* Mute tests that rely on assert.
* Replace JVM-specific assert calls with require calls and unmute passed K/JS tests.

Merge-request: KT-MR-8636
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2023-02-02 07:06:12 +00:00
Alexander.Likhachev ca60a4fcf9 [Build] Add a temporary workaround for KT-56357 2023-02-01 14:56:07 +01:00
Dmitriy Novozhilov a5f48e295e [Build] Add configuration cache compatibility workaround for MetadataDependencyTransformationTask 2023-02-01 11:31:45 +00:00
Zalim Bashorov 58e523b890 [Wasm] Change target directory for wasm intrinsics for finer tuning code owners
Also, minor cleanup in the generator.
2023-02-01 00:35:49 +01:00
Zalim Bashorov 885381dd63 [Wasm] Change externRefToAny to make it compatible with SpiderMonkey and V8
It's hard to achieve that without implementing part of `externRefToAny` using an intrinsic. It should be rewritten when all VMs and tools update to the latest spec.

Also, stop using (deprecated) instructions unsupported by SpiderMonkey.

#KT-56166 In-Progress
2023-01-27 17:57:50 +01:00
Svyatoslav Kuzmich 983140ca04 [Wasm] stdlib NFC: suppress unchecked cast 2023-01-24 16:02:48 +01:00
Svyatoslav Kuzmich feca26e481 [Wasm] stdlib NFC: remove experimentalPackageStub.kt
Common sources now include `kotlin.experimental` and this file is no longer needed.
2023-01-24 14:55:00 +01:00
Svyatoslav Kuzmich e1f72d60dc [Wasm] stdlib API: Mark primitives constructor properties as private
These are implementation detail and were not meant to be public
2023-01-24 14:55:00 +01:00
Svyatoslav Kuzmich 354b231ea2 [Wasm] stdlib API: Mark internal compareTo functions as internal
Default public visibility was a mistake.
They were not intended to be public.
2023-01-24 14:54:59 +01:00