Commit Graph

44 Commits

Author SHA1 Message Date
Filipp Zhinkin cadf4f63b0 KT-54739 Return single empty inst from collection builders(all src-sets)
Fixed remaining builders, added additional checks to a test.

^KT-54739 fixed
2023-04-26 12:05:15 +00:00
Ilya Gorbunov 2100f08655 Make subarrayContentToString internal 2023-04-26 10:44:52 +00:00
Abduqodiri Qurbonzoda 175566fe56 KT-51908 Common MatchGroupCollection.get(name) extension function 2023-04-26 10:44:21 +00:00
mvicsokolova 75b4469757 [K/N] Stabilization of Atomics API
`AtomicInt`, `AtomicLong`, `AtomicReference` and `AtomicNativePtr` classes were moved to `kotlin.concurrent` package. The corresponding classes from `kotlin.native.concurrent` were deprecated with warning since Kotlin 1.9.

In order to prepare for further commonization of Atomics API the following changes were made:
* `kotlin.concurrent.AtomicInt`: 
    * `increment(): Unit` and `decrement(): Unit` methods were deprecated with error
    * New methods were added: `incrementAndGet(): Int` , `decrementAndGet(): Int`, `getAndIncrement(): Int`, `getAndDecrement(): Int`, `getAndSet(newValue: Int): Int` 
* `kotlin.concurrent.AtomicLong`:
    * `increment(): Unit` and `decrement(): Unit` methods were deprecated with error
    * New methods were added: `incrementAndGet(): Long`, `decrementAndGet(): Long`, `getAndIncrement(): Long`, `getAndDecrement(): Long`, `getAndSet(newValue: Long): Long`
    * Deprecated `AtomicLong()` constructor with default parameter value
* For all atomic classes `compareAndSwap` method was renamed to `compareAndExchange`

See KT-58074 for more details.

Merge-request: KT-MR-9272
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-04-25 16:55:42 +00:00
Filipp Zhinkin 50841e7cb0 KT-42589 Add listOf, setOf, mapOf overloads for a single value to common src-set
`listOf`, `setOf` and `mapOf` overloads were defined in some source-sets
but common source-set was missing it.
This change adds common definition of these methods and also add
declarations for source-sets that were previously
missing it.

^KT-42589 fixed
2023-04-20 08:42:15 +00:00
Abduqodiri Qurbonzoda da0cc2ea4d [K/N] Deprecate Char.MIN_RADIX and MAX_RADIX constants
As a part of efforts to stabilize Native stdlib.
2023-04-19 20:33:33 +00:00
Abduqodiri Qurbonzoda b25f3be81b [K/N] Experimental Char code point constants and functions
Internalize WASM Char code point functions.

As a part of efforts to stabilize Native stdlib.
2023-04-19 20:33:33 +00:00
Abduqodiri Qurbonzoda 954e11c265 [K/N] Mark MutableList.replaceAll with ExperimentalNativeApi
As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-19 20:32:55 +00:00
Abduqodiri Qurbonzoda 208b279d2b [K/N] Internalize CharCategory.value/valueOf
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:42 +00:00
Abduqodiri Qurbonzoda 0d31b0d12c [K/N] Internalize RegexOption.value/mask properties
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:42 +00:00
Abduqodiri Qurbonzoda 3a4a00ef84 [K/N] Fix MatchGroup.range documentation
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:41 +00:00
Abduqodiri Qurbonzoda b6c2ce2dc8 [K/N] Make assert functions experimental with ExperimentalNativeApi 2023-04-19 19:02:14 +00:00
Vsevolod Tolstopyatov af9252aa96 Mark all Worker-related API as obsolete.
* Explain what obsolete means and why workers are obsolete
* Add some documentation to workers to explain its common pitfalls

^KT-54702


