Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Macros | Enumerations | Functions | Variables
vm_insnhelper.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros
#define | VMDEBUG 0
| VM Debug Level. More...
#define | COLLECT_USAGE_INSN(insn) /* none */
#define | COLLECT_USAGE_OPERAND(insn, n, op) /* none */
#define | COLLECT_USAGE_REGISTER(reg, s) /* none */
#define | PUSH(x) (SET_SV(x), INC_SP(1))
#define | TOPN(n) (*(GET_SP()-(n)-1))
#define | POPN(n) (DEC_SP(n))
#define | POP() (DEC_SP(1))
#define | STACK_ADDR_FROM_TOP(n) (GET_SP()-(n))
#define | GET_TOS() (tos) /* dummy */
#define | REG_CFP (reg_cfp)
#define | REG_PC (REG_CFP->pc)
#define | REG_SP (REG_CFP->sp)
#define | REG_EP (REG_CFP->ep)
#define | RESTORE_REGS()
#define | REG_A reg_a
#define | REG_B reg_b
#define | COLLECT_USAGE_REGISTER_HELPER(a, b, v) (v)
#define | GET_PC() (COLLECT_USAGE_REGISTER_HELPER(PC, GET, REG_PC))
#define | SET_PC(x) (REG_PC = (COLLECT_USAGE_REGISTER_HELPER(PC, SET, (x))))
#define | GET_CURRENT_INSN() (*GET_PC())
#define | GET_OPERAND(n) (GET_PC()[(n)])
#define | ADD_PC(n) (SET_PC(REG_PC + (n)))
#define | GET_PC_COUNT() (REG_PC - GET_ISEQ()->iseq_encoded)
#define | JUMP(dst) (REG_PC += (dst))
#define | GET_CFP() (COLLECT_USAGE_REGISTER_HELPER(CFP, GET, REG_CFP))
#define | GET_EP() (COLLECT_USAGE_REGISTER_HELPER(EP, GET, REG_EP))
#define | SET_EP(x) (REG_EP = (COLLECT_USAGE_REGISTER_HELPER(EP, SET, (x))))
#define | GET_LEP() (VM_EP_LEP(GET_EP()))
#define | GET_SP() (COLLECT_USAGE_REGISTER_HELPER(SP, GET, REG_SP))
#define | SET_SP(x) (REG_SP = (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
#define | INC_SP(x) (REG_SP += (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
#define | DEC_SP(x) (REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
#define | SET_SV(x) (*GET_SP() = (x))
#define | GET_SP_COUNT() (REG_SP - th->stack)
#define | GET_ISEQ() (GET_CFP()->iseq)
#define | GET_PREV_EP(ep) ((VALUE *)((ep)[0] & ~0x03))
#define | GET_GLOBAL(entry) rb_gvar_get((struct rb_global_entry*)(entry))
#define | SET_GLOBAL(entry, val) rb_gvar_set((struct rb_global_entry*)(entry), (val))
#define | GET_CONST_INLINE_CACHE(dst) ((IC) * (GET_PC() + (dst) + 2))
#define | GET_SELF() (COLLECT_USAGE_REGISTER_HELPER(SELF, GET, GET_CFP()->self))
#define | COPY_CREF_OMOD(c1, c2)
#define | COPY_CREF(c1, c2)
#define | CALL_METHOD(ci)
#define | OPT_CALL_FASTPATH 1
#define | CI_SET_FASTPATH(ci, func, enabled)
#define | GET_BLOCK_PTR() ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LEP()[0])))
#define | FIXNUM_REDEFINED_OP_FLAG (1 << 0)
#define | FLOAT_REDEFINED_OP_FLAG (1 << 1)
#define | STRING_REDEFINED_OP_FLAG (1 << 2)
#define | ARRAY_REDEFINED_OP_FLAG (1 << 3)
#define | HASH_REDEFINED_OP_FLAG (1 << 4)
#define | BIGNUM_REDEFINED_OP_FLAG (1 << 5)
#define | SYMBOL_REDEFINED_OP_FLAG (1 << 6)
#define | TIME_REDEFINED_OP_FLAG (1 << 7)
#define | BASIC_OP_UNREDEFINED_P(op, klass) (LIKELY((ruby_vm_redefined_flag[(op)]&(klass)) == 0))
#define | FIXNUM_2_P(a, b) ((a) & (b) & 1)
#define | FLONUM_2_P(a, b) 0
#define | HEAP_CLASS_OF(obj) (RBASIC(obj)->klass)
#define | USE_IC_FOR_SPECIALIZED_METHOD 1
#define | CALL_SIMPLE_METHOD(recv)
#define | GET_VM_STATE_VERSION() (ruby_vm_global_state_version)
#define | INC_VM_STATE_VERSION()

