Ruby  2.7.1p83(2020-03-31revisiona0c7c23c9cec0d0ffcba012279cd652d28ad5bf3)
Macros | Typedefs | Functions
vm_insnhelper.c File Reference
#include "insns.inc"
#include "insns_info.inc"
#include <math.h>
#include "constant.h"
#include "internal.h"
#include "ruby/config.h"
#include "debug_counter.h"
#include "variable.h"
#include "vm_args.c"

Go to the source code of this file.

Macros

#define vm_check_canary(ec, sp)
 
#define vm_check_frame(a, b, c, d)
 
#define BUILTIN_CLASS_P(x, k)   (!SPECIAL_CONST_P(x) && RBASIC_CLASS(x) == k)
 
#define EQ_UNREDEFINED_P(t)   BASIC_OP_UNREDEFINED_P(BOP_EQ, t##_REDEFINED_OP_FLAG)
 
#define CHECK_CMP_NAN(a, b)   /* do nothing */
 
#define USE_OPT_HIST   0
 
#define CHECK_CFP_CONSISTENCY(func)
 
#define id_cmp   idCmp
 
#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)
 

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)
 
MJIT_STATIC VALUE ruby_vm_special_exception_copy (VALUE exc)
 
 NORETURN (static void ec_stack_overflow(rb_execution_context_t *ec, int))
 
 NORETURN (static void vm_stackoverflow(void))
 
 NORETURN (MJIT_STATIC void rb_ec_stack_overflow(rb_execution_context_t *ec, int crit))
 
MJIT_STATIC void rb_ec_stack_overflow (rb_execution_context_t *ec, int crit)
 
MJIT_STATIC void rb_vm_pop_frame (rb_execution_context_t *ec)
 
MJIT_STATIC void rb_error_arity (int argc, int min, int max)
 
 NOINLINE (static void vm_env_write_slowpath(const VALUE *ep, int index, VALUE v))
 
MJIT_STATIC VALUE rb_vm_bh_to_procval (const rb_execution_context_t *ec, VALUE block_handler)
 
 PUREFUNC (static rb_callable_method_entry_t *check_method_entry(VALUE obj, int can_be_svar))
 
const MJIT_STATIC rb_callable_method_entry_trb_vm_frame_method_entry (const rb_control_frame_t *cfp)
 
 PUREFUNC (static rb_cref_t *check_cref(VALUE, int))
 
void rb_vm_rewrite_cref (rb_cref_t *cref, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr)
 
 ALWAYS_INLINE (static VALUE vm_getivar(VALUE, ID, IVC, struct rb_call_cache *, int))
 
MJIT_FUNC_EXPORTED void rb_vm_search_method_slowpath (struct rb_call_data *cd, 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)
 
 ALWAYS_INLINE (static VALUE vm_call_iseq_setup_normal(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const rb_callable_method_entry_t *me, int opt_pc, int param_size, int local_size))
 
MJIT_STATIC bool rb_simple_iseq_p (const rb_iseq_t *iseq)
 
 NOINLINE (static VALUE vm_invoke_block_opt_call(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, VALUE block_handler))
 
 PUREFUNC (static rb_control_frame_t *current_method_entry(const rb_execution_context_t *ec, rb_control_frame_t *cfp))
 
 NORETURN (static void vm_raise_method_missing(rb_execution_context_t *ec, int argc, const VALUE *argv, VALUE obj, int call_status))
 
rb_control_frame_t *FUNC_FASTCALL() rb_vm_opt_struct_aref (rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)
 
rb_control_frame_t *FUNC_FASTCALL() rb_vm_opt_struct_aset (rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)
 
 NORETURN (static void unmatched_redefinition(const char *type, VALUE cbase, ID id, VALUE old))
 
 NORETURN (static void vm_stack_consistency_error(const rb_execution_context_t *ec, const rb_control_frame_t *, const VALUE *))
 
