Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
insns.def: drop opt_plus insn
  • Loading branch information
k0kubun committed Sep 19, 2018
commit 91ef66e3d7feb060616d5630ead78eebe4c7640b
1 change: 0 additions & 1 deletion compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3232,7 +3232,6 @@ iseq_specialized_instruction(rb_iseq_t *iseq, INSN *iobj)
break;
case 1:
switch (ci->mid) {
case idPLUS: SP_INSN(plus); return COMPILE_OK;
case idMINUS: SP_INSN(minus); return COMPILE_OK;
case idMULT: SP_INSN(mult); return COMPILE_OK;
case idDIV: SP_INSN(div); return COMPILE_OK;
Expand Down
17 changes: 0 additions & 17 deletions insns.def
Original file line number Diff line number Diff line change
Expand Up @@ -1040,23 +1040,6 @@ opt_case_dispatch

/** simple functions */

/* optimized X+Y. */
DEFINE_INSN
opt_plus
(CALL_INFO ci, CALL_CACHE cc)
(VALUE recv, VALUE obj)
(VALUE val)
/* Array + anything can be handled inside of opt_plus, and that
* anything is converted into array using #to_ary. */
// attr bool leaf = false; /* has rb_to_array_type() */
{
val = vm_opt_plus(recv, obj);

if (val == Qundef) {
CALL_SIMPLE_METHOD();
}
}

/* optimized X-Y. */
DEFINE_INSN
opt_minus
Expand Down
33 changes: 0 additions & 33 deletions vm_insnhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -3423,39 +3423,6 @@ vm_stack_consistency_error(const rb_execution_context_t *ec,
#endif
}

static VALUE
vm_opt_plus(VALUE recv, VALUE obj)
{
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS, INTEGER_REDEFINED_OP_FLAG)) {
return rb_fix_plus_fix(recv, obj);
}
else if (FLONUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS, FLOAT_REDEFINED_OP_FLAG)) {
return DBL2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj));
}
else if (SPECIAL_CONST_P(recv) || SPECIAL_CONST_P(obj)) {
return Qundef;
}
else if (RBASIC_CLASS(recv) == rb_cFloat &&
RBASIC_CLASS(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS, FLOAT_REDEFINED_OP_FLAG)) {
return DBL2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj));
}
else if (RBASIC_CLASS(recv) == rb_cString &&
RBASIC_CLASS(obj) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS, STRING_REDEFINED_OP_FLAG)) {
return rb_str_plus(recv, obj);
}
else if (RBASIC_CLASS(recv) == rb_cArray &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS, ARRAY_REDEFINED_OP_FLAG)) {
return rb_ary_plus(recv, obj);
}
else {
return Qundef;
}
}

static VALUE
vm_opt_minus(VALUE recv, VALUE obj)
{
Expand Down