/* -*-c-*- *********************************************************/ /*******************************************************************/ /*******************************************************************/ /** This file is VM main loop. ---- This file is auto generated by insns2vm.rb DO NOT TOUCH! If you want to fix something, you must edit 'insns.c' */ INSN_ENTRY(nop){ { DEBUG_ENTER_INSN("nop"); ADD_PC(1+0); PREFETCH(GET_PC()); #define CURRENT_INSN_nop 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_nop_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(nop)); { #line 40 "insns.def" /* none */ #line 32 "vm.inc" #undef CURRENT_INSN_nop #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(nop);}}} INSN_ENTRY(getlocal){ { VALUE val; rb_num_t level = (rb_num_t)GET_OPERAND(2); lindex_t idx = (lindex_t)GET_OPERAND(1); DEBUG_ENTER_INSN("getlocal"); ADD_PC(1+2); PREFETCH(GET_PC()); #define CURRENT_INSN_getlocal 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_getlocal_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(getlocal)); COLLECT_USAGE_OPERAND(BIN(getlocal), 0, idx); COLLECT_USAGE_OPERAND(BIN(getlocal), 1, level); { #line 60 "insns.def" int i, lev = (int)level; VALUE *ep = GET_EP(); for (i = 0; i < lev; i++) { ep = GET_PREV_EP(ep); } val = *(ep - idx); #line 64 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_getlocal #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(getlocal);}}} INSN_ENTRY(setlocal){ { rb_num_t level = (rb_num_t)GET_OPERAND(2); lindex_t idx = (lindex_t)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("setlocal"); ADD_PC(1+2); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_setlocal 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setlocal_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setlocal)); COLLECT_USAGE_OPERAND(BIN(setlocal), 0, idx); COLLECT_USAGE_OPERAND(BIN(setlocal), 1, level); { #line 82 "insns.def" int i, lev = (int)level; VALUE *ep = GET_EP(); for (i = 0; i < lev; i++) { ep = GET_PREV_EP(ep); } *(ep - idx) = val; #line 98 "vm.inc" #undef CURRENT_INSN_setlocal #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setlocal);}}} INSN_ENTRY(getspecial){ { VALUE val; rb_num_t type = (rb_num_t)GET_OPERAND(2); rb_num_t key = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("getspecial"); ADD_PC(1+2); PREFETCH(GET_PC()); #define CURRENT_INSN_getspecial 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_getspecial_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(getspecial)); COLLECT_USAGE_OPERAND(BIN(getspecial), 0, key); COLLECT_USAGE_OPERAND(BIN(getspecial), 1, type); { #line 102 "insns.def" val = vm_getspecial(th, GET_LEP(), key, type); #line 124 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_getspecial #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(getspecial);}}} INSN_ENTRY(setspecial){ { rb_num_t key = (rb_num_t)GET_OPERAND(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("setspecial"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_setspecial 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setspecial_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setspecial)); COLLECT_USAGE_OPERAND(BIN(setspecial), 0, key); { #line 116 "insns.def" lep_svar_set(th, GET_LEP(), key, obj); #line 150 "vm.inc" #undef CURRENT_INSN_setspecial #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setspecial);}}} INSN_ENTRY(getinstancevariable){ { VALUE val; IC ic = (IC)GET_OPERAND(2); ID id = (ID)GET_OPERAND(1); DEBUG_ENTER_INSN("getinstancevariable"); ADD_PC(1+2); PREFETCH(GET_PC()); #define CURRENT_INSN_getinstancevariable 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_getinstancevariable_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(getinstancevariable)); COLLECT_USAGE_OPERAND(BIN(getinstancevariable), 0, id); COLLECT_USAGE_OPERAND(BIN(getinstancevariable), 1, ic); { #line 131 "insns.def" val = vm_getinstancevariable(GET_SELF(), id, ic); #line 176 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_getinstancevariable #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(getinstancevariable);}}} INSN_ENTRY(setinstancevariable){ { IC ic = (IC)GET_OPERAND(2); ID id = (ID)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("setinstancevariable"); ADD_PC(1+2); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_setinstancevariable 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setinstancevariable_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setinstancevariable)); COLLECT_USAGE_OPERAND(BIN(setinstancevariable), 0, id); COLLECT_USAGE_OPERAND(BIN(setinstancevariable), 1, ic); { #line 146 "insns.def" vm_setinstancevariable(GET_SELF(), id, val, ic); #line 204 "vm.inc" #undef CURRENT_INSN_setinstancevariable #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setinstancevariable);}}} INSN_ENTRY(getclassvariable){ { VALUE val; ID id = (ID)GET_OPERAND(1); DEBUG_ENTER_INSN("getclassvariable"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_getclassvariable 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_getclassvariable_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(getclassvariable)); COLLECT_USAGE_OPERAND(BIN(getclassvariable), 0, id); { #line 160 "insns.def" NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP()); val = rb_cvar_get(vm_get_cvar_base(cref, GET_CFP()), id); #line 229 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_getclassvariable #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(getclassvariable);}}} INSN_ENTRY(setclassvariable){ { ID id = (ID)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("setclassvariable"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_setclassvariable 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setclassvariable_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setclassvariable)); COLLECT_USAGE_OPERAND(BIN(setclassvariable), 0, id); { #line 175 "insns.def" NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP()); rb_cvar_set(vm_get_cvar_base(cref, GET_CFP()), id, val); #line 256 "vm.inc" #undef CURRENT_INSN_setclassvariable #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setclassvariable);}}} INSN_ENTRY(getconstant){ { VALUE val; ID id = (ID)GET_OPERAND(1); VALUE klass = TOPN(0); DEBUG_ENTER_INSN("getconstant"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_getconstant 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_getconstant_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(getconstant)); COLLECT_USAGE_OPERAND(BIN(getconstant), 0, id); { #line 197 "insns.def" val = vm_get_ev_const(th, GET_ISEQ(), klass, id, 0); #line 281 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_getconstant #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(getconstant);}}} INSN_ENTRY(setconstant){ { ID id = (ID)GET_OPERAND(1); VALUE val = TOPN(1); VALUE cbase = TOPN(0); DEBUG_ENTER_INSN("setconstant"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_setconstant 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setconstant_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setconstant)); COLLECT_USAGE_OPERAND(BIN(setconstant), 0, id); { #line 219 "insns.def" vm_check_if_namespace(cbase); rb_const_set(cbase, id, val); #line 309 "vm.inc" #undef CURRENT_INSN_setconstant #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setconstant);}}} INSN_ENTRY(getglobal){ { VALUE val; GENTRY entry = (GENTRY)GET_OPERAND(1); DEBUG_ENTER_INSN("getglobal"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_getglobal 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_getglobal_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(getglobal)); COLLECT_USAGE_OPERAND(BIN(getglobal), 0, entry); { #line 234 "insns.def" val = GET_GLOBAL((VALUE)entry); #line 333 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_getglobal #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(getglobal);}}} INSN_ENTRY(setglobal){ { GENTRY entry = (GENTRY)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("setglobal"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_setglobal 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setglobal_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setglobal)); COLLECT_USAGE_OPERAND(BIN(setglobal), 0, entry); { #line 248 "insns.def" SET_GLOBAL((VALUE)entry, val); #line 359 "vm.inc" #undef CURRENT_INSN_setglobal #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setglobal);}}} INSN_ENTRY(putnil){ { VALUE val; DEBUG_ENTER_INSN("putnil"); ADD_PC(1+0); PREFETCH(GET_PC()); #define CURRENT_INSN_putnil 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_putnil_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(putnil)); { #line 267 "insns.def" val = Qnil; #line 382 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_putnil #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(putnil);}}} INSN_ENTRY(putself){ { VALUE val; DEBUG_ENTER_INSN("putself"); ADD_PC(1+0); PREFETCH(GET_PC()); #define CURRENT_INSN_putself 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_putself_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(putself)); { #line 281 "insns.def" val = GET_SELF(); #line 407 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_putself #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(putself);}}} INSN_ENTRY(putobject){ { VALUE val = (VALUE)GET_OPERAND(1); DEBUG_ENTER_INSN("putobject"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_putobject 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_putobject_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(putobject)); COLLECT_USAGE_OPERAND(BIN(putobject), 0, val); { #line 297 "insns.def" /* */ #line 432 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_putobject #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(putobject);}}} INSN_ENTRY(putspecialobject){ { VALUE val; rb_num_t value_type = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("putspecialobject"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_putspecialobject 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_putspecialobject_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(putspecialobject)); COLLECT_USAGE_OPERAND(BIN(putspecialobject), 0, value_type); { #line 312 "insns.def" enum vm_special_object_type type = (enum vm_special_object_type)value_type; switch (type) { case VM_SPECIAL_OBJECT_VMCORE: val = rb_mRubyVMFrozenCore; break; case VM_SPECIAL_OBJECT_CBASE: val = vm_get_cbase(GET_ISEQ(), GET_EP()); break; case VM_SPECIAL_OBJECT_CONST_BASE: val = vm_get_const_base(GET_ISEQ(), GET_EP()); break; default: rb_bug("putspecialobject insn: unknown value_type"); } #line 472 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_putspecialobject #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(putspecialobject);}}} INSN_ENTRY(putiseq){ { VALUE ret; ISEQ iseq = (ISEQ)GET_OPERAND(1); DEBUG_ENTER_INSN("putiseq"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_putiseq 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_putiseq_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(putiseq)); COLLECT_USAGE_OPERAND(BIN(putiseq), 0, iseq); { #line 340 "insns.def" ret = iseq->self; #line 498 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(ret); #undef CURRENT_INSN_putiseq #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(putiseq);}}} INSN_ENTRY(putstring){ { VALUE val; VALUE str = (VALUE)GET_OPERAND(1); DEBUG_ENTER_INSN("putstring"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_putstring 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_putstring_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(putstring)); COLLECT_USAGE_OPERAND(BIN(putstring), 0, str); { #line 354 "insns.def" val = rb_str_resurrect(str); #line 524 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_putstring #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(putstring);}}} INSN_ENTRY(concatstrings){ { VALUE val; rb_num_t num = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("concatstrings"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_concatstrings 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_concatstrings_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(concatstrings)); COLLECT_USAGE_OPERAND(BIN(concatstrings), 0, num); { #line 368 "insns.def" rb_num_t i = num - 1; val = rb_str_resurrect(TOPN(i)); while (i-- > 0) { const VALUE v = TOPN(i); rb_str_append(val, v); } POPN(num); #line 557 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_concatstrings #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(concatstrings);}}} INSN_ENTRY(tostring){ { VALUE val = TOPN(0); DEBUG_ENTER_INSN("tostring"); ADD_PC(1+0); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_tostring 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_tostring_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(tostring)); { #line 389 "insns.def" val = rb_obj_as_string(val); #line 582 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_tostring #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(tostring);}}} INSN_ENTRY(toregexp){ { VALUE val; rb_num_t cnt = (rb_num_t)GET_OPERAND(2); rb_num_t opt = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("toregexp"); ADD_PC(1+2); PREFETCH(GET_PC()); #define CURRENT_INSN_toregexp 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_toregexp_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(toregexp)); COLLECT_USAGE_OPERAND(BIN(toregexp), 0, opt); COLLECT_USAGE_OPERAND(BIN(toregexp), 1, cnt); { #line 404 "insns.def" VALUE rb_reg_new_ary(VALUE ary, int options); rb_num_t i; const VALUE ary = rb_ary_tmp_new(cnt); for (i = 0; i < cnt; i++) { rb_ary_store(ary, cnt-i-1, TOPN(i)); } POPN(cnt); val = rb_reg_new_ary(ary, (int)opt); rb_ary_clear(ary); #line 618 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_toregexp #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(toregexp);}}} INSN_ENTRY(newarray){ { VALUE val; rb_num_t num = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("newarray"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_newarray 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_newarray_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(newarray)); COLLECT_USAGE_OPERAND(BIN(newarray), 0, num); { #line 426 "insns.def" val = rb_ary_new4((long)num, STACK_ADDR_FROM_TOP(num)); POPN(num); #line 645 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_newarray #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(newarray);}}} INSN_ENTRY(duparray){ { VALUE val; VALUE ary = (VALUE)GET_OPERAND(1); DEBUG_ENTER_INSN("duparray"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_duparray 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_duparray_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(duparray)); COLLECT_USAGE_OPERAND(BIN(duparray), 0, ary); { #line 441 "insns.def" val = rb_ary_resurrect(ary); #line 671 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_duparray #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(duparray);}}} INSN_ENTRY(expandarray){ { rb_num_t flag = (rb_num_t)GET_OPERAND(2); rb_num_t num = (rb_num_t)GET_OPERAND(1); VALUE ary = TOPN(0); DEBUG_ENTER_INSN("expandarray"); ADD_PC(1+2); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_expandarray 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_expandarray_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(expandarray)); COLLECT_USAGE_OPERAND(BIN(expandarray), 0, num); COLLECT_USAGE_OPERAND(BIN(expandarray), 1, flag); { #line 462 "insns.def" vm_expandarray(GET_CFP(), ary, num, (int)flag); #line 699 "vm.inc" #undef CURRENT_INSN_expandarray #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(expandarray);}}} INSN_ENTRY(concatarray){ { VALUE ary; VALUE ary1 = TOPN(1); VALUE ary2st = TOPN(0); DEBUG_ENTER_INSN("concatarray"); ADD_PC(1+0); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_concatarray 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_concatarray_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(concatarray)); { #line 476 "insns.def" const VALUE ary2 = ary2st; VALUE tmp1 = rb_check_convert_type(ary1, T_ARRAY, "Array", "to_a"); VALUE tmp2 = rb_check_convert_type(ary2, T_ARRAY, "Array", "to_a"); if (NIL_P(tmp1)) { tmp1 = rb_ary_new3(1, ary1); } if (NIL_P(tmp2)) { tmp2 = rb_ary_new3(1, ary2); } if (tmp1 == ary1) { tmp1 = rb_ary_dup(ary1); } ary = rb_ary_concat(tmp1, tmp2); #line 739 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(ary); #undef CURRENT_INSN_concatarray #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(concatarray);}}} INSN_ENTRY(splatarray){ { VALUE obj; VALUE flag = (VALUE)GET_OPERAND(1); VALUE ary = TOPN(0); DEBUG_ENTER_INSN("splatarray"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_splatarray 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_splatarray_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(splatarray)); COLLECT_USAGE_OPERAND(BIN(splatarray), 0, flag); { #line 505 "insns.def" VALUE tmp = rb_check_convert_type(ary, T_ARRAY, "Array", "to_a"); if (NIL_P(tmp)) { tmp = rb_ary_new3(1, ary); } else if (RTEST(flag)) { tmp = rb_ary_dup(tmp); } obj = tmp; #line 773 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(obj); #undef CURRENT_INSN_splatarray #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(splatarray);}}} INSN_ENTRY(newhash){ { VALUE val; rb_num_t num = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("newhash"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_newhash 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_newhash_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(newhash)); COLLECT_USAGE_OPERAND(BIN(newhash), 0, num); { #line 527 "insns.def" rb_num_t i; if(RUBY_DTRACE_HASH_CREATE_ENABLED()) { RUBY_DTRACE_HASH_CREATE(num, rb_sourcefile(), rb_sourceline()); } val = rb_hash_new(); for (i = num; i > 0; i -= 2) { const VALUE v = TOPN(i - 2); const VALUE k = TOPN(i - 1); rb_hash_aset(val, k, v); } POPN(num); #line 812 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_newhash #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(newhash);}}} INSN_ENTRY(newrange){ { VALUE val; rb_num_t flag = (rb_num_t)GET_OPERAND(1); VALUE low = TOPN(1); VALUE high = TOPN(0); DEBUG_ENTER_INSN("newrange"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_newrange 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_newrange_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(newrange)); COLLECT_USAGE_OPERAND(BIN(newrange), 0, flag); { #line 554 "insns.def" val = rb_range_new(low, high, (int)flag); #line 840 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_newrange #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(newrange);}}} INSN_ENTRY(pop){ { VALUE val = TOPN(0); DEBUG_ENTER_INSN("pop"); ADD_PC(1+0); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_pop 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_pop_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(pop)); { #line 572 "insns.def" (void)val; /* none */ #line 866 "vm.inc" #undef CURRENT_INSN_pop #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(pop);}}} INSN_ENTRY(dup){ { VALUE val2; VALUE val1; VALUE val = TOPN(0); DEBUG_ENTER_INSN("dup"); ADD_PC(1+0); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_dup 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_dup_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(dup)); { #line 587 "insns.def" val1 = val2 = val; #line 891 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 2); PUSH(val1); PUSH(val2); #undef CURRENT_INSN_dup #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(dup);}}} INSN_ENTRY(dupn){ { rb_num_t n = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("dupn"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_dupn 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_dupn_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(dupn)); COLLECT_USAGE_OPERAND(BIN(dupn), 0, n); { #line 601 "insns.def" rb_num_t i; VALUE *sp = STACK_ADDR_FROM_TOP(n); for (i = 0; i < n; i++) { GET_SP()[i] = sp[i]; } INC_SP(n); #line 922 "vm.inc" #undef CURRENT_INSN_dupn #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(dupn);}}} INSN_ENTRY(swap){ { VALUE val = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("swap"); ADD_PC(1+0); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_swap 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_swap_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(swap)); { #line 621 "insns.def" /* none */ #line 946 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 2); PUSH(obj); PUSH(val); #undef CURRENT_INSN_swap #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(swap);}}} INSN_ENTRY(reput){ { VALUE val = TOPN(0); DEBUG_ENTER_INSN("reput"); ADD_PC(1+0); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_reput 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_reput_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(reput)); { #line 635 "insns.def" /* none */ #line 972 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_reput #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(reput);}}} INSN_ENTRY(topn){ { VALUE val; rb_num_t n = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("topn"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_topn 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_topn_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(topn)); COLLECT_USAGE_OPERAND(BIN(topn), 0, n); { #line 649 "insns.def" val = TOPN(n); #line 998 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_topn #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(topn);}}} INSN_ENTRY(setn){ { rb_num_t n = (rb_num_t)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("setn"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_setn 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setn_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setn)); COLLECT_USAGE_OPERAND(BIN(setn), 0, n); { #line 663 "insns.def" TOPN(n-1) = val; #line 1024 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_setn #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setn);}}} INSN_ENTRY(adjuststack){ { rb_num_t n = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("adjuststack"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_adjuststack 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_adjuststack_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(adjuststack)); COLLECT_USAGE_OPERAND(BIN(adjuststack), 0, n); { #line 677 "insns.def" DEC_SP(n); #line 1049 "vm.inc" #undef CURRENT_INSN_adjuststack #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(adjuststack);}}} INSN_ENTRY(defined){ { VALUE val; VALUE needstr = (VALUE)GET_OPERAND(3); VALUE obj = (VALUE)GET_OPERAND(2); rb_num_t op_type = (rb_num_t)GET_OPERAND(1); VALUE v = TOPN(0); DEBUG_ENTER_INSN("defined"); ADD_PC(1+3); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_defined 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_defined_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(defined)); COLLECT_USAGE_OPERAND(BIN(defined), 0, op_type); COLLECT_USAGE_OPERAND(BIN(defined), 1, obj); COLLECT_USAGE_OPERAND(BIN(defined), 2, needstr); { #line 696 "insns.def" VALUE klass; enum defined_type expr_type = 0; enum defined_type type = (enum defined_type)op_type; val = Qnil; switch (type) { case DEFINED_IVAR: if (rb_ivar_defined(GET_SELF(), SYM2ID(obj))) { expr_type = DEFINED_IVAR; } break; case DEFINED_IVAR2: klass = vm_get_cbase(GET_ISEQ(), GET_EP()); break; case DEFINED_GVAR: if (rb_gvar_defined(rb_global_entry(SYM2ID(obj)))) { expr_type = DEFINED_GVAR; } break; case DEFINED_CVAR: { NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP()); klass = vm_get_cvar_base(cref, GET_CFP()); if (rb_cvar_defined(klass, SYM2ID(obj))) { expr_type = DEFINED_CVAR; } break; } case DEFINED_CONST: klass = v; if (vm_get_ev_const(th, GET_ISEQ(), klass, SYM2ID(obj), 1)) { expr_type = DEFINED_CONST; } break; case DEFINED_FUNC: klass = CLASS_OF(v); if (rb_method_boundp(klass, SYM2ID(obj), 0)) { expr_type = DEFINED_METHOD; } break; case DEFINED_METHOD:{ VALUE klass = CLASS_OF(v); const rb_method_entry_t *me = rb_method_entry(klass, SYM2ID(obj), 0); if (me) { if (!(me->flag & NOEX_PRIVATE) && !((me->flag & NOEX_PROTECTED) && !rb_obj_is_kind_of(GET_SELF(), rb_class_real(klass)))) { expr_type = DEFINED_METHOD; } } else { VALUE args[2]; VALUE r; args[0] = obj; args[1] = Qfalse; r = rb_check_funcall(v, idRespond_to_missing, 2, args); if (r != Qundef && RTEST(r)) expr_type = DEFINED_METHOD; } break; } case DEFINED_YIELD: if (GET_BLOCK_PTR()) { expr_type = DEFINED_YIELD; } break; case DEFINED_ZSUPER:{ rb_call_info_t cit; if (vm_search_superclass(GET_CFP(), GET_ISEQ(), Qnil, &cit) == 0) { VALUE klass = cit.klass; ID id = cit.mid; if (rb_method_boundp(klass, id, 0)) { expr_type = DEFINED_ZSUPER; } } break; } case DEFINED_REF:{ val = vm_getspecial(th, GET_LEP(), Qfalse, FIX2INT(obj)); if (val != Qnil) { expr_type = DEFINED_GVAR; } break; } default: rb_bug("unimplemented defined? type (VM)"); break; } if (expr_type != 0) { if (needstr != Qfalse) { val = rb_iseq_defined_string(expr_type); } else { val = Qtrue; } } #line 1173 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_defined #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(defined);}}} INSN_ENTRY(checkmatch){ { VALUE result; rb_num_t flag = (rb_num_t)GET_OPERAND(1); VALUE target = TOPN(1); VALUE pattern = TOPN(0); DEBUG_ENTER_INSN("checkmatch"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_checkmatch 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_checkmatch_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(checkmatch)); COLLECT_USAGE_OPERAND(BIN(checkmatch), 0, flag); { #line 810 "insns.def" enum vm_check_match_type checkmatch_type = (enum vm_check_match_type)(flag & VM_CHECKMATCH_TYPE_MASK); result = Qfalse; if (flag & VM_CHECKMATCH_ARRAY) { int i; for (i = 0; i < RARRAY_LEN(pattern); i++) { if (RTEST(check_match(RARRAY_AREF(pattern, i), target, checkmatch_type))) { result = Qtrue; break; } } } else { if (RTEST(check_match(pattern, target, checkmatch_type))) { result = Qtrue; } } #line 1218 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(result); #undef CURRENT_INSN_checkmatch #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(checkmatch);}}} INSN_ENTRY(trace){ { rb_num_t nf = (rb_num_t)GET_OPERAND(1); DEBUG_ENTER_INSN("trace"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_trace 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_trace_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(trace)); COLLECT_USAGE_OPERAND(BIN(trace), 0, nf); { #line 841 "insns.def" rb_event_flag_t flag = (rb_event_flag_t)nf; if (RUBY_DTRACE_METHOD_ENTRY_ENABLED() || RUBY_DTRACE_METHOD_RETURN_ENABLED() || RUBY_DTRACE_CMETHOD_ENTRY_ENABLED() || RUBY_DTRACE_CMETHOD_RETURN_ENABLED()) { switch(flag) { case RUBY_EVENT_CALL: RUBY_DTRACE_METHOD_ENTRY_HOOK(th, 0, 0); break; case RUBY_EVENT_C_CALL: RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, 0, 0); break; case RUBY_EVENT_RETURN: RUBY_DTRACE_METHOD_RETURN_HOOK(th, 0, 0); break; case RUBY_EVENT_C_RETURN: RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, 0, 0); break; } } EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* id and klass are resolved at callee */, (flag & (RUBY_EVENT_RETURN | RUBY_EVENT_B_RETURN)) ? TOPN(0) : Qundef); #line 1267 "vm.inc" #undef CURRENT_INSN_trace #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(trace);}}} INSN_ENTRY(defineclass){ { VALUE val; rb_num_t flags = (rb_num_t)GET_OPERAND(3); ISEQ class_iseq = (ISEQ)GET_OPERAND(2); ID id = (ID)GET_OPERAND(1); VALUE cbase = TOPN(1); VALUE super = TOPN(0); DEBUG_ENTER_INSN("defineclass"); ADD_PC(1+3); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_defineclass 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_defineclass_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(defineclass)); COLLECT_USAGE_OPERAND(BIN(defineclass), 0, id); COLLECT_USAGE_OPERAND(BIN(defineclass), 1, class_iseq); COLLECT_USAGE_OPERAND(BIN(defineclass), 2, flags); { #line 887 "insns.def" VALUE klass; rb_vm_defineclass_type_t type = VM_DEFINECLASS_TYPE(flags); switch (type) { case VM_DEFINECLASS_TYPE_CLASS: /* val is dummy. classdef returns class scope value */ if (VM_DEFINECLASS_HAS_SUPERCLASS_P(flags) && !RB_TYPE_P(super, T_CLASS)) { rb_raise(rb_eTypeError, "superclass must be a Class (%s given)", rb_obj_classname(super)); } if (super == Qnil) { super = rb_cObject; } vm_check_if_namespace(cbase); /* find klass */ rb_autoload_load(cbase, id); if ((klass = vm_search_const_defined_class(cbase, id)) != 0) { /* already exist */ klass = VM_DEFINECLASS_SCOPED_P(flags) ? rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id); if (!RB_TYPE_P(klass, T_CLASS)) { rb_raise(rb_eTypeError, "%s is not a class", rb_id2name(id)); } if (super != rb_cObject) { VALUE tmp; tmp = rb_class_real(RCLASS_SUPER(klass)); if (tmp != super) { rb_raise(rb_eTypeError, "superclass mismatch for class %s", rb_id2name(id)); } } } else { /* new class declaration */ klass = rb_define_class_id(id, super); rb_set_class_path_string(klass, cbase, rb_id2str(id)); rb_const_set(cbase, id, klass); rb_class_inherited(super, klass); } break; case VM_DEFINECLASS_TYPE_SINGLETON_CLASS: /* val is dummy. classdef returns class scope value */ /* super is dummy */ klass = rb_singleton_class(cbase); break; case VM_DEFINECLASS_TYPE_MODULE: /* val is dummy. classdef returns class scope value */ /* super is dummy */ vm_check_if_namespace(cbase); /* find klass */ if ((klass = vm_search_const_defined_class(cbase, id)) != 0) { klass = VM_DEFINECLASS_SCOPED_P(flags) ? rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id); /* already exist */ if (!RB_TYPE_P(klass, T_MODULE)) { rb_raise(rb_eTypeError, "%s is not a module", rb_id2name(id)); } } else { /* new module declaration */ klass = rb_define_module_id(id); rb_set_class_path_string(klass, cbase, rb_id2str(id)); rb_const_set(cbase, id, klass); } break; default: rb_bug("unknown defineclass type: %d", (int)type); } COPY_CREF(class_iseq->cref_stack, vm_cref_push(th, klass, NOEX_PUBLIC, NULL)); /* enter scope */ vm_push_frame(th, class_iseq, VM_FRAME_MAGIC_CLASS, klass, 0, VM_ENVVAL_BLOCK_PTR(GET_BLOCK_PTR()), class_iseq->iseq_encoded, GET_SP(), class_iseq->local_size, 0, class_iseq->stack_max); RESTORE_REGS(); NEXT_INSN(); #line 1383 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_defineclass #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(defineclass);}}} INSN_ENTRY(send){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); DEBUG_ENTER_INSN("send"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_send 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_send_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(send)); COLLECT_USAGE_OPERAND(BIN(send), 0, ci); { #line 992 "insns.def" ci->argc = ci->orig_argc; ci->blockptr = 0; vm_caller_setup_args(th, reg_cfp, ci); vm_search_method(ci, ci->recv = TOPN(ci->argc)); CALL_METHOD(ci); #line 1413 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_send #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(send);}}} INSN_ENTRY(opt_str_freeze){ { VALUE val; VALUE str = (VALUE)GET_OPERAND(1); DEBUG_ENTER_INSN("opt_str_freeze"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_opt_str_freeze 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_str_freeze_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_str_freeze)); COLLECT_USAGE_OPERAND(BIN(opt_str_freeze), 0, str); { #line 1005 "insns.def" if (BASIC_OP_UNREDEFINED_P(BOP_FREEZE, STRING_REDEFINED_OP_FLAG)) { val = str; } else { val = rb_funcall(rb_str_resurrect(str), idFreeze, 0); } #line 1444 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_str_freeze #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_str_freeze);}}} INSN_ENTRY(opt_send_simple){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); DEBUG_ENTER_INSN("opt_send_simple"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_opt_send_simple 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_send_simple_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_send_simple)); COLLECT_USAGE_OPERAND(BIN(opt_send_simple), 0, ci); { #line 1024 "insns.def" vm_search_method(ci, ci->recv = TOPN(ci->argc)); CALL_METHOD(ci); #line 1471 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_send_simple #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_send_simple);}}} INSN_ENTRY(invokesuper){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); DEBUG_ENTER_INSN("invokesuper"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_invokesuper 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_invokesuper_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(invokesuper)); COLLECT_USAGE_OPERAND(BIN(invokesuper), 0, ci); { #line 1039 "insns.def" ci->argc = ci->orig_argc; ci->blockptr = !(ci->flag & VM_CALL_ARGS_BLOCKARG) ? GET_BLOCK_PTR() : 0; if (UNLIKELY(!(ci->flag & VM_CALL_ARGS_SKIP_SETUP))) { vm_caller_setup_args(th, reg_cfp, ci); } ci->recv = GET_SELF(); vm_search_super_method(th, GET_CFP(), ci); CALL_METHOD(ci); #line 1505 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_invokesuper #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(invokesuper);}}} INSN_ENTRY(invokeblock){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); DEBUG_ENTER_INSN("invokeblock"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_invokeblock 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_invokeblock_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(invokeblock)); COLLECT_USAGE_OPERAND(BIN(invokeblock), 0, ci); { #line 1061 "insns.def" ci->argc = ci->orig_argc; ci->blockptr = 0; ci->recv = GET_SELF(); val = vm_invoke_block(th, GET_CFP(), ci); if (val == Qundef) { RESTORE_REGS(); NEXT_INSN(); } #line 1538 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_invokeblock #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(invokeblock);}}} INSN_ENTRY(leave){ { VALUE val = TOPN(0); DEBUG_ENTER_INSN("leave"); ADD_PC(1+0); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_leave 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_leave_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(leave)); { #line 1082 "insns.def" if (OPT_CHECKED_RUN) { if (reg_cfp->sp != vm_base_ptr(reg_cfp)) { rb_bug("Stack consistency error (sp: %"PRIdPTRDIFF", bp: %"PRIdPTRDIFF")", VM_SP_CNT(th, reg_cfp->sp), VM_SP_CNT(th, vm_base_ptr(reg_cfp))); } } RUBY_VM_CHECK_INTS(th); if (UNLIKELY(VM_FRAME_TYPE_FINISH_P(GET_CFP()))) { vm_pop_frame(th); #if OPT_CALL_THREADED_CODE th->retval = val; return 0; #else return val; #endif } else { vm_pop_frame(th); RESTORE_REGS(); } #line 1585 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_leave #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(leave);}}} INSN_ENTRY(throw){ { VALUE val; rb_num_t throw_state = (rb_num_t)GET_OPERAND(1); VALUE throwobj = TOPN(0); DEBUG_ENTER_INSN("throw"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_throw 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_throw_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(throw)); COLLECT_USAGE_OPERAND(BIN(throw), 0, throw_state); { #line 1122 "insns.def" RUBY_VM_CHECK_INTS(th); val = vm_throw(th, GET_CFP(), throw_state, throwobj); THROW_EXCEPTION(val); /* unreachable */ #line 1615 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_throw #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(throw);}}} INSN_ENTRY(jump){ { OFFSET dst = (OFFSET)GET_OPERAND(1); DEBUG_ENTER_INSN("jump"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_jump 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_jump_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(jump)); COLLECT_USAGE_OPERAND(BIN(jump), 0, dst); { #line 1143 "insns.def" RUBY_VM_CHECK_INTS(th); JUMP(dst); #line 1641 "vm.inc" #undef CURRENT_INSN_jump #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(jump);}}} INSN_ENTRY(branchif){ { OFFSET dst = (OFFSET)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("branchif"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_branchif 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_branchif_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(branchif)); COLLECT_USAGE_OPERAND(BIN(branchif), 0, dst); { #line 1158 "insns.def" if (RTEST(val)) { RUBY_VM_CHECK_INTS(th); JUMP(dst); } #line 1668 "vm.inc" #undef CURRENT_INSN_branchif #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(branchif);}}} INSN_ENTRY(branchunless){ { OFFSET dst = (OFFSET)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("branchunless"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_branchunless 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_branchunless_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(branchunless)); COLLECT_USAGE_OPERAND(BIN(branchunless), 0, dst); { #line 1175 "insns.def" if (!RTEST(val)) { RUBY_VM_CHECK_INTS(th); JUMP(dst); } #line 1695 "vm.inc" #undef CURRENT_INSN_branchunless #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(branchunless);}}} INSN_ENTRY(getinlinecache){ { VALUE val; IC ic = (IC)GET_OPERAND(2); OFFSET dst = (OFFSET)GET_OPERAND(1); DEBUG_ENTER_INSN("getinlinecache"); ADD_PC(1+2); PREFETCH(GET_PC()); #define CURRENT_INSN_getinlinecache 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_getinlinecache_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(getinlinecache)); COLLECT_USAGE_OPERAND(BIN(getinlinecache), 0, dst); COLLECT_USAGE_OPERAND(BIN(getinlinecache), 1, ic); { #line 1197 "insns.def" if (ic->ic_serial == GET_GLOBAL_CONSTANT_STATE()) { val = ic->ic_value.value; JUMP(dst); } else { /* none */ val = Qnil; } #line 1728 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_getinlinecache #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(getinlinecache);}}} INSN_ENTRY(setinlinecache){ { IC ic = (IC)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("setinlinecache"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_setinlinecache 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setinlinecache_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setinlinecache)); COLLECT_USAGE_OPERAND(BIN(setinlinecache), 0, ic); { #line 1218 "insns.def" if (ic->ic_value.value == Qundef) { rb_iseq_add_mark_object(GET_ISEQ(), val); } ic->ic_value.value = val; ic->ic_serial = GET_GLOBAL_CONSTANT_STATE() - ruby_vm_const_missing_count; ruby_vm_const_missing_count = 0; #line 1759 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_setinlinecache #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setinlinecache);}}} INSN_ENTRY(once){ { VALUE val; IC ic = (IC)GET_OPERAND(2); ISEQ iseq = (ISEQ)GET_OPERAND(1); DEBUG_ENTER_INSN("once"); ADD_PC(1+2); PREFETCH(GET_PC()); #define CURRENT_INSN_once 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_once_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(once)); COLLECT_USAGE_OPERAND(BIN(once), 0, iseq); COLLECT_USAGE_OPERAND(BIN(once), 1, ic); { #line 1237 "insns.def" union iseq_inline_storage_entry *is = (union iseq_inline_storage_entry *)ic; retry: if (is->once.done == Qfalse) { if (is->once.running_thread == NULL) { is->once.running_thread = th; val = is->once.value = rb_ensure(vm_once_exec, (VALUE)iseq, vm_once_clear, (VALUE)is); /* is->once.running_thread is cleared by vm_once_clear() */ is->once.done = Qtrue; rb_iseq_add_mark_object(GET_ISEQ(), val); } else if (is->once.running_thread == th) { /* recursive once */ val = vm_once_exec(iseq); } else { /* waiting for finish */ RUBY_VM_CHECK_INTS(th); rb_thread_schedule(); goto retry; } } else { val = is->once.value; } #line 1811 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_once #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(once);}}} INSN_ENTRY(opt_case_dispatch){ { OFFSET else_offset = (OFFSET)GET_OPERAND(2); CDHASH hash = (CDHASH)GET_OPERAND(1); VALUE key = TOPN(0); DEBUG_ENTER_INSN("opt_case_dispatch"); ADD_PC(1+2); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_opt_case_dispatch 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_case_dispatch_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_case_dispatch)); COLLECT_USAGE_OPERAND(BIN(opt_case_dispatch), 0, hash); COLLECT_USAGE_OPERAND(BIN(opt_case_dispatch), 1, else_offset); { #line 1275 "insns.def" switch(TYPE(key)) { case T_FLOAT: { double ival; if (modf(RFLOAT_VALUE(key), &ival) == 0.0 && !isinf(ival)) { key = FIXABLE(ival) ? LONG2FIX((long)ival) : rb_dbl2big(ival); } } case T_SYMBOL: /* fall through */ case T_FIXNUM: case T_BIGNUM: case T_STRING: if (BASIC_OP_UNREDEFINED_P(BOP_EQQ, SYMBOL_REDEFINED_OP_FLAG | FIXNUM_REDEFINED_OP_FLAG | FLOAT_REDEFINED_OP_FLAG | BIGNUM_REDEFINED_OP_FLAG | STRING_REDEFINED_OP_FLAG)) { st_data_t val; if (st_lookup(RHASH_TBL_RAW(hash), key, &val)) { JUMP(FIX2INT((VALUE)val)); } else { JUMP(else_offset); } break; } default: break; } #line 1867 "vm.inc" #undef CURRENT_INSN_opt_case_dispatch #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_case_dispatch);}}} INSN_ENTRY(opt_plus){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_plus"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_plus 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_plus_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_plus)); COLLECT_USAGE_OPERAND(BIN(opt_plus), 0, ci); { #line 1319 "insns.def" if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_PLUS,FIXNUM_REDEFINED_OP_FLAG)) { /* fixnum + fixnum */ #ifndef LONG_LONG_VALUE val = (recv + (obj & (~1))); if ((~(recv ^ obj) & (recv ^ val)) & ((VALUE)0x01 << ((sizeof(VALUE) * CHAR_BIT) - 1))) { val = rb_big_plus(rb_int2big(FIX2LONG(recv)), rb_int2big(FIX2LONG(obj))); } #else long a, b, c; a = FIX2LONG(recv); b = FIX2LONG(obj); c = a + b; if (FIXABLE(c)) { val = LONG2FIX(c); } else { val = rb_big_plus(rb_int2big(a), rb_int2big(b)); } #endif } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_PLUS, FLOAT_REDEFINED_OP_FLAG)) { val = DBL2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj)); } else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_PLUS, FLOAT_REDEFINED_OP_FLAG)) { val = 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)) { val = rb_str_plus(recv, obj); } else if (RBASIC_CLASS(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_PLUS, ARRAY_REDEFINED_OP_FLAG)) { val = rb_ary_plus(recv, obj); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 1942 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_plus #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_plus);}}} INSN_ENTRY(opt_minus){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_minus"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_minus 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_minus_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_minus)); COLLECT_USAGE_OPERAND(BIN(opt_minus), 0, ci); { #line 1382 "insns.def" if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_MINUS, FIXNUM_REDEFINED_OP_FLAG)) { long a, b, c; a = FIX2LONG(recv); b = FIX2LONG(obj); c = a - b; if (FIXABLE(c)) { val = LONG2FIX(c); } else { val = rb_big_minus(rb_int2big(a), rb_int2big(b)); } } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_MINUS, FLOAT_REDEFINED_OP_FLAG)) { val = DBL2NUM(RFLOAT_VALUE(recv) - RFLOAT_VALUE(obj)); } else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_MINUS, FLOAT_REDEFINED_OP_FLAG)) { val = DBL2NUM(RFLOAT_VALUE(recv) - RFLOAT_VALUE(obj)); } else { goto INSN_LABEL(normal_dispatch); } } else { /* other */ INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2004 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_minus #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_minus);}}} INSN_ENTRY(opt_mult){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_mult"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_mult 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_mult_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_mult)); COLLECT_USAGE_OPERAND(BIN(opt_mult), 0, ci); { #line 1430 "insns.def" if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_MULT, FIXNUM_REDEFINED_OP_FLAG)) { long a, b; a = FIX2LONG(recv); if (a == 0) { val = recv; } else { b = FIX2LONG(obj); if (MUL_OVERFLOW_FIXNUM_P(a, b)) { val = rb_big_mul(rb_int2big(a), rb_int2big(b)); } else { val = LONG2FIX(a * b); } } } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_MULT, FLOAT_REDEFINED_OP_FLAG)) { val = DBL2NUM(RFLOAT_VALUE(recv) * RFLOAT_VALUE(obj)); } else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_MULT, FLOAT_REDEFINED_OP_FLAG)) { val = DBL2NUM(RFLOAT_VALUE(recv) * RFLOAT_VALUE(obj)); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2068 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_mult #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_mult);}}} INSN_ENTRY(opt_div){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_div"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_div 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_div_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_div)); COLLECT_USAGE_OPERAND(BIN(opt_div), 0, ci); { #line 1480 "insns.def" if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_DIV, FIXNUM_REDEFINED_OP_FLAG)) { long x, y, div; x = FIX2LONG(recv); y = FIX2LONG(obj); { /* copied from numeric.c#fixdivmod */ long mod; if (y == 0) goto INSN_LABEL(normal_dispatch); if (y < 0) { if (x < 0) div = -x / -y; else div = -(x / -y); } else { if (x < 0) div = -(-x / y); else div = x / y; } mod = x - div * y; if ((mod < 0 && y > 0) || (mod > 0 && y < 0)) { mod += y; div -= 1; } } val = LONG2NUM(div); } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_DIV, FLOAT_REDEFINED_OP_FLAG)) { val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj)); } else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_DIV, FLOAT_REDEFINED_OP_FLAG)) { val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj)); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2145 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_div #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_div);}}} INSN_ENTRY(opt_mod){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_mod"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_mod 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_mod_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_mod)); COLLECT_USAGE_OPERAND(BIN(opt_mod), 0, ci); { #line 1543 "insns.def" if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_MOD, FIXNUM_REDEFINED_OP_FLAG )) { long x, y; x = FIX2LONG(recv); y = FIX2LONG(obj); if (x > 0 && y > 0) { val = LONG2FIX(x % y); } else { /* copied from numeric.c#fixdivmod */ long div, mod; if (y == 0) rb_num_zerodiv(); if (y < 0) { if (x < 0) div = -x / -y; else div = -(x / -y); } else { if (x < 0) div = -(-x / y); else div = x / y; } mod = x - div * y; if ((mod < 0 && y > 0) || (mod > 0 && y < 0)) { mod += y; div -= 1; } val = LONG2FIX(mod); } } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_MOD, FLOAT_REDEFINED_OP_FLAG)) { val = DBL2NUM(ruby_float_mod(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj))); } else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_MOD, FLOAT_REDEFINED_OP_FLAG)) { val = DBL2NUM(ruby_float_mod(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj))); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2225 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_mod #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_mod);}}} INSN_ENTRY(opt_eq){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_eq"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_eq 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_eq_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_eq)); COLLECT_USAGE_OPERAND(BIN(opt_eq), 0, ci); { #line 1609 "insns.def" val = opt_eq_func(recv, obj, ci); if (val == Qundef) { /* other */ PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2260 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_eq #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_eq);}}} INSN_ENTRY(opt_neq){ { VALUE val; CALL_INFO ci_eq = (CALL_INFO)GET_OPERAND(2); CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_neq"); ADD_PC(1+2); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_neq 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_neq_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_neq)); COLLECT_USAGE_OPERAND(BIN(opt_neq), 0, ci); COLLECT_USAGE_OPERAND(BIN(opt_neq), 1, ci_eq); { #line 1630 "insns.def" extern VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2); vm_search_method(ci, recv); val = Qundef; if (check_cfunc(ci->me, rb_obj_not_equal)) { val = opt_eq_func(recv, obj, ci_eq); if (val != Qundef) { val = RTEST(val) ? Qfalse : Qtrue; } } if (val == Qundef) { /* other */ PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2307 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_neq #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_neq);}}} INSN_ENTRY(opt_lt){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_lt"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_lt 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_lt_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_lt)); COLLECT_USAGE_OPERAND(BIN(opt_lt), 0, ci); { #line 1661 "insns.def" if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_LT, FIXNUM_REDEFINED_OP_FLAG)) { SIGNED_VALUE a = recv, b = obj; if (a < b) { val = Qtrue; } else { val = Qfalse; } } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_LT, FLOAT_REDEFINED_OP_FLAG)) { /* flonum is not NaN */ val = RFLOAT_VALUE(recv) < RFLOAT_VALUE(obj) ? Qtrue : Qfalse; } else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_LT, FLOAT_REDEFINED_OP_FLAG)) { val = double_cmp_lt(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj)); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2365 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_lt #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_lt);}}} INSN_ENTRY(opt_le){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_le"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_le 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_le_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_le)); COLLECT_USAGE_OPERAND(BIN(opt_le), 0, ci); { #line 1705 "insns.def" if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_LE, FIXNUM_REDEFINED_OP_FLAG)) { SIGNED_VALUE a = recv, b = obj; if (a <= b) { val = Qtrue; } else { val = Qfalse; } } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_LE, FLOAT_REDEFINED_OP_FLAG)) { /* flonum is not NaN */ val = RFLOAT_VALUE(recv) <= RFLOAT_VALUE(obj) ? Qtrue : Qfalse; } else { /* other */ PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2414 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_le #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_le);}}} INSN_ENTRY(opt_gt){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_gt"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_gt 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_gt_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_gt)); COLLECT_USAGE_OPERAND(BIN(opt_gt), 0, ci); { #line 1740 "insns.def" if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_GT, FIXNUM_REDEFINED_OP_FLAG)) { SIGNED_VALUE a = recv, b = obj; if (a > b) { val = Qtrue; } else { val = Qfalse; } } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_GT, FLOAT_REDEFINED_OP_FLAG)) { /* flonum is not NaN */ val = RFLOAT_VALUE(recv) > RFLOAT_VALUE(obj) ? Qtrue : Qfalse; } else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) { if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_GT, FLOAT_REDEFINED_OP_FLAG)) { val = double_cmp_gt(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj)); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2472 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_gt #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_gt);}}} INSN_ENTRY(opt_ge){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_ge"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_ge 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_ge_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_ge)); COLLECT_USAGE_OPERAND(BIN(opt_ge), 0, ci); { #line 1784 "insns.def" if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_GE, FIXNUM_REDEFINED_OP_FLAG)) { SIGNED_VALUE a = recv, b = obj; if (a >= b) { val = Qtrue; } else { val = Qfalse; } } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_GE, FLOAT_REDEFINED_OP_FLAG)) { /* flonum is not NaN */ val = RFLOAT_VALUE(recv) >= RFLOAT_VALUE(obj) ? Qtrue : Qfalse; } else { PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2520 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_ge #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_ge);}}} INSN_ENTRY(opt_ltlt){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_ltlt"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_ltlt 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_ltlt_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_ltlt)); COLLECT_USAGE_OPERAND(BIN(opt_ltlt), 0, ci); { #line 1818 "insns.def" if (!SPECIAL_CONST_P(recv)) { if (RBASIC_CLASS(recv) == rb_cString && BASIC_OP_UNREDEFINED_P(BOP_LTLT, STRING_REDEFINED_OP_FLAG)) { val = rb_str_concat(recv, obj); } else if (RBASIC_CLASS(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_LTLT, ARRAY_REDEFINED_OP_FLAG)) { val = rb_ary_push(recv, obj); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2566 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_ltlt #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_ltlt);}}} INSN_ENTRY(opt_aref){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_aref"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_aref 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_aref_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_aref)); COLLECT_USAGE_OPERAND(BIN(opt_aref), 0, ci); { #line 1850 "insns.def" if (!SPECIAL_CONST_P(recv)) { if (RBASIC_CLASS(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_AREF, ARRAY_REDEFINED_OP_FLAG) && FIXNUM_P(obj)) { val = rb_ary_entry(recv, FIX2LONG(obj)); } else if (RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_AREF, HASH_REDEFINED_OP_FLAG)) { val = rb_hash_aref(recv, obj); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); CALL_SIMPLE_METHOD(recv); } #line 2610 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_aref #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_aref);}}} INSN_ENTRY(opt_aset){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(2); VALUE obj = TOPN(1); VALUE set = TOPN(0); DEBUG_ENTER_INSN("opt_aset"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(3); #define CURRENT_INSN_opt_aset 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_aset_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_aset)); COLLECT_USAGE_OPERAND(BIN(opt_aset), 0, ci); { #line 1880 "insns.def" if (!SPECIAL_CONST_P(recv)) { if (RBASIC_CLASS(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_ASET, ARRAY_REDEFINED_OP_FLAG) && FIXNUM_P(obj)) { rb_ary_store(recv, FIX2LONG(obj), set); val = set; } else if (RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_ASET, HASH_REDEFINED_OP_FLAG)) { rb_hash_aset(recv, obj, set); val = set; } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); PUSH(obj); PUSH(set); CALL_SIMPLE_METHOD(recv); } #line 2658 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_aset #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_aset);}}} INSN_ENTRY(opt_length){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(0); DEBUG_ENTER_INSN("opt_length"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_opt_length 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_length_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_length)); COLLECT_USAGE_OPERAND(BIN(opt_length), 0, ci); { #line 1913 "insns.def" if (!SPECIAL_CONST_P(recv)) { if (RBASIC_CLASS(recv) == rb_cString && BASIC_OP_UNREDEFINED_P(BOP_LENGTH, STRING_REDEFINED_OP_FLAG)) { val = rb_str_length(recv); } else if (RBASIC_CLASS(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_LENGTH, ARRAY_REDEFINED_OP_FLAG)) { val = LONG2NUM(RARRAY_LEN(recv)); } else if (RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_LENGTH, HASH_REDEFINED_OP_FLAG)) { val = INT2FIX(RHASH_SIZE(recv)); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); CALL_SIMPLE_METHOD(recv); } #line 2706 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_length #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_length);}}} INSN_ENTRY(opt_size){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(0); DEBUG_ENTER_INSN("opt_size"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_opt_size 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_size_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_size)); COLLECT_USAGE_OPERAND(BIN(opt_size), 0, ci); { #line 1948 "insns.def" if (!SPECIAL_CONST_P(recv)) { if (RBASIC_CLASS(recv) == rb_cString && BASIC_OP_UNREDEFINED_P(BOP_SIZE, STRING_REDEFINED_OP_FLAG)) { val = rb_str_length(recv); } else if (RBASIC_CLASS(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_SIZE, ARRAY_REDEFINED_OP_FLAG)) { val = LONG2NUM(RARRAY_LEN(recv)); } else if (RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_SIZE, HASH_REDEFINED_OP_FLAG)) { val = INT2FIX(RHASH_SIZE(recv)); } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); CALL_SIMPLE_METHOD(recv); } #line 2754 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_size #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_size);}}} INSN_ENTRY(opt_empty_p){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(0); DEBUG_ENTER_INSN("opt_empty_p"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_opt_empty_p 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_empty_p_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_empty_p)); COLLECT_USAGE_OPERAND(BIN(opt_empty_p), 0, ci); { #line 1983 "insns.def" if (!SPECIAL_CONST_P(recv)) { if (RBASIC_CLASS(recv) == rb_cString && BASIC_OP_UNREDEFINED_P(BOP_EMPTY_P, STRING_REDEFINED_OP_FLAG)) { if (RSTRING_LEN(recv) == 0) val = Qtrue; else val = Qfalse; } else if (RBASIC_CLASS(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_EMPTY_P, ARRAY_REDEFINED_OP_FLAG)) { if (RARRAY_LEN(recv) == 0) val = Qtrue; else val = Qfalse; } else if (RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_EMPTY_P, HASH_REDEFINED_OP_FLAG)) { if (RHASH_EMPTY_P(recv)) val = Qtrue; else val = Qfalse; } else { goto INSN_LABEL(normal_dispatch); } } else { INSN_LABEL(normal_dispatch): PUSH(recv); CALL_SIMPLE_METHOD(recv); } #line 2805 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_empty_p #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_empty_p);}}} INSN_ENTRY(opt_succ){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(0); DEBUG_ENTER_INSN("opt_succ"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_opt_succ 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_succ_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_succ)); COLLECT_USAGE_OPERAND(BIN(opt_succ), 0, ci); { #line 2021 "insns.def" if (SPECIAL_CONST_P(recv)) { if (FIXNUM_P(recv) && BASIC_OP_UNREDEFINED_P(BOP_SUCC, FIXNUM_REDEFINED_OP_FLAG)) { const VALUE obj = INT2FIX(1); /* fixnum + INT2FIX(1) */ val = (recv + (obj & (~1))); if ((~(recv ^ obj) & (recv ^ val)) & ((unsigned long)LONG_MAX + 1)) { val = rb_big_plus(rb_int2big(FIX2LONG(recv)), rb_int2big(FIX2LONG(obj))); } } else { goto INSN_LABEL(normal_dispatch); } } else { if (RBASIC_CLASS(recv) == rb_cString && BASIC_OP_UNREDEFINED_P(BOP_SUCC, STRING_REDEFINED_OP_FLAG)) { val = rb_str_succ(recv); } else if (RBASIC_CLASS(recv) == rb_cTime && BASIC_OP_UNREDEFINED_P(BOP_SUCC, TIME_REDEFINED_OP_FLAG)) { val = rb_time_succ(recv); } else { goto INSN_LABEL(normal_dispatch); } } if (0) { INSN_LABEL(normal_dispatch): PUSH(recv); CALL_SIMPLE_METHOD(recv); } #line 2865 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_succ #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_succ);}}} INSN_ENTRY(opt_not){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE recv = TOPN(0); DEBUG_ENTER_INSN("opt_not"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_opt_not 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_not_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_not)); COLLECT_USAGE_OPERAND(BIN(opt_not), 0, ci); { #line 2068 "insns.def" extern VALUE rb_obj_not(VALUE obj); vm_search_method(ci, recv); if (check_cfunc(ci->me, rb_obj_not)) { val = RTEST(recv) ? Qfalse : Qtrue; } else { PUSH(recv); CALL_SIMPLE_METHOD(recv); } #line 2901 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_not #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_not);}}} INSN_ENTRY(opt_regexpmatch1){ { VALUE val; VALUE r = (VALUE)GET_OPERAND(1); VALUE obj = TOPN(0); DEBUG_ENTER_INSN("opt_regexpmatch1"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_opt_regexpmatch1 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_regexpmatch1_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_regexpmatch1)); COLLECT_USAGE_OPERAND(BIN(opt_regexpmatch1), 0, r); { #line 2092 "insns.def" if (BASIC_OP_UNREDEFINED_P(BOP_MATCH, REGEXP_REDEFINED_OP_FLAG)) { val = rb_reg_match(r, obj); } else { val = rb_funcall(r, idEqTilde, 1, obj); } #line 2932 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_regexpmatch1 #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_regexpmatch1);}}} INSN_ENTRY(opt_regexpmatch2){ { VALUE val; CALL_INFO ci = (CALL_INFO)GET_OPERAND(1); VALUE obj2 = TOPN(1); VALUE obj1 = TOPN(0); DEBUG_ENTER_INSN("opt_regexpmatch2"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(2); #define CURRENT_INSN_opt_regexpmatch2 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_regexpmatch2_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_regexpmatch2)); COLLECT_USAGE_OPERAND(BIN(opt_regexpmatch2), 0, ci); { #line 2110 "insns.def" if (RB_TYPE_P(obj2, T_STRING) && BASIC_OP_UNREDEFINED_P(BOP_MATCH, STRING_REDEFINED_OP_FLAG)) { val = rb_reg_match(obj1, obj2); } else { PUSH(obj2); PUSH(obj1); CALL_SIMPLE_METHOD(obj2); } #line 2968 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef CURRENT_INSN_opt_regexpmatch2 #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_regexpmatch2);}}} INSN_ENTRY(opt_call_c_function){ { rb_insn_func_t funcptr = (rb_insn_func_t)GET_OPERAND(1); DEBUG_ENTER_INSN("opt_call_c_function"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_opt_call_c_function 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_opt_call_c_function_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(opt_call_c_function)); COLLECT_USAGE_OPERAND(BIN(opt_call_c_function), 0, funcptr); { #line 2132 "insns.def" reg_cfp = (funcptr)(th, reg_cfp); if (reg_cfp == 0) { VALUE err = th->errinfo; th->errinfo = Qnil; THROW_EXCEPTION(err); } RESTORE_REGS(); NEXT_INSN(); #line 3002 "vm.inc" #undef CURRENT_INSN_opt_call_c_function #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(opt_call_c_function);}}} INSN_ENTRY(bitblt){ { VALUE ret; DEBUG_ENTER_INSN("bitblt"); ADD_PC(1+0); PREFETCH(GET_PC()); #define CURRENT_INSN_bitblt 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_bitblt_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(bitblt)); { #line 2155 "insns.def" ret = rb_str_new2("a bit of bacon, lettuce and tomato"); #line 3025 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(ret); #undef CURRENT_INSN_bitblt #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(bitblt);}}} INSN_ENTRY(answer){ { VALUE ret; DEBUG_ENTER_INSN("answer"); ADD_PC(1+0); PREFETCH(GET_PC()); #define CURRENT_INSN_answer 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_answer_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(answer)); { #line 2169 "insns.def" ret = INT2FIX(42); #line 3050 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(ret); #undef CURRENT_INSN_answer #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(answer);}}} INSN_ENTRY(getlocal_OP__WC__0){ { VALUE val; #define level 0 lindex_t idx = (lindex_t)GET_OPERAND(1); DEBUG_ENTER_INSN("getlocal_OP__WC__0"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_getlocal_OP__WC__0 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_getlocal_OP__WC__0_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(getlocal_OP__WC__0)); COLLECT_USAGE_OPERAND(BIN(getlocal_OP__WC__0), 0, idx); { #line 60 "insns.def" int i, lev = (int)level; VALUE *ep = GET_EP(); for (i = 0; i < lev; i++) { ep = GET_PREV_EP(ep); } val = *(ep - idx); #line 3083 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef level #undef CURRENT_INSN_getlocal_OP__WC__0 #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(getlocal_OP__WC__0);}}} INSN_ENTRY(getlocal_OP__WC__1){ { VALUE val; #define level 1 lindex_t idx = (lindex_t)GET_OPERAND(1); DEBUG_ENTER_INSN("getlocal_OP__WC__1"); ADD_PC(1+1); PREFETCH(GET_PC()); #define CURRENT_INSN_getlocal_OP__WC__1 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_getlocal_OP__WC__1_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(getlocal_OP__WC__1)); COLLECT_USAGE_OPERAND(BIN(getlocal_OP__WC__1), 0, idx); { #line 60 "insns.def" int i, lev = (int)level; VALUE *ep = GET_EP(); for (i = 0; i < lev; i++) { ep = GET_PREV_EP(ep); } val = *(ep - idx); #line 3117 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef level #undef CURRENT_INSN_getlocal_OP__WC__1 #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(getlocal_OP__WC__1);}}} INSN_ENTRY(setlocal_OP__WC__0){ { #define level 0 lindex_t idx = (lindex_t)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("setlocal_OP__WC__0"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_setlocal_OP__WC__0 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setlocal_OP__WC__0_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setlocal_OP__WC__0)); COLLECT_USAGE_OPERAND(BIN(setlocal_OP__WC__0), 0, idx); { #line 82 "insns.def" int i, lev = (int)level; VALUE *ep = GET_EP(); for (i = 0; i < lev; i++) { ep = GET_PREV_EP(ep); } *(ep - idx) = val; #line 3151 "vm.inc" #undef level #undef CURRENT_INSN_setlocal_OP__WC__0 #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setlocal_OP__WC__0);}}} INSN_ENTRY(setlocal_OP__WC__1){ { #define level 1 lindex_t idx = (lindex_t)GET_OPERAND(1); VALUE val = TOPN(0); DEBUG_ENTER_INSN("setlocal_OP__WC__1"); ADD_PC(1+1); PREFETCH(GET_PC()); POPN(1); #define CURRENT_INSN_setlocal_OP__WC__1 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_setlocal_OP__WC__1_##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(setlocal_OP__WC__1)); COLLECT_USAGE_OPERAND(BIN(setlocal_OP__WC__1), 0, idx); { #line 82 "insns.def" int i, lev = (int)level; VALUE *ep = GET_EP(); for (i = 0; i < lev; i++) { ep = GET_PREV_EP(ep); } *(ep - idx) = val; #line 3183 "vm.inc" #undef level #undef CURRENT_INSN_setlocal_OP__WC__1 #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(setlocal_OP__WC__1);}}} INSN_ENTRY(putobject_OP_INT2FIX_O_0_C_){ { #define val INT2FIX(0) DEBUG_ENTER_INSN("putobject_OP_INT2FIX_O_0_C_"); ADD_PC(1+0); PREFETCH(GET_PC()); #define CURRENT_INSN_putobject_OP_INT2FIX_O_0_C_ 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_putobject_OP_INT2FIX_O_0_C__##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(putobject_OP_INT2FIX_O_0_C_)); { #line 297 "insns.def" /* */ #line 3207 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef val #undef CURRENT_INSN_putobject_OP_INT2FIX_O_0_C_ #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(putobject_OP_INT2FIX_O_0_C_);}}} INSN_ENTRY(putobject_OP_INT2FIX_O_1_C_){ { #define val INT2FIX(1) DEBUG_ENTER_INSN("putobject_OP_INT2FIX_O_1_C_"); ADD_PC(1+0); PREFETCH(GET_PC()); #define CURRENT_INSN_putobject_OP_INT2FIX_O_1_C_ 1 #define INSN_IS_SC() 0 #define INSN_LABEL(lab) LABEL_putobject_OP_INT2FIX_O_1_C__##lab #define LABEL_IS_SC(lab) LABEL_##lab##_##t COLLECT_USAGE_INSN(BIN(putobject_OP_INT2FIX_O_1_C_)); { #line 297 "insns.def" /* */ #line 3233 "vm.inc" CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, 1); PUSH(val); #undef val #undef CURRENT_INSN_putobject_OP_INT2FIX_O_1_C_ #undef INSN_IS_SC #undef INSN_LABEL #undef LABEL_IS_SC END_INSN(putobject_OP_INT2FIX_O_1_C_);}}}