Commit Graph

3638 Commits

Author SHA1 Message Date
Ilya Gorbunov 916f733f73 Make k.c.Volatile since 1.9 in JVM and Common KT-55268, KT-55609
Leave it experimental since 1.8 for K/Native.
2023-01-04 17:28:46 +00:00
Ilya Goncharov b4c0cab22a [Gradle, JS] Regenerate API stdlib 2023-01-04 16:30:34 +00:00
Ilya Goncharov ba8cc877fd [Gradle, JS] Remove module dom-api-compat 2023-01-04 16:30:33 +00:00
Alexander Udalov ae6d4d268d Use short copyright from COPYRIGHT_HEADER in generated files 2023-01-02 22:52:18 +01:00
Mikhail Glukhikh bc5acb5e9d Regenerate built-ins copyright comments (year 2023) 2023-01-02 13:44:21 +01: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 35340f2f04 [Wasm] Fix stdlib String to Float parse 2022-12-29 11:57:47 +00:00
Igor Yakovlev 1b2b7ce34c [Wasm] Support Number type for external functions 2022-12-29 11:57:45 +00:00
Igor Yakovlev 4bd187ccea [Wasm] Move ItemArrayLike w3c declarations into the right package 2022-12-29 11:57:44 +00:00
Svyatoslav Kuzmich add5fa6e0d [Wasm] Minor: remove unused stdlib stub
Merge-request: KT-MR-8140
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2022-12-29 05:29:32 +00:00
Svyatoslav Kuzmich 3bbd8c291a [Wasm] Add @WasmImport annotation
Imports top-level function from given module
2022-12-28 12:13:18 +01:00
Abduqodiri Qurbonzoda fff593492d Introduce Common AutoCloseable & use #KT-31066
Co-authored-by: Ilya Gorbunov <Ilya.Gorbunov@jetbrains.com>

Merge-request: KT-MR-8113
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2022-12-27 11:50:22 +00:00
Ilya Gorbunov e2d96da396 Introduce experimental kotlin.concurrent.Volatile annotation KT-55268, KT-55609
Use this annotation in tests to ensure it works the same at least on JVM
2022-12-23 19:07:30 +01:00
Ilya Gorbunov b6e6ca7c96 Deprecate Synchronized annotation in common and JS #KT-55344 2022-12-22 21:22:44 +00:00
Ilya Goncharov 688894aabc [JS, Stdlib] Move DOM API to separate module kotlin-dom-api-compat
[JS, Stdlib] Leave sources of dom api inside stdlib

[Stdlib, JS] Leave ItemArrayLike inside stdlib
2022-12-22 15:45:23 +00:00
Dmitriy Novozhilov 7cbe13dee9 [JS] Update testdata of ApiTest.test(Ir)Stdlib
Most likely it caused by 17e9a6a781
2022-12-21 22:30:08 +00:00
Abduqodiri Qurbonzoda fb31a29c39 [K/N] Fix stack overflow in regex when a quantifier is matched many times
Motivation:

Users often expect simple patterns, like `[a]+` or `[^a]+`, to work fast
and without any problems, even with long strings.
Char class from the first pattern matches only 'a' and gets wrapped into
LeafQuantifierSet, and works fine with long strings indeed.
Char class from the second pattern, however, matches any character
except 'a', including supplementary code points. So, the number of chars
it consumes is not known beforehand. There is no optimization for such
char classes, and if they are matched multiple times, the stack memory
gets exhausted.

Modification:

Introduce FixedLengthQuantifierSet node.
The node represents quantifier over constructs that consume a fixed
amount of characters for a given string and index. Such constructs don't
need backtracking to find a different match. Thus, it is possible for
the node to avoid recursion when matching multiple times.

Result:

Fixes KT-46211, KT-35508 and probably KT-39789. Reproducer for the
latter issue is no longer available, but error stacktrace resembles
those of the other issues.
2022-12-19 16:40:51 +00:00
Abduqodiri Qurbonzoda 6e50bbee3b [K/N] Set mayContainSupplCodepoints flag only when alt is updated
Motivation:

Calling AbstractCharClass.setNegative always leads to
mayContainSupplCodepoints being `true`, even when `alt` is already
equal to the argument. Given that CharClass always calls setNegative
with its constructor parameter - `negative`, mayContainSupplCodepoints
always gets set. i.e. `[a]` will have mayContainSupplCodepoints set.
mayContainSupplCodepoints affects what node (RangeSet or SupplementaryRangeSet)
wraps this char class. See Pattern.processRangeSet.
RangeSet is better optimized and avoids recursion when it is quantified.

Modification:

Set `mayContainSupplCodepoints` flag only when `alt` is updated.
When `alt` is updated, this char class gets inverted, hence now may
contain supplementary code points.
Otherwise, content of this char class does not change, i.e. no new
supplementary code points is added.

Result:

