8000 Add missing write barrier in set_i_initialize_copy by jhawthorn · Pull Request #13558 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

Add missing write barrier in set_i_initialize_copy #13558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add missing write barrier in set_i_initialize_copy
When we copy the table from one set to another we need to run write
barriers.
  • Loading branch information
jhawthorn committed Jun 8, 2025
commit cb2703a5fd95126eb198bb6310b99d019b6313ce
1 change: 1 addition & 0 deletions set.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ set_i_initialize_copy(VALUE set, VALUE other)

set_free_embedded(sobj);
set_copy(&sobj->table, RSET_TABLE(other));
rb_gc_writebarrier_remember(set);

return set;
}
Expand Down
6 changes: 6 additions & 0 deletions test/ruby/test_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ def test_replace
assert_same(set, ret)
assert_equal(Set['a','b','c'], set)

set = Set[1,2]
ret = set.replace(Set.new('a'..'c'))

assert_same(set, ret)
assert_equal(Set['a','b','c'], set)

set = Set[1,2]
assert_raise(ArgumentError) {
set.replace(3)
Expand Down
Loading
0