Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Enumerations | 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.

## Defines
#define | VMDEBUG 0
| VM Debug Level.
#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)
#define | REG_CFP (reg_cfp)
#define | REG_PC (REG_CFP->pc)
#define | REG_SP (REG_CFP->sp)
#define | REG_LFP (REG_CFP->lfp)
#define | REG_DFP (REG_CFP->dfp)
#define | RESTORE_REGS()
#define | REG_A reg_a
#define | REG_B reg_b
#define | USAGE_ANALYSIS_REGISTER_HELPER(a, b, v) (v)
#define | GET_PC() (USAGE_ANALYSIS_REGISTER_HELPER(0, 0, REG_PC))
#define | SET_PC(x) (REG_PC = (USAGE_ANALYSIS_REGISTER_HELPER(0, 1, 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() (USAGE_ANALYSIS_REGISTER_HELPER(2, 0, REG_CFP))
#define | GET_LFP() (USAGE_ANALYSIS_REGISTER_HELPER(3, 0, REG_LFP))
#define | SET_LFP(x) (REG_LFP = (USAGE_ANALYSIS_REGISTER_HELPER(3, 1, (x))))
#define | GET_DFP() (USAGE_ANALYSIS_REGISTER_HELPER(4, 0, REG_DFP))
#define | SET_DFP(x) (REG_DFP = (USAGE_ANALYSIS_REGISTER_HELPER(4, 1, (x))))
#define | GET_SP() (USAGE_ANALYSIS_REGISTER_HELPER(1, 0, REG_SP))
#define | SET_SP(x) (REG_SP = (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x))))
#define | INC_SP(x) (REG_SP += (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x))))
#define | DEC_SP(x) (REG_SP -= (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (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_DFP(dfp) ((VALUE *)((dfp)[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() (USAGE_ANALYSIS_REGISTER_HELPER(5, 0, GET_CFP()->self))
#define | COPY_CREF(c1, c2)
#define | CALL_METHOD(num, blockptr, flag, id, me, recv)
#define | GET_BLOCK_PTR()
#define | FIXNUM_2_P(a, b) ((a) & (b) & 1)
#define | BASIC_OP_UNREDEFINED_P(op) (LIKELY(ruby_vm_redefined_flag[op] == 0))
#define | HEAP_CLASS_OF(obj) RBASIC(obj)->klass
#define | USE_IC_FOR_SPECIALIZED_METHOD 1
#define | CALL_SIMPLE_METHOD(num, id, recv)
## 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_SUCC, BOP_GT, BOP_GE, BOP_NOT, BOP_NEQ, BOP_LAST_ }
## Variables
char | ruby_vm_redefined_flag [BOP_LAST_]
VALUE | ruby_vm_const_missing_count

## Define Documentation

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

Definition at line 106 of file vm_insnhelper.h.

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

Definition at line 185 of file vm_insnhelper.h.

Referenced by opt_eq_func().

#define CALL_METHOD | ( |  | num,
|  |  | blockptr,
|  |  | flag,
|  |  | id,
|  |  | me,
|  |  | recv
| ) |  |

Value:

    do { \
        VALUE v = vm_call_method(th, GET_CFP(), num, blockptr, flag, id, me, recv); \
        if (v == Qundef) { \
            RESTORE_REGS(); \
            NEXT_INSN(); \
        } \
        else { \
            val = v; \
        } \
    } while (0)

Definition at line 159 of file vm_insnhelper.h.

#define CALL_SIMPLE_METHOD | ( |  | num,
|  |  | id,
|  |  | recv
| ) |  |

Value:

    do { \
        VALUE klass = CLASS_OF(recv); \
        CALL_METHOD(num, 0, 0, id, vm_method_search(id, klass, ic), recv); \
    } while (0)

Definition at line 194 of file vm_insnhelper.h.

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

Value:

    do {  \
      NODE *__tmp_c2 = (c2); \
      c1->nd_clss = __tmp_c2->nd_clss; \
      c1->nd_visi = __tmp_c2->nd_visi;\
      c1->nd_next = __tmp_c2->nd_next; \
    } while (0)

Definition at line 152 of file vm_insnhelper.h.

Referenced by vm_define_method().

#define DEC_SP | ( |  | x | ) | (REG_SP -= (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x))))

Definition at line 122 of file vm_insnhelper.h.

Referenced by vm_call_method().

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

Definition at line 184 of file vm_insnhelper.h.

Referenced by opt_eq_func().

#define GET_BLOCK_PTR | ( |  | ) |

Value:

    ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LFP()[0] & \
                                         ((GET_LFP()[0] & 0x02) - 0x02))))

Definition at line 170 of file vm_insnhelper.h.

Referenced by vm_invoke_block().

#define GET_CFP | ( |  | ) | (USAGE_ANALYSIS_REGISTER_HELPER(2, 0, REG_CFP))

Definition at line 112 of file vm_insnhelper.h.

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

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

Definition at line 140 of file vm_insnhelper.h.

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

Definition at line 104 of file vm_insnhelper.h.

