vm_core.h File Reference
`#include "ruby/ruby.h"`
`#include "ruby/st.h"`
`#include "node.h"`
`#include "debug.h"`
`#include "vm_opts.h"`
`#include "id.h"`
`#include "method.h"`
`#include "atomic.h"`
`#include <setjmp.h>`
`#include <signal.h>`
`#include <varargs.h>`

Go to the source code of this file.

## Data Structures

struct | iseq_inline_cache_entry
struct | rb_iseq_struct
struct | rb_vm_struct
struct | rb_control_frame_t
struct | rb_block_struct
struct | rb_vm_tag
struct | rb_vm_protect_tag
struct | rb_unblock_callback
struct | rb_thread_struct
struct | rb_proc_t
struct | rb_env_t
struct | rb_binding_t

## Macros

#define | RUBY_VM_THREAD_MODEL 2
#define | ENABLE_VM_OBJSPACE 1
#define | NSIG (_SIGMAX + 1) /* For QNX */
#define | RUBY_NSIG NSIG
#define | va_init_list(a, b) va_start((a))
#define | LIKELY(x) (x)
#define | UNLIKELY(x) (x)
#define | UNINITIALIZED_VAR(x) x
#define | GetCoreDataFromValue(obj, type, ptr)
#define | GetISeqPtr(obj, ptr) GetCoreDataFromValue((obj), rb_iseq_t, (ptr))
#define | GetVMPtr(obj, ptr) GetCoreDataFromValue((obj), rb_vm_t, (ptr))
#define | GetThreadPtr(obj, ptr) TypedData_Get_Struct((obj), rb_thread_t, &ruby_threadptr_data_type, (ptr))
#define | ALT_STACK_SIZE (4*1024)
#define | RUBY_VM_THREAD_STACK_SIZE (128 * 1024)
#define | GetProcPtr(obj, ptr) GetCoreDataFromValue((obj), rb_proc_t, (ptr))
#define | GetEnvPtr(obj, ptr) GetCoreDataFromValue((obj), rb_env_t, (ptr))
#define | GetBindingPtr(obj, ptr) GetCoreDataFromValue((obj), rb_binding_t, (ptr))
#define | VM_CALL_ARGS_SPLAT_BIT (0x01 << 1)
#define | VM_CALL_ARGS_BLOCKARG_BIT (0x01 << 2)
#define | VM_CALL_FCALL_BIT (0x01 << 3)
#define | VM_CALL_VCALL_BIT (0x01 << 4)
#define | VM_CALL_TAILCALL_BIT (0x01 << 5)
#define | VM_CALL_TAILRECURSION_BIT (0x01 << 6)
#define | VM_CALL_SUPER_BIT (0x01 << 7)
#define | VM_CALL_OPT_SEND_BIT (0x01 << 8)
#define | VM_FRAME_MAGIC_METHOD 0x11
#define | VM_FRAME_MAGIC_BLOCK 0x21
#define | VM_FRAME_MAGIC_CLASS 0x31
#define | VM_FRAME_MAGIC_TOP 0x41
#define | VM_FRAME_MAGIC_FINISH 0x51
#define | VM_FRAME_MAGIC_CFUNC 0x61
#define | VM_FRAME_MAGIC_PROC 0x71
#define | VM_FRAME_MAGIC_IFUNC 0x81
#define | VM_FRAME_MAGIC_EVAL 0x91
#define | VM_FRAME_MAGIC_LAMBDA 0xa1
#define | VM_FRAME_MAGIC_MASK_BITS 8
#define | VM_FRAME_MAGIC_MASK (~(~0<<VM_FRAME_MAGIC_MASK_BITS))
#define | VM_FRAME_TYPE(cfp) ((cfp)->flag & VM_FRAME_MAGIC_MASK)
#define | VM_FRAME_FLAG_PASSED 0x0100
#define | RUBYVM_CFUNC_FRAME_P(cfp) (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
#define | FUNC_FASTCALL(x) x
#define | GC_GUARDED_PTR(p) ((VALUE)((VALUE)(p) | 0x01))
#define | GC_GUARDED_PTR_REF(p) ((void *)(((VALUE)(p)) & ~0x03))
#define | GC_GUARDED_PTR_P(p) (((VALUE)(p)) & 0x01)
#define | RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) ((cfp)+1)
#define | RUBY_VM_NEXT_CONTROL_FRAME(cfp) ((cfp)-1)
#define | RUBY_VM_END_CONTROL_FRAME(th) ((rb_control_frame_t *)((th)->stack + (th)->stack_size))
#define | RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp) ((void *)(ecfp) > (void *)(cfp))
#define | RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) (!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
#define | RUBY_VM_IFUNC_P(ptr) (BUILTIN_TYPE(ptr) == T_NODE)
#define | RUBY_VM_NORMAL_ISEQ_P(ptr) ((ptr) && !RUBY_VM_IFUNC_P(ptr))
#define | RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp) ((rb_block_t *)(&(cfp)->self))
#define | RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) ((rb_control_frame_t *)((VALUE *)(b) - 5))
#define | SDR() rb_vmdebug_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
#define | SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_THREAD(), (cfp))
#define | sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
#define | GET_VM() ruby_current_vm
#define | GET_THREAD() ruby_current_thread
#define | rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th))
#define | rb_thread_set_current(th)
#define | RUBY_VM_SET_TIMER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x01)
#define | RUBY_VM_SET_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x02)
#define | RUBY_VM_SET_FINALIZER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x04)
#define | RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & 0x02)
#define | RUBY_VM_CHECK_INTS_TH(th)
#define | RUBY_VM_CHECK_INTS() RUBY_VM_CHECK_INTS_TH(GET_THREAD())
#define | EXEC_EVENT_HOOK(th, flag, self, id, klass)

## Typedefs

typedef unsigned long | rb_num_t
typedef struct rb_compile_option_struct | rb_compile_option_t
typedef struct rb_vm_struct | rb_vm_t
typedef struct rb_block_struct | rb_block_t
typedef RUBY_JMP_BUF | rb_jmpbuf_t
typedef struct rb_thread_struct | rb_thread_t
typedef struct iseq_inline_cache_entry * | IC
typedef VALUE | CDHASH
typedef rb_control_frame_t *FUNC_FASTCALL | rb_insn_func_t (rb_thread_t *, rb_control_frame_t *)
typedef int | rb_backtrace_iter_func (void *, VALUE, int, VALUE)

## Enumerations

enum | ruby_special_exceptions { ruby_error_reenter, ruby_error_nomemory, ruby_error_sysstack, ruby_error_closed_stream, ruby_special_error_count }
enum | rb_thread_status { THREAD_TO_KILL, THREAD_RUNNABLE, THREAD_STOPPED, THREAD_STOPPED_FOREVER, THREAD_KILLED }
enum | vm_special_object_type { VM_SPECIAL_OBJECT_VMCORE = 1, VM_SPECIAL_OBJECT_CBASE, VM_SPECIAL_OBJECT_CONST_BASE }

## Functions

