mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
rb_gc_impl_mark_and_move: avoid needless writes
Assuming not all objects are moved during compaction, it is preferable to avoid rewriting references that haven't moved as to avoid invalidating potentially shared memory pages.
This commit is contained in:
parent
95320f1ddf
commit
3ef8d833ab
@ -4420,7 +4420,10 @@ rb_gc_impl_mark_and_move(void *objspace_ptr, VALUE *ptr)
|
||||
GC_ASSERT(objspace->flags.during_compacting);
|
||||
GC_ASSERT(during_gc);
|
||||
|
||||
*ptr = rb_gc_impl_location(objspace, *ptr);
|
||||
VALUE destination = rb_gc_impl_location(objspace, *ptr);
|
||||
if (destination != *ptr) {
|
||||
*ptr = destination;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gc_mark(objspace, *ptr);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user