#define GET_DFP | ( |  | ) | (USAGE_ANALYSIS_REGISTER_HELPER(4, 0, REG_DFP))

Definition at line 115 of file vm_insnhelper.h.

Referenced by vm_throw().

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

Definition at line 137 of file vm_insnhelper.h.

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

Definition at line 129 of file vm_insnhelper.h.

Referenced by vm_invoke_block(), and vm_throw().

#define GET_LFP | ( |  | ) | (USAGE_ANALYSIS_REGISTER_HELPER(3, 0, REG_LFP))

Definition at line 113 of file vm_insnhelper.h.

Referenced by vm_throw().

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

Definition at line 105 of file vm_insnhelper.h.

#define GET_PC | ( |  | ) | (USAGE_ANALYSIS_REGISTER_HELPER(0, 0, REG_PC))

Definition at line 102 of file vm_insnhelper.h.

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

Definition at line 108 of file vm_insnhelper.h.

#define GET_PREV_DFP | ( |  | dfp | ) | ((VALUE *)((dfp)[0] & ~0x03))

Definition at line 135 of file vm_insnhelper.h.

Referenced by vm_get_cref0(), and vm_search_superclass().

#define GET_SELF | ( |  | ) | (USAGE_ANALYSIS_REGISTER_HELPER(5, 0, GET_CFP()->self))

Definition at line 146 of file vm_insnhelper.h.

#define GET_SP | ( |  | ) | (USAGE_ANALYSIS_REGISTER_HELPER(1, 0, REG_SP))

Definition at line 119 of file vm_insnhelper.h.

Referenced by vm_invoke_block().

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

Definition at line 126 of file vm_insnhelper.h.

#define GET_TOS | ( |  | ) | (tos)

Definition at line 75 of file vm_insnhelper.h.

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

Definition at line 186 of file vm_insnhelper.h.

Referenced by opt_eq_func().

#define INC_SP | ( |  | x | ) | (REG_SP += (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x))))

Definition at line 121 of file vm_insnhelper.h.

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

Definition at line 109 of file vm_insnhelper.h.

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

Definition at line 72 of file vm_insnhelper.h.

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

Definition at line 71 of file vm_insnhelper.h.

Referenced by vm_invoke_block(), and vm_method_missing_args().

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

Definition at line 69 of file vm_insnhelper.h.

#define REG_A reg_a

Definition at line 91 of file vm_insnhelper.h.

#define REG_B reg_b

Definition at line 92 of file vm_insnhelper.h.

#define REG_CFP (reg_cfp)

Definition at line 81 of file vm_insnhelper.h.

#define REG_DFP (REG_CFP->dfp)

Definition at line 85 of file vm_insnhelper.h.

#define REG_LFP (REG_CFP->lfp)

Definition at line 84 of file vm_insnhelper.h.

#define REG_PC (REG_CFP->pc)

Definition at line 82 of file vm_insnhelper.h.

#define REG_SP (REG_CFP->sp)

Definition at line 83 of file vm_insnhelper.h.

#define RESTORE_REGS | ( |  | ) |

Value:

    do { \
      REG_CFP = th->cfp; \
    } while (0)

Definition at line 87 of file vm_insnhelper.h.

#define SET_DFP | ( |  | x | ) | (REG_DFP = (USAGE_ANALYSIS_REGISTER_HELPER(4, 1, (x))))

Definition at line 116 of file vm_insnhelper.h.

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

Definition at line 138 of file vm_insnhelper.h.

#define SET_LFP | ( |  | x | ) | (REG_LFP = (USAGE_ANALYSIS_REGISTER_HELPER(3, 1, (x))))

Definition at line 114 of file vm_insnhelper.h.

#define SET_PC | ( |  | x | ) | (REG_PC = (USAGE_ANALYSIS_REGISTER_HELPER(0, 1, x)))

Definition at line 103 of file vm_insnhelper.h.

#define SET_SP | ( |  | x | ) | (REG_SP = (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x))))

Definition at line 120 of file vm_insnhelper.h.

Referenced by vm_invoke_block().

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

Definition at line 123 of file vm_insnhelper.h.

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

Definition at line 73 of file vm_insnhelper.h.

Referenced by vm_invoke_block(), and vm_method_missing_args().

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

Definition at line 70 of file vm_insnhelper.h.

Referenced by vm_call_method().

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

Definition at line 98 of file vm_insnhelper.h.

#define USE_IC_FOR_SPECIALIZED_METHOD 1

Definition at line 189 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.

Referenced by rb_vm_make_proc(), vm_pop_frame(), and vm_push_frame().

## 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_SUCC |
  BOP_GT |
  BOP_GE |
  BOP_NOT |
  BOP_NEQ |
  BOP_LAST_ |

Definition at line 37 of file vm_insnhelper.h.

## Variable Documentation

VALUE ruby_vm_const_missing_count

Definition at line 39 of file vm.c.

Referenced by rb_vm_inc_const_missing_count().

char ruby_vm_redefined_flag[BOP_LAST_]

Definition at line 41 of file vm.c.

Referenced by rb_vm_check_redefinition_opt_method().