Commit Graph

30 Commits

Author SHA1 Message Date
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