Ruby  1.9.3p551(2014-11-13revision48407)
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
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 "ruby_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_ORIG(th, flag, self, id, klass, pop_p)
 
#define EXEC_EVENT_HOOK(th, flag, self, id, klass)   EXEC_EVENT_HOOK_ORIG(th, flag, self, id, klass, 0)
 
#define EXEC_EVENT_HOOK_AND_POP_FRAME(th, flag, self, id, klass)   EXEC_EVENT_HOOK_ORIG(th, flag, self, id, klass, 1)
 

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.
 
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)
 
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_trb_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 pop_p)
 
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_truby_current_thread
 
rb_vm_truby_current_vm
 

Macro Definition Documentation

#define ALT_STACK_SIZE   (4*1024)

Definition at line 390 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 
)    EXEC_EVENT_HOOK_ORIG(th, flag, self, id, klass, 0)
#define EXEC_EVENT_HOOK_AND_POP_FRAME (   th,
  flag,
  self,
  id,
  klass 
)    EXEC_EVENT_HOOK_ORIG(th, flag, self, id, klass, 1)

Definition at line 746 of file vm_core.h.

Referenced by vm_exec().

#define EXEC_EVENT_HOOK_ORIG (   th,
  flag,
  self,
  id,
  klass,
  pop_p 
)
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), (pop_p)); \
} \
} \
} while (0)

Definition at line 734 of file vm_core.h.

#define FUNC_FASTCALL (   x)    x

Definition at line 601 of file vm_core.h.

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

Definition at line 609 of file vm_core.h.

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

Definition at line 690 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_exec_end_proc(), 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_funcall_with_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_with_block(), 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
#define GetBindingPtr (   obj,
  ptr 
)    GetCoreDataFromValue((obj), rb_binding_t, (ptr))
#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))
#define GetISeqPtr (   obj,
  ptr 
)    GetCoreDataFromValue((obj), rb_iseq_t, (ptr))
#define GetProcPtr (   obj,
  ptr 
)    GetCoreDataFromValue((obj), rb_proc_t, (ptr))
#define GetThreadPtr (   obj,
  ptr 
)    TypedData_Get_Struct((obj), rb_thread_t, &ruby_threadptr_data_type, (ptr))
#define GetVMPtr (   obj,
  ptr 
)    GetCoreDataFromValue((obj), rb_vm_t, (ptr))

Definition at line 269 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 692 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 691 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())
#define RUBY_VM_CHECK_INTS_TH (   th)
Value:
do { \
if (UNLIKELY((th)->interrupt_flag)) { \
rb_threadptr_execute_interrupts(th); \
} \
} while (0)

Definition at line 721 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)))
#define RUBY_VM_END_CONTROL_FRAME (   th)    ((rb_control_frame_t *)((th)->stack + (th)->stack_size))

Definition at line 613 of file vm_core.h.

Referenced by errinfo_place().

#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))

Definition at line 625 of file vm_core.h.

Referenced by rb_vm_make_proc().

#define RUBY_VM_IFUNC_P (   ptr)    (BUILTIN_TYPE(ptr) == T_NODE)
#define RUBY_VM_INTERRUPTED (   th)    ((th)->interrupt_flag & 0x02)

Definition at line 707 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 612 of file vm_core.h.

Referenced by vm_backtrace_each().

#define RUBY_VM_NORMAL_ISEQ_P (   ptr)    ((ptr) && !RUBY_VM_IFUNC_P(ptr))
#define RUBY_VM_PREVIOUS_CONTROL_FRAME (   cfp)    ((cfp)+1)
#define RUBY_VM_SET_FINALIZER_INTERRUPT (   th)    ATOMIC_OR((th)->interrupt_flag, 0x04)

Definition at line 706 of file vm_core.h.

Referenced by slot_sweep().

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

Definition at line 705 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 704 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 521 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 615 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 590 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 634 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 635 of file vm_core.h.

Referenced by rb_vmdebug_debug_print_post().

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

Definition at line 117 of file vm_core.h.

Referenced by do_select().

#define UNLIKELY (   x)    (x)
#define va_init_list (   a,
 
)    va_start((a))

Definition at line 64 of file vm_core.h.

#define VM_CALL_ARGS_BLOCKARG_BIT   (0x01 << 2)

Definition at line 558 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 557 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 559 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 564 of file vm_core.h.

Referenced by vm_call_method().

#define VM_CALL_SUPER_BIT   (0x01 << 7)

Definition at line 563 of file vm_core.h.

Referenced by vm_call_method().

#define VM_CALL_TAILCALL_BIT   (0x01 << 5)

Definition at line 561 of file vm_core.h.

Referenced by iseq_peephole_optimize(), and vm_setup_method().

#define VM_CALL_TAILRECURSION_BIT   (0x01 << 6)

Definition at line 562 of file vm_core.h.

#define VM_CALL_VCALL_BIT   (0x01 << 4)

Definition at line 560 of file vm_core.h.

Referenced by iseq_compile_each(), and vm_call_method().

#define VM_FRAME_FLAG_PASSED   0x0100

Definition at line 588 of file vm_core.h.

Referenced by vm_get_ruby_level_caller_cfp().

#define VM_FRAME_MAGIC_BLOCK   0x21

Definition at line 573 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 577 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 574 of file vm_core.h.

Referenced by control_frame_dump(), and vm_exec().

#define VM_FRAME_MAGIC_EVAL   0x91

Definition at line 580 of file vm_core.h.

Referenced by control_frame_dump(), and vm_set_eval_stack().

