1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

refactor move logics out of insns.def

This is a pure refactoring.  I see no difference in this change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shyouhei 2018-06-27 01:10:02 +00:00
parent 22444ae9b1
commit 529af9c821
2 changed files with 13 additions and 12 deletions

View file

@ -730,12 +730,7 @@ opt_str_freeze
()
(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
()
(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

View file

@ -3213,6 +3213,17 @@ vm_find_or_create_class_by_id(ID id,
}
}
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