## Enumerations
enum | { BOP_PLUS, BOP_MINUS, BOP_MULT, BOP_DIV, BOP_MOD, BOP_EQ, BOP_EQQ, BOP_LT, BOP_LE, BOP_LTLT, BOP_AREF, BOP_ASET, BOP_LENGTH, BOP_SIZE, BOP_EMPTY_P, BOP_SUCC, BOP_GT, BOP_GE, BOP_NOT, BOP_NEQ, BOP_LAST_ }
enum | vm_regan_regtype { VM_REGAN_PC = 0, VM_REGAN_SP = 1, VM_REGAN_EP = 2, VM_REGAN_CFP = 3, VM_REGAN_SELF = 4, VM_REGAN_ISEQ = 5 }
enum | vm_regan_acttype { VM_REGAN_ACT_GET = 0, VM_REGAN_ACT_SET = 1 }

## Functions
static void | vm_clear_all_cache (void)
static VALUE | make_no_method_exception (VALUE exc, const char *format, VALUE obj, int argc, const VALUE *argv)

## Variables
char | ruby_vm_redefined_flag [BOP_LAST_]
VALUE | ruby_vm_const_missing_count
static VALUE | ruby_vm_global_state_version = 1

## Macro Definition Documentation

#define ADD_PC | ( |  | n | ) | (SET_PC(REG_PC + (n)))

Definition at line 129 of file vm_insnhelper.h.

#define ARRAY_REDEFINED_OP_FLAG (1 << 3)

Definition at line 235 of file vm_insnhelper.h.

Referenced by vm_redefinition_check_flag().

#define BASIC_OP_UNREDEFINED_P | ( |  | op,
|  |  | klass
| ) |  | (LIKELY((ruby_vm_redefined_flag[(op)]&(klass)) == 0))

Definition at line 241 of file vm_insnhelper.h.

Referenced by opt_eq_func().

#define BIGNUM_REDEFINED_OP_FLAG (1 << 5)

Definition at line 237 of file vm_insnhelper.h.

Referenced by vm_redefinition_check_flag().

#define CALL_METHOD | ( |  | ci | ) |

Value:
do { \
VALUE v = (*(ci)->call)(th, GET_CFP(), (ci)); \
if (v == Qundef) { \
RESTORE_REGS(); \
NEXT_INSN(); \
} \
else { \
val = v; \
} \
} while (0)
RESTORE_REGS
#define RESTORE_REGS()
Definition: vm_insnhelper.h:97
th
static VALUE VALUE th
Definition: tcltklib.c:2948
NEXT_INSN
#define NEXT_INSN()
Definition: vm_exec.h:156
GET_CFP
#define GET_CFP()
Definition: vm_insnhelper.h:135
val
#define val
Definition: tcltklib.c:1949
else
else
Definition: bigdecimal.c:1192
Qundef
#define Qundef
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
VALUE
unsigned long VALUE
Definition: ripper.y:104
v
BDIGIT v
Definition: bigdecimal.c:5656

Definition at line 193 of file vm_insnhelper.h.

#define CALL_SIMPLE_METHOD | ( |  | recv | ) |

Value:
do { \
ci->blockptr = 0; ci->argc = ci->orig_argc; \
vm_search_method(ci, ci->recv = (recv)); \
CALL_METHOD(ci); \
} while (0)
CALL_METHOD
#define CALL_METHOD(ci)
Definition: vm_insnhelper.h:193
vm_search_method
static void vm_search_method(rb_call_info_t *ci, VALUE recv)
Definition: vm_insnhelper.c:843

Definition at line 255 of file vm_insnhelper.h.

#define CI_SET_FASTPATH | ( |  | ci,
|  |  | func,
|  |  | enabled
| ) |  |

Value:
do { \
if (LIKELY(enabled)) ((ci)->call = (func)); \
} while (0)
func
SSL_METHOD *(* func)(void)
Definition: ossl_ssl.c:108
LIKELY
#define LIKELY(x)
Definition: vm_core.h:114
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186

Definition at line 213 of file vm_insnhelper.h.

Referenced by vm_call_method().

#define COLLECT_USAGE_INSN | ( |  | insn | ) | /* none */

Definition at line 71 of file vm_insnhelper.h.

