Kunshan Wang
0f408602cb
Fix missing increment of deleted_entries
...
When `rb_concurrent_set_foreach_with_replace` deletes entries from a
concurrent set, it should increment the `deleted_entries` field, too.
2025-07-22 10:05:24 -04:00
Peter Zhu
6b0e5de4e6
Don't rehash on retry in concurrent set
...
Since the hash should never change, we only need to calculate it once.
2025-07-21 10:58:30 -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
efc232241e
Don't call cmp on garbage objects
...
If the object is garbage, then calling cmp on it may crash.
2025-07-21 10:58:30 -04:00
Peter Zhu
2bcb155b49
Convert global symbol table to concurrent set
2025-07-21 10:58:30 -04:00
Peter Zhu
f05ee26a1f
Add rb_concurrent_set_find
2025-07-21 10:58:30 -04:00
Peter Zhu
9ef482bd13
Add rb_concurrent_set_size
2025-07-21 10:58:30 -04:00
Peter Zhu
5d44f2917f
Skip garbage check for special consts in concurrent set
...
rb_objspace_garbage_object_p expects only GC managed objects to be passed
in. We should skip the check if curr_key is a special constant.
2025-07-21 10:58:30 -04:00
Peter Zhu
dafc4e131e
Fix size assertion in concurrent set resizing
...
Since we resize when `prev_size > set->capacity / 2`, it's possible that
`prev_size == set->capacity / 2`, so we need to change the assertion in
concurrent_set_try_resize_without_locking to be
`new_set->size <= new_set->capacity / 2`.
2025-07-18 10:01:06 -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
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