ruby-changes:51548
From: shyouhei <ko1@a...>
Date: Thu, 28 Jun 2018 00:00:58 +0900 (JST)
Subject: [ruby-changes:51548] shyouhei:r63756 (trunk): refactor move logics out of insns.def
shyouhei 2018-06-27 10:10:02 +0900 (Wed, 27 Jun 2018) New Revision: 63756 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63756 Log: refactor move logics out of insns.def This is a pure refactoring. I see no difference in this change. Modified files: trunk/insns.def trunk/vm_insnhelper.c Index: insns.def =================================================================== --- insns.def (revision 63755) +++ insns.def (revision 63756) @@ -730,12 +730,7 @@ opt_str_freeze https://github.com/ruby/ruby/blob/trunk/insns.def#L730 () (VALUE val) { - if (BASIC_OP_UNREDEFINED_P(BOP_FREEZE, STRING_REDEFINED_OP_FLAG)) { - val = str; - } - else { - val = rb_funcall(rb_str_resurrect(str), idFreeze, 0); - } + val = vm_opt_str_freeze(str, BOP_FREEZE, idFreeze); } DEFINE_INSN @@ -744,12 +739,7 @@ opt_str_uminus https://github.com/ruby/ruby/blob/trunk/insns.def#L739 () (VALUE val) { - if (BASIC_OP_UNREDEFINED_P(BOP_UMINUS, STRING_REDEFINED_OP_FLAG)) { - val = str; - } - else { - val = rb_funcall(rb_str_resurrect(str), idUMinus, 0); - } + val = vm_opt_str_freeze(str, BOP_UMINUS, idUMinus); } DEFINE_INSN Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 63755) +++ vm_insnhelper.c (revision 63756) @@ -3213,6 +3213,17 @@ vm_find_or_create_class_by_id(ID id, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3213 } } +static VALUE +vm_opt_str_freeze(VALUE str, int bop, ID id) +{ + if (BASIC_OP_UNREDEFINED_P(bop, STRING_REDEFINED_OP_FLAG)) { + return str; + } + else { + return rb_funcall(rb_str_resurrect(str), id, 0); + } +} + /* this macro is mandatory to use OPTIMIZED_CMP. What a design! */ #define id_cmp idCmp -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/