#define COLLECT_USAGE_OPERAND | ( |  | insn,
|  |  | n,
|  |  | op
| ) |  | /* none */

Definition at line 72 of file vm_insnhelper.h.

#define COLLECT_USAGE_REGISTER | ( |  | reg,
|  |  | s
| ) |  | /* none */

Definition at line 73 of file vm_insnhelper.h.

#define COLLECT_USAGE_REGISTER_HELPER | ( |  | a,
|  |  | b,
|  |  | v
| ) |  | (v)

Definition at line 121 of file vm_insnhelper.h.

#define COPY_CREF | ( |  | c1,
|  |  | c2
| ) |  |

Value:
do { \
NODE *__tmp_c2 = (c2); \
COPY_CREF_OMOD(c1, __tmp_c2); \
(c1)->nd_clss = __tmp_c2->nd_clss; \
(c1)->nd_visi = __tmp_c2->nd_visi;\
(c1)->nd_next = __tmp_c2->nd_next; \
if (__tmp_c2->flags & NODE_FL_CREF_PUSHED_BY_EVAL) { \
(c1)->flags |= NODE_FL_CREF_PUSHED_BY_EVAL; \
} \
} while (0)
nd_next
#define nd_next
flags
int flags
Definition: tcltklib.c:3023
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
NODE
struct RNode NODE
nd_clss
#define nd_clss
NODE_FL_CREF_PUSHED_BY_EVAL
#define NODE_FL_CREF_PUSHED_BY_EVAL
COPY_CREF_OMOD
#define COPY_CREF_OMOD(c1, c2)
Definition: vm_insnhelper.h:174

Definition at line 182 of file vm_insnhelper.h.

Referenced by vm_define_method().

#define COPY_CREF_OMOD | ( |  | c1,
|  |  | c2
| ) |  |

Value:
do { \
(c1)->nd_refinements = (c2)->nd_refinements; \
if (!NIL_P((c2)->nd_refinements)) { \
(c1)->flags |= NODE_FL_CREF_OMOD_SHARED; \
(c2)->flags |= NODE_FL_CREF_OMOD_SHARED; \
} \
} while (0)
NIL_P
NIL_P(eventloop_thread)
Definition: tcltklib.c:4068
nd_refinements
#define nd_refinements
NODE_FL_CREF_OMOD_SHARED
#define NODE_FL_CREF_OMOD_SHARED
flags
int flags
Definition: tcltklib.c:3023
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186

Definition at line 174 of file vm_insnhelper.h.

Referenced by vm_cref_push().

#define DEC_SP | ( |  | x | ) | (REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))

Definition at line 144 of file vm_insnhelper.h.

Referenced by vm_call_opt_send().

#define FIXNUM_2_P | ( |  | a,
|  |  | b
| ) |  | ((a) & (b) & 1)

Definition at line 243 of file vm_insnhelper.h.

Referenced by opt_eq_func().

#define FIXNUM_REDEFINED_OP_FLAG (1 << 0)

Definition at line 232 of file vm_insnhelper.h.

Referenced by opt_eq_func(), and vm_redefinition_check_flag().

#define FLOAT_REDEFINED_OP_FLAG (1 << 1)

Definition at line 233 of file vm_insnhelper.h.

Referenced by opt_eq_func(), and vm_redefinition_check_flag().

#define FLONUM_2_P | ( |  | a,
|  |  | b
| ) |  | 0

Definition at line 247 of file vm_insnhelper.h.

Referenced by opt_eq_func().

#define GET_BLOCK_PTR | ( |  | ) | ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LEP()[0])))

Definition at line 220 of file vm_insnhelper.h.

#define GET_CFP | ( |  | ) | (COLLECT_USAGE_REGISTER_HELPER(CFP, GET, REG_CFP))

Definition at line 135 of file vm_insnhelper.h.

Referenced by vm_invoke_block(), vm_search_super_method(), vm_search_superclass(), and vm_throw().

#define GET_CONST_INLINE_CACHE | ( |  | dst | ) | ((IC) * (GET_PC() + (dst) + 2))

Definition at line 162 of file vm_insnhelper.h.

#define GET_CURRENT_INSN | ( |  | ) | (*GET_PC())

Definition at line 127 of file vm_insnhelper.h.

#define GET_EP | ( |  | ) | (COLLECT_USAGE_REGISTER_HELPER(EP, GET, REG_EP))

Definition at line 136 of file vm_insnhelper.h.

Referenced by vm_throw().

#define GET_GLOBAL | ( |  | entry | ) | rb_gvar_get((struct rb_global_entry*)(entry))

