diff --git a/compile.c b/compile.c index 4365a177b4..315e2dc92e 100644 --- a/compile.c +++ b/compile.c @@ -2954,9 +2954,9 @@ insn_set_specialized_instruction(rb_iseq_t *iseq, INSN *iobj, int insn_id) VALUE *old_operands = iobj->operands; iobj->operand_size = 4; iobj->operands = (VALUE *)compile_data_alloc(iseq, iobj->operand_size * sizeof(VALUE)); - iobj->operands[0] = old_operands[0]; + iobj->operands[0] = (VALUE)new_callinfo(iseq, idEq, 1, 0, NULL, FALSE); iobj->operands[1] = Qfalse; /* CALL_CACHE */ - iobj->operands[2] = (VALUE)new_callinfo(iseq, idEq, 1, 0, NULL, FALSE); + iobj->operands[2] = old_operands[0]; iobj->operands[3] = Qfalse; /* CALL_CACHE */ } @@ -6092,9 +6092,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) { VALUE str = freeze_literal(iseq, node->nd_args->nd_head->nd_lit); CHECK(COMPILE(ret, "recv", node->nd_recv)); - ADD_INSN3(ret, line, opt_aref_with, + ADD_INSN3(ret, line, opt_aref_with, str, new_callinfo(iseq, idAREF, 1, 0, NULL, FALSE), - NULL/* CALL_CACHE */, str); + NULL/* CALL_CACHE */); if (popped) { ADD_INSN(ret, line, pop); } @@ -7106,9 +7106,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in ADD_INSN(ret, line, swap); ADD_INSN1(ret, line, topn, INT2FIX(1)); } - ADD_INSN3(ret, line, opt_aset_with, + ADD_INSN3(ret, line, opt_aset_with, str, new_callinfo(iseq, idASET, 2, 0, NULL, FALSE), - NULL/* CALL_CACHE */, str); + NULL/* CALL_CACHE */); ADD_INSN(ret, line, pop); break; } diff --git a/insns.def b/insns.def index 0b9bead23c..eabace4ce1 100644 --- a/insns.def +++ b/insns.def @@ -1083,18 +1083,15 @@ opt_eq /* optimized X!=Y. */ DEFINE_INSN opt_neq -(CALL_INFO ci, CALL_CACHE cc, CALL_INFO ci_eq, CALL_CACHE cc_eq) +(CALL_INFO ci_eq, CALL_CACHE cc_eq, CALL_INFO ci, CALL_CACHE cc) (VALUE recv, VALUE obj) (VALUE val) -// attr bool handles_frame = true; { val = vm_opt_neq(ci, cc, ci_eq, cc_eq, recv, obj); if (val == Qundef) { - /* other */ - PUSH(recv); - PUSH(obj); - CALL_SIMPLE_METHOD(recv); + ADD_PC(2); /* !!! */ + DISPATCH_ORIGINAL_INSN(opt_send_without_block); } } @@ -1199,10 +1196,9 @@ opt_aset /* recv[str] = set */ DEFINE_INSN opt_aset_with -(CALL_INFO ci, CALL_CACHE cc, VALUE key) +(VALUE key, CALL_INFO ci, CALL_CACHE cc) (VALUE recv, VALUE val) (VALUE val) -// attr bool handles_frame = true; { VALUE tmp = vm_opt_aset_with(recv, key, val); @@ -1210,29 +1206,26 @@ opt_aset_with val = tmp; } else { - /* other */ - PUSH(recv); - PUSH(rb_str_resurrect(key)); + TOPN(0) = rb_str_resurrect(key); PUSH(val); - CALL_SIMPLE_METHOD(recv); + ADD_PC(1); /* !!! */ + DISPATCH_ORIGINAL_INSN(opt_send_without_block); } } /* recv[str] */ DEFINE_INSN opt_aref_with -(CALL_INFO ci, CALL_CACHE cc, VALUE key) +(VALUE key, CALL_INFO ci, CALL_CACHE cc) (VALUE recv) (VALUE val) -// attr bool handles_frame = true; { val = vm_opt_aref_with(recv, key); if (val == Qundef) { - /* other */ - PUSH(recv); PUSH(rb_str_resurrect(key)); - CALL_SIMPLE_METHOD(recv); + ADD_PC(1); /* !!! */ + DISPATCH_ORIGINAL_INSN(opt_send_without_block); } } diff --git a/vm_insnhelper.h b/vm_insnhelper.h index 0fc31d2cea..01ea7a2a3e 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -194,14 +194,6 @@ enum vm_regan_acttype { #define USE_IC_FOR_SPECIALIZED_METHOD 1 #endif -#define CALL_SIMPLE_METHOD(recv_) do { \ - struct rb_calling_info calling; \ - calling.block_handler = VM_BLOCK_HANDLER_NONE; \ - calling.argc = ci->orig_argc; \ - vm_search_method(ci, cc, calling.recv = (recv_)); \ - CALL_METHOD(&calling, ci, cc); \ -} while (0) - #define NEXT_CLASS_SERIAL() (++ruby_vm_class_serial) #define GET_GLOBAL_METHOD_STATE() (ruby_vm_global_method_state) #define INC_GLOBAL_METHOD_STATE() (++ruby_vm_global_method_state)