summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gc.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/gc.c b/gc.c
index 27cf65b196..998f08630e 100644
--- a/gc.c
+++ b/gc.c
@@ -4761,12 +4761,8 @@ gc_compact_finish(rb_objspace_t *objspace, rb_heap_t *heap)
{
GC_ASSERT(heap->sweeping_page == heap->compact_cursor);
- /* If this is an explicit compaction (GC.compact), no read barrier was set
- * so we don't need to unprotect pages or uninstall the SEGV handler */
- if (!(objspace->flags.during_compacting >> 1)) {
- gc_unprotect_pages(objspace, heap);
- uninstall_handlers();
- }
+ gc_unprotect_pages(objspace, heap);
+ uninstall_handlers();
/* The mutator is allowed to run during incremental sweeping. T_MOVED
* objects can get pushed on the stack and when the compaction process
@@ -5306,12 +5302,6 @@ gc_compact_start(rb_objspace_t *objspace, rb_heap_t *heap)
memset(objspace->rcompactor.considered_count_table, 0, T_MASK * sizeof(size_t));
memset(objspace->rcompactor.moved_count_table, 0, T_MASK * sizeof(size_t));
- /* If this is an explicit compaction (GC.compact), we don't need a read
- * barrier, so just return early. */
- if (objspace->flags.during_compacting >> 1) {
- return;
- }
-
/* Set up read barrier for pages containing MOVED objects */
install_handlers();
}
@@ -9487,11 +9477,7 @@ heap_check_moved_i(void *vstart, void *vend, size_t stride, void *data)
static VALUE
gc_compact(rb_execution_context_t *ec, VALUE self)
{
- /* Clear the heap. */
- gc_start_internal(ec, self, Qtrue, Qtrue, Qtrue, Qfalse);
-
- /* At this point, all references are live and the mutator is not allowed
- * to run, so we don't need a read barrier. */
+ /* Run GC with compaction enabled */
gc_start_internal(ec, self, Qtrue, Qtrue, Qtrue, Qtrue);
return gc_compact_stats(ec, self);