Ruby  3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
Macros | Typedefs | Enumerations | Functions
vm_insnhelper.c File Reference

(b76ad15ed0da636161de0243c547ee1e6fc95681)

#include "ruby/internal/config.h"
#include <math.h>
#include "constant.h"
#include "debug_counter.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/compar.h"
#include "internal/hash.h"
#include "internal/numeric.h"
#include "internal/proc.h"
#include "internal/random.h"
#include "internal/variable.h"
#include "variable.h"
#include "insns.inc"
#include "insns_info.inc"
#include "vm_args.c"
Include dependency graph for vm_insnhelper.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define vm_check_canary(ec, sp)
 
#define vm_check_frame(a, b, c, d)
 
#define vm_push_frame_debug_counter_inc(ec, cfp, t)   /* void */
 
#define EQ_UNREDEFINED_P(t)   BASIC_OP_UNREDEFINED_P(BOP_EQ, t##_REDEFINED_OP_FLAG)
 
#define CHECK_CMP_NAN(a, b)   if (isnan(a) || isnan(b)) return Qfalse;
 
#define USE_OPT_HIST   0
 
#define CHECK_CFP_CONSISTENCY(func)
 
#define id_cmp   idCmp
 
#define IMEMO_CONST_CACHE_SHAREABLE   IMEMO_FL_USER0
 
#define VM_TRACE_HOOK(target_event, val)
 

Typedefs

typedef VALUE(* builtin_invoker) (rb_execution_context_t *ec, VALUE self, const VALUE *argv, rb_insn_func_t funcptr)
 

Enumerations

enum  method_explorer_type { mexp_search_method, mexp_search_invokeblock, mexp_search_super }
 

Functions

rb_method_definition_trb_method_definition_create (rb_method_type_t type, ID mid)
 
void rb_method_definition_set (const rb_method_entry_t *me, rb_method_definition_t *def, void *opts)
 
int rb_method_definition_eq (const rb_method_definition_t *d1, const rb_method_definition_t *d2)
 
VALUE rb_make_no_method_exception (VALUE exc, VALUE format, VALUE obj, int argc, const VALUE *argv, int priv)
 
VALUE ruby_vm_special_exception_copy (VALUE exc)
 
void rb_ec_stack_overflow (rb_execution_context_t *ec, int crit)
 
 STATIC_ASSERT (VM_ENV_DATA_INDEX_ME_CREF, VM_ENV_DATA_INDEX_ME_CREF==-2)
 
 STATIC_ASSERT (VM_ENV_DATA_INDEX_SPECVAL, VM_ENV_DATA_INDEX_SPECVAL==-1)
 
 STATIC_ASSERT (VM_ENV_DATA_INDEX_FLAGS, VM_ENV_DATA_INDEX_FLAGS==-0)
 
void rb_vm_pop_frame (rb_execution_context_t *ec)
 
void rb_error_arity (int argc, int min, int max)
 
VALUE rb_vm_bh_to_procval (const rb_execution_context_t *ec, VALUE block_handler)
 
const rb_callable_method_entry_trb_vm_frame_method_entry (const rb_control_frame_t *cfp)
 
void rb_vm_rewrite_cref (rb_cref_t *cref, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr)
 
const struct rb_callcacherb_vm_search_method_slowpath (const struct rb_callinfo *ci, VALUE klass)
 
VALUE rb_equal_opt (VALUE obj1, VALUE obj2)
 
VALUE rb_eql_opt (VALUE obj1, VALUE obj2)
 
VALUE rb_vm_call0 (rb_execution_context_t *ec, VALUE, ID, int, const VALUE *, const rb_callable_method_entry_t *, int kw_splat)
 
bool rb_simple_iseq_p (const rb_iseq_t *iseq)
 
bool rb_splat_or_kwargs_p (const struct rb_callinfo *restrict ci)
 
bool rb_vm_call_ivar_attrset_p (const vm_call_handler ch)
 
VALUE rb_find_defined_class_by_owner (VALUE current_class, VALUE target_owner)
 
void rb_vm_cc_general (const struct rb_callcache *cc)
 
VALUE rb_false (VALUE obj)
 
rb_event_flag_t rb_iseq_event_flags (const rb_iseq_t *iseq, size_t pos)
 
bool rb_vm_opt_cfunc_p (CALL_CACHE cc, int insn)
 
void Init_vm_stack_canary (void)
 