void | rb_objspace_free (struct rb_objspace *)
VALUE | rb_iseq_new (NODE *, VALUE, VALUE, VALUE, VALUE, enum iseq_type)
VALUE | rb_iseq_new_top (NODE *node, VALUE name, VALUE filename, VALUE filepath, VALUE parent)
VALUE | rb_iseq_new_main (NODE *node, VALUE filename, VALUE filepath)
VALUE | rb_iseq_new_with_bopt (NODE *, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, VALUE)
VALUE | rb_iseq_new_with_opt (NODE *, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, const rb_compile_option_t *)
VALUE | rb_iseq_compile (VALUE src, VALUE file, VALUE line)
VALUE | rb_iseq_compile_with_option (VALUE src, VALUE file, VALUE filepath, VALUE line, VALUE opt)
VALUE | rb_iseq_disasm (VALUE self)
int | rb_iseq_disasm_insn (VALUE str, VALUE *iseqval, size_t pos, rb_iseq_t *iseq, VALUE child)
| Disassemble a instruction Iseq -> Iseq inspect object. More...
const char * | ruby_node_name (int node)
int | rb_iseq_first_lineno (rb_iseq_t *iseq)
void | rb_vm_change_state (void)
VALUE | rb_thread_alloc (VALUE klass)
VALUE | rb_proc_alloc (VALUE klass)
void | rb_vmdebug_stack_dump_raw (rb_thread_t *, rb_control_frame_t *)
void | rb_vm_bugreport (void)
VALUE | rb_iseq_eval (VALUE iseqval)
VALUE | rb_iseq_eval_main (VALUE iseqval)
void | rb_enable_interrupt (void)
void | rb_disable_interrupt (void)
int | rb_thread_method_id_and_class (rb_thread_t *th, ID *idp, VALUE *klassp)
VALUE | rb_vm_invoke_proc (rb_thread_t *th, rb_proc_t *proc, VALUE self, int argc, const VALUE *argv, const rb_block_t *blockptr)
VALUE | rb_vm_make_proc (rb_thread_t *th, const rb_block_t *block, VALUE klass)
VALUE | rb_vm_make_env_object (rb_thread_t *th, rb_control_frame_t *cfp)
void | rb_vm_rewrite_dfp_in_errinfo (rb_thread_t *th, rb_control_frame_t *cfp)
void | rb_vm_inc_const_missing_count (void)
void | rb_vm_gvl_destroy (rb_vm_t *vm)
VALUE | rb_vm_call (rb_thread_t *th, VALUE recv, VALUE id, int argc, const VALUE *argv, const rb_method_entry_t *me)
void | rb_unlink_method_entry (rb_method_entry_t *me)
void | rb_gc_mark_unlinked_live_method_entries (void *pvm)
void | rb_thread_start_timer_thread (void)
void | rb_thread_stop_timer_thread (int)
void | rb_thread_reset_timer_thread (void)
void | rb_thread_wakeup_timer_thread (void)
int | ruby_thread_has_gvl_p (void)
VALUE | rb_make_backtrace (void)
int | rb_backtrace_each (rb_backtrace_iter_func *iter, void *arg)
rb_control_frame_t * | rb_vm_get_ruby_level_next_cfp (rb_thread_t *th, rb_control_frame_t *cfp)
int | rb_vm_get_sourceline (const rb_control_frame_t *)
VALUE | rb_name_err_mesg_new (VALUE obj, VALUE mesg, VALUE recv, VALUE method)
void | rb_vm_stack_to_heap (rb_thread_t *th)
void | ruby_thread_init_stack (rb_thread_t *th)
| NOINLINE (void rb_gc_save_machine_context(rb_thread_t *))
void | rb_gc_mark_machine_stack (rb_thread_t *th)
int | rb_signal_buff_size (void)
void | rb_signal_exec (rb_thread_t *th, int sig)
void | rb_threadptr_check_signal (rb_thread_t *mth)
void | rb_threadptr_signal_raise (rb_thread_t *th, int sig)
void | rb_threadptr_signal_exit (rb_thread_t *th)
void | rb_threadptr_execute_interrupts (rb_thread_t *)
void | rb_threadptr_interrupt (rb_thread_t *th)
void | rb_threadptr_unlock_all_locking_mutexes (rb_thread_t *th)
void | rb_thread_lock_unlock (rb_thread_lock_t *)
void | rb_thread_lock_destroy (rb_thread_lock_t *)
void | rb_threadptr_exec_event_hooks (rb_thread_t *th, rb_event_flag_t flag, VALUE self, ID id, VALUE klass)
int | rb_thread_check_trap_pending (void)
VALUE | rb_get_coverages (void)
void | rb_set_coverages (VALUE)
void | rb_reset_coverages (void)

## Variables

const rb_data_type_t | ruby_threadptr_data_type
RUBY_EXTERN VALUE | rb_cISeq
RUBY_EXTERN VALUE | rb_cRubyVM
RUBY_EXTERN VALUE | rb_cEnv
RUBY_EXTERN VALUE | rb_mRubyVMFrozenCore
RUBY_EXTERN rb_thread_t * | ruby_current_thread
rb_vm_t * | ruby_current_vm

## Macro Definition Documentation

#define ALT_STACK_SIZE (4*1024)

Definition at line 389 of file vm_core.h.

Referenced by init_heap(), and th_init().

#define ENABLE_VM_OBJSPACE 1

Definition at line 46 of file vm_core.h.

#define EXEC_EVENT_HOOK | ( |  | th,
|  |  | flag,
|  |  | self,
|  |  | id,
|  |  | klass
| ) |  |

Value:
do { \
rb_event_flag_t wait_event__ = (th)->event_flags; \
if (UNLIKELY(wait_event__)) { \
if (wait_event__ & ((flag) | RUBY_EVENT_VM)) { \
rb_threadptr_exec_event_hooks((th), (flag), (self), (id), (klass)); \
} \
} \
} while (0)

Definition at line 733 of file vm_core.h.

Referenced by rb_iterate(), rb_raise_jump(), rb_threadptr_execute_interrupts_common(), setup_exception(), vm_call0(), vm_call_bmethod(), vm_call_cfunc(), and vm_exec().

#define FUNC_FASTCALL | ( |  | x | ) | x

Definition at line 600 of file vm_core.h.

#define GC_GUARDED_PTR | ( |  | p | ) | ((VALUE)((VALUE)(p) | 0x01))

Definition at line 606 of file vm_core.h.

Referenced by invoke_block_from_c(), rb_vm_make_proc(), vm_make_env_each(), vm_push_frame(), vm_set_eval_stack(), vm_yield_with_cfunc(), and yield_under().

#define GC_GUARDED_PTR_P | ( |  | p | ) | (((VALUE)(p)) & 0x01)

Definition at line 608 of file vm_core.h.

#define GC_GUARDED_PTR_REF | ( |  | p | ) | ((void *)(((VALUE)(p)) & ~0x03))

Definition at line 607 of file vm_core.h.

Referenced by check_block(), proc_new(), rb_block_given_p(), rb_f_block_given_p(), rb_f_local_variables(), rb_iterate(), rb_vm_make_proc(), rb_vmdebug_stack_dump_raw(), vm_iter_break(), vm_make_env_each(), vm_throw(), and yield_under().

#define GET_THREAD | ( |  | ) | ruby_current_thread

Definition at line 689 of file vm_core.h.

