diff options
author | Peter Zhu <[email protected]> | 2021-09-15 09:37:46 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2021-09-15 09:59:37 -0400 |
commit | db51bcada408f8b0b93a11d41f8e4222436bd9f2 (patch) | |
tree | a76d15a692b6c420e900f98f90de59a4055a0980 /gc.c | |
parent | a65ac2d6fa4e7381d88b79a2881f7c05daa903c3 (diff) |
Fix total_freed_objects for invalidated pages
When the object is moved back into the T_MOVED, the flags of the T_MOVED
is not copied, so the FL_FROM_FREELIST flag is lost. This causes
total_freed_objects to always be incremented.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4841
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -5833,6 +5833,7 @@ invalidate_moved_plane(rb_objspace_t *objspace, struct heap_page *page, uintptr_ CLEAR_IN_BITMAP(GET_HEAP_PINNED_BITS(forwarding_object), forwarding_object); + bool from_freelist = FL_TEST_RAW(forwarding_object, FL_FROM_FREELIST); object = rb_gc_location(forwarding_object); gc_move(objspace, object, forwarding_object, page->size_pool->slot_size); @@ -5840,7 +5841,7 @@ invalidate_moved_plane(rb_objspace_t *objspace, struct heap_page *page, uintptr_ * is the free slot for the original page */ struct heap_page *orig_page = GET_HEAP_PAGE(object); orig_page->free_slots++; - if (!FL_TEST_RAW(object, FL_FROM_FREELIST)) { + if (!from_freelist) { objspace->profile.total_freed_objects++; } heap_page_add_freeobj(objspace, orig_page, object); |