VALUE rb_vm_lvar_exposed (rb_execution_context_t *ec, int index)
 

Macro Definition Documentation

◆ CHECK_CFP_CONSISTENCY

#define CHECK_CFP_CONSISTENCY (   func)
Value:
(LIKELY(vm_cfp_consistent_p(ec, reg_cfp)) ? (void)0 : \
rb_bug(func ": cfp consistency error (%p, %p)", (void *)reg_cfp, (void *)(ec->cfp+1)))

Definition at line 2926 of file vm_insnhelper.c.

◆ CHECK_CMP_NAN

#define CHECK_CMP_NAN (   a,
 
)    if (isnan(a) || isnan(b)) return Qfalse;

Definition at line 2120 of file vm_insnhelper.c.

◆ EQ_UNREDEFINED_P

#define EQ_UNREDEFINED_P (   t)    BASIC_OP_UNREDEFINED_P(BOP_EQ, t##_REDEFINED_OP_FLAG)

Definition at line 1952 of file vm_insnhelper.c.

◆ id_cmp

#define id_cmp   idCmp

Definition at line 4659 of file vm_insnhelper.c.

◆ IMEMO_CONST_CACHE_SHAREABLE

#define IMEMO_CONST_CACHE_SHAREABLE   IMEMO_FL_USER0

Definition at line 4715 of file vm_insnhelper.c.

◆ USE_OPT_HIST

#define USE_OPT_HIST   0

Definition at line 2320 of file vm_insnhelper.c.

◆ vm_check_canary

#define vm_check_canary (   ec,
  sp 
)

Definition at line 290 of file vm_insnhelper.c.

◆ vm_check_frame

#define vm_check_frame (   a,
  b,
  c,
 
)

Definition at line 291 of file vm_insnhelper.c.

◆ vm_push_frame_debug_counter_inc

#define vm_push_frame_debug_counter_inc (   ec,
  cfp,
  t 
)    /* void */

Definition at line 341 of file vm_insnhelper.c.

◆ VM_TRACE_HOOK

#define VM_TRACE_HOOK (   target_event,
  val 
)
Value:
do { \
if ((pc_events & (target_event)) & enabled_flags) { \
vm_trace_hook(ec, reg_cfp, pc, pc_events, (target_event), global_hooks, local_hooks, (val)); \
} \
} while (0)

Definition at line 5386 of file vm_insnhelper.c.

Typedef Documentation

◆ builtin_invoker

typedef VALUE(* builtin_invoker) (rb_execution_context_t *ec, VALUE self, const VALUE *argv, rb_insn_func_t funcptr)

Definition at line 5622 of file vm_insnhelper.c.

Enumeration Type Documentation

◆ method_explorer_type

Enumerator
mexp_search_method 
mexp_search_invokeblock 
mexp_search_super 

Definition at line 4557 of file vm_insnhelper.c.

Function Documentation

◆ Init_vm_stack_canary()

void Init_vm_stack_canary ( void  )

Definition at line 5482 of file vm_insnhelper.c.

◆ rb_ec_stack_overflow()

void rb_ec_stack_overflow ( rb_execution_context_t ec,
int  crit 
)

◆ rb_eql_opt()

VALUE rb_eql_opt ( VALUE  obj1,
VALUE  obj2 
)

Definition at line 2082 of file vm_insnhelper.c.

◆ rb_equal_opt()

VALUE rb_equal_opt ( VALUE  obj1,
VALUE  obj2 
)

Definition at line 2076 of file vm_insnhelper.c.

◆ rb_error_arity()

void rb_error_arity ( int  argc,
int  min,
int  max 
)

Definition at line 442 of file vm_insnhelper.c.

◆ rb_find_defined_class_by_owner()

VALUE rb_find_defined_class_by_owner ( VALUE  current_class,
VALUE  target_owner 
)

Definition at line 3078 of file vm_insnhelper.c.

◆ rb_iseq_event_flags()

rb_event_flag_t rb_iseq_event_flags ( const rb_iseq_t iseq,
size_t  pos 
)

Definition at line 1869 of file iseq.c.

Referenced by rb_iseq_disasm_insn(), and rb_iseq_trace_set().

◆ rb_make_no_method_exception()

VALUE rb_make_no_method_exception ( VALUE  exc,
VALUE  format,
VALUE  obj,
int  argc,
const VALUE argv,
int  priv 
)

