Ruby: vm_insnhelper.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Variables
vm_insnhelper.h File Reference

Go to the source code of this file.

## Macros
#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 | VM_REG_CFP (reg_cfp)
#define | VM_REG_PC (VM_REG_CFP->pc)
#define | VM_REG_SP (VM_REG_CFP->sp)
#define | VM_REG_EP (VM_REG_CFP->ep)
#define | RESTORE_REGS()
#define | COLLECT_USAGE_REGISTER_HELPER(a, b, v) (v)
#define | GET_PC() (COLLECT_USAGE_REGISTER_HELPER(PC, GET, VM_REG_PC))
#define | SET_PC(x) (VM_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(VM_REG_PC + (n)))
#define | JUMP(dst) (SET_PC(VM_REG_PC + (dst)))
#define | GET_CFP() (COLLECT_USAGE_REGISTER_HELPER(CFP, GET, VM_REG_CFP))
#define | GET_EP() (COLLECT_USAGE_REGISTER_HELPER(EP, GET, VM_REG_EP))
#define | SET_EP(x) (VM_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, VM_REG_SP))
#define | SET_SP(x) (VM_REG_SP = (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
#define | INC_SP(x) (VM_REG_SP += (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
#define | DEC_SP(x) (VM_REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
#define | SET_SV(x) (*GET_SP() = rb_ractor_confirm_belonging(x))
#define | GET_ISEQ() (GET_CFP()->iseq)
#define | GET_PREV_EP(ep) ((VALUE *)((ep)[VM_ENV_DATA_INDEX_SPECVAL] & ~0x03))
#define | GET_SELF() (COLLECT_USAGE_REGISTER_HELPER(SELF, GET, GET_CFP()->self))
#define | GET_BLOCK_HANDLER() (GET_LEP()[VM_ENV_DATA_INDEX_SPECVAL])
#define | SETUP_CANARY(cond) if (cond) {} else {}
#define | CHECK_CANARY(cond, insn) if (cond) {(void)(insn);}
#define | CALL_SIMPLE_METHOD()
#define | PREV_CLASS_SERIAL() (ruby_vm_class_serial)
#define | NEXT_CLASS_SERIAL() (++ruby_vm_class_serial)
#define | GET_GLOBAL_CONSTANT_STATE() (ruby_vm_global_constant_state)
#define | INC_GLOBAL_CONSTANT_STATE() (++ruby_vm_global_constant_state)
#define | IS_ARGS_SPLAT(ci) (vm_ci_flag(ci) & VM_CALL_ARGS_SPLAT)
#define | IS_ARGS_KEYWORD(ci) (vm_ci_flag(ci) & VM_CALL_KWARG)
#define | IS_ARGS_KW_SPLAT(ci) (vm_ci_flag(ci) & VM_CALL_KW_SPLAT)
#define | IS_ARGS_KW_OR_KW_SPLAT(ci) (vm_ci_flag(ci) & (VM_CALL_KWARG | VM_CALL_KW_SPLAT))
#define | IS_ARGS_KW_SPLAT_MUT(ci) (vm_ci_flag(ci) & VM_CALL_KW_SPLAT_MUT)

## Variables
VALUE | ruby_vm_const_missing_count
rb_serial_t | ruby_vm_global_constant_state
rb_serial_t | ruby_vm_class_serial

## Macro Definition Documentation

## ◆ ADD_PC

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

Definition at line 81 of file vm_insnhelper.h.

## ◆ CALL_SIMPLE_METHOD

#define CALL_SIMPLE_METHOD | ( |  | ) |

Value:
do { \
rb_snum_t x = leaf ? INSN_ATTR(width) : 0; \
rb_snum_t y = attr_width_opt_send_without_block(0); \
rb_snum_t z = x - y; \
ADD_PC(z); \
DISPATCH_ORIGINAL_INSN(opt_send_without_block); \
} while (0)
rb_snum_t
signed long rb_snum_t
Definition: vm_core.h:183

Definition at line 169 of file vm_insnhelper.h.

## ◆ CHECK_CANARY

#define CHECK_CANARY | ( |  | cond,
|  |  | insn
| ) |  | if (cond) {(void)(insn);}

Definition at line 161 of file vm_insnhelper.h.

## ◆ COLLECT_USAGE_INSN

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

Definition at line 28 of file vm_insnhelper.h.

## ◆ COLLECT_USAGE_OPERAND

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

Definition at line 29 of file vm_insnhelper.h.

## ◆ COLLECT_USAGE_REGISTER

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

Definition at line 30 of file vm_insnhelper.h.

## ◆ COLLECT_USAGE_REGISTER_HELPER

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

Definition at line 73 of file vm_insnhelper.h.

## ◆ DEC_SP

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

Definition at line 94 of file vm_insnhelper.h.

## ◆ GET_BLOCK_HANDLER

#define GET_BLOCK_HANDLER | ( |  | ) | (GET_LEP()[VM_ENV_DATA_INDEX_SPECVAL])

Definition at line 129 of file vm_insnhelper.h.

## ◆ GET_CFP

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

Definition at line 85 of file vm_insnhelper.h.

## ◆ GET_CURRENT_INSN

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

Definition at line 79 of file vm_insnhelper.h.

## ◆ GET_EP

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

Definition at line 86 of file vm_insnhelper.h.

## ◆ GET_GLOBAL_CONSTANT_STATE

#define GET_GLOBAL_CONSTANT_STATE | ( |  | ) | (ruby_vm_global_constant_state)