Definition at line 159 of file vm_insnhelper.h.

#define GET_ISEQ | ( |  | ) | (GET_CFP()->iseq)

Definition at line 151 of file vm_insnhelper.h.

Referenced by vm_invoke_block(), vm_search_super_method(), and vm_throw().

#define GET_LEP | ( |  | ) | (VM_EP_LEP(GET_EP()))

Definition at line 138 of file vm_insnhelper.h.

#define GET_OPERAND | ( |  | n | ) | (GET_PC()[(n)])

Definition at line 128 of file vm_insnhelper.h.

#define GET_PC | ( |  | ) | (COLLECT_USAGE_REGISTER_HELPER(PC, GET, REG_PC))

Definition at line 125 of file vm_insnhelper.h.

#define GET_PC_COUNT | ( |  | ) | (REG_PC - GET_ISEQ()->iseq_encoded)

Definition at line 131 of file vm_insnhelper.h.

#define GET_PREV_EP | ( |  | ep | ) | ((VALUE *)((ep)[0] & ~0x03))

Definition at line 157 of file vm_insnhelper.h.

#define GET_SELF | ( |  | ) | (COLLECT_USAGE_REGISTER_HELPER(SELF, GET, GET_CFP()->self))

Definition at line 168 of file vm_insnhelper.h.

#define GET_SP | ( |  | ) | (COLLECT_USAGE_REGISTER_HELPER(SP, GET, REG_SP))

Definition at line 141 of file vm_insnhelper.h.

Referenced by vm_invoke_block().

#define GET_SP_COUNT | ( |  | ) | (REG_SP - th->stack)

Definition at line 148 of file vm_insnhelper.h.

#define GET_TOS | ( |  | ) | (tos) /* dummy */

Definition at line 86 of file vm_insnhelper.h.

#define GET_VM_STATE_VERSION | ( |  | ) | (ruby_vm_global_state_version)

Definition at line 263 of file vm_insnhelper.h.

Referenced by rb_method_entry(), rb_method_entry_get_without_cache(), vm_getivar(), vm_search_method(), and vm_setivar().

#define HASH_REDEFINED_OP_FLAG (1 << 4)

Definition at line 236 of file vm_insnhelper.h.

Referenced by vm_redefinition_check_flag().

#define HEAP_CLASS_OF | ( |  | obj | ) | (RBASIC(obj)->klass)

Definition at line 249 of file vm_insnhelper.h.

Referenced by opt_eq_func().

#define INC_SP | ( |  | x | ) | (REG_SP += (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))

Definition at line 143 of file vm_insnhelper.h.

Referenced by vm_call_method_missing().

#define INC_VM_STATE_VERSION | ( |  | ) |

Value:
do { \
ruby_vm_global_state_version = (ruby_vm_global_state_version + 1); \
if (ruby_vm_global_state_version == 0) vm_clear_all_cache(); \
} while (0)
ruby_vm_global_state_version
static VALUE ruby_vm_global_state_version
Definition: vm_insnhelper.h:261
while
while(a->frac[0]/shift==0)
Definition: bigdecimal.c:5117
vm_clear_all_cache
static void vm_clear_all_cache(void)
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186

Definition at line 264 of file vm_insnhelper.h.

Referenced by m_core_undef_method(), rb_vm_change_state(), and vm_define_method().

#define JUMP | ( |  | dst | ) | (REG_PC += (dst))

Definition at line 132 of file vm_insnhelper.h.

#define OPT_CALL_FASTPATH 1

Definition at line 209 of file vm_insnhelper.h.

#define POP | ( |  | ) | (DEC_SP(1))

Definition at line 83 of file vm_insnhelper.h.

#define POPN | ( |  | n | ) | (DEC_SP(n))

Definition at line 82 of file vm_insnhelper.h.

Referenced by vm_invoke_block().

#define PUSH | ( |  | x | ) | (SET_SV(x), INC_SP(1))

Definition at line 80 of file vm_insnhelper.h.

#define REG_A reg_a

Definition at line 101 of file vm_insnhelper.h.

#define REG_B reg_b

Definition at line 102 of file vm_insnhelper.h.

#define REG_CFP (reg_cfp)

Definition at line 92 of file vm_insnhelper.h.

#define REG_EP (REG_CFP->ep)

Definition at line 95 of file vm_insnhelper.h.

#define REG_PC (REG_CFP->pc)

Definition at line 93 of file vm_insnhelper.h.

#define REG_SP (REG_CFP->sp)

Definition at line 94 of file vm_insnhelper.h.