◆ rb_method_definition_create()

rb_method_definition_t* rb_method_definition_create ( rb_method_type_t  type,
ID  mid 
)

◆ rb_method_definition_eq()

int rb_method_definition_eq ( const rb_method_definition_t d1,
const rb_method_definition_t d2 
)

Definition at line 1860 of file vm_method.c.

References d1.

Referenced by rb_method_entry_eq().

◆ rb_method_definition_set()

void rb_method_definition_set ( const rb_method_entry_t me,
rb_method_definition_t def,
void *  opts 
)

Definition at line 437 of file vm_method.c.

References rb_method_entry_struct::def, if(), NULL, and VM_METHOD_TYPE_ISEQ.

◆ rb_simple_iseq_p()

bool rb_simple_iseq_p ( const rb_iseq_t iseq)

◆ rb_splat_or_kwargs_p()

bool rb_splat_or_kwargs_p ( const struct rb_callinfo *restrict  ci)

Definition at line 2254 of file vm_insnhelper.c.

References IS_ARGS_KW_OR_KW_SPLAT, and IS_ARGS_SPLAT.

◆ rb_vm_bh_to_procval()

VALUE rb_vm_bh_to_procval ( const rb_execution_context_t ec,
VALUE  block_handler 
)

Definition at line 474 of file vm_insnhelper.c.

References Qnil, and VM_BLOCK_HANDLER_NONE.

◆ rb_vm_call0()

VALUE rb_vm_call0 ( rb_execution_context_t ec,
VALUE  ,
ID  ,
int  ,
const VALUE ,
const rb_callable_method_entry_t ,
int  kw_splat 
)

◆ rb_vm_call_ivar_attrset_p()

bool rb_vm_call_ivar_attrset_p ( const vm_call_handler  ch)

Definition at line 3033 of file vm_insnhelper.c.

◆ rb_vm_cc_general()

void rb_vm_cc_general ( const struct rb_callcache cc)

◆ rb_vm_frame_method_entry()

const rb_callable_method_entry_t* rb_vm_frame_method_entry ( const rb_control_frame_t cfp)

◆ rb_vm_lvar_exposed()

VALUE rb_vm_lvar_exposed ( rb_execution_context_t ec,
int  index 
)

◆ rb_vm_opt_cfunc_p()

bool rb_vm_opt_cfunc_p ( CALL_CACHE  cc,
int  insn 
)

Definition at line 5372 of file vm_insnhelper.c.

◆ rb_vm_pop_frame()

void rb_vm_pop_frame ( rb_execution_context_t ec)

Definition at line 419 of file vm_insnhelper.c.

◆ rb_vm_rewrite_cref()

void rb_vm_rewrite_cref ( rb_cref_t cref,
VALUE  old_klass,
VALUE  new_klass,
rb_cref_t **  new_cref_ptr 
)

Definition at line 867 of file vm_insnhelper.c.

◆ rb_vm_search_method_slowpath()

const struct rb_callcache* rb_vm_search_method_slowpath ( const struct rb_callinfo ci,
VALUE  klass 
)

Definition at line 1816 of file vm_insnhelper.c.

References VM_ASSERT.

◆ ruby_vm_special_exception_copy()

VALUE ruby_vm_special_exception_copy ( VALUE  exc)

Definition at line 48 of file vm_insnhelper.c.

References rb_class_real(), rb_obj_alloc(), rb_obj_copy_ivar(), and RBASIC_CLASS.

◆ STATIC_ASSERT() [1/3]

STATIC_ASSERT ( VM_ENV_DATA_INDEX_FLAGS  ,
VM_ENV_DATA_INDEX_FLAGS  = =-0 
)

◆ STATIC_ASSERT() [2/3]

STATIC_ASSERT ( VM_ENV_DATA_INDEX_ME_CREF  ,
VM_ENV_DATA_INDEX_ME_CREF  = =-2 
)

◆ STATIC_ASSERT() [3/3]

STATIC_ASSERT ( VM_ENV_DATA_INDEX_SPECVAL  ,
VM_ENV_DATA_INDEX_SPECVAL  = =-1 
)
LIKELY
#define LIKELY(x)
Definition: dtoa.c:508
rb_control_frame_struct::pc
const VALUE * pc
Definition: vm_core.h:781
rb_bug
void rb_bug(const char *fmt,...)
Definition: error.c:796