Commit graph

1998 commits

Author SHA1 Message Date
BurdetteLamar
72b8bb4caf [DOC] Tweaks for String#gsub! 2025-08-05 10:11:11 -04:00
Burdette Lamar
409da39afb
[DOC] Tweaks for String#gsub 2025-08-05 10:06:47 -04:00
BurdetteLamar
6f7a4f9c96 [DOC] Tweaks for String#getbyte 2025-07-31 09:14:11 -04:00
BurdetteLamar
6d466a55bd [DOC] Tweaks for String#eql? 2025-07-31 09:13:36 -04:00
Burdette Lamar
56572baa4c
[DOC] Tweaks for String#each_grapheme_cluster (#13981) 2025-07-23 17:07:25 -04:00
Burdette Lamar
e3d36fff8f
[DOC] Tweaks for String#empty? 2025-07-23 17:06:44 -04:00
BurdetteLamar
7816a04d97 [DOC] Tweaks for String#each_line 2025-07-23 15:48:35 -04:00
BurdetteLamar
17eee25c66 [DOC] Tweaks for String#each_codepoint 2025-07-23 15:36:32 -04:00
BurdetteLamar
cd9b74638c [DOC] Tweaks for String#each_char 2025-07-23 15:35:28 -04:00
Peter Zhu
21c78cb0f7 [DOC] Docs for String#dump 2025-07-21 17:07:39 -04:00
Peter Zhu
66349692f0 Introduce free function to rb_concurrent_set_funcs
If we create a key but don't insert it (due to other Ractor winning the
race), then it would leak memory if we don't free it. This introduces a
new function to free that memory for this case.
2025-07-21 10:58:30 -04:00
Peter Zhu
e64a9e392e Alphabetize concurrent_set.h in string.c 2025-07-16 16:41:18 -04:00
Burdette Lamar
3cf32e9364
[DOC] Tweaks for String#downcase 2025-07-15 16:31:58 -04:00
BurdetteLamar
be38cb92d5 [DOC] Tweaks for String#downcase! 2025-07-15 14:13:17 -04:00
Peter Zhu
f5312d8e7f Make rb_concurrent_set_funcs const
We should never modify rb_concurrent_set_funcs during runtime, so we can
make it const.
2025-07-15 09:55:36 -04:00
Burdette Lamar
64d4e7727e
[DOC] Tweaks for String#delete_suffix! (#13872) 2025-07-14 10:05:00 -04:00
BurdetteLamar
55dd2022fd [DOC] Tweaks for String#delete_prefix! 2025-07-14 09:58:12 -04:00
BurdetteLamar
b438915f0a [DOC] TWeaks for String#delete! 2025-07-12 14:22:57 -04:00
BurdetteLamar
e1bc92d00b [DOC] Tweaks for String#delete 2025-07-12 13:08:14 -04:00
Burdette Lamar
b0db93c002
[DOC] Tweaks for String#count 2025-07-12 10:55:33 -04:00
Burdette Lamar
51252ef8d7
[DOC] Tweaks for String#concat (#13836) 2025-07-10 10:40:49 -04:00
BurdetteLamar
b146eae3b5 [DOC] Tweaks for String#clear 2025-07-09 14:42:19 -04:00
BurdetteLamar
6c77a0c62b [DOC] Tweaks for String#chop 2025-07-09 14:41:51 -04:00
BurdetteLamar
3baed2ea38 [DOC] Tweaks for String#chr 2025-07-09 14:41:11 -04:00
BurdetteLamar
f17e5c4d5a [DOC] Tweaks for String#chomp! 2025-07-09 11:54:07 -04:00
BurdetteLamar
14971e75ce [DOC] Tweaks for String#center 2025-07-08 13:26:46 -04:00
Burdette Lamar
e9d7e105ef
[DOC] Tweaks for String#casecmp? (#13810) 2025-07-07 15:14:56 -04:00
BurdetteLamar
c2c0c220a8 [DOC] Tweaks for String#casecmp 2025-07-07 15:10:17 -04:00
Jean Boussier
0bb44f291e Rename ractor_safe_set into concurrent_set
There's nothing ractor related in them, and the classic terminology
for these sort of data structures is `concurrent-*`, e.g.
concurrent hash.
2025-07-07 15:12:39 +02:00
BurdetteLamar
0604d0c9db [DOC] Tweaks for String#capitalize! 2025-07-07 09:03:02 -04:00
Burdette Lamar
987b5bf972
[DOC] Tweaks for String#capitalize 2025-07-07 09:02:15 -04:00
Burdette Lamar
350df4fbd9
[DOC] Tweaks for Case Mapping doc 2025-07-04 11:42:29 -04:00
Burdette Lamar
35feaee917
[DOC] Tweaks for String#bytesplice 2025-06-30 14:13:09 -04:00
BurdetteLamar
456f6f3f83 [DOC] Tweaks for Strings#byteslice 2025-06-30 13:59:25 -04:00
Peter Zhu
d9b2d89976 Extract Ractor safe table used for frozen strings
This commit extracts the Ractor safe table used for frozen strings into
ractor_safe_table.c, which will allow it to be used elsewhere, including
for the global symbol table.
2025-06-27 09:23:14 -04:00
Luke Gruber
328e3029d8 Get String#crypt working with multi-ractor in cases where !HAVE_CRYPT_R
In commit 12f7ba5ed4, ractor safety was added to String#crypt, however
in certain cases it can cause a deadlock. When we lock a native mutex,
we cannot allocate ruby objects because they might trigger GC which
starts a VM barrier. If the barrier is triggered and other native threads
are waiting on this mutex, they will not be able to be woken up in order to join
the barrier. To fix this, we don't allocate ruby objects when we hold the
lock.

