Skip to content

Commit

Permalink
moved object should not have a shape ID
Browse files Browse the repository at this point in the history
fix [Bug #19917]
  • Loading branch information
ko1 committed Dec 19, 2023
1 parent 7a0dfde commit 054f56f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bootstraptest/test_ractor.rb
Expand Up @@ -1643,6 +1643,24 @@ class C8; def self.foo = 17; end
eval("Ractor.new{}.take", nil, "test_ractor.rb", 1)
}

# check moved object
assert_equal 'ok', %q{
r = Ractor.new do
Ractor.receive
GC.start
:ok
end
obj = begin
raise
rescue => e
e = Marshal.load(Marshal.dump(e))
end
r.send obj, move: true
r.take
}

## Ractor::Selector

# Selector#empty? returns true
Expand Down
2 changes: 2 additions & 0 deletions ractor.c
Expand Up @@ -3491,6 +3491,8 @@ ractor_moved_bang(VALUE obj)
rv->v3 = 0;
rv->flags = rv->flags & ~fl_users;

if (BUILTIN_TYPE(obj) == T_OBJECT) ROBJECT_SET_SHAPE_ID(obj, ROOT_SHAPE_ID);

// TODO: record moved location
}

Expand Down

0 comments on commit 054f56f

Please sign in to comment.