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

ruby-changes:61996

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

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

From a6b1454a5d6a9d489e3ed70114e43a5d3a9467ec 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: Thu, 11 Jun 2020 14:33:36 +0900
Subject: optimize_checktype: 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/compile.c b/compile.c
index fd94d61..51477e9 100644
--- a/compile.c
+++ b/compile.c
@@ -2746,7 +2746,6 @@ optimize_checktype(rb_iseq_t *iseq, INSN *iobj) https://github.com/ruby/ruby/blob/trunk/compile.c#L2746
     if (!ciobj || !IS_INSN_ID(ciobj, checktype)) return FALSE;
     niobj = (INSN *)get_next_insn(ciobj);
     if (!niobj) {
-      no_branch:
 	/* TODO: putobject true/false */
 	return FALSE;
     }
@@ -2762,7 +2761,7 @@ optimize_checktype(rb_iseq_t *iseq, INSN *iobj) https://github.com/ruby/ruby/blob/trunk/compile.c#L2761
 	}
 	break;
       default:
-	goto no_branch;
+        return FALSE;
     }
     line = ciobj->insn_info.line_no;
     if (!dest) {
-- 
cgit v0.10.2


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

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