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

ruby-changes:63465

From: Aaron <ko1@a...>
Date: Thu, 29 Oct 2020 02:00:30 +0900 (JST)
Subject: [ruby-changes:63465] 5be42c1ef4 (master): Remove unnecessary conditional

https://git.ruby-lang.org/ruby.git/commit/?id=5be42c1ef4

From 5be42c1ef4f7ed0a8004cad750a9ce61869bd768 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@r...>
Date: Wed, 28 Oct 2020 09:57:44 -0700
Subject: Remove unnecessary conditional

As of 0b81a484f3453082d28a48968a063fd907daa5b5, `ROBJECT_IVPTR` will
always return a value, so we don't need to test whether or not we got
one.  T_OBJECTs always come to life as embedded objects, so they will
return an ivptr, and when they become "unembedded" they will have an
ivptr at that point too

diff --git a/gc.c b/gc.c
index d316feb..58541a4 100644
--- a/gc.c
+++ b/gc.c
@@ -5702,16 +5702,14 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L5702
         {
             const VALUE * const ptr = ROBJECT_IVPTR(obj);
 
-            if (ptr) {
-                uint32_t i, len = ROBJECT_NUMIV(obj);
-                for (i  = 0; i < len; i++) {
-                    gc_mark(objspace, ptr[i]);
-                }
+            uint32_t i, len = ROBJECT_NUMIV(obj);
+            for (i  = 0; i < len; i++) {
+                gc_mark(objspace, ptr[i]);
+            }
 
-                if (LIKELY(during_gc) &&
+            if (LIKELY(during_gc) &&
                     ROBJ_TRANSIENT_P(obj)) {
-                    rb_transient_heap_mark(obj, ptr);
-                }
+                rb_transient_heap_mark(obj, ptr);
             }
         }
 	break;
-- 
cgit v0.10.2


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

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