#define VM_FRAME_MAGIC_FINISH   0x51
#define VM_FRAME_MAGIC_IFUNC   0x81

Definition at line 579 of file vm_core.h.

Referenced by control_frame_dump(), and vm_yield_with_cfunc().

#define VM_FRAME_MAGIC_LAMBDA   0xa1

Definition at line 581 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 583 of file vm_core.h.

#define VM_FRAME_MAGIC_MASK_BITS   8

Definition at line 582 of file vm_core.h.

#define VM_FRAME_MAGIC_METHOD   0x11

Definition at line 572 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 578 of file vm_core.h.

Referenced by control_frame_dump().

#define VM_FRAME_MAGIC_TOP   0x41

Definition at line 575 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)

Typedef Documentation

typedef VALUE CDHASH

Definition at line 598 of file vm_core.h.

typedef struct iseq_inline_cache_entry* IC

Definition at line 594 of file vm_core.h.

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

Definition at line 670 of file vm_core.h.

typedef struct rb_block_struct rb_block_t

Definition at line 126 of file vm_core.h.

Definition at line 605 of file vm_core.h.

typedef RUBY_JMP_BUF rb_jmpbuf_t

Definition at line 367 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

Enumerator
THREAD_TO_KILL 
THREAD_RUNNABLE 
THREAD_STOPPED 
THREAD_STOPPED_FOREVER 
THREAD_KILLED 

Definition at line 359 of file vm_core.h.

Enumerator
ruby_error_reenter 
ruby_error_nomemory 
ruby_error_sysstack 
ruby_error_closed_stream 
ruby_special_error_count 

Definition at line 261 of file vm_core.h.

Enumerator
VM_SPECIAL_OBJECT_VMCORE 
VM_SPECIAL_OBJECT_CBASE 
VM_SPECIAL_OBJECT_CONST_BASE 

Definition at line 566 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 1682 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 538 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 550 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 2622 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)
VALUE rb_get_coverages ( void  )

Definition at line 4886 of file thread.c.

References GET_VM.

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

Definition at line 583 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 
)
VALUE rb_iseq_disasm ( VALUE  self)
int rb_iseq_disasm_insn ( VALUE  str,
VALUE iseqval,
size_t  pos,
rb_iseq_t iseq,
VALUE  child 
)
VALUE rb_iseq_eval ( VALUE  iseqval)

Definition at line 1456 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 1470 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 687 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 380 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 
)
VALUE rb_iseq_new_top ( NODE node,
VALUE  name,
VALUE  filename,
VALUE  filepath,
VALUE  parent 
)

Definition at line 388 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 431 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  
)
VALUE rb_make_backtrace ( void  )

Definition at line 1657 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 
)
void rb_objspace_free ( struct rb_objspace )
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 4899 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 4892 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 524 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 
)
VALUE rb_thread_alloc ( VALUE  klass)

Definition at line 1925 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 1008 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 272 of file thread.c.

void rb_thread_lock_unlock ( rb_thread_lock_t )

Definition at line 266 of file thread.c.

int rb_thread_method_id_and_class ( rb_thread_t th,
ID idp,
VALUE klassp 
)
void rb_thread_reset_timer_thread ( void  )

Definition at line 3055 of file thread.c.

Referenced by after_exec().

void rb_thread_start_timer_thread ( void  )

Definition at line 3061 of file thread.c.

References system_working.

Referenced by after_exec().

void rb_thread_stop_timer_thread ( int  )

Definition at line 3047 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 3014 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,
int  pop_p 
)
void rb_threadptr_execute_interrupts ( rb_thread_t )

Definition at line 1348 of file thread.c.

References rb_threadptr_execute_interrupts_common().

void rb_threadptr_interrupt ( rb_thread_t th)
void rb_threadptr_signal_exit ( rb_thread_t th)
void rb_threadptr_signal_raise ( rb_thread_t th,
int  sig 
)
void rb_threadptr_unlock_all_locking_mutexes ( rb_thread_t th)
void rb_unlink_method_entry ( rb_method_entry_t me)
void rb_vm_bugreport ( void  )
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_with_block().

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 
)
int rb_vm_get_sourceline ( const rb_control_frame_t )
void rb_vm_gvl_destroy ( rb_vm_t vm)

Definition at line 259 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 
)
VALUE rb_vm_make_env_object ( rb_thread_t th,
rb_control_frame_t cfp 
)
VALUE rb_vm_make_proc ( rb_thread_t th,
const rb_block_t block,
VALUE  klass 
)
void rb_vm_rewrite_dfp_in_errinfo ( rb_thread_t th)
void rb_vm_stack_to_heap ( rb_thread_t th)
void rb_vmdebug_stack_dump_raw ( rb_thread_t ,
rb_control_frame_t  
)
const char* ruby_node_name ( int  node)

Definition at line 1057 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  )
void ruby_thread_init_stack ( rb_thread_t th)

Definition at line 433 of file thread.c.

Referenced by Init_BareVM().

Variable Documentation

RUBY_EXTERN VALUE rb_cEnv

Definition at line 514 of file vm_core.h.

RUBY_EXTERN VALUE rb_cISeq

Definition at line 512 of file vm_core.h.

RUBY_EXTERN VALUE rb_cRubyVM

Definition at line 513 of file vm_core.h.

RUBY_EXTERN VALUE rb_mRubyVMFrozenCore

Definition at line 515 of file vm_core.h.

RUBY_EXTERN rb_thread_t* ruby_current_thread

Definition at line 686 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 1851 of file vm.c.