VALUE rb_false (VALUE obj)
 
rb_event_flag_t rb_iseq_event_flags (const rb_iseq_t *iseq, size_t pos)
 
 NOINLINE (static void vm_trace(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, const VALUE *pc))
 
void Init_vm_stack_canary (void)
 
VALUE rb_vm_lvar_exposed (rb_execution_context_t *ec, int index)
 

Macro Definition Documentation

◆ BUILTIN_CLASS_P

#define BUILTIN_CLASS_P (   x,
 
)    (!SPECIAL_CONST_P(x) && RBASIC_CLASS(x) == k)

Definition at line 1663 of file vm_insnhelper.c.

◆ 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 2448 of file vm_insnhelper.c.

◆ CHECK_CMP_NAN

#define CHECK_CMP_NAN (   a,
 
)    /* do nothing */

Definition at line 1823 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 1664 of file vm_insnhelper.c.

◆ id_cmp

#define id_cmp   idCmp

Definition at line 4070 of file vm_insnhelper.c.

◆ USE_OPT_HIST

#define USE_OPT_HIST   0

Definition at line 2004 of file vm_insnhelper.c.

◆ vm_check_canary

#define vm_check_canary (   ec,
  sp 
)

Definition at line 257 of file vm_insnhelper.c.

◆ vm_check_frame

#define vm_check_frame (   a,
  b,
  c,
 
)

Definition at line 258 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 4764 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 4996 of file vm_insnhelper.c.

Function Documentation

◆ ALWAYS_INLINE() [1/2]

ALWAYS_INLINE ( static VALUE   vm_call_iseq_setup_normalrb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const rb_callable_method_entry_t *me, int opt_pc, int param_size, int local_size)

◆ ALWAYS_INLINE() [2/2]

ALWAYS_INLINE ( static VALUE   vm_getivarVALUE, ID, IVC, struct rb_call_cache *, int)

◆ Init_vm_stack_canary()

void Init_vm_stack_canary ( void  )

Definition at line 4856 of file vm_insnhelper.c.

◆ NOINLINE() [1/3]

NOINLINE ( static VALUE   vm_invoke_block_opt_callrb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, VALUE block_handler)

◆ NOINLINE() [2/3]

NOINLINE ( static void   vm_env_write_slowpathconst VALUE *ep, int index, VALUE v)

◆ NOINLINE() [3/3]

NOINLINE ( static void   vm_tracerb_execution_context_t *ec, rb_control_frame_t *reg_cfp, const VALUE *pc)

◆ NORETURN() [1/6]

NORETURN ( MJIT_STATIC void   rb_ec_stack_overflowrb_execution_context_t *ec, int crit)

◆ NORETURN() [2/6]

NORETURN ( static void   ec_stack_overflowrb_execution_context_t *ec, int)

◆ NORETURN() [3/6]

NORETURN ( static void   unmatched_redefinitionconst char *type, VALUE cbase, ID id, VALUE old)

◆ NORETURN() [4/6]

NORETURN ( static void   vm_raise_method_missingrb_execution_context_t *ec, int argc, const VALUE *argv, VALUE obj, int call_status)

◆ NORETURN() [5/6]

NORETURN ( static void   vm_stack_consistency_errorconst rb_execution_context_t *ec, const rb_control_frame_t *, const VALUE *)

◆ NORETURN() [6/6]

NORETURN ( static void   vm_stackoverflowvoid)

◆ PUREFUNC() [1/3]

PUREFUNC ( static rb_callable_method_entry_t check_method_entryVALUE obj, int can_be_svar)

◆ PUREFUNC() [2/3]

PUREFUNC ( static rb_control_frame_t current_method_entryconst rb_execution_context_t *ec, rb_control_frame_t *cfp)

◆ PUREFUNC() [3/3]

PUREFUNC ( static rb_cref_t check_crefVALUE, int)

◆ rb_ec_stack_overflow()