Referenced by call_trace_func(), check_funcall(), cont_capture(), cont_free(), cont_new(), cont_restore_thread(), default_handler(), do_select(), err_append(), error_handle(), error_print(), eval_string_with_cref(), eval_under(), fiber_store(), fiber_switch(), fiber_t_alloc(), gc_marks(), get_errinfo(), Init_Cont(), init_heap(), Init_signal(), Init_Thread(), Init_VM(), m_core_define_method(), m_core_define_singleton_method(), m_core_set_postexe(), method_entry_of_iseq(), method_missing(), parse_string(), prepare_iseq_build(), proc_call(), proc_new(), process_options(), rb_add_method(), rb_backtrace(), rb_backtrace_each(), rb_barrier_wait(), rb_binding_new(), rb_block_given_p(), rb_bug(), rb_call0(), rb_call_super(), rb_catch_obj(), rb_check_deadlock(), rb_cont_call(), rb_current_realfilepath(), rb_dvar_defined(), rb_errinfo(), rb_eval_string_wrap(), rb_exit(), rb_f_abort(), rb_f_block_given_p(), rb_f_caller(), rb_f_local_variables(), rb_fiber_current(), rb_fiber_start(), rb_frame_callee(), rb_frame_caller(), rb_frame_method_id_and_class(), rb_frame_pop(), rb_frame_this_func(), rb_funcall_passing_block(), rb_gc_register_mark_object(), rb_iseq_compile_with_option(), rb_iseq_eval(), rb_iseq_eval_main(), rb_iseq_new_main(), rb_iter_break(), rb_iterate(), rb_last_status_clear(), rb_last_status_get(), rb_last_status_set(), rb_load_internal(), rb_local_defined(), rb_longjmp(), rb_make_backtrace(), rb_memerror(), rb_method_call(), rb_method_missing(), rb_mutex_lock(), rb_mutex_trylock(), rb_mutex_unlock(), rb_parse_in_eval(), rb_parse_in_main(), rb_proc_call(), rb_proc_call_with_block(), rb_protect(), rb_raise_jump(), rb_require_safe(), rb_rescue2(), rb_safe_level(), rb_set_end_proc(), rb_set_errinfo(), rb_set_safe_level(), rb_set_safe_level_force(), rb_sourcefile(), rb_sourceline(), rb_thread_alone(), rb_thread_atfork(), rb_thread_atfork_internal(), rb_thread_blocking_region(), rb_thread_blocking_region_begin(), rb_thread_blocking_region_end(), rb_thread_current(), rb_thread_exit(), rb_thread_fd_close(), rb_thread_io_blocking_region(), rb_thread_kill(), rb_thread_list(), rb_thread_local_aref(), rb_thread_local_aset(), rb_thread_main(), rb_thread_mark(), rb_thread_polling(), rb_thread_s_abort_exc(), rb_thread_s_abort_exc_set(), rb_thread_schedule(), rb_thread_schedule_limits(), rb_thread_sleep_deadly(), rb_thread_sleep_forever(), rb_thread_terminate_all(), rb_thread_wait_for(), rb_throw_obj(), rb_vm_call_cfunc(), rb_vm_cbase(), rb_vm_cref(), rb_vm_make_jump_tag_but_local_jump(), rb_vmdebug_stack_dump_raw_current(), rb_yield_0(), require_libraries(), return_fiber(), ruby_cleanup(), ruby_exec_internal(), ruby_finalize_1(), ruby_options(), ruby_stack_length(), ruby_suppress_tracing(), ruby_thread_init(), safe_setter(), send_internal(), set_relation(), set_trace_func(), slot_sweep(), stack_check(), thgroup_list(), thread_create_core(), thread_join(), top_include(), update_coverage(), vm_search_superclass(), vm_svar_get(), vm_svar_set(), and yield_under().

#define GET_VM | ( |  | ) | ruby_current_vm

Definition at line 688 of file vm_core.h.

Referenced by before_gc_sweep(), bm_free(), get_loaded_features(), get_loading_table(), Init_load(), Init_top_self(), load_lock(), process_options(), push_include(), rb_add_event_hook(), rb_clear_trace_func(), rb_get_coverages(), rb_get_load_path(), rb_remove_event_hook(), rb_reset_coverages(), rb_ruby_debug_ptr(), rb_ruby_verbose_ptr(), rb_set_coverages(), rb_signal_exec(), rb_trap_exit(), rb_unlink_method_entry(), rb_vm_bugreport(), rb_vm_set_progname(), rb_vm_top_self(), ruby_cleanup(), ruby_init(), ruby_init_loadpath_safe(), ruby_vm_at_exit(), set_threads_event_flags(), thread_create_core(), thread_s_new(), timer_thread_function(), and trap().

#define GetBindingPtr | ( |  | obj,
|  |  | ptr
| ) |  | GetCoreDataFromValue((obj), rb_binding_t, (ptr))

Definition at line 546 of file vm_core.h.

Referenced by binding_dup(), eval_string_with_cref(), proc_binding(), process_options(), rb_binding_new(), and vm_set_main_stack().

#define GetCoreDataFromValue | ( |  | obj,
|  |  | type,
|  |  | ptr
| ) |  |

Value:
do { \
(ptr) = (type*)DATA_PTR(obj); \
} while (0)

Definition at line 139 of file vm_core.h.

#define GetEnvPtr | ( |  | obj,
|  |  | ptr
| ) |  | GetCoreDataFromValue((obj), rb_env_t, (ptr))

Definition at line 535 of file vm_core.h.

Referenced by check_env_value(), collect_local_variables_in_env(), eval_string_with_cref(), process_options(), rb_vm_rewrite_dfp_in_errinfo(), rb_vmdebug_env_dump_raw(), rb_vmdebug_proc_dump_raw(), vm_collect_local_variables_in_heap(), vm_make_env_each(), and vm_set_main_stack().

#define GetISeqPtr | ( |  | obj,
|  |  | ptr
| ) |  | GetCoreDataFromValue((obj), rb_iseq_t, (ptr))

Definition at line 146 of file vm_core.h.

Referenced by clone_method(), eval_string_with_cref(), Init_VM(), iseq_check(), iseq_data_to_ary(), iseq_inspect(), iseq_load(), iseq_set_sequence(), m_core_set_postexe(), rb_iseq_build_for_ruby2cext(), rb_iseq_clone(), rb_iseq_compile_node(), rb_iseq_new_with_bopt_and_opt(), set_relation(), vm_define_method(), vm_exec(), vm_set_eval_stack(), vm_set_main_stack(), and vm_set_top_stack().

#define GetProcPtr | ( |  | obj,
|  |  | ptr
| ) |  | GetCoreDataFromValue((obj), rb_proc_t, (ptr))

Definition at line 522 of file vm_core.h.

Referenced by block_proc_is_lambda(), caller_setup_args(), iseq_s_disasm(), make_curry_proc(), method_proc(), proc_binding(), proc_call(), proc_dup(), proc_eq(), proc_hash(), proc_new(), proc_to_s(), rb_fiber_start(), rb_mod_define_method(), rb_proc_arity(), rb_proc_call(), rb_proc_call_with_block(), rb_proc_get_iseq(), rb_proc_lambda_p(), rb_vm_make_proc(), thread_start_func_2(), trap_handler(), vm_call0(), vm_call_bmethod(), vm_call_method(), and vm_callee_setup_arg_complex().

#define GetThreadPtr | ( |  | obj,
|  |  | ptr
| ) |  | TypedData_Get_Struct((obj), rb_thread_t, &ruby_threadptr_data_type, (ptr))

Definition at line 355 of file vm_core.h.

