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

ruby-changes:71009

From: Peter <ko1@a...>
Date: Tue, 25 Jan 2022 23:38:35 +0900 (JST)
Subject: [ruby-changes:71009] b07879e553 (master): Remove redundant if statement in try_move

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

From b07879e553a73200ec1d2c3f6b12127e22f965cd Mon Sep 17 00:00:00 2001
From: Peter Zhu <peter@p...>
Date: Mon, 24 Jan 2022 14:44:58 -0500
Subject: Remove redundant if statement in try_move

The if statement is redundant since if `index == 0` then
`BITS_BITLENGTH * index == 0`.
---
 gc.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gc.c b/gc.c
index d189c42cde6..d448c7515d5 100644
--- a/gc.c
+++ b/gc.c
@@ -4959,12 +4959,7 @@ try_move(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page, https://github.com/ruby/ruby/blob/trunk/gc.c#L4959
         bits >>= NUM_IN_PAGE(p) % BITS_BITLENGTH;
         if (try_move_plane(objspace, heap, sweep_page, (uintptr_t)p, bits, dest)) return 1;
 
-        if (index == 0) {
-            p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start));
-        }
-        else {
-            p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start)) + (BITS_BITLENGTH * index);
-        }
+        p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start)) + (BITS_BITLENGTH * index);
 
         /* Find an object to move and move it. Movable objects must be
          * marked, so we iterate using the marking bitmap */
-- 
cgit v1.2.1


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

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