MJIT_STATIC 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 1783 of file vm_insnhelper.c.

References rb_call_data::ci, idEqlP, and rb_call_info::mid.

◆ rb_equal_opt()

VALUE rb_equal_opt ( VALUE  obj1,
VALUE  obj2 
)

Definition at line 1775 of file vm_insnhelper.c.

References rb_call_data::ci, idEq, and rb_call_info::mid.

◆ rb_error_arity()

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

Definition at line 387 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 1774 of file iseq.c.

◆ rb_make_no_method_exception()

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

Definition at line 772 of file vm_eval.c.

◆ rb_method_definition_create()

rb_method_definition_t* rb_method_definition_create ( rb_method_type_t  type,
ID  mid 
)

Definition at line 348 of file vm_method.c.

◆ rb_method_definition_eq()

MJIT_FUNC_EXPORTED int rb_method_definition_eq ( const rb_method_definition_t d1,
const rb_method_definition_t d2 
)

Definition at line 1504 of file vm_method.c.

◆ 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 232 of file vm_method.c.

◆ rb_simple_iseq_p()

MJIT_STATIC bool rb_simple_iseq_p ( const rb_iseq_t iseq)

◆ rb_vm_bh_to_procval()

MJIT_STATIC VALUE rb_vm_bh_to_procval ( const rb_execution_context_t ec,
VALUE  block_handler 
)

Definition at line 419 of file vm_insnhelper.c.

References block_handler, 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 
)

Definition at line 46 of file vm_eval.c.

◆ rb_vm_frame_method_entry()

Definition at line 612 of file vm_insnhelper.c.

References cfp, rb_control_frame_struct::ep, and me.

Referenced by rb_vm_control_frame_id_and_class(), and rb_vm_pop_cfunc_frame().

◆ rb_vm_lvar_exposed()

VALUE rb_vm_lvar_exposed ( rb_execution_context_t ec,
int  index 
)

◆ rb_vm_opt_struct_aref()

rb_control_frame_t* FUNC_FASTCALL() rb_vm_opt_struct_aref ( rb_execution_context_t ec,
rb_control_frame_t reg_cfp 
)

Definition at line 3467 of file vm_insnhelper.c.

References GET_SELF, rb_struct_aref(), reg_cfp, and TOPN.

◆ rb_vm_opt_struct_aset()

rb_control_frame_t* FUNC_FASTCALL() rb_vm_opt_struct_aset ( rb_execution_context_t ec,
rb_control_frame_t reg_cfp 
)

Definition at line 3474 of file vm_insnhelper.c.

References GET_SELF, rb_struct_aset(), reg_cfp, and TOPN.

◆ rb_vm_pop_frame()

MJIT_STATIC void rb_vm_pop_frame ( rb_execution_context_t ec)

Definition at line 364 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 801 of file vm_insnhelper.c.

◆ rb_vm_search_method_slowpath()

MJIT_FUNC_EXPORTED void rb_vm_search_method_slowpath ( struct rb_call_data cd,
VALUE  klass 
)

Definition at line 1467 of file vm_insnhelper.c.

References call, rb_call_data::cc, cc, rb_call_data::ci, ci, klass, me, and rb_callable_method_entry().

◆ ruby_vm_special_exception_copy()

MJIT_STATIC VALUE ruby_vm_special_exception_copy ( VALUE  exc)

Definition at line 34 of file vm_insnhelper.c.

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

void
void
Definition: rb_mjit_min_header-2.7.1.h:13198
LIKELY
#define LIKELY(x)
Definition: ffi_common.h:125
reg_cfp
rb_control_frame_t * reg_cfp
Definition: rb_mjit_min_header-2.7.1.h:15083
rb_bug
void rb_bug(const char *fmt,...)
Definition: error.c:634
pc
rb_control_frame_t const VALUE * pc
Definition: rb_mjit_min_header-2.7.1.h:16860