Referenced by check_deadlock_i(), clear_trace_func_i(), cont_mark(), rb_fiber_reset_root_local_storage(), rb_thread_abort_exc(), rb_thread_abort_exc_set(), rb_thread_alive_p(), rb_thread_backtrace(), rb_thread_execute_interrupts(), rb_thread_group(), rb_thread_inspect(), rb_thread_interrupted(), rb_thread_key_p(), rb_thread_keys(), rb_thread_kill(), rb_thread_local_aref(), rb_thread_local_aset(), rb_thread_priority(), rb_thread_priority_set(), rb_thread_safe_level(), rb_thread_status(), rb_thread_stop_p(), rb_thread_wakeup_alive(), rb_vmdebug_stack_dump_th(), rb_vmdebug_thread_dump_regs(), rb_vmdebug_thread_dump_state(), ruby_thread_init(), set_threads_event_flags_i(), terminate_atfork_before_exec_i(), terminate_atfork_i(), terminate_i(), thgroup_add(), thgroup_list_i(), thread_add_trace_func_m(), thread_create_core(), thread_fd_close_i(), thread_initialize(), thread_join_m(), thread_list_i(), thread_raise_m(), thread_s_new(), thread_set_trace_func_m(), thread_value(), and thval2thread_t().

#define GetVMPtr | ( |  | obj,
|  |  | ptr
| ) |  | GetCoreDataFromValue((obj), rb_vm_t, (ptr))

Definition at line 268 of file vm_core.h.

#define LIKELY | ( |  | x | ) | (x)

Definition at line 110 of file vm_core.h.

Referenced by vm_getivar(), vm_method_search(), vm_setivar(), and vm_setup_method().

#define NSIG (_SIGMAX + 1) /* For QNX */

Definition at line 54 of file vm_core.h.

Referenced by esignal_init(), and trap_signm().

#define rb_thread_set_current | ( |  | th | ) |

Value:
do { \
if ((th)->vm->running_thread != (th)) { \
(th)->vm->running_thread->running_time_us = 0; \
} \
rb_thread_set_current_raw(th); \
(th)->vm->running_thread = (th); \
} while (0)

Definition at line 691 of file vm_core.h.

Referenced by blocking_region_end(), Init_VM(), rb_thread_schedule_limits(), and thread_start_func_2().

#define rb_thread_set_current_raw | ( |  | th | ) | (void)(ruby_current_thread = (th))

Definition at line 690 of file vm_core.h.

Referenced by Init_BareVM().

#define RUBY_NSIG NSIG

Definition at line 57 of file vm_core.h.

Referenced by rb_get_next_signal(), and rb_vm_mark().

#define RUBY_VM_CHECK_INTS | ( |  | ) | RUBY_VM_CHECK_INTS_TH(GET_THREAD())

Definition at line 726 of file vm_core.h.

Referenced by fiber_switch(), rb_mutex_lock(), rb_thread_blocking_region_end(), rb_thread_check_ints(), rb_thread_polling(), rb_waitpid(), ruby_cleanup(), set_unblock_function(), sleep_forever(), sleep_timeval(), vm_call0(), and vm_call_method().

#define RUBY_VM_CHECK_INTS_TH | ( |  | th | ) |

Value:
do { \
if (UNLIKELY((th)->interrupt_flag)) { \
rb_threadptr_execute_interrupts(th); \
} \
} while (0)

Definition at line 720 of file vm_core.h.

#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P | ( |  | th,
|  |  | cfp
| ) |  | (!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))

Definition at line 616 of file vm_core.h.

Referenced by rb_vm_get_ruby_level_next_cfp(), vm_get_ruby_level_caller_cfp(), vm_normal_frame(), and vm_search_superclass().

#define RUBY_VM_END_CONTROL_FRAME | ( |  | th | ) | ((rb_control_frame_t *)((th)->stack + (th)->stack_size))

Definition at line 612 of file vm_core.h.

Referenced by errinfo_place().

#define RUBY_VM_GET_BLOCK_PTR_IN_CFP | ( |  | cfp | ) | ((rb_block_t *)(&(cfp)->self))

Definition at line 623 of file vm_core.h.

Referenced by caller_setup_args(), eval_string_with_cref(), m_core_set_postexe(), and rb_iterate().

#define RUBY_VM_GET_CFP_FROM_BLOCK_PTR | ( |  | b | ) | ((rb_control_frame_t *)((VALUE *)(b) - 5))

Definition at line 624 of file vm_core.h.

Referenced by rb_vm_make_proc().

#define RUBY_VM_IFUNC_P | ( |  | ptr | ) | (BUILTIN_TYPE(ptr) == T_NODE)

Definition at line 619 of file vm_core.h.

Referenced by control_frame_dump(), frame_func_id(), proc_mark(), and rb_thread_method_id_and_class().

#define RUBY_VM_INTERRUPTED | ( |  | th | ) | ((th)->interrupt_flag & 0x02)

Definition at line 706 of file vm_core.h.

Referenced by check_deadlock_i(), lock_func(), and rb_thread_interrupted().

#define RUBY_VM_NEXT_CONTROL_FRAME | ( |  | cfp | ) | ((cfp)-1)

Definition at line 611 of file vm_core.h.

Referenced by vm_backtrace_each().

#define RUBY_VM_NORMAL_ISEQ_P | ( |  | ptr | ) | ((ptr) && !RUBY_VM_IFUNC_P(ptr))

Definition at line 620 of file vm_core.h.

Referenced by errinfo_place(), iseq_s_disasm(), proc_binding(), proc_to_s(), rb_proc_get_iseq(), rb_thread_mark(), rb_vm_get_ruby_level_next_cfp(), rb_vm_get_sourceline(), rb_vm_rewrite_dfp_in_errinfo(), rb_vmdebug_debug_print_register(), vm_get_cref0(), vm_get_ruby_level_caller_cfp(), vm_make_env_each(), and vm_pop_frame().

#define RUBY_VM_PREVIOUS_CONTROL_FRAME | ( |  | cfp | ) | ((cfp)+1)

Definition at line 610 of file vm_core.h.

Referenced by errinfo_place(), method_entry_of_iseq(), proc_new(), raise_method_missing(), rb_current_realfilepath(), rb_f_block_given_p(), rb_f_local_variables(), rb_frame_caller(), rb_frame_pop(), rb_iterate(), rb_raise_jump(), rb_thread_mark(), rb_vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(), rb_vm_stack_to_heap(), send_internal(), vm_exec(), vm_get_ruby_level_caller_cfp(), vm_normal_frame(), vm_pop_frame(), vm_search_superclass(), and vm_throw().

#define RUBY_VM_SET_FINALIZER_INTERRUPT | ( |  | th | ) | ATOMIC_OR((th)->interrupt_flag, 0x04)

Definition at line 705 of file vm_core.h.

Referenced by slot_sweep().

#define RUBY_VM_SET_INTERRUPT | ( |  | th | ) | ATOMIC_OR((th)->interrupt_flag, 0x02)

Definition at line 704 of file vm_core.h.

Referenced by rb_fiber_start(), rb_threadptr_interrupt(), and thread_fd_close_i().

#define RUBY_VM_SET_TIMER_INTERRUPT | ( |  | th | ) | ATOMIC_OR((th)->interrupt_flag, 0x01)

Definition at line 703 of file vm_core.h.

Referenced by timer_thread_function().

#define RUBY_VM_THREAD_MODEL 2

Definition at line 15 of file vm_core.h.

#define RUBY_VM_THREAD_STACK_SIZE (128 * 1024)

Definition at line 520 of file vm_core.h.

Referenced by th_init().

#define RUBY_VM_VALID_CONTROL_FRAME_P | ( |  | cfp,
|  |  | ecfp
| ) |  | ((void *)(ecfp) > (void *)(cfp))

Definition at line 614 of file vm_core.h.

Referenced by errinfo_place().

