summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-11 14:33:36 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commita6b1454a5d6a9d489e3ed70114e43a5d3a9467ec (patch)
tree9ace3000cc2113f3ca9a9248d62b40f5db4b29e3
parenta5342f46e6efc88bd0c0af9d30ba8af7194eb005 (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3247
-rw-r--r--compile.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index fd94d61552..51477e9e20 100644
--- a/compile.c
+++ b/compile.c
@@ -2746,7 +2746,6 @@ optimize_checktype(rb_iseq_t *iseq, INSN *iobj)
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)
}
break;
default:
- goto no_branch;
+ return FALSE;
}
line = ciobj->insn_info.line_no;
if (!dest) {