Definition at line 180 of file vm_insnhelper.h.

## ◆ GET_ISEQ

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

Definition at line 99 of file vm_insnhelper.h.

## ◆ GET_LEP

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

Definition at line 88 of file vm_insnhelper.h.

## ◆ GET_OPERAND

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

Definition at line 80 of file vm_insnhelper.h.

## ◆ GET_PC

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

Definition at line 77 of file vm_insnhelper.h.

## ◆ GET_PREV_EP

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

Definition at line 105 of file vm_insnhelper.h.

## ◆ GET_SELF

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

Definition at line 111 of file vm_insnhelper.h.

## ◆ GET_SP

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

Definition at line 91 of file vm_insnhelper.h.

## ◆ INC_GLOBAL_CONSTANT_STATE

#define INC_GLOBAL_CONSTANT_STATE | ( |  | ) | (++ruby_vm_global_constant_state)

Definition at line 181 of file vm_insnhelper.h.

## ◆ INC_SP

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

Definition at line 93 of file vm_insnhelper.h.

## ◆ IS_ARGS_KEYWORD

#define IS_ARGS_KEYWORD | ( |  | ci | ) | (vm_ci_flag(ci) & VM_CALL_KWARG)

Definition at line 243 of file vm_insnhelper.h.

## ◆ IS_ARGS_KW_OR_KW_SPLAT

#define IS_ARGS_KW_OR_KW_SPLAT | ( |  | ci | ) | (vm_ci_flag(ci) & (VM_CALL_KWARG | VM_CALL_KW_SPLAT))

Definition at line 245 of file vm_insnhelper.h.

## ◆ IS_ARGS_KW_SPLAT

#define IS_ARGS_KW_SPLAT | ( |  | ci | ) | (vm_ci_flag(ci) & VM_CALL_KW_SPLAT)

Definition at line 244 of file vm_insnhelper.h.

## ◆ IS_ARGS_KW_SPLAT_MUT

#define IS_ARGS_KW_SPLAT_MUT | ( |  | ci | ) | (vm_ci_flag(ci) & VM_CALL_KW_SPLAT_MUT)

Definition at line 246 of file vm_insnhelper.h.

## ◆ IS_ARGS_SPLAT

#define IS_ARGS_SPLAT | ( |  | ci | ) | (vm_ci_flag(ci) & VM_CALL_ARGS_SPLAT)

Definition at line 242 of file vm_insnhelper.h.

## ◆ JUMP

#define JUMP | ( |  | dst | ) | (SET_PC(VM_REG_PC + (dst)))

Definition at line 82 of file vm_insnhelper.h.

## ◆ NEXT_CLASS_SERIAL

#define NEXT_CLASS_SERIAL | ( |  | ) | (++ruby_vm_class_serial)

Definition at line 179 of file vm_insnhelper.h.

## ◆ POP

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

Definition at line 40 of file vm_insnhelper.h.

## ◆ POPN

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

Definition at line 39 of file vm_insnhelper.h.

## ◆ PREV_CLASS_SERIAL

#define PREV_CLASS_SERIAL | ( |  | ) | (ruby_vm_class_serial)

Definition at line 178 of file vm_insnhelper.h.

## ◆ PUSH

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

Definition at line 37 of file vm_insnhelper.h.

## ◆ RESTORE_REGS

#define RESTORE_REGS | ( |  | ) |

Value:
do { \
VM_REG_CFP = ec->cfp; \
} while (0)
VM_REG_CFP
#define VM_REG_CFP
Definition: vm_insnhelper.h:47

Definition at line 52 of file vm_insnhelper.h.

## ◆ SET_EP

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

Definition at line 87 of file vm_insnhelper.h.

## ◆ SET_PC

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

Definition at line 78 of file vm_insnhelper.h.

## ◆ SET_SP

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

Definition at line 92 of file vm_insnhelper.h.

## ◆ SET_SV

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

Definition at line 95 of file vm_insnhelper.h.

## ◆ SETUP_CANARY

#define SETUP_CANARY | ( |  | cond | ) | if (cond) {} else {}

Definition at line 160 of file vm_insnhelper.h.

## ◆ STACK_ADDR_FROM_TOP

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

Definition at line 41 of file vm_insnhelper.h.

## ◆ TOPN

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

Definition at line 38 of file vm_insnhelper.h.

## ◆ VM_REG_CFP

#define VM_REG_CFP (reg_cfp)

Definition at line 47 of file vm_insnhelper.h.

## ◆ VM_REG_EP

#define VM_REG_EP (VM_REG_CFP->ep)

Definition at line 50 of file vm_insnhelper.h.

## ◆ VM_REG_PC

#define VM_REG_PC (VM_REG_CFP->pc)

Definition at line 48 of file vm_insnhelper.h.

## ◆ VM_REG_SP

#define VM_REG_SP (VM_REG_CFP->sp)

Definition at line 49 of file vm_insnhelper.h.

## Variable Documentation

## ◆ ruby_vm_class_serial

rb_serial_t ruby_vm_class_serial
| extern

Definition at line 408 of file vm.c.

## ◆ ruby_vm_const_missing_count

VALUE ruby_vm_const_missing_count
| extern

Definition at line 379 of file vm.c.

Referenced by rb_vm_inc_const_missing_count().

## ◆ ruby_vm_global_constant_state

rb_serial_t ruby_vm_global_constant_state
| extern

Definition at line 407 of file vm.c.