#define RUBYVM_CFUNC_FRAME_P | ( |  | cfp | ) | (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)

Definition at line 589 of file vm_core.h.

Referenced by vm_backtrace_each().

#define SDR | ( |  | ) | rb_vmdebug_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)

Definition at line 633 of file vm_core.h.

Referenced by rb_vm_bugreport(), vm_make_env_each(), vm_pop_frame(), and vm_push_frame().

#define SDR2 | ( |  | cfp | ) | rb_vmdebug_stack_dump_raw(GET_THREAD(), (cfp))

Definition at line 634 of file vm_core.h.

Referenced by rb_vmdebug_debug_print_post().

#define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]

Definition at line 680 of file vm_core.h.

Referenced by Init_Proc(), make_exception(), ruby_thread_stack_overflow(), setup_exception(), stack_check(), and vm_push_frame().

#define UNINITIALIZED_VAR | ( |  | x | ) | x

Definition at line 117 of file vm_core.h.

Referenced by do_select().

#define UNLIKELY | ( |  | x | ) | (x)

Definition at line 111 of file vm_core.h.

Referenced by iseq_set_sequence(), rb_iterate(), rb_method_call_status(), rb_newobj(), rb_thread_schedule(), vm_exec(), vm_exec_core(), and vm_getivar().

#define va_init_list | ( |  | a,
|  |  | b
| ) |  | va_start((a))

Definition at line 64 of file vm_core.h.

#define VM_CALL_ARGS_BLOCKARG_BIT (0x01 << 2)

Definition at line 557 of file vm_core.h.

Referenced by caller_setup_args(), iseq_compile_each(), and setup_args().

#define VM_CALL_ARGS_SPLAT_BIT (0x01 << 1)

Definition at line 556 of file vm_core.h.

Referenced by caller_setup_args(), iseq_compile_each(), and setup_args().

#define VM_CALL_FCALL_BIT (0x01 << 3)

Definition at line 558 of file vm_core.h.

Referenced by iseq_compile_each(), and vm_call_method().

#define VM_CALL_OPT_SEND_BIT (0x01 << 8)

Definition at line 563 of file vm_core.h.

Referenced by vm_call_method().

#define VM_CALL_SUPER_BIT (0x01 << 7)

Definition at line 562 of file vm_core.h.

Referenced by vm_call_method().

#define VM_CALL_TAILCALL_BIT (0x01 << 5)

Definition at line 560 of file vm_core.h.

Referenced by iseq_peephole_optimize(), and vm_setup_method().

#define VM_CALL_TAILRECURSION_BIT (0x01 << 6)

Definition at line 561 of file vm_core.h.

#define VM_CALL_VCALL_BIT (0x01 << 4)

Definition at line 559 of file vm_core.h.

Referenced by iseq_compile_each(), and vm_call_method().

#define VM_FRAME_FLAG_PASSED 0x0100

Definition at line 587 of file vm_core.h.

Referenced by vm_get_ruby_level_caller_cfp().

#define VM_FRAME_MAGIC_BLOCK 0x21

Definition at line 572 of file vm_core.h.

Referenced by control_frame_dump(), invoke_block_from_c(), vm_exec(), and vm_invoke_block().

#define VM_FRAME_MAGIC_CFUNC 0x61

Definition at line 576 of file vm_core.h.

Referenced by control_frame_dump(), rb_iterate(), vm_call0(), vm_call_cfunc(), and vm_exec().

#define VM_FRAME_MAGIC_CLASS 0x31

Definition at line 573 of file vm_core.h.

Referenced by control_frame_dump(), and vm_exec().

#define VM_FRAME_MAGIC_EVAL 0x91

Definition at line 579 of file vm_core.h.

Referenced by control_frame_dump(), and vm_set_eval_stack().

#define VM_FRAME_MAGIC_FINISH 0x51

Definition at line 575 of file vm_core.h.

Referenced by control_frame_dump(), rb_vm_make_env_object(), rb_vm_set_finish_env(), rb_vmdebug_debug_print_pre(), and vm_exec().

#define VM_FRAME_MAGIC_IFUNC 0x81

Definition at line 578 of file vm_core.h.

Referenced by control_frame_dump(), and vm_yield_with_cfunc().

#define VM_FRAME_MAGIC_LAMBDA 0xa1

Definition at line 580 of file vm_core.h.

Referenced by control_frame_dump(), invoke_block_from_c(), and vm_throw().

#define VM_FRAME_MAGIC_MASK (~(~0<<VM_FRAME_MAGIC_MASK_BITS))

Definition at line 582 of file vm_core.h.

#define VM_FRAME_MAGIC_MASK_BITS 8

Definition at line 581 of file vm_core.h.

#define VM_FRAME_MAGIC_METHOD 0x11

Definition at line 571 of file vm_core.h.

Referenced by control_frame_dump(), vm_exec(), and vm_setup_method().

#define VM_FRAME_MAGIC_PROC 0x71

Definition at line 577 of file vm_core.h.

Referenced by control_frame_dump().

#define VM_FRAME_MAGIC_TOP 0x41

Definition at line 574 of file vm_core.h.

Referenced by control_frame_dump(), rb_vm_call_cfunc(), th_init(), and vm_set_top_stack().

#define VM_FRAME_TYPE | ( |  | cfp | ) | ((cfp)->flag & VM_FRAME_MAGIC_MASK)

Definition at line 584 of file vm_core.h.

Referenced by control_frame_dump(), rb_iterate(), rb_vm_make_env_object(), rb_vmdebug_debug_print_pre(), vm_exec(), and vm_throw().

## Typedef Documentation

typedef VALUE CDHASH

Definition at line 597 of file vm_core.h.

typedef struct iseq_inline_cache_entry* IC

Definition at line 593 of file vm_core.h.

typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE)

Definition at line 669 of file vm_core.h.

typedef struct rb_block_struct rb_block_t

typedef struct rb_compile_option_struct rb_compile_option_t

Definition at line 126 of file vm_core.h.

typedef rb_control_frame_t* FUNC_FASTCALL rb_insn_func_t(rb_thread_t *, rb_control_frame_t *)

Definition at line 604 of file vm_core.h.

typedef RUBY_JMP_BUF rb_jmpbuf_t

Definition at line 366 of file vm_core.h.

typedef unsigned long rb_num_t

Definition at line 120 of file vm_core.h.

typedef struct rb_thread_struct rb_thread_t

typedef struct rb_vm_struct rb_vm_t

## Enumeration Type Documentation

enum rb_thread_status

Enumerator
THREAD_TO_KILL |
THREAD_RUNNABLE |
THREAD_STOPPED |
THREAD_STOPPED_FOREVER |
THREAD_KILLED |

Definition at line 358 of file vm_core.h.

enum ruby_special_exceptions

Enumerator
ruby_error_reenter |
ruby_error_nomemory |
ruby_error_sysstack |
ruby_error_closed_stream |
ruby_special_error_count |

Definition at line 260 of file vm_core.h.

enum vm_special_object_type

Enumerator
VM_SPECIAL_OBJECT_VMCORE |
VM_SPECIAL_OBJECT_CBASE |
VM_SPECIAL_OBJECT_CONST_BASE |

Definition at line 565 of file vm_core.h.

## Function Documentation

NOINLINE | ( | void | rb_gc_save_machine_contextrb_thread_t * | ) |

int rb_backtrace_each | ( | rb_backtrace_iter_func * | iter,
|  | void * | arg
| ) |  |

Definition at line 1665 of file vm_eval.c.

