From 640c3dbfa1a0f7eb908fd8f378f3caa42076a704 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 17 Jan 2018 06:23:57 +0000 Subject: [PATCH] iseq.c: flatten TS_NUM operand conditions git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- iseq.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/iseq.c b/iseq.c index 20ad68e65e..5c67e1c6c4 100644 --- a/iseq.c +++ b/iseq.c @@ -1534,21 +1534,24 @@ rb_insn_operand_intern(const rb_iseq_t *iseq, break; case TS_NUM: /* ULONG */ - { - const char *type_str; - if (insn == BIN(branchiftype) && (type_str = rb_type_str((enum ruby_value_type)op)) != NULL) { - ret = rb_str_new_cstr(type_str); + if (insn == BIN(defined) && op_no == 0) { + enum defined_type deftype = (enum defined_type)op; + if (deftype == DEFINED_FUNC) { + ret = rb_fstring_cstr("func"); break; } - else if (insn == BIN(defined) && op_no == 0 && - ((enum defined_type)op == DEFINED_FUNC ? (ret = rb_fstring_cstr("func"), 1) : - (enum defined_type)op == DEFINED_REF ? (ret = rb_fstring_cstr("ref"), 1) : - (ret = rb_iseq_defined_string((enum defined_type)op)) != 0)) { - /* ok */ + if (deftype == DEFINED_REF) { + ret = rb_fstring_cstr("ref"); break; } - else { - ret = rb_sprintf("%"PRIuVALUE, op); + ret = rb_iseq_defined_string((enum defined_type)op); + if (ret) break; + } + else if (insn == BIN(branchiftype) && op_no == 0) { + const char *type_str = rb_type_str((enum ruby_value_type)op); + if (type_str) { + ret = rb_str_new_cstr(type_str); break; } } + ret = rb_sprintf("%"PRIuVALUE, op); break; case TS_LINDEX:{