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

ruby-changes:61998

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Mon, 29 Jun 2020 11:06:55 +0900 (JST)
Subject: [ruby-changes:61998] 228118482e (master): gc_marks_finish: do not goto into a branch

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

From 228118482e4df04e42b64bca09f7bf2306c2314f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Mon, 15 Jun 2020 14:31:31 +0900
Subject: gc_marks_finish: do not goto into a branch

I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.

diff --git a/gc.c b/gc.c
index 4744d21..05b8fb3 100644
--- a/gc.c
+++ b/gc.c
@@ -6459,15 +6459,15 @@ gc_marks_finish(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L6459
 		if (objspace->profile.count - objspace->rgengc.last_major_gc < RVALUE_OLD_AGE) {
 		    full_marking = TRUE;
 		    /* do not update last_major_gc, because full marking is not done. */
-		    goto increment;
+                    /* goto increment; */
 		}
 		else {
 		    gc_report(1, objspace, "gc_marks_finish: next is full GC!!)\n");
 		    objspace->rgengc.need_major_gc |= GPR_FLAG_MAJOR_BY_NOFREE;
 		}
 	    }
-	    else {
-	      increment:
+            if (full_marking) {
+              /* increment: */
 		gc_report(1, objspace, "gc_marks_finish: heap_set_increment!!\n");
 		heap_set_increment(objspace, heap_extend_pages(objspace, sweep_slots, total_slots));
 		heap_increment(objspace, heap);
-- 
cgit v0.10.2


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

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