Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
Macros | Typedefs | Enumerations | Functions
vm.h File Reference

Internal header for RubyVM. More...

#include "ruby/internal/stdbool.h"
#include "internal/serial.h"
#include "internal/static_assert.h"
#include "ruby/ruby.h"
#include "ruby/st.h"

Go to the source code of this file.

Macros

#define RUBY_DTRACE_CREATE_HOOK(name, arg)    RUBY_DTRACE_HOOK(name##_CREATE, arg)
 
#define RUBY_DTRACE_HOOK(name, arg)
 

Typedefs

typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE)
 

Enumerations

enum  method_missing_reason {
  MISSING_NOENTRY = 0x00 , MISSING_PRIVATE = 0x01 , MISSING_PROTECTED = 0x02 , MISSING_FCALL = 0x04 ,
  MISSING_VCALL = 0x08 , MISSING_SUPER = 0x10 , MISSING_MISSING = 0x20 , MISSING_NONE = 0x40
}
 

Functions

rb_serial_t rb_next_class_serial (void)
 
VALUE rb_obj_is_thread (VALUE obj)
 
void rb_vm_mark (void *ptr)
 
void rb_vm_each_stack_value (void *ptr, void(*cb)(VALUE, void *), void *ctx)
 
VALUE rb_vm_top_self (void)
 
void rb_vm_inc_const_missing_count (void)
 
const void ** rb_vm_get_insns_address_table (void)
 
VALUE rb_source_location (int *pline)
 
const char * rb_source_location_cstr (int *pline)
 
void rb_vm_pop_cfunc_frame (void)
 
int rb_vm_add_root_module (VALUE module)
 
void rb_vm_check_redefinition_by_prepend (VALUE klass)
 
int rb_vm_check_optimizable_mid (VALUE mid)
 
VALUE rb_yield_refine_block (VALUE refinement, VALUE refinements)
 
VALUE ruby_vm_special_exception_copy (VALUE)
 
st_tablerb_vm_fstring_table (void)
 
VALUE vm_exec (struct rb_execution_context_struct *, bool)
 
VALUE rb_current_realfilepath (void)
 
VALUE rb_check_block_call (VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE)
 
VALUE rb_check_funcall_with_hook (VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg)
 
VALUE rb_check_funcall_with_hook_kw (VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg, int kw_splat)
 
const char * rb_type_str (enum ruby_value_type type)
 
VALUE rb_check_funcall_default (VALUE, ID, int, const VALUE *, VALUE)
 
VALUE rb_check_funcall_basic_kw (VALUE, ID, VALUE, int, const VALUE *, int)
 Calls a method only if it is the basic method of ancestor otherwise returns Qundef;. More...
 
VALUE rb_yield_1 (VALUE val)
 
VALUE rb_yield_force_blockarg (VALUE values)
 
VALUE rb_lambda_call (VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, int min_argc, int max_argc, VALUE data2)
 
void rb_check_stack_overflow (void)
 
VALUE rb_equal_opt (VALUE obj1, VALUE obj2)
 
VALUE rb_eql_opt (VALUE obj1, VALUE obj2)
 
const struct rb_callcacherb_vm_search_method_slowpath (const struct rb_callinfo *ci, VALUE klass)
 
int rb_ec_obj_respond_to (struct rb_execution_context_struct *ec, VALUE obj, ID id, int priv)
 
void rb_print_backtrace (void)
 
VALUE rb_vm_thread_backtrace (int argc, const VALUE *argv, VALUE thval)
 
VALUE rb_vm_thread_backtrace_locations (int argc, const VALUE *argv, VALUE thval)
 
VALUE rb_vm_backtrace (int argc, const VALUE *argv, struct rb_execution_context_struct *ec)
 
VALUE rb_vm_backtrace_locations (int argc, const VALUE *argv, struct rb_execution_context_struct *ec)
 
VALUE rb_make_backtrace (void)
 
void rb_backtrace_print_as_bugreport (void)
 
int rb_backtrace_p (VALUE obj)
 
VALUE rb_backtrace_to_str_ary (VALUE obj)
 
VALUE rb_backtrace_to_location_ary (VALUE obj)
 
void rb_backtrace_each (VALUE(*iter)(VALUE recv, VALUE str), VALUE output)
 
VALUE rb_ec_backtrace_object (const struct rb_execution_context_struct *ec)
 
void rb_backtrace_use_iseq_first_lineno_for_last_location (VALUE self)
 

Detailed Description

Internal header for RubyVM.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Definition in file vm.h.

Macro Definition Documentation

◆ RUBY_DTRACE_CREATE_HOOK

#define RUBY_DTRACE_CREATE_HOOK (   name,
  arg 
)     RUBY_DTRACE_HOOK(name##_CREATE, arg)

Definition at line 120 of file vm.h.

◆ RUBY_DTRACE_HOOK

#define RUBY_DTRACE_HOOK (   name,
  arg 
)
Value:
do { \
if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
int dtrace_line; \
const char *dtrace_file = rb_source_location_cstr(&dtrace_line); \
if (!dtrace_file) dtrace_file = ""; \
RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
} \
} while (0)
#define UNLIKELY(x)
Definition: ffi_common.h:126
const char * rb_source_location_cstr(int *pline)
Definition: vm.c:1616
const char * name
Definition: nkf.c:208

