mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02: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
1 changed files with 4 additions and 1 deletions
|
@ -4420,7 +4420,10 @@ rb_gc_impl_mark_and_move(void *objspace_ptr, VALUE *ptr)
|
||||||
GC_ASSERT(objspace->flags.during_compacting);
|
GC_ASSERT(objspace->flags.during_compacting);
|
||||||
GC_ASSERT(during_gc);
|
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 {
|
else {
|
||||||
gc_mark(objspace, *ptr);
|
gc_mark(objspace, *ptr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue