[前][次][番号順一覧][スレッド一覧]

ruby-changes:55714

From: Aaron <ko1@a...>
Date: Tue, 14 May 2019 05:00:05 +0900 (JST)
Subject: [ruby-changes:55714] Aaron Patterson: 66a7c92938 (trunk): Don't run the compactor if GC is disabled

https://git.ruby-lang.org/ruby.git/commit/?id=66a7c92938

From 66a7c92938638e3afceb1d92ae877376902a71a0 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@r...>
Date: Mon, 13 May 2019 12:59:30 -0700
Subject: Don't run the compactor if GC is disabled

GC is required for pinning / marking objects.  If the compactor runs
without pinning everything, then it will blow up, so just return early
if the GC is disabled.

diff --git a/gc.c b/gc.c
index 7a95700..55af437 100644
--- a/gc.c
+++ b/gc.c
@@ -7322,7 +7322,7 @@ gc_move(rb_objspace_t *objspace, VALUE scan, VALUE free) https://github.com/ruby/ruby/blob/trunk/gc.c#L7322
     RVALUE *dest = (RVALUE *)free;
     RVALUE *src = (RVALUE *)scan;
 
-    gc_report(4, objspace, "Moving object: %s -> %p\n", obj_info(scan), (void *)free);
+    gc_report(4, objspace, "Moving object: %p -> %p\n", (void*)scan, (void *)free);
 
     GC_ASSERT(BUILTIN_TYPE(scan) != T_NONE);
     GC_ASSERT(BUILTIN_TYPE(free) == T_NONE);
@@ -7867,7 +7867,7 @@ gc_update_object_references(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L7867
 {
     RVALUE *any = RANY(obj);
 
-    gc_report(4, objspace, "update-refs: %s ->", obj_info(obj));
+    gc_report(4, objspace, "update-refs: %p ->", (void *)obj);
 
     switch(BUILTIN_TYPE(obj)) {
         case T_CLASS:
@@ -8013,8 +8013,9 @@ gc_update_object_references(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L8013
 
     UPDATE_IF_MOVED(objspace, RBASIC(obj)->klass);
 
-    gc_report(4, objspace, "update-refs: %s <-", obj_info(obj));
+    gc_report(4, objspace, "update-refs: %p <-", (void *)obj);
 }
+
 static int
 gc_ref_update(void *vstart, void *vend, size_t stride, void * data)
 {
@@ -8067,6 +8068,8 @@ gc_update_references(rb_objspace_t * objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L8068
     rb_objspace_each_objects_without_setup(gc_ref_update, objspace);
     rb_vm_update_references(vm);
     rb_transient_heap_update_references();
+    global_symbols.ids = rb_gc_new_location(global_symbols.ids);
+    global_symbols.dsymbol_fstr_hash = rb_gc_new_location(global_symbols.dsymbol_fstr_hash);
     gc_update_table_refs(objspace, global_symbols.str_sym);
 }
 
@@ -8101,6 +8104,7 @@ rb_gc_compact(VALUE mod) https://github.com/ruby/ruby/blob/trunk/gc.c#L8104
 {
     rb_objspace_t *objspace = &rb_objspace;
 
+    if (dont_gc) return Qnil;
     /* Ensure objects are pinned */
     rb_gc();
 
@@ -8192,6 +8196,8 @@ gc_verify_compaction_references(VALUE mod) https://github.com/ruby/ruby/blob/trunk/gc.c#L8196
 {
     rb_objspace_t *objspace = &rb_objspace;
 
+    if (dont_gc) return Qnil;
+
     /* Ensure objects are pinned */
     rb_gc();
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]