Merge-request: KT-MR-9563
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-04-19 09:28:23 +00:00
Abduqodiri Qurbonzoda 9076e5b112 [K/N] Mark BitSet usages in stdlib with @ObsoleteNativeApi 2023-03-23 14:48:23 +00:00
Abduqodiri Qurbonzoda ba2833b90f Mark Base64 API with ExperimentalEncodingApi 2023-01-16 11:24:50 +00:00
Abduqodiri Qurbonzoda dc03a03762 Introduce basic, url-safe and mime Base64 variants #KT-9823 2023-01-16 11:24:49 +00: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
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
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
Abduqodiri Qurbonzoda 7060811c8b Remove the brittle contains optimization code #KT-47707 2022-09-11 10:54:37 +00:00
Abduqodiri Qurbonzoda 2d0e95cea0 Remove StringBuilder functions with nonnull parameter type in K/N and JS #KT-53864 2022-09-08 12:16:55 +00:00
Abduqodiri Qurbonzoda 0208246094 Remove StringBuilder functions with renamed parameters in K/N #KT-53864 2022-09-08 12:02:37 +00:00
Vsevolod Tolstopyatov 5054e301be [stdlib] Improve EnumEntries
* Provide short-circuit methods for contract "EnumEntries contains all
  enum entries"
* Make EnumEntries serializable
* Introduce more convenient overload for other backends

#KT-53152


Merge-request: KT-MR-6867
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-08-22 16:50:28 +00:00
Ilya Gorbunov 1cfc6a8fca Move sources of ranges to common stdlib from builtins
But still cherry-pick them when serializing builtins because they are
used in builtins signatures.

Merge-request: KT-MR-6488
Merged-by: Ilya Gorbunov <Ilya.Gorbunov@jetbrains.com>
2022-06-23 03:49:30 +00:00
Alexander Shabalin 29f3445721 [K/N] Deprecated freezing ^KT-50541
Starting with 1.7.20 freezing is deprecated. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details.

Merge-request: KT-MR-6399
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-06-16 09:04:14 +00:00
Ilya Gorbunov f3cf8cc13b Hide subarrayContentToString in Native&Wasm 2022-04-12 15:03:40 +00:00
Ilya Gorbunov 4598552e46 Promote Regex.matchAt and matchesAt to Stable #KT-51470 2022-04-12 15:03:37 +00:00
Abduqodiri Qurbonzoda 1cb5cab28f [K/N and WASM] Fix ESCAPE and COMMENTS modes 2022-04-05 15:21:31 +00:00
Abduqodiri Qurbonzoda 7b46738796 [K/N and WASM] Throw on unknown inline flag modifier 2022-04-05 15:21:30 +00:00
Abduqodiri Qurbonzoda 9593069cb3 [K/N and WASM] Throw on duplicate group name 2022-04-05 15:21:30 +00:00
Abduqodiri Qurbonzoda d500d03baa [K/N and WASM] Support back references to groups with multi-digit index #KT-51776 2022-04-05 15:21:27 +00:00
Abduqodiri Qurbonzoda 9c4c1ed557 [K/N and WASM] Implement named capturing group in Regexes #KT-41890 2022-04-05 15:21:26 +00:00
Ilya Matveev f7468cf9bc [K/N][stdlib] Support \V, \v, \H, \h, \R in regex engine
Issue #KT-50742 Fixed
2022-02-21 13:20:23 +07:00
Igor Yakovlev d30a4fa4d5 [WASM/Native] Split AllCodePointsTest into two separate tests 2022-02-03 21:25:59 +01:00
Igor Yakovlev 195513d4f2 [WASM] Workaround about call toTypedArray on AbstractCollection 2022-02-03 21:25:58 +01:00
Igor Yakovlev e58d4163ad [WASM] Add std methods for collections 2022-01-05 13:12:32 +01:00
Igor Yakovlev 72e360be83 [WASM] More optimal way to keep regex decomposition table 2021-12-09 00:57:55 +01:00
Igor Yakovlev d55e16a030 [WASM] Regex std implementation 2021-12-07 21:33:31 +03:00
Pavel Punegov 0249b7ed74 [K/N] Stdlib: warnings as errors
Fix or suppress warnings in Native stdlib.
2021-11-25 08:08:38 +00:00
Svyatoslav Kuzmich b8a5b9bb02 [Native-Wasm][Stdlib] Workaround FE bug
Workaround bug that causes frontend to produce invalid IR (KT-49182)
2021-10-12 08:42:00 +03:00
Svyatoslav Kuzmich ab9a23cbfa [Wasm][Stdlib] Reuse K/N collections and StringBuilder 2021-10-01 17:18:49 +03:00