vm.inc
Go to the documentation of this file.
/* -*-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
USAGE_ANALYSIS_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;
lindex_t idx = (lindex_t)GET_OPERAND(1);
DEBUG_ENTER_INSN("getlocal");
ADD_PC(1+1);
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
USAGE_ANALYSIS_INSN(BIN(getlocal));
USAGE_ANALYSIS_OPERAND(BIN(getlocal), 0, idx);
{
#line 58 "insns.def"
val = *(GET_LFP() - idx);
#line 56 "vm.inc"
CHECK_STACK_OVERFLOW(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){
{
lindex_t idx = (lindex_t)GET_OPERAND(1);
VALUE val = TOPN(0);
DEBUG_ENTER_INSN("setlocal");
ADD_PC(1+1);
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
USAGE_ANALYSIS_INSN(BIN(setlocal));
USAGE_ANALYSIS_OPERAND(BIN(setlocal), 0, idx);
{
#line 72 "insns.def"
(*(GET_LFP() - idx)) = val;
#line 82 "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);
VALUE key = (VALUE)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
USAGE_ANALYSIS_INSN(BIN(getspecial));
USAGE_ANALYSIS_OPERAND(BIN(getspecial), 0, key);
USAGE_ANALYSIS_OPERAND(BIN(getspecial), 1, type);
{
#line 86 "insns.def"
val = vm_getspecial(th, GET_LFP(), key, type);
#line 108 "vm.inc"
CHECK_STACK_OVERFLOW(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){
{
VALUE key = (VALUE)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
USAGE_ANALYSIS_INSN(BIN(setspecial));
USAGE_ANALYSIS_OPERAND(BIN(setspecial), 0, key);
{
#line 100 "insns.def"
lfp_svar_set(th, GET_LFP(), key, obj);
#line 134 "vm.inc"
#undef CURRENT_INSN_setspecial
#undef INSN_IS_SC
#undef INSN_LABEL
#undef LABEL_IS_SC
END_INSN(setspecial);}}}
INSN_ENTRY(getdynamic){
{
VALUE val;
rb_num_t level = (rb_num_t)GET_OPERAND(2);
dindex_t idx = (dindex_t)GET_OPERAND(1);
DEBUG_ENTER_INSN("getdynamic");
ADD_PC(1+2);
PREFETCH(GET_PC());
#define CURRENT_INSN_getdynamic 1
#define INSN_IS_SC() 0
#define INSN_LABEL(lab) LABEL_getdynamic_##lab
#define LABEL_IS_SC(lab) LABEL_##lab##_##t
USAGE_ANALYSIS_INSN(BIN(getdynamic));
USAGE_ANALYSIS_OPERAND(BIN(getdynamic), 0, idx);
USAGE_ANALYSIS_OPERAND(BIN(getdynamic), 1, level);
{
#line 116 "insns.def"
rb_num_t i;
VALUE *dfp2 = GET_DFP();
for (i = 0; i < level; i++) {
dfp2 = GET_PREV_DFP(dfp2);
}
val = *(dfp2 - idx);
#line 165 "vm.inc"
CHECK_STACK_OVERFLOW(REG_CFP, 1);
PUSH(val);
#undef CURRENT_INSN_getdynamic
#undef INSN_IS_SC
#undef INSN_LABEL
#undef LABEL_IS_SC
END_INSN(getdynamic);}}}
INSN_ENTRY(setdynamic){
{
rb_num_t level = (rb_num_t)GET_OPERAND(2);
dindex_t idx = (dindex_t)GET_OPERAND(1);
VALUE val = TOPN(0);
DEBUG_ENTER_INSN("setdynamic");
ADD_PC(1+2);
PREFETCH(GET_PC());
POPN(1);
#define CURRENT_INSN_setdynamic 1
#define INSN_IS_SC() 0
#define INSN_LABEL(lab) LABEL_setdynamic_##lab
#define LABEL_IS_SC(lab) LABEL_##lab##_##t
USAGE_ANALYSIS_INSN(BIN(setdynamic));
USAGE_ANALYSIS_OPERAND(BIN(setdynamic), 0, idx);
USAGE_ANALYSIS_OPERAND(BIN(setdynamic), 1, level);
{
#line 137 "insns.def"
rb_num_t i;
VALUE *dfp2 = GET_DFP();
for (i = 0; i < level; i++) {
dfp2 = GET_PREV_DFP(dfp2);
}
*(dfp2 - idx) = val;
#line 198 "vm.inc"
#undef CURRENT_INSN_setdynamic
#undef INSN_IS_SC
#undef INSN_LABEL
#undef LABEL_IS_SC
END_INSN(setdynamic);}}}
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
USAGE_ANALYSIS_INSN(BIN(getinstancevariable));
USAGE_ANALYSIS_OPERAND(BIN(getinstancevariable), 0, id);
USAGE_ANALYSIS_OPERAND(BIN(getinstancevariable), 1, ic);
{
#line 157 "insns.def"
val = vm_getivar(GET_SELF(), id, ic);
#line 224 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(setinstancevariable));
USAGE_ANALYSIS_OPERAND(BIN(setinstancevariable), 0, id);
USAGE_ANALYSIS_OPERAND(BIN(setinstancevariable), 1, ic);
{
#line 172 "insns.def"
vm_setivar(GET_SELF(), id, val, ic);
#line 252 "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
USAGE_ANALYSIS_INSN(BIN(getclassvariable));
USAGE_ANALYSIS_OPERAND(BIN(getclassvariable), 0, id);
{
#line 186 "insns.def"
NODE * const cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP());
val = rb_cvar_get(vm_get_cvar_base(cref), id);
#line 277 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(setclassvariable));
USAGE_ANALYSIS_OPERAND(BIN(setclassvariable), 0, id);
{
#line 201 "insns.def"
NODE * const cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP());
rb_cvar_set(vm_get_cvar_base(cref), id, val);
#line 304 "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
USAGE_ANALYSIS_INSN(BIN(getconstant));
USAGE_ANALYSIS_OPERAND(BIN(getconstant), 0, id);
{
#line 223 "insns.def"
val = vm_get_ev_const(th, GET_ISEQ(), klass, id, 0);
#line 329 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(setconstant));
USAGE_ANALYSIS_OPERAND(BIN(setconstant), 0, id);
{
#line 245 "insns.def"
vm_check_if_namespace(cbase);
rb_const_set(cbase, id, val);
INC_VM_STATE_VERSION();
#line 358 "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
USAGE_ANALYSIS_INSN(BIN(getglobal));
USAGE_ANALYSIS_OPERAND(BIN(getglobal), 0, entry);
{
#line 261 "insns.def"
val = GET_GLOBAL((VALUE)entry);
#line 382 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(setglobal));
USAGE_ANALYSIS_OPERAND(BIN(setglobal), 0, entry);
{
#line 275 "insns.def"
SET_GLOBAL((VALUE)entry, val);
#line 408 "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
USAGE_ANALYSIS_INSN(BIN(putnil));
{
#line 294 "insns.def"
val = Qnil;
#line 431 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(putself));
{
#line 308 "insns.def"
val = GET_SELF();
#line 456 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(putobject));
USAGE_ANALYSIS_OPERAND(BIN(putobject), 0, val);
{
#line 324 "insns.def"
/* */
#line 481 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(putspecialobject));
USAGE_ANALYSIS_OPERAND(BIN(putspecialobject), 0, value_type);
{
#line 339 "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_LFP(), GET_DFP());
break;
case VM_SPECIAL_OBJECT_CONST_BASE:
val = vm_get_const_base(GET_ISEQ(), GET_LFP(), GET_DFP());
break;
default:
rb_bug("putspecialobject insn: unknown value_type");
}
#line 521 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(putiseq));
USAGE_ANALYSIS_OPERAND(BIN(putiseq), 0, iseq);
{
#line 367 "insns.def"
ret = iseq->self;
#line 547 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(putstring));
USAGE_ANALYSIS_OPERAND(BIN(putstring), 0, str);
{
#line 381 "insns.def"
val = rb_str_resurrect(str);
#line 573 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(concatstrings));
USAGE_ANALYSIS_OPERAND(BIN(concatstrings), 0, num);
{
#line 395 "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 606 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(tostring));
{
#line 416 "insns.def"
val = rb_obj_as_string(val);
#line 631 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(toregexp));
USAGE_ANALYSIS_OPERAND(BIN(toregexp), 0, opt);
USAGE_ANALYSIS_OPERAND(BIN(toregexp), 1, cnt);
{
#line 431 "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 667 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(newarray));
USAGE_ANALYSIS_OPERAND(BIN(newarray), 0, num);
{
#line 453 "insns.def"
val = rb_ary_new4((long)num, STACK_ADDR_FROM_TOP(num));
POPN(num);
#line 694 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(duparray));
USAGE_ANALYSIS_OPERAND(BIN(duparray), 0, ary);
{
#line 468 "insns.def"
val = rb_ary_resurrect(ary);
#line 720 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(expandarray));
USAGE_ANALYSIS_OPERAND(BIN(expandarray), 0, num);
USAGE_ANALYSIS_OPERAND(BIN(expandarray), 1, flag);
{
#line 489 "insns.def"
vm_expandarray(GET_CFP(), ary, num, (int)flag);
#line 748 "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
USAGE_ANALYSIS_INSN(BIN(concatarray));
{
#line 503 "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 788 "vm.inc"
CHECK_STACK_OVERFLOW(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 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
USAGE_ANALYSIS_INSN(BIN(splatarray));
USAGE_ANALYSIS_OPERAND(BIN(splatarray), 0, flag);
{
#line 532 "insns.def"
VALUE tmp = rb_check_convert_type(ary, T_ARRAY, "Array", "to_a");
if (NIL_P(tmp)) {
tmp = rb_ary_new3(1, ary);
}
obj = tmp;
#line 819 "vm.inc"
CHECK_STACK_OVERFLOW(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(checkincludearray){
{
VALUE result;
VALUE flag = (VALUE)GET_OPERAND(1);
VALUE obj = TOPN(1);
VALUE ary = TOPN(0);
DEBUG_ENTER_INSN("checkincludearray");
ADD_PC(1+1);
PREFETCH(GET_PC());
POPN(2);
#define CURRENT_INSN_checkincludearray 1
#define INSN_IS_SC() 0
#define INSN_LABEL(lab) LABEL_checkincludearray_##lab
#define LABEL_IS_SC(lab) LABEL_##lab##_##t
USAGE_ANALYSIS_INSN(BIN(checkincludearray));
USAGE_ANALYSIS_OPERAND(BIN(checkincludearray), 0, flag);
{
#line 550 "insns.def"
int i;
result = Qfalse;
if (TYPE(ary) != T_ARRAY) {
ary = rb_Array(ary);
}
if (flag == Qtrue) {
/* NODE_CASE */
for (i = 0; i < RARRAY_LEN(ary); i++) {
/* TODO: fix me (use another method dispatch) */
if (RTEST(rb_funcall2(RARRAY_PTR(ary)[i], idEqq, 1, &obj))) {
result = Qtrue;
break;
}
}
}
else {
obj = Qfalse;
/* NODE_WHEN */
for (i = 0; i < RARRAY_LEN(ary); i++) {
if (RTEST(RARRAY_PTR(ary)[i])) {
obj = result = Qtrue;
break;
}
}
}
#line 873 "vm.inc"
CHECK_STACK_OVERFLOW(REG_CFP, 2);
PUSH(obj);
PUSH(result);
#undef CURRENT_INSN_checkincludearray
#undef INSN_IS_SC
#undef INSN_LABEL
#undef LABEL_IS_SC
END_INSN(checkincludearray);}}}
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
USAGE_ANALYSIS_INSN(BIN(newhash));
USAGE_ANALYSIS_OPERAND(BIN(newhash), 0, num);
{
#line 591 "insns.def"
rb_num_t i;
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 908 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(newrange));
USAGE_ANALYSIS_OPERAND(BIN(newrange), 0, flag);
{
#line 613 "insns.def"
val = rb_range_new(low, high, (int)flag);
#line 936 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(pop));
{
#line 631 "insns.def"
val = val;
/* none */
#line 962 "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
USAGE_ANALYSIS_INSN(BIN(dup));
{
#line 646 "insns.def"
val1 = val2 = val;
#line 987 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(dupn));
USAGE_ANALYSIS_OPERAND(BIN(dupn), 0, n);
{
#line 660 "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 1018 "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
USAGE_ANALYSIS_INSN(BIN(swap));
{
#line 680 "insns.def"
/* none */
#line 1042 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(reput));
{
#line 694 "insns.def"
/* none */
#line 1068 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(topn));
USAGE_ANALYSIS_OPERAND(BIN(topn), 0, n);
{
#line 708 "insns.def"
val = TOPN(n);
#line 1094 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(setn));
USAGE_ANALYSIS_OPERAND(BIN(setn), 0, n);
{
#line 722 "insns.def"
TOPN(n-1) = val;
#line 1120 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(adjuststack));
USAGE_ANALYSIS_OPERAND(BIN(adjuststack), 0, n);
{
#line 736 "insns.def"
DEC_SP(n);
#line 1145 "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
USAGE_ANALYSIS_INSN(BIN(defined));
USAGE_ANALYSIS_OPERAND(BIN(defined), 0, op_type);
USAGE_ANALYSIS_OPERAND(BIN(defined), 1, obj);
USAGE_ANALYSIS_OPERAND(BIN(defined), 2, needstr);
{
#line 755 "insns.def"
VALUE klass;
const char *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 = "instance-variable";
}
break;
case DEFINED_IVAR2:
klass = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP());
break;
case DEFINED_GVAR:
if (rb_gvar_defined(rb_global_entry(SYM2ID(obj)))) {
expr_type = "global-variable";
}
break;
case DEFINED_CVAR:
{
NODE *cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP());
klass = vm_get_cvar_base(cref);
if (rb_cvar_defined(klass, SYM2ID(obj))) {
expr_type = "class variable";
}
break;
}
case DEFINED_CONST:
klass = v;
if (vm_get_ev_const(th, GET_ISEQ(), klass, SYM2ID(obj), 1)) {
expr_type = "constant";
}
break;
case DEFINED_FUNC:
klass = CLASS_OF(v);
if (rb_method_boundp(klass, SYM2ID(obj), 0)) {
expr_type = "method";
}
break;
case DEFINED_METHOD:{
VALUE klass = CLASS_OF(v);
const rb_method_entry_t *me = rb_method_entry(klass, SYM2ID(obj));
if (me) {
if (!(me->flag & NOEX_PRIVATE)) {
if (!((me->flag & NOEX_PROTECTED) &&
!rb_obj_is_kind_of(GET_SELF(),
rb_class_real(klass)))) {
expr_type = "method";
}
}
}
{
VALUE args[2];
VALUE r;
args[0] = obj; args[1] = Qfalse;
r = rb_check_funcall(v, rb_intern("respond_to_missing?"), 2, args);
if (r != Qundef && RTEST(r))
expr_type = "method";
}
break;
}
case DEFINED_YIELD:
if (GET_BLOCK_PTR()) {
expr_type = "yield";
}
break;
case DEFINED_ZSUPER:{
rb_iseq_t *iseq = GET_ISEQ();
while (iseq) {
if (iseq->defined_method_id) {
break;
}
iseq = iseq->parent_iseq;
}
if (iseq) {
VALUE klass = vm_search_normal_superclass(iseq->klass, GET_SELF());
if (rb_method_boundp(klass, iseq->defined_method_id, 0)) {
expr_type = "super";
}
}
break;
}
case DEFINED_REF:{
val = vm_getspecial(th, GET_LFP(), Qfalse, FIX2INT(obj));
if (val != Qnil) {
expr_type = "global-variable";
}
break;
}
default:
rb_bug("unimplemented defined? type (VM)");
break;
}
if (expr_type != 0) {
if (needstr != Qfalse) {
val = rb_str_new2(expr_type);
}
else {
val = Qtrue;
}
}
#line 1278 "vm.inc"
CHECK_STACK_OVERFLOW(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(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
USAGE_ANALYSIS_INSN(BIN(trace));
USAGE_ANALYSIS_OPERAND(BIN(trace), 0, nf);
{
#line 873 "insns.def"
rb_event_flag_t flag = (rb_event_flag_t)nf;
EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */);
#line 1305 "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 define_type = (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
USAGE_ANALYSIS_INSN(BIN(defineclass));
USAGE_ANALYSIS_OPERAND(BIN(defineclass), 0, id);
USAGE_ANALYSIS_OPERAND(BIN(defineclass), 1, class_iseq);
USAGE_ANALYSIS_OPERAND(BIN(defineclass), 2, define_type);
{
#line 897 "insns.def"
VALUE klass;
switch ((int)define_type) {
case 0: /* scoped: class Foo::Bar */
case 3: /* no scope: class Bar */
/* val is dummy. classdef returns class scope value */
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 = define_type == 0 ? rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id);
if (TYPE(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 1:
/* val is dummy. classdef returns class scope value */
/* super is dummy */
klass = rb_singleton_class(cbase);
break;
case 2: /* scoped: module Foo::Bar or module ::Bar */
case 5: /* no scope: module Bar */
/* 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 = define_type == 2 ? rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id);
/* already exist */
if (TYPE(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)define_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, (VALUE) GET_BLOCK_PTR(),
class_iseq->iseq_encoded, GET_SP(), 0,
class_iseq->local_size);
RESTORE_REGS();
INC_VM_STATE_VERSION();
NEXT_INSN();
#line 1416 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)GET_OPERAND(5);
rb_num_t op_flag = (rb_num_t)GET_OPERAND(4);
ISEQ blockiseq = (ISEQ)GET_OPERAND(3);
rb_num_t op_argc = (rb_num_t)GET_OPERAND(2);
ID op_id = (ID)GET_OPERAND(1);
DEBUG_ENTER_INSN("send");
ADD_PC(1+5);
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
USAGE_ANALYSIS_INSN(BIN(send));
USAGE_ANALYSIS_OPERAND(BIN(send), 0, op_id);
USAGE_ANALYSIS_OPERAND(BIN(send), 1, op_argc);
USAGE_ANALYSIS_OPERAND(BIN(send), 2, blockiseq);
USAGE_ANALYSIS_OPERAND(BIN(send), 3, op_flag);
USAGE_ANALYSIS_OPERAND(BIN(send), 4, ic);
{
#line 1003 "insns.def"
const rb_method_entry_t *me;
VALUE recv, klass;
rb_block_t *blockptr = 0;
VALUE flag = op_flag;
int num = caller_setup_args(th, GET_CFP(), flag, (int)op_argc,
(rb_iseq_t *)blockiseq, &blockptr);
ID id = op_id;
/* get receiver */
recv = TOPN(num);
klass = CLASS_OF(recv);
me = vm_method_search(id, klass, ic);
CALL_METHOD(num, blockptr, flag, id, me, recv);
#line 1462 "vm.inc"
CHECK_STACK_OVERFLOW(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(invokesuper){
{
VALUE val;
rb_num_t op_flag = (rb_num_t)GET_OPERAND(3);
ISEQ blockiseq = (ISEQ)GET_OPERAND(2);
rb_num_t op_argc = (rb_num_t)GET_OPERAND(1);
DEBUG_ENTER_INSN("invokesuper");
ADD_PC(1+3);
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
USAGE_ANALYSIS_INSN(BIN(invokesuper));
USAGE_ANALYSIS_OPERAND(BIN(invokesuper), 0, op_argc);
USAGE_ANALYSIS_OPERAND(BIN(invokesuper), 1, blockiseq);
USAGE_ANALYSIS_OPERAND(BIN(invokesuper), 2, op_flag);
{
#line 1031 "insns.def"
rb_block_t *blockptr = !(op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? GET_BLOCK_PTR() : 0;
VALUE flag = op_flag;
int num = caller_setup_args(th, GET_CFP(), flag,
(int)op_argc, blockiseq, &blockptr);
VALUE recv, klass;
ID id;
const rb_method_entry_t *me;
flag = VM_CALL_SUPER_BIT | VM_CALL_FCALL_BIT;
recv = GET_SELF();
vm_search_superclass(GET_CFP(), GET_ISEQ(), recv, TOPN(num), &id, &klass);
/* temporary measure for [Bug #2402] [Bug #2502] [Bug #3136] */
if (!rb_obj_is_kind_of(recv, klass)) {
rb_raise(rb_eNotImpError, "super from singleton method that is defined to multiple classes is not supported; this will be fixed in 1.9.3 or later");
}
me = rb_method_entry(klass, id);
CALL_METHOD(num, blockptr, flag, id, me, recv);
#line 1512 "vm.inc"
CHECK_STACK_OVERFLOW(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;
rb_num_t flag = (rb_num_t)GET_OPERAND(2);
rb_num_t num = (rb_num_t)GET_OPERAND(1);
DEBUG_ENTER_INSN("invokeblock");
ADD_PC(1+2);
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
USAGE_ANALYSIS_INSN(BIN(invokeblock));
USAGE_ANALYSIS_OPERAND(BIN(invokeblock), 0, num);
USAGE_ANALYSIS_OPERAND(BIN(invokeblock), 1, flag);
{
#line 1066 "insns.def"
val = vm_invoke_block(th, GET_CFP(), num, flag);
if (val == Qundef) {
RESTORE_REGS();
NEXT_INSN();
}
#line 1544 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(leave));
{
#line 1084 "insns.def"
if (OPT_CHECKED_RUN) {
if (reg_cfp->sp != reg_cfp->bp) {
rb_bug("Stack consistency error (sp: %"PRIdPTRDIFF", bp: %"PRIdPTRDIFF")",
VM_SP_CNT(th, reg_cfp->sp), VM_SP_CNT(th, reg_cfp->bp));
}
}
RUBY_VM_CHECK_INTS();
vm_pop_frame(th);
RESTORE_REGS();
#line 1578 "vm.inc"
CHECK_STACK_OVERFLOW(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(finish){
{
VALUE val = TOPN(0);
DEBUG_ENTER_INSN("finish");
ADD_PC(1+0);
PREFETCH(GET_PC());
POPN(1);
#define CURRENT_INSN_finish 1
#define INSN_IS_SC() 0
#define INSN_LABEL(lab) LABEL_finish_##lab
#define LABEL_IS_SC(lab) LABEL_##lab##_##t
USAGE_ANALYSIS_INSN(BIN(finish));
{
#line 1107 "insns.def"
#if OPT_CALL_THREADED_CODE
rb_bug("unused instruction on OPT_CALL_THREADED_CODE");
#else
th->cfp++;
return val;
#endif
#line 1608 "vm.inc"
CHECK_STACK_OVERFLOW(REG_CFP, 1);
PUSH(val);
#undef CURRENT_INSN_finish
#undef INSN_IS_SC
#undef INSN_LABEL
#undef LABEL_IS_SC
END_INSN(finish);}}}
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
USAGE_ANALYSIS_INSN(BIN(throw));
USAGE_ANALYSIS_OPERAND(BIN(throw), 0, throw_state);
{
#line 1130 "insns.def"
RUBY_VM_CHECK_INTS();
val = vm_throw(th, GET_CFP(), throw_state, throwobj);
THROW_EXCEPTION(val);
/* unreachable */
#line 1638 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(jump));
USAGE_ANALYSIS_OPERAND(BIN(jump), 0, dst);
{
#line 1151 "insns.def"
RUBY_VM_CHECK_INTS();
JUMP(dst);
#line 1664 "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
USAGE_ANALYSIS_INSN(BIN(branchif));
USAGE_ANALYSIS_OPERAND(BIN(branchif), 0, dst);
{
#line 1166 "insns.def"
if (RTEST(val)) {
RUBY_VM_CHECK_INTS();
JUMP(dst);
}
#line 1691 "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
USAGE_ANALYSIS_INSN(BIN(branchunless));
USAGE_ANALYSIS_OPERAND(BIN(branchunless), 0, dst);
{
#line 1183 "insns.def"
if (!RTEST(val)) {
RUBY_VM_CHECK_INTS();
JUMP(dst);
}
#line 1718 "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
USAGE_ANALYSIS_INSN(BIN(getinlinecache));
USAGE_ANALYSIS_OPERAND(BIN(getinlinecache), 0, dst);
USAGE_ANALYSIS_OPERAND(BIN(getinlinecache), 1, ic);
{
#line 1205 "insns.def"
if (ic->ic_vmstat == GET_VM_STATE_VERSION()) {
val = ic->ic_value.value;
JUMP(dst);
}
else {
/* none */
val = Qnil;
}
#line 1751 "vm.inc"
CHECK_STACK_OVERFLOW(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(onceinlinecache){
{
VALUE val;
IC ic = (IC)GET_OPERAND(2);
OFFSET dst = (OFFSET)GET_OPERAND(1);
DEBUG_ENTER_INSN("onceinlinecache");
ADD_PC(1+2);
PREFETCH(GET_PC());
#define CURRENT_INSN_onceinlinecache 1
#define INSN_IS_SC() 0
#define INSN_LABEL(lab) LABEL_onceinlinecache_##lab
#define LABEL_IS_SC(lab) LABEL_##lab##_##t
USAGE_ANALYSIS_INSN(BIN(onceinlinecache));
USAGE_ANALYSIS_OPERAND(BIN(onceinlinecache), 0, dst);
USAGE_ANALYSIS_OPERAND(BIN(onceinlinecache), 1, ic);
{
#line 1226 "insns.def"
retry:
if (ic->ic_vmstat) {
val = ic->ic_value.value;
JUMP(dst);
}
else if (ic->ic_value.value == Qundef)
{
RUBY_VM_CHECK_INTS();
rb_thread_schedule();
goto retry;
}
else {
/* none */
ic->ic_value.value = Qundef;
val = Qnil;
}
#line 1794 "vm.inc"
CHECK_STACK_OVERFLOW(REG_CFP, 1);
PUSH(val);
#undef CURRENT_INSN_onceinlinecache
#undef INSN_IS_SC
#undef INSN_LABEL
#undef LABEL_IS_SC
END_INSN(onceinlinecache);}}}
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
USAGE_ANALYSIS_INSN(BIN(setinlinecache));
USAGE_ANALYSIS_OPERAND(BIN(setinlinecache), 0, ic);
{
#line 1255 "insns.def"
if (ic->ic_value.value == Qundef) {
rb_ary_push(GET_ISEQ()->mark_ary, val);
}
ic->ic_value.value = val;
ic->ic_vmstat = GET_VM_STATE_VERSION() - ruby_vm_const_missing_count;
ruby_vm_const_missing_count = 0;
#line 1825 "vm.inc"
CHECK_STACK_OVERFLOW(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(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
USAGE_ANALYSIS_INSN(BIN(opt_case_dispatch));
USAGE_ANALYSIS_OPERAND(BIN(opt_case_dispatch), 0, hash);
USAGE_ANALYSIS_OPERAND(BIN(opt_case_dispatch), 1, else_offset);
{
#line 1274 "insns.def"
switch(TYPE(key)) {
case T_FLOAT: {
double ival;
if (modf(RFLOAT_VALUE(key), &ival) == 0.0) {
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)) {
st_data_t val;
if (st_lookup(RHASH_TBL(hash), key, &val)) {
JUMP(FIX2INT((VALUE)val));
}
else {
JUMP(else_offset);
}
break;
}
default:
break;
}
#line 1876 "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_checkenv){
{
DEBUG_ENTER_INSN("opt_checkenv");
ADD_PC(1+0);
PREFETCH(GET_PC());
#define CURRENT_INSN_opt_checkenv 1
#define INSN_IS_SC() 0
#define INSN_LABEL(lab) LABEL_opt_checkenv_##lab
#define LABEL_IS_SC(lab) LABEL_##lab##_##t
USAGE_ANALYSIS_INSN(BIN(opt_checkenv));
{
#line 1311 "insns.def"
if (GET_CFP()->bp != GET_DFP() + 1) {
VALUE *new_dfp = GET_CFP()->bp - 1;
/* TODO: copy env and clean stack at creating env? */
*new_dfp = *GET_DFP();
SET_DFP(new_dfp);
}
#line 1903 "vm.inc"
#undef CURRENT_INSN_opt_checkenv
#undef INSN_IS_SC
#undef INSN_LABEL
#undef LABEL_IS_SC
END_INSN(opt_checkenv);}}}
INSN_ENTRY(opt_plus){
{
VALUE val;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_plus));
USAGE_ANALYSIS_OPERAND(BIN(opt_plus), 0, ic);
{
#line 1333 "insns.def"
if (0) {
}
#if 1
else if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS)) {
/* 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
}
#endif
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
if (0) {
}
#if 1
else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
HEAP_CLASS_OF(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS)) {
val = DBL2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj));
}
#endif
#if 1
else if (HEAP_CLASS_OF(recv) == rb_cString &&
HEAP_CLASS_OF(obj) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS)) {
val = rb_str_plus(recv, obj);
}
#endif
#if 1
else if (HEAP_CLASS_OF(recv) == rb_cArray &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS)) {
val = rb_ary_plus(recv, obj);
}
#endif
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idPLUS, recv);
}
#line 1991 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_minus));
USAGE_ANALYSIS_OPERAND(BIN(opt_minus), 0, ic);
{
#line 1409 "insns.def"
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_MINUS)) {
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 (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
if (0) {
}
#if 1
else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
HEAP_CLASS_OF(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_MINUS)) {
val = DBL2NUM(RFLOAT_VALUE(recv) - RFLOAT_VALUE(obj));
}
#endif
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
/* other */
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idMINUS, recv);
}
#line 2054 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_mult));
USAGE_ANALYSIS_OPERAND(BIN(opt_mult), 0, ic);
{
#line 1458 "insns.def"
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_MULT)) {
long a, b;
a = FIX2LONG(recv);
if (a == 0) {
val = recv;
}
else {
volatile long c;
b = FIX2LONG(obj);
c = a * b;
if (FIXABLE(c) && c / a == b) {
val = LONG2FIX(c);
}
else {
val = rb_big_mul(rb_int2big(a), rb_int2big(b));
}
}
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
if (0) {
}
#if 1
else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
HEAP_CLASS_OF(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_MULT)) {
val = DBL2NUM(RFLOAT_VALUE(recv) * RFLOAT_VALUE(obj));
}
#endif
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idMULT, recv);
}
#line 2122 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_div));
USAGE_ANALYSIS_OPERAND(BIN(opt_div), 0, ic);
{
#line 1512 "insns.def"
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_DIV)) {
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 (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
if (0) {
}
#if 1
else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
HEAP_CLASS_OF(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_DIV)) {
val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj));
}
#endif
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idDIV, recv);
}
#line 2200 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_mod));
USAGE_ANALYSIS_OPERAND(BIN(opt_mod), 0, ic);
{
#line 1576 "insns.def"
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_MOD)) {
long x, y, mod;
x = FIX2LONG(recv);
y = FIX2LONG(obj);
{
/* copied from numeric.c#fixdivmod */
long div;
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 (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
if (0) {
}
else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
HEAP_CLASS_OF(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_MOD)) {
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(1, idMOD, recv);
}
#line 2277 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_eq));
USAGE_ANALYSIS_OPERAND(BIN(opt_eq), 0, ic);
{
#line 1639 "insns.def"
val = opt_eq_func(recv, obj, ic);
if (val == Qundef) {
/* other */
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idEq, recv);
}
#line 2312 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic_eq = (IC)GET_OPERAND(2);
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_neq));
USAGE_ANALYSIS_OPERAND(BIN(opt_neq), 0, ic);
USAGE_ANALYSIS_OPERAND(BIN(opt_neq), 1, ic_eq);
{
#line 1660 "insns.def"
extern VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2);
const rb_method_entry_t *me = vm_method_search(idNeq, CLASS_OF(recv), ic);
val = Qundef;
if (check_cfunc(me, rb_obj_not_equal)) {
val = opt_eq_func(recv, obj, ic_eq);
if (val != Qundef) {
val = RTEST(val) ? Qfalse : Qtrue;
}
}
if (val == Qundef) {
/* other */
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idNeq, recv);
}
#line 2359 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_lt));
USAGE_ANALYSIS_OPERAND(BIN(opt_lt), 0, ic);
{
#line 1691 "insns.def"
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_LT)) {
SIGNED_VALUE a = recv, b = obj;
if (a < b) {
val = Qtrue;
}
else {
val = Qfalse;
}
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
if (0) {
}
#if 1
else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
HEAP_CLASS_OF(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_LT)) {
double a = RFLOAT_VALUE(recv);
double b = RFLOAT_VALUE(obj);
#if defined(_MSC_VER) && _MSC_VER < 1300
if (isnan(a) || isnan(b)) val = Qfalse;
else
#endif
val = a < b ? Qtrue : Qfalse;
}
#endif
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idLT, recv);
}
#line 2423 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_le));
USAGE_ANALYSIS_OPERAND(BIN(opt_le), 0, ic);
{
#line 1741 "insns.def"
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_LE)) {
SIGNED_VALUE a = recv, b = obj;
if (a <= b) {
val = Qtrue;
}
else {
val = Qfalse;
}
}
else {
/* other */
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idLE, recv);
}
#line 2467 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_gt));
USAGE_ANALYSIS_OPERAND(BIN(opt_gt), 0, ic);
{
#line 1771 "insns.def"
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_GT)) {
SIGNED_VALUE a = recv, b = obj;
if (a > b) {
val = Qtrue;
}
else {
val = Qfalse;
}
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
if (0) {
}
#if 1
else if (HEAP_CLASS_OF(recv) == rb_cFloat &&
HEAP_CLASS_OF(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_GT)) {
double a = RFLOAT_VALUE(recv);
double b = RFLOAT_VALUE(obj);
#if defined(_MSC_VER) && _MSC_VER < 1300
if (isnan(a) || isnan(b)) val = Qfalse;
else
#endif
val = a > b ? Qtrue : Qfalse;
}
#endif
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idGT, recv);
}
#line 2531 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_ge));
USAGE_ANALYSIS_OPERAND(BIN(opt_ge), 0, ic);
{
#line 1821 "insns.def"
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_GE)) {
SIGNED_VALUE a = recv, b = obj;
if (a >= b) {
val = Qtrue;
}
else {
val = Qfalse;
}
}
else {
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idGE, recv);
}
#line 2574 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_ltlt));
USAGE_ANALYSIS_OPERAND(BIN(opt_ltlt), 0, ic);
{
#line 1850 "insns.def"
if (!SPECIAL_CONST_P(recv)) {
if (0) {
}
else if (HEAP_CLASS_OF(recv) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_LTLT)) {
val = rb_str_concat(recv, obj);
}
else if (HEAP_CLASS_OF(recv) == rb_cArray &&
BASIC_OP_UNREDEFINED_P(BOP_LTLT)) {
val = rb_ary_push(recv, obj);
}
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idLTLT, recv);
}
#line 2622 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_aref));
USAGE_ANALYSIS_OPERAND(BIN(opt_aref), 0, ic);
{
#line 1884 "insns.def"
if (!SPECIAL_CONST_P(recv) && BASIC_OP_UNREDEFINED_P(BOP_AREF)) {
if (HEAP_CLASS_OF(recv) == rb_cArray && FIXNUM_P(obj)) {
val = rb_ary_entry(recv, FIX2LONG(obj));
}
else if (HEAP_CLASS_OF(recv) == rb_cHash) {
val = rb_hash_aref(recv, obj);
}
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
PUSH(obj);
CALL_SIMPLE_METHOD(1, idAREF, recv);
}
#line 2666 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_aset));
USAGE_ANALYSIS_OPERAND(BIN(opt_aset), 0, ic);
{
#line 1914 "insns.def"
if (!SPECIAL_CONST_P(recv) &&
BASIC_OP_UNREDEFINED_P(BOP_ASET)) {
if (HEAP_CLASS_OF(recv) == rb_cArray && FIXNUM_P(obj)) {
rb_ary_store(recv, FIX2LONG(obj), set);
val = set;
}
else if (HEAP_CLASS_OF(recv) == rb_cHash) {
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(2, idASET, recv);
}
#line 2715 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_length));
USAGE_ANALYSIS_OPERAND(BIN(opt_length), 0, ic);
{
#line 1948 "insns.def"
if (LIKELY(!SPECIAL_CONST_P(recv) &&
BASIC_OP_UNREDEFINED_P(BOP_LENGTH))) {
if (HEAP_CLASS_OF(recv) == rb_cString) {
val = rb_str_length(recv);
}
else if (HEAP_CLASS_OF(recv) == rb_cArray) {
val = LONG2NUM(RARRAY_LEN(recv));
}
else if (HEAP_CLASS_OF(recv) == rb_cHash) {
val = INT2FIX(RHASH_SIZE(recv));
}
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
CALL_SIMPLE_METHOD(0, idLength, recv);
}
#line 2761 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_size));
USAGE_ANALYSIS_OPERAND(BIN(opt_size), 0, ic);
{
#line 1981 "insns.def"
if (LIKELY(BASIC_OP_UNREDEFINED_P(BOP_SIZE) &&
!SPECIAL_CONST_P(recv))) {
if (HEAP_CLASS_OF(recv) == rb_cString) {
val = rb_str_length(recv);
}
else if (HEAP_CLASS_OF(recv) == rb_cArray) {
val = LONG2NUM(RARRAY_LEN(recv));
}
else if (HEAP_CLASS_OF(recv) == rb_cHash) {
val = INT2FIX(RHASH_SIZE(recv));
}
else {
goto INSN_LABEL(normal_dispatch);
}
}
else {
INSN_LABEL(normal_dispatch):
PUSH(recv);
CALL_SIMPLE_METHOD(0, idSize, recv);
}
#line 2807 "vm.inc"
CHECK_STACK_OVERFLOW(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_succ){
{
VALUE val;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_succ));
USAGE_ANALYSIS_OPERAND(BIN(opt_succ), 0, ic);
{
#line 2014 "insns.def"
if (SPECIAL_CONST_P(recv)) {
if (FIXNUM_P(recv) &&
BASIC_OP_UNREDEFINED_P(BOP_SUCC)) {
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 (HEAP_CLASS_OF(recv) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_SUCC)) {
val = rb_str_succ(recv);
}
else if (HEAP_CLASS_OF(recv) == rb_cTime &&
BASIC_OP_UNREDEFINED_P(BOP_SUCC)) {
val = rb_time_succ(recv);
}
else
{
goto INSN_LABEL(normal_dispatch);
}
}
if (0) {
INSN_LABEL(normal_dispatch):
PUSH(recv);
CALL_SIMPLE_METHOD(0, idSucc, recv);
}
#line 2867 "vm.inc"
CHECK_STACK_OVERFLOW(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;
IC ic = (IC)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
USAGE_ANALYSIS_INSN(BIN(opt_not));
USAGE_ANALYSIS_OPERAND(BIN(opt_not), 0, ic);
{
#line 2061 "insns.def"
extern VALUE rb_obj_not(VALUE obj);
const rb_method_entry_t *me = vm_method_search(idNot, CLASS_OF(recv), ic);
if (check_cfunc(me, rb_obj_not)) {
val = RTEST(recv) ? Qfalse : Qtrue;
}
else {
PUSH(recv);
CALL_SIMPLE_METHOD(0, idNot, recv);
}
#line 2903 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(opt_regexpmatch1));
USAGE_ANALYSIS_OPERAND(BIN(opt_regexpmatch1), 0, r);
{
#line 2085 "insns.def"
val = rb_reg_match(r, obj);
#line 2930 "vm.inc"
CHECK_STACK_OVERFLOW(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;
VALUE obj2 = TOPN(1);
VALUE obj1 = TOPN(0);
DEBUG_ENTER_INSN("opt_regexpmatch2");
ADD_PC(1+0);
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
USAGE_ANALYSIS_INSN(BIN(opt_regexpmatch2));
{
#line 2099 "insns.def"
if (TYPE(obj2) == T_STRING) {
val = rb_reg_match(obj1, obj2);
}
else {
val = rb_funcall(obj2, idEqTilde, 1, obj1);
}
#line 2962 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(opt_call_c_function));
USAGE_ANALYSIS_OPERAND(BIN(opt_call_c_function), 0, funcptr);
{
#line 2118 "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 2996 "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
USAGE_ANALYSIS_INSN(BIN(bitblt));
{
#line 2141 "insns.def"
ret = rb_str_new2("a bit of bacon, lettuce and tomato");
#line 3019 "vm.inc"
CHECK_STACK_OVERFLOW(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
USAGE_ANALYSIS_INSN(BIN(answer));
{
#line 2155 "insns.def"
ret = INT2FIX(42);
#line 3044 "vm.inc"
CHECK_STACK_OVERFLOW(REG_CFP, 1);
PUSH(ret);
#undef CURRENT_INSN_answer
#undef INSN_IS_SC
#undef INSN_LABEL
#undef LABEL_IS_SC
END_INSN(answer);}}}