Commit Graph

88 Commits

Author SHA1 Message Date
Artem Kobzar 8c69ffe8c9 [K/Wasm] Generate wasm-specific unsigned implementations ^KT-58039 Fixed 2024-01-29 20:11:41 +00:00
Ilya Gorbunov cfa8a1dc0f [stdlib] Explicit visibility and return types: Wasm 2023-11-21 18:14:09 +00:00
Ilya Gorbunov 53681a33d9 Add required opt-ins in wasm stdlib sources 2023-10-17 16:30:41 +00:00
Igor Yakovlev 8cc0660693 [Wasm] Wasi stdlib implementation
KT-56608
2023-08-08 18:10:19 +02:00
Igor Yakovlev 090f393f97 [Wasm] Make std internal functions have a bodies 2023-08-08 18:10:19 +02:00
Zalim Bashorov 4572680877 [Wasm] Migrate to the latest br_on_cast* instructions
#KT-59722 Fixed
2023-07-28 16:16:33 +00:00
Abduqodiri Qurbonzoda 193aa0f935 Align the Boolean.hashCode() value across platforms
Boolean.hashCode() should return 1231/1237 for true/false correspondingly.

As a part of efforts to stabilize Native stdlib.
2023-06-14 08:19:46 +00:00
Igor Yakovlev 1749bafc30 [Wasm] Rename dateref to structref 2023-05-19 15:50:07 +00:00
Igor Yakovlev 6437d0919c [Wasm] Replace deprecated cast instructions 2023-05-19 15:50:06 +00:00
Zalim Bashorov 77491ded1b Use Array constructor with size to create Array of nulls
Change the constructor visibility from public to private as it should be.
2023-04-22 17:41:23 +00:00
Svyatoslav Kuzmich 933f47aaf9 [Wasm] Rename JsHandle to JsReference
Decision to do this was made at Kotlin/Wasm interop design meeting
2023-04-21 15:03:20 +00:00
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 295acdf2af [Wasm] Rewrite lazy initialization without by lazy and lateinit to reduce overhead 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
Igor Yakovlev 49beec33b4 [Wasm] Replace ClassId and InterfaceId with single TypeId 2023-04-04 18:39:18 +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 7175b9f31c [Wasm] Migrate usages of @JsFun to js("code") 2023-03-03 19:39:10 +00: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 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
Svyatoslav Kuzmich 72d9b8ddae [Wasm] stdlib NFC: Fix or suppress remaining warnings 2023-01-24 14:54:59 +01:00
Svyatoslav Kuzmich 14cf0a0b3f [Wasm] stdlib NFC: Remove dead code in Number2String.kt
This fixes compiler warning
`w_exp` corresponds to unused field of `w` struct
in the original C code
2023-01-24 14:54:59 +01: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
Svyatoslav Kuzmich 9bc6b420a9 [Wasm][Stdlib] Add public APIs for linear memory access
Needed for interop with APIs that use linear memory.
2022-12-29 19:25:23 +00:00
Igor Yakovlev 1b2b7ce34c [Wasm] Support Number type for external functions 2022-12-29 11:57:45 +00:00
Zalim Bashorov 7f8f7aa050 [Wasm] Revert ref cast and test instructions to be compatible with Binaryen 2022-11-25 15:31:48 +01:00
Zalim Bashorov 5f140dac21 [Wasm] Remove wasm_ref_cast and use wasm_ref_cast_null inside the compiler 2022-11-25 15:31:47 +01:00
Zalim Bashorov 919029f34f [Wasm] Add fast path for null in externRefToAny
- Introduce new intrinsics `wasm_ref_cast_null` & `wasm_ref_test_null`.
- Support getting type for immediate from generic argument.
- Remove redundant null check in `tryGetOrSetExternrefBox`.
2022-11-18 17:30:10 +01:00
Zalim Bashorov ab590e1279 [Wasm, stdlib] Change visibility for wasm_* helper functions to internal 2022-11-15 12:55:10 +01:00
Zalim Bashorov 2fc6cea681 [Wasm] Migrate to the new GC M6 instructions 2022-11-15 12:55:10 +01:00
Igor Yakovlev 346b2f162c [WASM] Optimize varargs without spreads 2022-11-01 13:15:11 +00:00
Igor Yakovlev 8d8430cde7 [WASM] Remove unnecessary boxing/unboxing 2022-11-01 13:15:10 +00:00
Igor Yakovlev 0e16889f45 [WASM] Fast load string literals from data section 2022-11-01 13:15:09 +00:00
Igor Yakovlev 033e2c45f1 [WASM] Caching string literals in global pool 2022-11-01 13:15:09 +00:00
Igor Yakovlev 5218acd5c9 [WASM] Optimise interop adapters 2022-10-18 20:48:12 +02:00
Igor Yakovlev 081cd4a4a8 [WASM] Support nullable types for external functions 2022-09-22 11:54:04 +02:00
Igor Yakovlev c94a051c19 [WASM] Renew to Milestone 6 instructions set 2022-09-15 16:27:42 +00:00
Igor Yakovlev 95396eb61a [WASM] When expressions optimisations for String and Int constant cases 2022-09-15 16:27:39 +00:00
Igor Yakovlev fff6b16483 [WASM] Wasm string.plus optimisations 2022-09-15 16:27:39 +00:00
Igor Yakovlev 0ea7e8b70a [WASM] Add array copy intrinsic 2022-07-06 19:07:56 +00:00
Igor Yakovlev 8306b1bd71 [WASM] Remove deprecated wasm instructions 2022-07-06 19:07:56 +00:00
Igor Yakovlev 6f88e9b16f [WASM] Fix interop adapter for long strings 2022-06-28 18:00:40 +00:00
Igor Yakovlev 641b2c6974 [WASM] Remove redundant bootstrap code 2022-05-28 13:26:14 +02:00
Igor Yakovlev 73a86fffe5 [WASM] Bootstrap std compatibility fix 2022-05-20 16:33:57 +02:00
Igor Yakovlev 8da6ab7a04 [WASM] New VTable format 2022-05-20 16:33:57 +02:00
Igor Laevsky 2c9bfe901d [Wasm] Pull array range checks into single function 2022-04-05 18:00:31 +00:00
Igor Yakovlev d881f0d2a6 [WASM] Replace String storage type from CharArray to WasmCharArray 2022-03-21 17:24:38 +00:00