References GET_THREAD, NULL, and vm_backtrace_each().

Referenced by rb_vm_bugreport().

void rb_disable_interrupt | ( | void |  | ) |

Definition at line 524 of file signal.c.

References NULL, and pthread_sigmask().

Referenced by after_exec(), and rb_get_next_signal().

void rb_enable_interrupt | ( | void |  | ) |

Definition at line 536 of file signal.c.

References NULL, and pthread_sigmask().

Referenced by before_exec(), and rb_get_next_signal().

void rb_gc_mark_machine_stack | ( | rb_thread_t * | th | ) |

Definition at line 2519 of file gc.c.

References GET_STACK_BOUNDS, rb_gc_mark_locations, and rb_objspace.

Referenced by rb_thread_mark().

void rb_gc_mark_unlinked_live_method_entries | ( | void * | pvm | ) |

Definition at line 99 of file vm_method.c.

References rb_method_entry_struct::mark, unlinked_method_entry_list_entry::me, unlinked_method_entry_list_entry::next, rb_mark_method_entry(), and rb_vm_struct::unlinked_method_entry_list.

Referenced by gc_marks().

VALUE rb_get_coverages | ( | void |  | ) |

Definition at line 4817 of file thread.c.

References GET_VM.

VALUE rb_iseq_compile | ( | VALUE | src,
|  | VALUE | file,
|  | VALUE | line
| ) |  |

Definition at line 571 of file iseq.c.

References Qnil, and rb_iseq_compile_with_option().

Referenced by eval_string_with_cref().

VALUE rb_iseq_compile_with_option | ( | VALUE | src,
|  | VALUE | file,
|  | VALUE | filepath,
|  | VALUE | line,
|  | VALUE | opt
| ) |  |

Definition at line 550 of file iseq.c.

References rb_thread_struct::base_block, GET_THREAD, rb_block_struct::iseq, make_compile_option(), rb_iseq_struct::name, NUM2INT, parse_string(), Qfalse, rb_iseq_new_with_opt(), rb_str_new2(), rb_iseq_struct::self, StringValue, and StringValueCStr.

VALUE rb_iseq_disasm | ( | VALUE | self | ) |

Definition at line 919 of file iseq.c.

References rb_iseq_struct::arg_block, rb_iseq_struct::arg_opt_table, rb_iseq_struct::arg_opts, rb_iseq_struct::arg_post_len, rb_iseq_struct::arg_post_start, rb_iseq_struct::arg_rest, rb_iseq_struct::arg_simple, argc, rb_iseq_struct::argc, rb_iseq_struct::catch_table, rb_iseq_struct::catch_table_size, catch_type(), iseq_catch_table_entry::cont, iseq_catch_table_entry::end, i, iseq_catch_table_entry::iseq, rb_iseq_struct::iseq, iseq_check(), iseq_inspect(), rb_iseq_struct::iseq_size, rb_iseq_struct::local_size, rb_iseq_struct::local_table, rb_iseq_struct::local_table_size, name, PRIdVALUE, RARRAY_LEN, rb_ary_entry(), rb_ary_new(), rb_id2name(), rb_iseq_disasm(), rb_iseq_disasm_insn(), rb_secure(), rb_str_cat2(), rb_str_catf(), rb_str_concat(), rb_str_new(), rb_str_resize(), RSTRING_LEN, RSTRING_PTR, rb_iseq_struct::self, size, snprintf, iseq_catch_table_entry::sp, iseq_catch_table_entry::start, and iseq_catch_table_entry::type.

Referenced by eval_string_with_cref(), Init_ISeq(), iseq_s_disasm(), iseq_setup(), process_options(), and rb_iseq_disasm().

int rb_iseq_disasm_insn | ( | VALUE | str,
|  | VALUE * | iseqval,
|  | size_t | pos,
|  | rb_iseq_t * | iseq,
|  | VALUE | child
| ) |  |

Disassemble a instruction Iseq -> Iseq inspect object.

Definition at line 837 of file iseq.c.

References find_line_no(), find_prev_line_no(), get_insn_info(), insn_operand_intern(), len, iseq_insn_info_entry::line_no, PRIdSIZE, rb_str_cat2(), rb_str_catf(), rb_str_concat(), rb_str_new(), RSTRING_LEN, RSTRING_PTR, and iseq_insn_info_entry::sp.

Referenced by rb_iseq_disasm(), and rb_vmdebug_debug_print_pre().

VALUE rb_iseq_eval | ( | VALUE | iseqval | ) |

Definition at line 1439 of file vm.c.

References GET_THREAD, vm_exec(), and vm_set_top_stack().

Referenced by iseq_eval(), prelude_eval(), and rb_load_internal().

VALUE rb_iseq_eval_main | ( | VALUE | iseqval | ) |

Definition at line 1453 of file vm.c.

References GET_THREAD, vm_exec(), and vm_set_main_stack().

Referenced by ruby_exec_internal().

int rb_iseq_first_lineno | ( | rb_iseq_t * | iseq | ) |

Definition at line 675 of file iseq.c.

References FIX2INT, and rb_iseq_struct::line_no.

Referenced by iseq_location(), proc_binding(), proc_to_s(), and rb_method_entry_make().

VALUE rb_iseq_new | ( | NODE * | ,
|  | VALUE | ,
|  | VALUE | ,
|  | VALUE | ,
|  | VALUE | ,
|  | enum | iseq_type
| ) |  |

Definition at line 376 of file iseq.c.

References INT2FIX, and rb_iseq_new_with_opt().

Referenced by Init_VM(), and rb_vm_call_cfunc().

VALUE rb_iseq_new_main | ( | NODE * | node,
|  | VALUE | filename,
|  | VALUE | filepath
| ) |  |

Definition at line 391 of file iseq.c.

References rb_thread_struct::base_block, GET_THREAD, INT2FIX, rb_block_struct::iseq, rb_iseq_new_with_opt(), rb_str_new2(), and rb_iseq_struct::self.

Referenced by process_options().

VALUE rb_iseq_new_top | ( | NODE * | node,
|  | VALUE | name,
|  | VALUE | filename,
|  | VALUE | filepath,
|  | VALUE | parent
| ) |  |

Definition at line 384 of file iseq.c.

References INT2FIX, and rb_iseq_new_with_opt().

Referenced by rb_load_internal().

VALUE rb_iseq_new_with_bopt | ( | NODE * | ,
|  | VALUE | ,
|  | VALUE | ,
|  | VALUE | ,
|  | VALUE | ,
|  | VALUE | ,
|  | enum | iseq_type,
|  | VALUE |
| ) |  |

Definition at line 427 of file iseq.c.

References rb_iseq_new_with_bopt_and_opt().

VALUE rb_iseq_new_with_opt | ( | NODE * | ,
|  | VALUE | ,
|  | VALUE | ,
|  | VALUE | ,
|  | VALUE | ,
|  | VALUE | ,
|  | enum | iseq_type,
|  | const rb_compile_option_t * |
| ) |  |

Definition at line 417 of file iseq.c.

References Qfalse, and rb_iseq_new_with_bopt_and_opt().

Referenced by iseq_s_compile_file(), new_child_iseq(), rb_iseq_compile_with_option(), rb_iseq_new(), rb_iseq_new_main(), and rb_iseq_new_top().

VALUE rb_make_backtrace | ( | void |  | ) |

Definition at line 1640 of file vm_eval.c.

References GET_THREAD, and vm_backtrace().