The following could reproduce the problem:

```ruby
strings = []
10_000.times do |i|
  strings << "my string #{i}"
end

STRINGS = Ractor.make_shareable(strings)

rs = []
100.times do
  rs << Ractor.new do
    STRINGS.each do |s|
      s.dup.crypt(s.dup)
    end
  end
end
while rs.any?
  r, obj = Ractor.select(*rs)
  rs.delete(r)
end
```

I will not be adding tests because I am almost finished a PR to enable
running test-all test cases inside many ractors at once, which is how I
found the issue.

Co-authored-by: jhawthorn <john@hawthorn.email>
2025-06-25 14:11:08 -07:00
Peter Zhu
aed7a95f9d Move RUBY_ATOMIC_VALUE_LOAD to ruby_atomic.h
Deduplicates RUBY_ATOMIC_VALUE_LOAD by moving it to ruby_atomic.h.
2025-06-25 13:04:25 -04:00
Burdette Lamar
ec071c849f
[DOC] Tweaks for String#byterindex (#13485) 2025-06-25 10:51:45 -04:00
Jean Boussier
45a2c95d0f Reduce exposure of FL_FREEZE
The `FL_FREEZE` flag is redundant with `SHAPE_ID_FL_FROZEN`, so
ideally it should be eliminated in favor of the later.

Doing so would eliminate the risk of desync between the two, but
also solve the problem of the frozen status being global in namespace
context (See Bug #21330).
2025-06-24 11:29:39 +01:00
Benoit Daloze
83fb07fb2c [Bug #20998] Check if the string is frozen in rb_str_locktmp() & rb_str_unlocktmp() 2025-06-16 22:59:10 +02:00
Jean Boussier
15084fbc3c Get rid of FL_EXIVAR
Now that the shape_id gives us all the same information, it's no
longer needed.
2025-06-13 23:50:30 +02:00
Jean Boussier
6dbe24fe56 Use the shape_id rather than FL_EXIVAR
We still keep setting `FL_EXIVAR` so that `rb_shape_verify_consistency`
can detect discrepancies.
2025-06-13 23:50:30 +02:00
Jean Boussier
a99d941cac Add SHAPE_ID_HAS_IVAR_MASK for quick ivar check
This allow checking if an object has ivars with just a shape_id
mask.
2025-06-13 19:46:29 +02:00
Nobuyoshi Nakada
fa85d23ff4
[Bug #21380] Prohibit modification in String#split block
Reported at https://hackerone.com/reports/3163876
2025-05-29 11:10:58 +09:00
Jean Boussier
925dec8d70 Rename rb_shape_set_shape_id in rb_obj_set_shape_id 2025-05-27 15:34:02 +02:00
BurdetteLamar
909a0daab6 [DOC] More tweaks for String#byteindex 2025-05-26 13:42:35 -04:00
John Hawthorn
f483befd90 Add shape_id to RBasic under 32 bit
This makes `RBobject` `4B` larger on 32 bit systems
but simplifies the implementation a lot.

[Feature #21353]

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2025-05-26 10:31:54 +02:00
Nobuyoshi Nakada
aad9fa2853
Use RB_VM_LOCKING 2025-05-25 15:22:43 +09:00
BurdetteLamar
3403055d13 [DOC] Tweaks for String#byteindex 2025-05-22 10:17:46 -04:00
Burdette Lamar
cc90adb68d
[DOC] Tweaks for String#append_as_bytes 2025-05-16 12:50:55 -04:00