Definition at line 122 of file vm.h.

Typedef Documentation

◆ rb_check_funcall_hook

typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE)

Definition at line 70 of file vm.h.

Enumeration Type Documentation

◆ method_missing_reason

Enumerator
MISSING_NOENTRY 
MISSING_PRIVATE 
MISSING_PROTECTED 
MISSING_FCALL 
MISSING_VCALL 
MISSING_SUPER 
MISSING_MISSING 
MISSING_NONE 

Definition at line 32 of file vm.h.

Function Documentation

◆ rb_backtrace_each()

void rb_backtrace_each ( VALUE(*)(VALUE recv, VALUE str iter,
VALUE  output 
)

◆ rb_backtrace_p()

int rb_backtrace_p ( VALUE  obj)

Definition at line 471 of file vm_backtrace.c.

References rb_typeddata_is_kind_of().

◆ rb_backtrace_print_as_bugreport()

void rb_backtrace_print_as_bugreport ( void  )

Definition at line 994 of file vm_backtrace.c.

References ALL_BACKTRACE_LINES, BACKTRACE_START, oldbt_arg::data, oldbt_arg::func, and NULL.

Referenced by rb_vm_bugreport().

◆ rb_backtrace_to_location_ary()

VALUE rb_backtrace_to_location_ary ( VALUE  obj)

Definition at line 864 of file vm_backtrace.c.

References GetCoreDataFromValue, and rb_backtrace_struct::locary.

◆ rb_backtrace_to_str_ary()

VALUE rb_backtrace_to_str_ary ( VALUE  obj)

◆ rb_backtrace_use_iseq_first_lineno_for_last_location()

void rb_backtrace_use_iseq_first_lineno_for_last_location ( VALUE  self)

◆ rb_check_block_call()

VALUE rb_check_block_call ( VALUE  obj,
ID  mid,
int  argc,
const VALUE argv,
rb_block_call_func_t  bl_proc,
VALUE  data2 
)

◆ rb_check_funcall_basic_kw()

VALUE rb_check_funcall_basic_kw ( VALUE  recv,
ID  mid,
VALUE  ancestor,
int  argc,
const VALUE argv,
int  kw_splat 
)

Calls a method only if it is the basic method of ancestor otherwise returns Qundef;.

Parameters
recvreceiver of the method
midan ID that represents the name of the method
ancestorthe Class that defined the basic method
argcthe number of arguments
argvpointer to an array of method arguments
kw_splatbool

Definition at line 1111 of file vm_eval.c.

References argc, argv, CLASS_OF, rb_callable_method_entry_struct::defined_class, rb_callcache::klass, METHOD_ENTRY_BASIC, Qundef, rb_callable_method_entry(), rb_vm_call0(), and RBASIC_CLASS.

Referenced by rb_hash().

◆ rb_check_funcall_default()

VALUE rb_check_funcall_default ( VALUE  recv,
ID  mid,
int  argc,
const VALUE argv,
VALUE  def 
)

◆ rb_check_funcall_with_hook()

VALUE rb_check_funcall_with_hook ( VALUE  recv,
ID  mid,
int  argc,
const VALUE argv,
rb_check_funcall_hook hook,
VALUE  arg 
)

◆ rb_check_funcall_with_hook_kw()

VALUE rb_check_funcall_with_hook_kw ( VALUE  recv,
ID  mid,
int  argc,
const VALUE argv,
rb_check_funcall_hook hook,
VALUE  arg,
int  kw_splat 
)

◆ rb_check_stack_overflow()

void rb_check_stack_overflow ( void  )

Definition at line 331 of file vm_eval.c.

References ruby_current_ec_key, and stack_check.

◆ rb_current_realfilepath()

VALUE rb_current_realfilepath ( void  )

◆ rb_ec_backtrace_object()

VALUE rb_ec_backtrace_object ( const struct rb_execution_context_struct ec)

◆ rb_ec_obj_respond_to()

int rb_ec_obj_respond_to ( struct rb_execution_context_struct ec,
VALUE  obj,
ID  id,
int  priv 
)

Definition at line 2552 of file vm_method.c.

References CLASS_OF.

Referenced by rb_obj_respond_to().

◆ rb_eql_opt()

VALUE rb_eql_opt ( VALUE  obj1,
VALUE  obj2 
)

Definition at line 2016 of file vm_insnhelper.c.

References idEqlP.

Referenced by rb_eql().

◆ rb_equal_opt()

VALUE rb_equal_opt ( VALUE  obj1,
VALUE  obj2 
)

Definition at line 2010 of file vm_insnhelper.c.

References idEq.

Referenced by rb_equal().

◆ rb_lambda_call()

VALUE rb_lambda_call ( VALUE  obj,
ID  mid,
int  argc,
const VALUE argv,
rb_block_call_func_t  bl_proc,
int  min_argc,
int  max_argc,
VALUE  data2 
)

◆ rb_make_backtrace()

VALUE rb_make_backtrace ( void  )

Definition at line 1059 of file vm_backtrace.c.

◆ rb_next_class_serial()

rb_serial_t rb_next_class_serial ( void  )

Definition at line 366 of file vm.c.

References NEXT_CLASS_SERIAL.

◆ rb_obj_is_thread()

VALUE rb_obj_is_thread ( VALUE  obj)

Definition at line 3003 of file vm.c.

References Qfalse, Qtrue, rb_typeddata_is_kind_of(), and thread_data_type.

Referenced by rb_objspace_call_finalizer().

◆ rb_print_backtrace()

void rb_print_backtrace ( void  )

Definition at line 753 of file vm_dump.c.

References free, and int().

Referenced by rb_fatal(), and rb_vm_bugreport().

◆ rb_source_location()

VALUE rb_source_location ( int pline)

◆ rb_source_location_cstr()

const char * rb_source_location_cstr ( int pline)

Definition at line 1616 of file vm.c.

References NIL_P, NULL, rb_source_location(), and RSTRING_PTR.

Referenced by rb_bug_for_fatal_signal(), rb_bug_without_die(), and rb_dtrace_setup().

◆ rb_type_str()

const char * rb_type_str ( enum ruby_value_type  type)

◆ rb_vm_add_root_module()

int rb_vm_add_root_module ( VALUE  module)

◆ rb_vm_backtrace()

VALUE rb_vm_backtrace ( int  argc,
const VALUE argv,
struct rb_execution_context_struct ec 
)

Definition at line 1162 of file vm_backtrace.c.

References argc, and argv.

◆ rb_vm_backtrace_locations()

VALUE rb_vm_backtrace_locations ( int  argc,
const VALUE argv,
struct rb_execution_context_struct ec 
)

Definition at line 1167 of file vm_backtrace.c.

References argc, and argv.

◆ rb_vm_check_optimizable_mid()

int rb_vm_check_optimizable_mid ( VALUE  mid)

Definition at line 1823 of file vm.c.

References FALSE, NULL, and st_lookup.

◆ rb_vm_check_redefinition_by_prepend()

void rb_vm_check_redefinition_by_prepend ( VALUE  klass)

Definition at line 1873 of file vm.c.

References rb_id_table_foreach(), RCLASS_M_TBL, and RCLASS_ORIGIN.

Referenced by rb_prepend_module().

◆ rb_vm_each_stack_value()

void rb_vm_each_stack_value ( void *  ptr,
void(*)(VALUE, void *)  cb,
void *  ctx 
)

◆ rb_vm_fstring_table()

st_table * rb_vm_fstring_table ( void  )

Definition at line 3787 of file vm.c.

Referenced by Init_String(), and rb_str_free().

◆ rb_vm_get_insns_address_table()

const void ** rb_vm_get_insns_address_table ( void  )

Definition at line 153 of file vm_exec.c.

Referenced by rb_vm_encoded_insn_data_table_init().

◆ rb_vm_inc_const_missing_count()

void rb_vm_inc_const_missing_count ( void  )

Definition at line 425 of file vm.c.

References ruby_vm_const_missing_count.

Referenced by rb_const_missing().

◆ rb_vm_mark()

void rb_vm_mark ( void *  ptr)

◆ rb_vm_pop_cfunc_frame()

void rb_vm_pop_cfunc_frame ( void  )

◆ rb_vm_search_method_slowpath()

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

◆ rb_vm_thread_backtrace()

VALUE rb_vm_thread_backtrace ( int  argc,
const VALUE argv,
VALUE  thval 
)

Definition at line 1151 of file vm_backtrace.c.

References argc, and argv.

◆ rb_vm_thread_backtrace_locations()

VALUE rb_vm_thread_backtrace_locations ( int  argc,
const VALUE argv,
VALUE  thval 
)

Definition at line 1157 of file vm_backtrace.c.

References argc, and argv.

◆ rb_vm_top_self()

VALUE rb_vm_top_self ( void  )

◆ rb_yield_1()

VALUE rb_yield_1 ( VALUE  val)

Definition at line 1335 of file vm_eval.c.

◆ rb_yield_force_blockarg()

VALUE rb_yield_force_blockarg ( VALUE  values)

Definition at line 1413 of file vm_eval.c.

◆ rb_yield_refine_block()

VALUE rb_yield_refine_block ( VALUE  refinement,
VALUE  refinements 
)

◆ ruby_vm_special_exception_copy()

VALUE ruby_vm_special_exception_copy ( VALUE  exc)

◆ vm_exec()

VALUE vm_exec ( struct rb_execution_context_struct ec,
bool  mjit_enable_p 
)