VALUE rb_name_err_mesg_new | ( | VALUE | obj,
|  | VALUE | mesg,
|  | VALUE | recv,
|  | VALUE | method
| ) |  |

Definition at line 911 of file error.c.

References ALLOC_N, NAME_ERR_MESG_COUNT, rb_cNameErrorMesg, RB_GC_GUARD, result, and TypedData_Wrap_Struct.

Referenced by Init_Exception(), and raise_method_missing().

void rb_objspace_free | ( | struct rb_objspace * |  | ) |

Definition at line 470 of file gc.c.

References free(), global_List, rb_objspace::heap, heaps, heaps_used, i, list, heaps_slot::membase, gc_list::next, rb_objspace::profile, rb_objspace::record, rest_sweep(), sorted_heaps_slot::slot, and rb_objspace::sorted.

Referenced by ruby_vm_destruct().

VALUE rb_proc_alloc | ( | VALUE | klass | ) |

Definition at line 81 of file proc.c.

References TypedData_Make_Struct.

Referenced by proc_dup(), and rb_vm_make_proc().

void rb_reset_coverages | ( | void |  | ) |

Definition at line 4830 of file thread.c.

References GET_VM, Qfalse, rb_remove_event_hook(), and update_coverage().

Referenced by rb_coverage_result().

void rb_set_coverages | ( | VALUE |  | ) |

Definition at line 4823 of file thread.c.

References GET_VM, Qnil, rb_add_event_hook(), RUBY_EVENT_COVERAGE, and update_coverage().

Referenced by rb_coverage_start().

int rb_signal_buff_size | ( | void |  | ) |

Definition at line 510 of file signal.c.

References signal_buff.

Referenced by rb_thread_check_trap_pending(), and rb_threadptr_check_signal().

void rb_signal_exec | ( | rb_thread_t * | th,
|  | int | sig
| ) |  |

Definition at line 634 of file signal.c.

References rb_vm_struct::cmd, GET_VM, Qundef, rb_interrupt(), rb_threadptr_signal_exit(), rb_threadptr_signal_raise(), rb_vm_struct::safe, SIGINT, signal_exec(), and rb_vm_struct::trap_list.

Referenced by rb_threadptr_execute_interrupts_common().

VALUE rb_thread_alloc | ( | VALUE | klass | ) |

Definition at line 1904 of file vm.c.

References ruby_thread_init(), and thread_alloc().

Referenced by rb_thread_create(), thread_s_new(), and thread_start().

int rb_thread_check_trap_pending | ( | void |  | ) |

Definition at line 993 of file thread.c.

References rb_signal_buff_size().

Referenced by ip_rbTkWaitCommand(), ip_rbUpdateCommand(), ip_rbVwaitCommand(), and trap_check().

void rb_thread_lock_destroy | ( | rb_thread_lock_t * |  | ) |

Definition at line 259 of file thread.c.

void rb_thread_lock_unlock | ( | rb_thread_lock_t * |  | ) |

Definition at line 253 of file thread.c.

int rb_thread_method_id_and_class | ( | rb_thread_t * | th,
|  | ID * | idp,
|  | VALUE * | klassp
| ) |  |

Definition at line 1467 of file vm.c.

References rb_thread_struct::cfp, CONST_ID, rb_method_entry_struct::def, rb_iseq_struct::defined_method_id, iseq_catch_table_entry::iseq, rb_control_frame_t::iseq, rb_method_entry_struct::klass, rb_iseq_struct::klass, rb_iseq_struct::local_iseq, rb_control_frame_t::me, rb_method_definition_struct::original_id, rb_iseq_struct::parent_iseq, and RUBY_VM_IFUNC_P.

Referenced by call_trace_proc(), and rb_frame_method_id_and_class().

void rb_thread_reset_timer_thread | ( | void |  | ) |

Definition at line 3040 of file thread.c.

Referenced by after_exec().

void rb_thread_start_timer_thread | ( | void |  | ) |

Definition at line 3046 of file thread.c.

References system_working.

Referenced by after_exec().

void rb_thread_stop_timer_thread | ( | int |  | ) |

Definition at line 3032 of file thread.c.

Referenced by before_exec(), and ruby_cleanup().

void rb_thread_wakeup_timer_thread | ( | void |  | ) |

Referenced by sighandler().

void rb_threadptr_check_signal | ( | rb_thread_t * | mth | ) |

Definition at line 2999 of file thread.c.

References rb_signal_buff_size(), and rb_threadptr_interrupt().

Referenced by ruby_cleanup(), and timer_thread_function().

void rb_threadptr_exec_event_hooks | ( | rb_thread_t * | th,
|  | rb_event_flag_t | flag,
|  | VALUE | self,
|  | ID | id,
|  | VALUE | klass
| ) |  |

Definition at line 4182 of file thread.c.

References rb_thread_struct::errinfo, event_call_args::event, EVENT_RUNNING_EVENT_MASK, FALSE, id, event_call_args::id, event_call_args::klass, event_call_args::proc, event_call_args::self, event_call_args::th, thread_exec_event_hooks(), and thread_suppress_tracing().

void rb_threadptr_execute_interrupts | ( | rb_thread_t * |  | ) |

Definition at line 1333 of file thread.c.

References rb_threadptr_execute_interrupts_common().

void rb_threadptr_interrupt | ( | rb_thread_t * | th | ) |

Definition at line 292 of file thread.c.

References rb_unblock_callback::arg, rb_unblock_callback::func, rb_thread_struct::interrupt_lock, RUBY_VM_SET_INTERRUPT, and rb_thread_struct::unblock.

Referenced by rb_thread_kill(), rb_threadptr_check_signal(), rb_threadptr_ready(), ruby_cleanup(), terminate_i(), and thread_start_func_2().

void rb_threadptr_signal_exit | ( | rb_thread_t * | th | ) |

Definition at line 1392 of file thread.c.

References argv, rb_vm_struct::main_thread, rb_eSystemExit, rb_str_new2(), rb_threadptr_raise(), and rb_thread_struct::vm.

Referenced by rb_signal_exec().

void rb_threadptr_signal_raise | ( | rb_thread_t * | th,
|  | int | sig
| ) |  |

Definition at line 1382 of file thread.c.

References argv, INT2FIX, rb_vm_struct::main_thread, rb_eSignal, rb_threadptr_raise(), and rb_thread_struct::vm.

Referenced by rb_signal_exec().

void rb_threadptr_unlock_all_locking_mutexes | ( | rb_thread_t * | th | ) |

Definition at line 338 of file thread.c.

References err, rb_thread_struct::keeping_mutexes, rb_mutex_struct::next_mutex, rb_bug(), and rb_mutex_unlock_th().

Referenced by rb_thread_terminate_all(), ruby_cleanup(), and thread_start_func_2().

void rb_unlink_method_entry | ( | rb_method_entry_t * | me | ) |

Definition at line 90 of file vm_method.c.

References ALLOC, GET_VM, unlinked_method_entry_list_entry::me, and unlinked_method_entry_list_entry::next.

Referenced by rb_method_entry_make(), and remove_method().

void rb_vm_bugreport | ( | void |  | ) |

Definition at line 770 of file vm_dump.c.

References bugreport_backtrace(), feof, free(), GET_VM, i, rb_vm_struct::loaded_features, rb_vm_struct::progname, RARRAY_LEN, RARRAY_PTR, rb_backtrace_each(), SDR, and StringValueCStr.

VALUE rb_vm_call | ( | rb_thread_t * | th,
|  | VALUE | recv,
|  | VALUE | id,
|  | int | argc,
|  | const VALUE * | argv,
|  | const rb_method_entry_t * | me
| ) |  |

