Commit Graph

15616 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 44a5882bc2 string.c (mrb_memsearch_ss): remove useless alignment adjustment
Ref #6158
2024-01-31 01:27:10 +09:00
Yukihiro "Matz" Matsumoto be5448fd16 string.c (mrb_memsearch): refactor m==1 (use memchr) case 2024-01-31 01:17:12 +09:00
Yukihiro "Matz" Matsumoto d8e1aed646 string.c (search_nonascii): need not to check n>3 on 32bit platforms 2024-01-30 12:35:56 +09:00
Yukihiro "Matz" Matsumoto 0e1125c3af Merge pull request #6152 from dearblue/io-error
Retrieving the IO exception class with presym
2024-01-27 15:10:29 +09:00
Yukihiro "Matz" Matsumoto fefebf7a77 Merge pull request #6151 from dearblue/eval-init
Refer to `mrb->module_class` directly in `mrb_mruby_eval_gem_init()`
2024-01-27 15:09:30 +09:00
Yukihiro "Matz" Matsumoto e859b430cc fixup! string.c (search_nonascii): add faster search using SSE2 2024-01-27 11:59:29 +09:00
Yukihiro "Matz" Matsumoto dee1ded7b5 string.c (mrb_memsearch_ss): support bigendians 2024-01-27 06:23:16 +09:00
Yukihiro "Matz" Matsumoto 06d9a54760 string.c (mrb_memsearch): remove simple search and quick search
Since mrb_memsearch_ss() is fast enough for most of the cases, we try to
simplify the code.
2024-01-27 06:22:55 +09:00
Yukihiro "Matz" Matsumoto 2943ca2685 string.c (mrb_memsearch_ss): faster integer-wise substring search
The function is based on @WojciechMula's code from the repository
https://github.com/WojciechMula/sse4-strstr.git Since it's licensed
under 2 clause BSD, we updated LEGAL file too.
2024-01-27 06:16:33 +09:00
Yukihiro "Matz" Matsumoto 08cd281200 string.c (search_nonascii): skip alignment adjustment for some CPUs
Some CPUs (e.g. x86) allow unaligned access to the memory.
2024-01-26 08:22:33 +09:00
Yukihiro "Matz" Matsumoto 68ab95ea57 string.c (mrb_memsearch): take char* instead of void*
Avoid useless `void*`.
2024-01-25 22:32:31 +09:00
Yukihiro "Matz" Matsumoto cf0cd6785c string.c: rename MRB_QS_SHORT_STRING_LENGTH
The new name is MRB_SEARCH_SHORT_STRING_LENGTH since it's no longer used
in the mrb_memsearch_qs(). FYI, 'qs' stands for 'quick search'.
2024-01-23 23:28:45 +09:00
Yukihiro "Matz" Matsumoto fb2ebcde7c string.c (search_nonascii): add faster search using SSE2 2024-01-23 23:28:45 +09:00
Yukihiro "Matz" Matsumoto 4108b85c62 string.c (search_nonascii): faster search using integer match
If you define `SIMPLE_SEARCH_NONASCII`, you can use old, naive
implementation of search_nonascii(). You may want to use the old one for
code size constraint for example.
2024-01-23 23:28:45 +09:00
Yukihiro "Matz" Matsumoto f41593f55a Merge pull request #6154 from dearblue/int_to_str 2024-01-23 21:59:14 +09:00
Yukihiro "Matz" Matsumoto 18bdcbe536 Merge pull request #6145 from hoshiumiarata/enum_chunk
Enumerable#chunk implementation
2024-01-23 08:58:19 +09:00
星湖新 ab21813100 Move Enumerable#chunk to mruby-enumerator 2024-01-22 18:31:28 +09:00
星湖新 d001974439 Revert "Enumerable#chunk implementation"
This reverts commit ebf86a24b0.
2024-01-22 18:26:01 +09:00
Yukihiro "Matz" Matsumoto 5431575d11 Merge pull request #6148 from buty4649/add-enumerable-grep_v
Add Enumerable#grep_v to mruby-enum-ext
2024-01-21 18:51:11 +09:00
dearblue bf2db1ed2b Check mrb_bigint_p() before mrb_integer() 2024-01-21 10:59:06 +09:00
Yukihiro "Matz" Matsumoto 028c53d667 Merge pull request #6149 from dearblue/rational.new
Remove unnecessary `Rational._new` method
2024-01-20 23:28:38 +09:00
Yukihiro "Matz" Matsumoto 888dd230dd Merge pull request #6147 from dearblue/memsearch
Fixed buffer overflow in `mrb_memsearch()`
2024-01-20 23:25:34 +09:00
Yukihiro "Matz" Matsumoto 12483c8393 Merge pull request #6146 from mruby/dependabot/github_actions/actions/cache-4
build(deps): bump actions/cache from 3 to 4
2024-01-20 23:24:40 +09:00
dearblue 5caf8e14cf Retrieving the IO exception class with presym 2024-01-20 22:33:43 +09:00
dearblue 82312467d0 Refer to mrb->module_class directly in mrb_mruby_eval_gem_init() 2024-01-20 22:20:20 +09:00
dearblue 35375257f6 Remove unnecessary Rational._new method 2024-01-20 21:52:49 +09:00
buty4649 97203729a9 Add Enumerable#grep_v to mruby-enum-ext 2024-01-20 11:47:37 +09:00
dearblue 772f13520c Fixed buffer overflow in mrb_memsearch() 2024-01-20 09:44:47 +09:00
Yukihiro "Matz" Matsumoto f13101124c string.c: add cast to remove warnings 2024-01-19 18:24:34 +09:00
Yukihiro "Matz" Matsumoto 69cf074778 string.c (mrb_memsearch): move simple search from mrb_memsearch_qs() 2024-01-19 15:21:43 +09:00
dependabot[bot] 1e9d69f896 build(deps): bump actions/cache from 3 to 4
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-18 14:59:43 +00:00
Yukihiro "Matz" Matsumoto 6f0c34e04e mruby-string-ext: implement String#ascii_only? method 2024-01-18 22:53:46 +09:00
Yukihiro "Matz" Matsumoto 57fd0edaa7 mruby.h: rename ASCII flag to SINGLE_BYTE
This flag means all the characters in the string can be represented by a
single byte, i.e., the string does not contain any multi-byte character.
Those characters are likely ASCII characters, but may be a part of broken
UTF-8 sequence, so the term 'ASCII' is not sufficient.
2024-01-18 22:50:39 +09:00
Yukihiro "Matz" Matsumoto 5b76d2cbbe string.h: RSTR_ASCII_P(s) should always be true for non-UTF8 mode 2024-01-16 17:38:51 +09:00
Yukihiro "Matz" Matsumoto 6c2ed55077 mruby-bin-mruby: remove unused assignments 2024-01-16 12:28:32 +09:00
Yukihiro "Matz" Matsumoto 0e079fe946 mruby-bin-mruby: reduce the scope of a loop variable i 2024-01-15 23:04:18 +09:00
Yukihiro "Matz" Matsumoto 9298dfb927 mruby-bin-mruby: reduce the scope of a local variable c 2024-01-15 23:03:34 +09:00
Yukihiro "Matz" Matsumoto 90fac46751 mruby-bin-mruby: remove unnecessary condition 2024-01-15 23:00:46 +09:00
Yukihiro "Matz" Matsumoto 4f8fd23f7a mruby-string-ext (str_uminus): remove wrong document
In mruby, deduplication of strings is not implemented (yet), so we have
to remove the description from `String#-@` document.
2024-01-13 23:00:13 +09:00
Yukihiro "Matz" Matsumoto c53d9a33fc mruby-string-ext (mrb_valid_enc_p): simplify the code
By using `mrb_utf8len` directly. If `len == 1` and `ch >= 0x80`, the
character should be an invalid character.
2024-01-13 22:48:16 +09:00
星湖新 ebf86a24b0 Enumerable#chunk implementation 2024-01-13 17:36:02 +09:00
Yukihiro "Matz" Matsumoto fb8bc1954b string.c: improve performance of chars2bytes/bytes2chars; ref #6143 2024-01-11 18:23:50 +09:00
Yukihiro "Matz" Matsumoto f646228dbe string.c (str_index_str_by_char): simplify using str_index_str()
Instead of its own version of quick search, now we use str_index_str()
and adjust character position. This change makes searching 4 times
faster in some cases; ref #6143
2024-01-11 12:23:06 +09:00
Yukihiro "Matz" Matsumoto e42f3b36f9 string.c (chars2bytes): simplify the condition to detect break 2024-01-11 11:49:49 +09:00
Yukihiro "Matz" Matsumoto 787439455c string.c: remove the macro BYTES_ALIGN_CHECK which is no longer used 2024-01-10 17:31:04 +09:00
Yukihiro "Matz" Matsumoto c2f148e15d string.c (mrb_memsearch_qs): reduce the scope of local variables 2024-01-10 16:21:39 +09:00
Yukihiro "Matz" Matsumoto 31f2d93657 string.c (bytes2chars): skip calling mrb_utf8len() if possible
If (ch < 0x80) the length of the character (in bytes) should be 1, so we
don't have to call mrb_utf8len().
2024-01-10 15:36:07 +09:00
Yukihiro "Matz" Matsumoto 4c859e754d string.c (bytes2chars): skip scanning if the string is ASCII only 2024-01-10 14:40:39 +09:00
Yukihiro "Matz" Matsumoto df0a5e838d string.c (chars2bytes): use early return 2024-01-10 12:41:28 +09:00
Yukihiro "Matz" Matsumoto e39e4ea26d string.c (chars2bytes): small refactoring 2024-01-10 11:09:47 +09:00