#define RESTORE_REGS | ( |  | ) |

Value:
do { \
REG_CFP = th->cfp; \
} while (0)
th
static VALUE VALUE th
Definition: tcltklib.c:2948
REG_CFP
#define REG_CFP
Definition: vm_insnhelper.h:92

Definition at line 97 of file vm_insnhelper.h.

#define SET_EP | ( |  | x | ) | (REG_EP = (COLLECT_USAGE_REGISTER_HELPER(EP, SET, (x))))

Definition at line 137 of file vm_insnhelper.h.

#define SET_GLOBAL | ( |  | entry,
|  |  | val
| ) |  | rb_gvar_set((struct rb_global_entry*)(entry), (val))

Definition at line 160 of file vm_insnhelper.h.

#define SET_PC | ( |  | x | ) | (REG_PC = (COLLECT_USAGE_REGISTER_HELPER(PC, SET, (x))))

Definition at line 126 of file vm_insnhelper.h.

#define SET_SP | ( |  | x | ) | (REG_SP = (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))

Definition at line 142 of file vm_insnhelper.h.

Referenced by vm_invoke_block().

#define SET_SV | ( |  | x | ) | (*GET_SP() = (x))

Definition at line 145 of file vm_insnhelper.h.

#define STACK_ADDR_FROM_TOP | ( |  | n | ) | (GET_SP()-(n))

Definition at line 84 of file vm_insnhelper.h.

Referenced by vm_call_method(), vm_call_method_missing(), and vm_invoke_block().

#define STRING_REDEFINED_OP_FLAG (1 << 2)

Definition at line 234 of file vm_insnhelper.h.

Referenced by opt_eq_func(), and vm_redefinition_check_flag().

#define SYMBOL_REDEFINED_OP_FLAG (1 << 6)

Definition at line 238 of file vm_insnhelper.h.

Referenced by vm_redefinition_check_flag().

#define TIME_REDEFINED_OP_FLAG (1 << 7)

Definition at line 239 of file vm_insnhelper.h.

Referenced by vm_redefinition_check_flag().

#define TOPN | ( |  | n | ) | (*(GET_SP()-(n)-1))

Definition at line 81 of file vm_insnhelper.h.

Referenced by vm_call_opt_send(), and vm_search_super_method().

#define USE_IC_FOR_SPECIALIZED_METHOD 1

Definition at line 252 of file vm_insnhelper.h.

#define VMDEBUG 0

VM Debug Level.

debug level: 0: no debug output 1: show instruction name 2: show stack frame when control stack frame is changed 3: show stack status 4: show register 5: 10: gc check

Definition at line 29 of file vm_insnhelper.h.

## Enumeration Type Documentation

anonymous enum

Enumerator
BOP_PLUS |
BOP_MINUS |
BOP_MULT |
BOP_DIV |
BOP_MOD |
BOP_EQ |
BOP_EQQ |
BOP_LT |
BOP_LE |
BOP_LTLT |
BOP_AREF |
BOP_ASET |
BOP_LENGTH |
BOP_SIZE |
BOP_EMPTY_P |
BOP_SUCC |
BOP_GT |
BOP_GE |
BOP_NOT |
BOP_NEQ |
BOP_LAST_ |

Definition at line 37 of file vm_insnhelper.h.

enum vm_regan_acttype

Enumerator
VM_REGAN_ACT_GET |
VM_REGAN_ACT_SET |

Definition at line 112 of file vm_insnhelper.h.

enum vm_regan_regtype

Enumerator
VM_REGAN_PC |
VM_REGAN_SP |
VM_REGAN_EP |
VM_REGAN_CFP |
VM_REGAN_SELF |
VM_REGAN_ISEQ |

Definition at line 104 of file vm_insnhelper.h.

## Function Documentation

static VALUE make_no_method_exception | ( | VALUE | exc,
|  | const char * | format,
|  | VALUE | obj,
|  | int | argc,
|  | const VALUE * | argv
| ) |  |
| static

static void vm_clear_all_cache | ( | void |  | ) |
| static

## Variable Documentation

VALUE ruby_vm_const_missing_count

Definition at line 94 of file vm.c.

Referenced by rb_vm_inc_const_missing_count().

VALUE ruby_vm_global_state_version = 1
| static

Definition at line 261 of file vm_insnhelper.h.

Referenced by vm_clear_all_cache().

char ruby_vm_redefined_flag[BOP_LAST_]

Definition at line 95 of file vm.c.

Referenced by rb_vm_check_redefinition_opt_method().