Definition at line 152 of file vm_eval.c.

References vm_call0().

Referenced by rb_method_call().

void rb_vm_change_state | ( | void |  | ) |

Definition at line 63 of file vm.c.

References INC_VM_STATE_VERSION.

rb_control_frame_t* rb_vm_get_ruby_level_next_cfp | ( | rb_thread_t * | th,
|  | rb_control_frame_t * | cfp
| ) |  |

Definition at line 169 of file vm.c.

References rb_control_frame_t::iseq, RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P, RUBY_VM_NORMAL_ISEQ_P, and RUBY_VM_PREVIOUS_CONTROL_FRAME.

Referenced by eval_string_with_cref(), m_core_set_postexe(), rb_add_method(), rb_binding_new(), rb_sourcefile(), rb_sourceline(), rb_vm_cbase(), rb_vm_cref(), and rb_vm_stack_to_heap().

int rb_vm_get_sourceline | ( | const rb_control_frame_t * |  | ) |

Definition at line 753 of file vm.c.

References i, rb_iseq_struct::insn_info_size, rb_iseq_struct::insn_info_table, rb_control_frame_t::iseq, rb_iseq_struct::iseq_encoded, iseq_insn_info_entry::line_no, rb_control_frame_t::pc, iseq_insn_info_entry::position, and RUBY_VM_NORMAL_ISEQ_P.

Referenced by control_frame_dump(), rb_add_method(), rb_binding_new(), rb_sourceline(), rb_thread_current_status(), and vm_backtrace_each().

void rb_vm_gvl_destroy | ( | rb_vm_t * | vm | ) |

Definition at line 246 of file thread.c.

Referenced by ruby_vm_destruct().

void rb_vm_inc_const_missing_count | ( | void |  | ) |

Definition at line 88 of file vm.c.

References ruby_vm_const_missing_count.

VALUE rb_vm_invoke_proc | ( | rb_thread_t * | th,
|  | rb_proc_t * | proc,
|  | VALUE | self,
|  | int | argc,
|  | const VALUE * | argv,
|  | const rb_block_t * | blockptr
| ) |  |

Definition at line 658 of file vm.c.

References rb_proc_t::block, EXEC_TAG, invoke_block_from_c(), rb_proc_t::is_from_method, JUMP_TAG, Qundef, rb_thread_struct::safe_level, rb_proc_t::safe_level, TH_POP_TAG, and TH_PUSH_TAG.

Referenced by proc_call(), rb_fiber_start(), rb_proc_call(), rb_proc_call_with_block(), thread_start_func_2(), vm_call0(), vm_call_bmethod(), and vm_call_method().

VALUE rb_vm_make_env_object | ( | rb_thread_t * | th,
|  | rb_control_frame_t * | cfp
| ) |  |

Definition at line 473 of file vm.c.

References check_env_value(), rb_control_frame_t::dfp, rb_control_frame_t::lfp, PROCDEBUG, RUBY_VM_PREVIOUS_CONTROL_FRAME, VM_FRAME_MAGIC_FINISH, VM_FRAME_TYPE, and vm_make_env_each().

Referenced by eval_string_with_cref(), rb_binding_new(), rb_vm_make_proc(), rb_vm_stack_to_heap(), and vm_set_main_stack().

VALUE rb_vm_make_proc | ( | rb_thread_t * | th,
|  | const rb_block_t * | block,
|  | VALUE | klass
| ) |  |

Definition at line 535 of file vm.c.

References rb_proc_t::block, rb_proc_t::blockprocval, check_env_value(), rb_block_struct::dfp, rb_proc_t::envval, GC_GUARDED_PTR, GC_GUARDED_PTR_REF, GetProcPtr, rb_block_struct::iseq, rb_control_frame_t::lfp, rb_block_struct::lfp, p, rb_block_struct::proc, PROCDEBUG, rb_bug(), rb_proc_alloc(), rb_vm_make_env_object(), RUBY_VM_GET_CFP_FROM_BLOCK_PTR, rb_thread_struct::safe_level, rb_proc_t::safe_level, rb_block_struct::self, rb_thread_struct::stack, rb_thread_struct::stack_size, vm_make_proc_from_block(), and VMDEBUG.

Referenced by m_core_set_postexe(), proc_new(), vm_callee_setup_arg_complex(), vm_make_proc_from_block(), vm_yield_setup_block_args(), and vm_yield_with_cfunc().

void rb_vm_rewrite_dfp_in_errinfo | ( | rb_thread_t * | th,
|  | rb_control_frame_t * | cfp
| ) |  |

Definition at line 492 of file vm.c.

References CLASS_OF, rb_control_frame_t::dfp, rb_env_t::env, ENV_IN_HEAP_P, GET_THROWOBJ_CATCH_POINT, GetEnvPtr, rb_control_frame_t::iseq, rb_env_t::local_size, rb_cEnv, RB_TYPE_P, RUBY_VM_NORMAL_ISEQ_P, SET_THROWOBJ_CATCH_POINT, T_NODE, and rb_iseq_struct::type.

Referenced by proc_new(), and vm_make_env_each().

void rb_vm_stack_to_heap | ( | rb_thread_t * | th | ) |

Definition at line 514 of file vm.c.

References rb_thread_struct::cfp, rb_vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(), and RUBY_VM_PREVIOUS_CONTROL_FRAME.

Referenced by cont_capture().

void rb_vmdebug_stack_dump_raw | ( | rb_thread_t * | ,
|  | rb_control_frame_t * |
| ) |  |

Definition at line 146 of file vm_dump.c.

References bp, rb_control_frame_t::bp, control_frame_dump(), rb_control_frame_t::dfp, GC_GUARDED_PTR_REF, rb_control_frame_t::lfp, p, PRIxVALUE, rb_control_frame_t::sp, rb_thread_struct::stack, and rb_thread_struct::stack_size.

Referenced by rb_vmdebug_stack_dump_raw_current(), and rb_vmdebug_stack_dump_th().

const char* ruby_node_name | ( | int | node | ) |

Definition at line 1045 of file iseq.c.

References rb_bug().

Referenced by compile_array_(), iseq_compile_each(), iseq_set_arguments(), ruby_debug_print_node(), and setup_args().

int ruby_thread_has_gvl_p | ( | void |  | ) |

Definition at line 1241 of file thread.c.

References rb_thread_struct::blocking_region_buffer.

Referenced by garbage_collect_with_gvl(), negative_size_allocation_error(), and ruby_memerror().

void ruby_thread_init_stack | ( | rb_thread_t * | th | ) |

Definition at line 418 of file thread.c.

Referenced by Init_BareVM().

## Variable Documentation

RUBY_EXTERN VALUE rb_cEnv

Definition at line 513 of file vm_core.h.

RUBY_EXTERN VALUE rb_cISeq

Definition at line 511 of file vm_core.h.

RUBY_EXTERN VALUE rb_cRubyVM

Definition at line 512 of file vm_core.h.

RUBY_EXTERN VALUE rb_mRubyVMFrozenCore

Definition at line 514 of file vm_core.h.

RUBY_EXTERN rb_thread_t* ruby_current_thread

Definition at line 685 of file vm_core.h.

rb_vm_t* ruby_current_vm

Definition at line 45 of file vm.c.

Referenced by Init_VM().

const rb_data_type_t ruby_threadptr_data_type

Definition at line 1830 of file vm.c.