Fixes KT-46211.
2022-12-19 16:40:51 +00:00
Abduqodiri Qurbonzoda d7f166eda3 [K/N] Remove unused SupplementaryCharSet in regex
Motivation:

The node was never used. Perhaps, it was copied from apache harmony
but ultimately, despite possible performance impact, SequenceSet was
used instead. See Pattern.processCharSet and AbstractSet.first.
The performance impact wouldn't be noticeable anyway.

Modification:

Keeping unused code in project is not a good practice, so get rid of it.

Result:

Less code to maintain.
2022-12-19 16:40:50 +00:00
Takumi Maeomote c4f83adc2a Add sample for Map.asSequence (#5055) 2022-12-15 19:58:38 +03:00
Pavel Mikhailovskii 6db5f8ee7f KT-55123 Add a default constructor to "expect" JvmSerializableLambda 2022-12-07 16:41:11 +00:00
Svyatoslav Kuzmich 7ec6608e29 [Wasm] Add Promise and support tests that return Promise
Co-authored-by: Ilya Gorbunov <Ilya.Gorbunov@jetbrains.com>

Merge-request: KT-MR-7717
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2022-11-25 20:56:47 +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
Ilya Gorbunov 7dd907342e Document the nature of natural order KT-54168 2022-11-25 14:09:10 +00:00
Ilya Gorbunov 0d0cc9250b Note about all() result on empty collections KT-54835 2022-11-25 14:09:09 +00:00
Ilya Gorbunov 77e03bb769 Minor fixes in math docs 2022-11-25 14:09:09 +00:00
Ilya Gorbunov b8728c18cb Fix Optional.asSequence docs 2022-11-25 14:09:09 +00:00
Abduqodiri Qurbonzoda 3f95b7e031 Clarify Map.getOrElse and MutableMap.getOrPut documentation #KT-21392 2022-11-25 09:37:37 +00:00
Igor Yakovlev c8306f1a3b [Wasm] Mark rotate functions with WasExperimental 2022-11-19 11:49:06 +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
Yahor Berdnikau e07e92c945 Raise 'kotlin.jvm.target.validation.mode' default value to 'error'.
Now target check intentionally runs always - even when Java sources are
empty. Java part configures publication 'org.gradle.jvm.version'
attribute which affect  published artifact consumers and should be the
same as Kotlin jvmTarget value.

^KT-54993 Fixed
2022-11-18 10:42:00 +00: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 210212c284 [WASM] Remove redundant parameters for w3c dynamic getters 2022-11-11 10:53:05 +00:00
Igor Yakovlev b6eb2b3620 [WASM] Add w3c bindings 2022-11-10 14:22:44 +00:00
Zalim Bashorov 9ed94b25fa [Wasm] Cleanup instructions list
* Split by proposal, at least for work-in-progress ones
* Add a link to the repo for WIP proposals
* Move some instructions to right group
2022-11-09 13:44:38 +01:00
Joshua Schwartz 96e789098f Close parenthesis
Also replace semicolon with comma to fix grammar.
2022-11-02 16:42:41 +02: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
Artem Kobzar 8a89b2f29f [K/JS] Remove the old interface runtime check because of bootstrapping
Merge-request: KT-MR-7457
Merged-by: Artem Kobzar <Artem.Kobzar@jetbrains.com>
2022-10-21 11:34:31 +00:00
Artem Kobzar 23384dd57d [K/JS] Remove @Suppress from stdlib @JsExport.Ignore 2022-10-19 10:22:15 +00:00
Igor Yakovlev 5218acd5c9 [WASM] Optimise interop adapters 2022-10-18 20:48:12 +02:00
Sergey Bogolepov c6bbce986d [K/N] Fix KT-54498
Forward users to kotlinlang.org instead of new_mm.md because the latter
is obsolete now.
2022-10-17 14:36:59 +00:00
Abduqodiri Qurbonzoda 71381ec8e2 [K/N] HashMap/HashSet doesn't reclaim storage after removing elements #KT-53310 2022-10-07 11:19:31 +00:00
Nikolay Krasko b5b58f40d6 Workaround instability of Gradle builds caused by the default encoding
The encoding setting from org.gradle.jvmargs is not applied
(https://github.com/gradle/gradle/issues/22292) during
the :kotlin-stdlib-js:compileJs, causing instability in kotlin.js.map
(https://youtrack.jetbrains.com/issue/KT-50589) on machines where
default encoding is not UTF-8.

This reverts commit d7ef5efa6a.

KTI-932
2022-10-05 10:57:46 +00:00
Artem Kobzar eb2326eabb [K/JS] Add ability to exclude declarations from export by a new annotation @JsExport.Ignore. 2022-10-03 11:07:25 +00:00
Abduqodiri Qurbonzoda 917c8606f5 Document @Synchronized behavior on extension functions #KT-32469 2022-10-03 10:16:37 +00:00