#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/encoding.h"
#include "gc.h"
#include "vm_core.h"
#include "iseq.h"
#include "eval_intern.h"
#include "vm_insnhelper.h"
#include "vm_insnhelper.c"
#include "vm_exec.h"
#include "vm_exec.c"
#include "vm_method.c"
#include "vm_eval.c"
#include <assert.h>
Go to the source code of this file.
#define C | ( | k | ) | add_opt_method(rb_c##k, mid, bop) |
#define ENV_IN_HEAP_P | ( | th, | ||
env | ||||
) | (!((th)->stack < (env) && (env) < ((th)->stack + (th)->stack_size))) |
Definition at line 185 of file vm.c.
Referenced by vm_collect_local_variables_in_heap(), and vm_make_env_each().
#define ENV_VAL | ( | env | ) | ((env)[1]) |
Definition at line 187 of file vm.c.
Referenced by vm_collect_local_variables_in_heap(), and vm_make_env_each().
#define OP | ( | mid_, | ||
bop_ | ||||
) | (mid = id##mid_, bop = BOP_##bop_, ruby_vm_redefined_flag[bop] = 0) |
Referenced by vm_init_redefined_flag().
#define PROCDEBUG 0 |
Definition at line 31 of file vm.c.
Referenced by rb_vm_make_env_object(), and rb_vm_make_proc().
#define RECYCLE_MAX 64 |
Definition at line 1589 of file vm.c.
Referenced by rb_thread_recycle_stack_release().
#define REWIND_CFP | ( | expr | ) |
do { \ rb_thread_t *th__ = GET_THREAD(); \ th__->cfp++; expr; th__->cfp--; \ } while (0)
Definition at line 1879 of file vm.c.
Referenced by m_core_define_method(), m_core_define_singleton_method(), m_core_set_method_alias(), m_core_set_postexe(), m_core_set_variable_alias(), and m_core_undef_method().
Definition at line 966 of file vm.c.
References rb_bug(), rb_id2name(), RCLASS_M_TBL, st_insert(), st_lookup(), and VM_METHOD_TYPE_CFUNC.
static const rb_block_t* check_block | ( | rb_thread_t * | th | ) | [inline, static] |
Definition at line 566 of file vm.c.
References rb_thread_struct::cfp, GC_GUARDED_PTR_REF, rb_control_frame_t::lfp, Qnil, and rb_vm_localjump_error().
Referenced by vm_yield(), and vm_yield_with_cref().
static int check_env | ( | rb_env_t *const | env | ) | [static] |
Definition at line 265 of file vm.c.
References rb_env_t::block, check_env_value(), rb_block_struct::dfp, dp, and rb_block_struct::lfp.
Referenced by check_env_value().
Definition at line 286 of file vm.c.
References check_env(), GetEnvPtr, and rb_bug().
Referenced by check_env(), rb_vm_make_env_object(), and rb_vm_make_proc().
Definition at line 398 of file vm.c.
References rb_env_t::block, collect_local_variables_in_iseq(), GetEnvPtr, rb_block_struct::iseq, and rb_env_t::prev_envval.
Referenced by vm_collect_local_variables_in_heap().
Definition at line 384 of file vm.c.
References ID2SYM, rb_iseq_struct::local_table, rb_iseq_struct::local_table_size, rb_ary_push(), and rb_is_local_id().
Referenced by collect_local_variables_in_env().
static VALUE env_alloc | ( | void | ) | [static] |
Definition at line 251 of file vm.c.
References rb_env_t::block, rb_env_t::env, rb_block_struct::iseq, rb_env_t::prev_envval, rb_cEnv, and TypedData_Make_Struct.
Referenced by vm_make_env_each().
static void env_free | ( | void *const | ptr | ) | [static] |
Definition at line 220 of file vm.c.
References rb_env_t::env, env, RUBY_FREE_ENTER, RUBY_FREE_LEAVE, RUBY_FREE_UNLESS_NULL, and ruby_xfree().
static void env_mark | ( | void *const | ptr | ) | [static] |
Definition at line 190 of file vm.c.
References rb_env_t::block, BUILTIN_TYPE, rb_env_t::env, env, rb_env_t::env_size, rb_block_struct::iseq, rb_env_t::prev_envval, rb_block_struct::proc, rb_gc_mark_locations, RUBY_GC_INFO, RUBY_MARK_ENTER, RUBY_MARK_LEAVE, RUBY_MARK_UNLESS_NULL, rb_iseq_struct::self, rb_block_struct::self, and T_NODE.
static size_t env_memsize | ( | const void * | ptr | ) | [static] |
Definition at line 232 of file vm.c.
References rb_env_t::env, env, rb_env_t::env_size, and size.
void Init_BareVM | ( | void | ) |
Definition at line 2127 of file vm.c.
References EXIT_FAILURE, Init_native_thread(), malloc, MEMZERO, rb_vm_struct::objspace, rb_objspace_alloc(), rb_thread_set_current_raw, ruby_thread_init_stack(), th_init2(), rb_thread_struct::vm, and vm_init2().
Referenced by ruby_init().
void Init_native_thread | ( | void | ) |
Referenced by Init_BareVM().
void Init_top_self | ( | void | ) |
Definition at line 2167 of file vm.c.
References GET_VM, main_to_s(), rb_vm_struct::mark_object_ary, rb_ary_tmp_new(), rb_cObject, rb_define_singleton_method(), rb_obj_alloc(), rb_vm_top_self(), and rb_vm_struct::top_self.
void Init_VM | ( | void | ) |
Definition at line 1995 of file vm.c.
References rb_thread_struct::cfp, CLASS_OF, GET_THREAD, GetISeqPtr, id_core_define_method, id_core_define_singleton_method, id_core_set_method_alias, id_core_set_postexe, id_core_set_variable_alias, id_core_undef_method, rb_control_frame_t::iseq, rb_iseq_struct::iseq_encoded, ISEQ_TYPE_TOP, rb_vm_struct::living_threads, m_core_define_method(), m_core_define_singleton_method(), m_core_set_method_alias(), m_core_set_postexe(), m_core_set_variable_alias(), m_core_undef_method(), rb_vm_struct::main_thread, nsdr(), rb_control_frame_t::pc, Qnil, rb_ary_new(), rb_ary_push(), rb_binding_new(), rb_cBasicObject, rb_cEnv, rb_class_new(), rb_cObject, rb_cRubyVM, rb_cThread, rb_define_class(), rb_define_class_under(), rb_define_const(), rb_define_global_const(), rb_define_method_id(), rb_define_singleton_method(), rb_gc_register_mark_object(), rb_hash_new(), rb_insns_name_array(), rb_iseq_new(), rb_mRubyVMFrozenCore, rb_obj_freeze(), rb_singleton_class(), rb_str_new2(), rb_thread_set_current, rb_undef_alloc_func(), rb_undef_method(), rb_vm_top_self(), RBASIC, rb_vm_struct::running_thread, sdr(), rb_control_frame_t::self, rb_thread_struct::self, rb_vm_struct::self, st_init_numtable(), st_insert(), rb_thread_struct::thread_id, rb_thread_struct::top_self, rb_thread_struct::top_wrapper, TypedData_Wrap_Struct, rb_thread_struct::vm, and vm_init_redefined_flag().
static VALUE invoke_block_from_c | ( | rb_thread_t * | th, | |
const rb_block_t * | block, | |||
VALUE | self, | |||
int | argc, | |||
const VALUE * | argv, | |||
const rb_block_t * | blockptr, | |||
const NODE * | cref | |||
) | [inline, static] |
Definition at line 520 of file vm.c.
References rb_iseq_struct::arg_size, block_proc_is_lambda(), BUILTIN_TYPE, rb_thread_struct::cfp, CHECK_STACK_OVERFLOW, rb_control_frame_t::dfp, rb_block_struct::dfp, GC_GUARDED_PTR, rb_block_struct::iseq, rb_iseq_struct::iseq_encoded, rb_block_struct::lfp, rb_iseq_struct::local_size, rb_control_frame_t::me, rb_thread_struct::passed_block, rb_thread_struct::passed_me, rb_block_struct::proc, rb_vm_set_finish_env(), rb_control_frame_t::sp, SPECIAL_CONST_P, rb_iseq_struct::stack_max, T_NODE, type, vm_exec(), VM_FRAME_MAGIC_LAMBDA, vm_push_frame(), vm_yield_setup_args(), and vm_yield_with_cfunc().
Referenced by rb_vm_invoke_proc(), vm_yield(), and vm_yield_with_cref().
Definition at line 1885 of file vm.c.
References GET_THREAD, rb_vm_cref(), REWIND_CFP, SYM2ID, and vm_define_method().
Referenced by Init_VM().
static VALUE m_core_define_singleton_method | ( | VALUE | self, | |
VALUE | cbase, | |||
VALUE | sym, | |||
VALUE | iseqval | |||
) | [static] |
Definition at line 1894 of file vm.c.
References GET_THREAD, rb_vm_cref(), REWIND_CFP, SYM2ID, and vm_define_method().
Referenced by Init_VM().
Definition at line 1903 of file vm.c.
References rb_alias(), REWIND_CFP, and SYM2ID.
Referenced by Init_VM().
Definition at line 1931 of file vm.c.
References rb_thread_struct::cfp, GET_THREAD, GetISeqPtr, rb_block_struct::iseq, rb_block_struct::proc, rb_call_end_proc(), rb_cProc, rb_set_end_proc(), rb_vm_get_ruby_level_next_cfp(), rb_vm_make_proc(), REWIND_CFP, and RUBY_VM_GET_BLOCK_PTR_IN_CFP.
Referenced by Init_VM().
Definition at line 1912 of file vm.c.
References rb_alias_variable(), REWIND_CFP, and SYM2ID.
Referenced by Init_VM().
Definition at line 1921 of file vm.c.
References INC_VM_STATE_VERSION, rb_undef(), REWIND_CFP, and SYM2ID.
Referenced by Init_VM().
Definition at line 851 of file vm.c.
References CONST_ID, id, ID2SYM, rb_eLocalJumpError, rb_exc_new2(), rb_iv_set(), TAG_BREAK, TAG_NEXT, TAG_REDO, TAG_RETRY, and TAG_RETURN.
Referenced by rb_vm_localjump_error(), and rb_vm_make_jump_tag_but_local_jump().
static void mark_event_hooks | ( | rb_event_hook_t * | hook | ) | [static] |
Definition at line 1482 of file vm.c.
References rb_event_hook_struct::data, rb_event_hook_struct::next, and rb_gc_mark().
Referenced by rb_thread_mark(), and rb_vm_mark().
NORETURN | ( | static void | vm_iter_breakrb_thread_t *th | ) |
static VALUE nsdr | ( | void | ) | [static] |
Definition at line 1971 of file vm.c.
References free, rb_ary_new(), rb_ary_push(), rb_memerror(), and rb_str_new2().
Referenced by Init_VM().
VALUE rb_backref_get | ( | void | ) |
Definition at line 661 of file vm.c.
References vm_svar_get().
Referenced by last_match_getter(), last_paren_match_getter(), match_getter(), nucomp_s_convert(), nurat_s_convert(), postmatch_getter(), prematch_getter(), rb_reg_match_m(), rb_reg_s_last_match(), rb_reg_search(), rb_str_rpartition(), rb_str_split_m(), rb_str_sub_bang(), rb_str_subpat(), rb_str_subpat_set(), scan_once(), str_gsub(), string_to_c(), and string_to_r().
void rb_backref_set | ( | VALUE | val | ) |
Definition at line 667 of file vm.c.
References vm_svar_set().
Referenced by match_setter(), nucomp_s_convert(), nurat_s_convert(), rb_reg_eqq(), rb_reg_match2(), rb_reg_match_m(), rb_reg_search(), rb_str_index_m(), rb_str_rindex_m(), reg_match_pos(), string_to_c(), and string_to_r().
Definition at line 1424 of file vm.c.
References GET_THREAD, and rb_thread_method_id_and_class().
void rb_gc_mark_machine_stack | ( | rb_thread_t * | th | ) |
Definition at line 2229 of file gc.c.
References GET_STACK_BOUNDS, and rb_gc_mark_locations.
Referenced by rb_thread_mark().
VALUE rb_insns_name_array | ( | void | ) |
Definition at line 5123 of file compile.c.
References numberof, rb_ary_new(), rb_ary_push(), rb_obj_freeze(), and rb_str_new2().
Referenced by Init_VM().
Definition at line 1366 of file vm.c.
References GET_THREAD, vm_exec(), and vm_set_top_stack().
Referenced by iseq_eval(), prelude_eval(), and rb_load_internal().
Definition at line 1380 of file vm.c.
References GET_THREAD, vm_exec(), and vm_set_main_stack().
Referenced by ruby_exec_internal().
void rb_iter_break | ( | void | ) |
Definition at line 945 of file vm.c.
References GET_THREAD, and vm_iter_break().
Referenced by DEFINE_ENUMFUNCS(), find_i(), find_index_i(), find_index_iter_i(), first_i(), lexer_i(), member_i(), take_i(), and take_while_i().
VALUE rb_lastline_get | ( | void | ) |
Definition at line 673 of file vm.c.
References vm_svar_get().
Referenced by Init_IO(), rb_io_print(), rb_reg_match2(), and uscore_get().
void rb_lastline_set | ( | VALUE | val | ) |
Definition at line 679 of file vm.c.
References vm_svar_set().
Referenced by argf_gets(), Init_IO(), rb_f_chomp(), rb_f_chop(), rb_f_gsub(), rb_f_sub(), rb_gets(), rb_io_gets_m(), and strio_gets().
struct rb_objspace* rb_objspace_alloc | ( | void | ) | [read] |
Definition at line 374 of file gc.c.
References malloc, malloc_limit, ruby_gc_stress, and ruby_initial_gc_stress.
Referenced by Init_BareVM().
VALUE* rb_ruby_debug_ptr | ( | void | ) |
Definition at line 2197 of file vm.c.
References GET_VM, and ruby_vm_debug_ptr().
VALUE* rb_ruby_verbose_ptr | ( | void | ) |
Definition at line 2191 of file vm.c.
References GET_VM, and ruby_vm_verbose_ptr().
const char* rb_sourcefile | ( | void | ) |
Definition at line 792 of file vm.c.
References rb_thread_struct::cfp, rb_iseq_struct::filename, GET_THREAD, rb_control_frame_t::iseq, rb_vm_get_ruby_level_next_cfp(), and RSTRING_PTR.
Referenced by call_trace_proc(), err_position(), error_pos(), error_print(), eval_string_with_cref(), rb_autoload_load(), rb_bug(), rb_exec(), rb_newobj_from_heap(), and setup_exception().
int rb_sourceline | ( | void | ) |
Definition at line 806 of file vm.c.
References rb_thread_struct::cfp, GET_THREAD, rb_vm_get_ruby_level_next_cfp(), and rb_vm_get_sourceline().
Referenced by call_trace_proc(), err_position(), error_pos(), error_print(), eval_string_with_cref(), rb_bug(), rb_exec(), rb_newobj_from_heap(), setup_exception(), and update_coverage().
Definition at line 1832 of file vm.c.
References ruby_thread_init(), and thread_alloc().
Referenced by rb_thread_create(), thread_s_new(), and thread_start().
VALUE rb_thread_current_status | ( | const rb_thread_t * | th | ) |
Definition at line 1430 of file vm.c.
References rb_thread_struct::cfp, rb_method_entry_struct::def, rb_iseq_struct::filename, iseq_catch_table_entry::iseq, rb_control_frame_t::iseq, rb_method_entry_struct::klass, rb_control_frame_t::me, rb_iseq_struct::name, rb_method_definition_struct::original_id, rb_control_frame_t::pc, rb_class2name(), rb_id2name(), rb_sprintf(), rb_vm_get_sourceline(), and RSTRING_PTR.
void rb_thread_mark | ( | void * | ptr | ) |
Definition at line 1633 of file vm.c.
References rb_thread_struct::cfp, rb_thread_struct::errinfo, rb_thread_struct::event_hooks, rb_thread_struct::fiber, rb_thread_struct::first_args, rb_thread_struct::first_proc, GET_THREAD, rb_control_frame_t::iseq, rb_thread_struct::last_status, rb_thread_struct::local_storage, rb_thread_struct::local_svar, rb_thread_struct::locking_mutex, rb_thread_struct::machine_regs, rb_thread_struct::machine_stack_end, rb_thread_struct::machine_stack_start, mark_event_hooks(), rb_thread_struct::mark_stack_len, rb_control_frame_t::me, rb_control_frame_t::proc, rb_gc_mark(), rb_gc_mark_locations, rb_gc_mark_machine_stack(), rb_mark_tbl(), rb_thread_struct::root_fiber, RUBY_MARK_ENTER, RUBY_MARK_LEAVE, RUBY_MARK_UNLESS_NULL, RUBY_VM_NORMAL_ISEQ_P, RUBY_VM_PREVIOUS_CONTROL_FRAME, rb_iseq_struct::self, rb_control_frame_t::self, rb_control_frame_t::sp, rb_thread_struct::stack, rb_thread_struct::stack_size, rb_thread_struct::stat_insn_usage, rb_thread_struct::thgroup, rb_thread_struct::thrown_errinfo, rb_thread_struct::top_self, rb_thread_struct::top_wrapper, and rb_thread_struct::value.
int rb_thread_method_id_and_class | ( | rb_thread_t * | th, | |
ID * | idp, | |||
VALUE * | klassp | |||
) |
Definition at line 1394 of file vm.c.
References rb_thread_struct::cfp, CONST_ID, rb_method_entry_struct::def, rb_iseq_struct::defined_method_id, rb_control_frame_t::iseq, iseq_catch_table_entry::iseq, rb_iseq_struct::klass, rb_method_entry_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_recycle_stack_release | ( | VALUE * | stack | ) |
Definition at line 1609 of file vm.c.
References RECYCLE_MAX, and ruby_xfree().
Referenced by thread_start_func_2().
VALUE rb_vm_call_cfunc | ( | VALUE | recv, | |
VALUE(*)(VALUE) | func, | |||
VALUE | arg, | |||
const rb_block_t * | blockptr, | |||
VALUE | filename, | |||
VALUE | filepath | |||
) |
Definition at line 1454 of file vm.c.
References rb_thread_struct::cfp, DATA_PTR, GET_THREAD, ISEQ_TYPE_TOP, rb_iseq_new(), rb_control_frame_t::sp, VM_FRAME_MAGIC_TOP, vm_pop_frame(), and vm_push_frame().
Referenced by rb_require_safe(), and ruby_init_ext().
VALUE rb_vm_cbase | ( | void | ) |
Definition at line 840 of file vm.c.
References rb_thread_struct::cfp, rb_control_frame_t::dfp, GET_THREAD, rb_control_frame_t::iseq, rb_control_frame_t::lfp, rb_vm_get_ruby_level_next_cfp(), and vm_get_cbase().
Referenced by rb_f_autoload(), rb_f_autoload_p(), and rb_undef().
void rb_vm_change_state | ( | void | ) |
Definition at line 55 of file vm.c.
References INC_VM_STATE_VERSION.
Referenced by mod_av_set(), rb_clear_cache(), rb_clear_cache_by_class(), rb_clear_cache_by_id(), rb_clear_cache_for_undef(), and rb_const_remove().
static void rb_vm_check_redefinition_opt_method | ( | const rb_method_entry_t * | me | ) | [static] |
Definition at line 955 of file vm.c.
References rb_method_entry_struct::def, ruby_vm_redefined_flag, st_lookup(), rb_method_definition_struct::type, and VM_METHOD_TYPE_CFUNC.
NODE* rb_vm_cref | ( | void | ) |
Definition at line 820 of file vm.c.
References rb_thread_struct::cfp, rb_control_frame_t::dfp, GET_THREAD, rb_control_frame_t::iseq, rb_control_frame_t::lfp, rb_vm_get_ruby_level_next_cfp(), and vm_get_cref().
Referenced by m_core_define_method(), m_core_define_singleton_method(), rb_mod_nesting(), and rb_mod_s_constants().
rb_control_frame_t* rb_vm_get_ruby_level_next_cfp | ( | rb_thread_t * | th, | |
rb_control_frame_t * | cfp | |||
) |
Definition at line 142 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 * | cfp | ) |
Definition at line 687 of file vm.c.
References 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_inc_const_missing_count | ( | void | ) |
Definition at line 61 of file vm.c.
References ruby_vm_const_missing_count.
Referenced by rb_const_get_0().
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 592 of file vm.c.
References rb_proc_t::block, EXEC_TAG, invoke_block_from_c(), rb_proc_t::is_from_method, JUMP_TAG, rb_proc_t::safe_level, rb_thread_struct::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().
void rb_vm_jump_tag_but_local_jump | ( | int | state, | |
VALUE | val | |||
) |
Definition at line 922 of file vm.c.
References JUMP_TAG, Qnil, rb_exc_raise(), and rb_vm_make_jump_tag_but_local_jump().
Referenced by rb_eval_cmd(), and rb_load_internal().
void rb_vm_localjump_error | ( | const char * | mesg, | |
VALUE | value, | |||
int | reason | |||
) |
Definition at line 883 of file vm.c.
References make_localjump_error(), and rb_exc_raise().
Referenced by check_block(), rb_need_block(), vm_invoke_block(), and vm_throw().
VALUE rb_vm_make_env_object | ( | rb_thread_t * | th, | |
rb_control_frame_t * | cfp | |||
) |
Definition at line 423 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().
Definition at line 890 of file vm.c.
References GET_THREAD, make_localjump_error(), Qnil, Qundef, result, TAG_BREAK, TAG_NEXT, TAG_REDO, TAG_RETRY, and TAG_RETURN.
Referenced by rb_fiber_start(), rb_vm_jump_tag_but_local_jump(), and thread_join().
VALUE rb_vm_make_proc | ( | rb_thread_t * | th, | |
const rb_block_t * | block, | |||
VALUE | klass | |||
) |
Definition at line 469 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_block_struct::lfp, rb_control_frame_t::lfp, 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_mark | ( | void * | ptr | ) |
Definition at line 1491 of file vm.c.
References rb_vm_struct::cmd, rb_vm_struct::coverages, rb_vm_struct::event_hooks, rb_vm_struct::living_threads, rb_vm_struct::load_path, rb_vm_struct::loaded_features, rb_vm_struct::loading_table, mark_event_hooks(), rb_vm_struct::mark_object_ary, rb_gc_mark(), rb_gc_mark_locations, rb_mark_tbl(), RUBY_GC_INFO, RUBY_MARK_ENTER, RUBY_MARK_LEAVE, RUBY_MARK_UNLESS_NULL, ruby_special_error_count, rb_vm_struct::special_exceptions, st_foreach(), rb_vm_struct::thgroup_default, rb_vm_struct::top_self, rb_vm_struct::trap_list, and vm_mark_each_thread_func().
Referenced by garbage_collect().
static VALUE rb_vm_set_finish_env | ( | rb_thread_t * | th | ) | [inline, static] |
Definition at line 69 of file vm.c.
References rb_thread_struct::cfp, finish_insn_seq, rb_control_frame_t::lfp, rb_control_frame_t::pc, Qnil, rb_control_frame_t::sp, VM_FRAME_MAGIC_FINISH, and vm_push_frame().
Referenced by invoke_block_from_c(), vm_set_eval_stack(), and vm_set_top_stack().
void rb_vm_set_progname | ( | VALUE | filename | ) |
Definition at line 2111 of file vm.c.
References rb_iseq_struct::filename, GET_VM, rb_control_frame_t::iseq, rb_thread_struct::stack, and rb_thread_struct::stack_size.
Referenced by load_file_internal(), process_options(), and ruby_script().
void rb_vm_stack_to_heap | ( | rb_thread_t *const | th | ) |
Definition at line 442 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().
VALUE rb_vm_top_self | ( | void | ) |
Definition at line 2161 of file vm.c.
References GET_VM.
Referenced by Init_eval(), Init_eval_method(), Init_top_self(), Init_VM(), rb_eval_cmd(), rb_eval_string(), rb_eval_string_wrap(), rb_load_internal(), rb_require_safe(), require_libraries(), ruby_init_ext(), and ruby_thread_init().
Definition at line 1817 of file vm.c.
References GET_THREAD, GetThreadPtr, rb_vm_top_self(), th_init(), rb_thread_struct::top_self, rb_thread_struct::top_wrapper, and rb_thread_struct::vm.
Referenced by rb_thread_alloc().
void ruby_thread_init_stack | ( | rb_thread_t * | th | ) |
Definition at line 415 of file thread.c.
Referenced by Init_BareVM().
Definition at line 2185 of file vm.c.
References rb_vm_struct::debug.
Referenced by rb_ruby_debug_ptr().
int ruby_vm_destruct | ( | void * | ptr | ) |
Definition at line 1528 of file vm.c.
References rb_vm_struct::global_vm_lock, rb_vm_struct::living_threads, rb_vm_struct::main_thread, rb_vm_struct::objspace, rb_gc_force_recycle(), rb_objspace_free(), rb_thread_lock_destroy(), rb_thread_lock_unlock(), RUBY_FREE_ENTER, RUBY_FREE_LEAVE, ruby_xfree(), rb_vm_struct::self, st_free_table(), and thread_free().
Definition at line 2179 of file vm.c.
References rb_vm_struct::verbose.
Referenced by rb_ruby_verbose_ptr().
static VALUE sdr | ( | void | ) | [static] |
static void th_init | ( | rb_thread_t * | th, | |
VALUE | self | |||
) | [static] |
static void th_init2 | ( | rb_thread_t * | th, | |
VALUE | self | |||
) | [static] |
Definition at line 1788 of file vm.c.
References rb_thread_struct::cfp, rb_thread_struct::errinfo, rb_thread_struct::last_status, Qnil, rb_thread_struct::self, rb_thread_struct::stack, rb_thread_struct::stack_size, rb_thread_struct::status, thread_recycle_stack(), VM_FRAME_MAGIC_TOP, and vm_push_frame().
Referenced by Init_BareVM(), and th_init().
Definition at line 1774 of file vm.c.
References TypedData_Make_Struct, and TypedData_Wrap_Struct.
Referenced by rb_thread_alloc().
static void thread_free | ( | void * | ptr | ) | [static] |
Definition at line 1696 of file vm.c.
References free, rb_thread_struct::keeping_mutexes, rb_thread_struct::local_storage, rb_thread_struct::locking_mutex, rb_vm_struct::main_thread, NULL, Qfalse, rb_bug(), RBASIC, rb_thread_struct::root_fiber, RUBY_FREE_ENTER, RUBY_FREE_LEAVE, RUBY_FREE_UNLESS_NULL, RUBY_GC_INFO, ruby_xfree(), st_free_table(), rb_thread_struct::stack, and rb_thread_struct::vm.
Referenced by ruby_vm_destruct().
static size_t thread_memsize | ( | const void * | ptr | ) | [static] |
Definition at line 1747 of file vm.c.
References rb_thread_struct::local_storage, rb_thread_struct::root_fiber, size, st_memsize(), and rb_thread_struct::stack_size.
static VALUE* thread_recycle_stack | ( | size_t | size | ) | [static] |
void vm_analysis_insn | ( | int | insn | ) |
void vm_analysis_operand | ( | int | insn, | |
int | n, | |||
VALUE | op | |||
) |
void vm_analysis_register | ( | int | reg, | |
int | isset | |||
) |
static VALUE vm_backtrace | ( | rb_thread_t * | th, | |
int | lev | |||
) | [inline, static] |
Definition at line 779 of file vm.c.
References rb_ary_new(), rb_ary_reverse(), vm_backtrace_alloc(), vm_backtrace_each(), and vm_backtrace_push().
static void vm_backtrace_alloc | ( | void * | arg | ) | [static] |
static int vm_backtrace_each | ( | rb_thread_t * | th, | |
int | lev, | |||
void(*)(void *) | init, | |||
rb_backtrace_iter_func * | iter, | |||
void * | arg | |||
) | [static] |
Definition at line 710 of file vm.c.
References rb_method_entry_struct::called_id, rb_thread_struct::cfp, rb_method_entry_struct::def, rb_iseq_struct::filename, id, ID_ALLOCATOR, init, rb_control_frame_t::iseq, rb_control_frame_t::me, rb_iseq_struct::name, NIL_P, rb_method_definition_struct::original_id, rb_control_frame_t::pc, rb_vm_struct::progname, rb_id2str(), rb_vm_get_sourceline(), ruby_engine_name, RUBY_VM_NEXT_CONTROL_FRAME, RUBYVM_CFUNC_FRAME_P, rb_thread_struct::stack, rb_thread_struct::stack_size, and rb_thread_struct::vm.
Referenced by vm_backtrace().
Definition at line 761 of file vm.c.
References rb_ary_push(), rb_enc_compatible(), rb_enc_sprintf(), and RSTRING_PTR.
Referenced by vm_backtrace().
static VALUE vm_cfp_svar_get | ( | rb_thread_t * | th, | |
rb_control_frame_t * | cfp, | |||
VALUE | key | |||
) | [static] |
Definition at line 633 of file vm.c.
References rb_control_frame_t::lfp, lfp_svar_get(), and vm_normal_frame().
Referenced by vm_svar_get().
static void vm_cfp_svar_set | ( | rb_thread_t * | th, | |
rb_control_frame_t * | cfp, | |||
VALUE | key, | |||
const VALUE | val | |||
) | [static] |
Definition at line 640 of file vm.c.
References rb_control_frame_t::lfp, lfp_svar_set(), and vm_normal_frame().
Referenced by vm_svar_set().
static int vm_collect_local_variables_in_heap | ( | rb_thread_t * | th, | |
VALUE * | dfp, | |||
VALUE | ary | |||
) | [static] |
Definition at line 409 of file vm.c.
References collect_local_variables_in_env(), ENV_IN_HEAP_P, ENV_VAL, and GetEnvPtr.
static void vm_define_method | ( | rb_thread_t * | th, | |
VALUE | obj, | |||
ID | id, | |||
VALUE | iseqval, | |||
rb_num_t | is_singleton, | |||
NODE * | cref | |||
) | [static] |
Definition at line 1840 of file vm.c.
References COPY_CREF, FIXNUM_P, GetISeqPtr, INC_VM_STATE_VERSION, NIL_P, NOEX_MODFUNC, NOEX_PUBLIC, OBJ_FROZEN, rb_add_method(), rb_error_frozen(), rb_eTypeError, rb_id2name(), rb_obj_classname(), rb_raise(), rb_singleton_class(), SYMBOL_P, and VM_METHOD_TYPE_ISEQ.
Referenced by m_core_define_method(), and m_core_define_singleton_method().
static VALUE vm_exec | ( | rb_thread_t * | th | ) | [static] |
Definition at line 1136 of file vm.c.
References rb_control_frame_t::bp, rb_method_entry_struct::called_id, rb_iseq_struct::catch_table, rb_iseq_struct::catch_table_size, CATCH_TYPE_ENSURE, CATCH_TYPE_RESCUE, CATCH_TYPE_RETRY, rb_thread_struct::cfp, iseq_catch_table_entry::cont, rb_control_frame_t::dfp, iseq_catch_table_entry::end, err, rb_thread_struct::errinfo, EXEC_EVENT_HOOK, EXEC_TAG, finish_insn_seq, GET_THROWOBJ_CATCH_POINT, GET_THROWOBJ_VAL, GetISeqPtr, iseq_catch_table_entry::iseq, rb_control_frame_t::iseq, rb_iseq_struct::iseq_encoded, JUMP_TAG, rb_method_entry_struct::klass, rb_control_frame_t::lfp, rb_iseq_struct::local_size, rb_control_frame_t::me, rb_control_frame_t::pc, result, RUBY_EVENT_C_RETURN, RUBY_EVENT_END, RUBY_EVENT_RETURN, RUBY_VM_PREVIOUS_CONTROL_FRAME, rb_control_frame_t::self, SET_THROWOBJ_CATCH_POINT, SET_THROWOBJ_STATE, rb_control_frame_t::sp, iseq_catch_table_entry::sp, iseq_catch_table_entry::start, rb_thread_struct::state, TAG_BREAK, TAG_NEXT, TAG_RAISE, TAG_REDO, TAG_RETRY, TAG_RETURN, TH_POP_TAG, TH_POP_TAG2, TH_PUSH_TAG, iseq_catch_table_entry::type, type, UNLIKELY, vm_exec_core(), VM_FRAME_MAGIC_BLOCK, VM_FRAME_MAGIC_CFUNC, VM_FRAME_MAGIC_CLASS, VM_FRAME_MAGIC_FINISH, VM_FRAME_MAGIC_METHOD, VM_FRAME_TYPE, vm_pop_frame(), and vm_push_frame().
Referenced by invoke_block_from_c(), rb_iseq_eval(), and rb_iseq_eval_main().
static rb_control_frame_t* vm_get_ruby_level_caller_cfp | ( | rb_thread_t * | th, | |
rb_control_frame_t * | cfp | |||
) | [static] |
Definition at line 154 of file vm.c.
References rb_control_frame_t::flag, rb_control_frame_t::iseq, RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P, RUBY_VM_NORMAL_ISEQ_P, RUBY_VM_PREVIOUS_CONTROL_FRAME, and VM_FRAME_FLAG_PASSED.
Referenced by rb_current_realfilepath(), rb_f_block_given_p(), and rb_f_local_variables().
static void vm_init2 | ( | rb_vm_t * | vm | ) | [static] |
Definition at line 1578 of file vm.c.
References MEMZERO, and rb_vm_struct::src_encoding_index.
Referenced by Init_BareVM().
static void vm_init_redefined_flag | ( | void | ) | [static] |
static void vm_iter_break | ( | rb_thread_t * | th | ) | [static] |
Definition at line 934 of file vm.c.
References rb_thread_struct::cfp, rb_control_frame_t::dfp, rb_thread_struct::errinfo, GC_GUARDED_PTR_REF, NEW_THROW_OBJECT, Qnil, rb_thread_struct::state, TAG_BREAK, and TH_JUMP_TAG.
Referenced by rb_iter_break().
static VALUE vm_make_env_each | ( | rb_thread_t *const | th, | |
rb_control_frame_t *const | cfp, | |||
VALUE * | envptr, | |||
VALUE *const | endptr | |||
) | [static] |
Definition at line 299 of file vm.c.
References ALLOC_N, rb_env_t::block, rb_block_struct::dfp, rb_control_frame_t::dfp, dp, rb_env_t::env, env_alloc(), ENV_IN_HEAP_P, rb_env_t::env_size, ENV_VAL, GC_GUARDED_PTR, GC_GUARDED_PTR_REF, GetEnvPtr, rb_block_struct::iseq, rb_control_frame_t::iseq, rb_block_struct::lfp, rb_control_frame_t::lfp, rb_env_t::local_size, rb_iseq_struct::local_size, rb_env_t::prev_envval, rb_bug(), RUBY_VM_NORMAL_ISEQ_P, SDR, rb_control_frame_t::self, rb_block_struct::self, and rb_thread_struct::stack.
Referenced by rb_vm_make_env_object().
static VALUE vm_make_proc_from_block | ( | rb_thread_t * | th, | |
rb_block_t * | block | |||
) | [static] |
Definition at line 454 of file vm.c.
References rb_block_struct::proc, rb_cProc, and rb_vm_make_proc().
Referenced by rb_vm_make_proc().
static size_t vm_memsize | ( | const void * | ptr | ) | [static] |
Definition at line 1561 of file vm.c.
References rb_vm_struct::living_threads, and st_memsize().
static rb_control_frame_t* vm_normal_frame | ( | rb_thread_t * | th, | |
rb_control_frame_t * | cfp | |||
) | [static] |
Definition at line 621 of file vm.c.
References rb_control_frame_t::pc, RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P, and RUBY_VM_PREVIOUS_CONTROL_FRAME.
Referenced by vm_cfp_svar_get(), and vm_cfp_svar_set().
static void vm_set_eval_stack | ( | rb_thread_t * | th, | |
VALUE | iseqval, | |||
const NODE * | cref | |||
) | [static] |
Definition at line 99 of file vm.c.
References rb_thread_struct::base_block, rb_thread_struct::cfp, CHECK_STACK_OVERFLOW, rb_control_frame_t::dfp, rb_block_struct::dfp, GC_GUARDED_PTR, GetISeqPtr, rb_iseq_struct::iseq_encoded, rb_block_struct::lfp, rb_iseq_struct::local_size, rb_vm_set_finish_env(), rb_block_struct::self, rb_control_frame_t::sp, rb_iseq_struct::stack_max, VM_FRAME_MAGIC_EVAL, and vm_push_frame().
Referenced by vm_set_main_stack().
static void vm_set_main_stack | ( | rb_thread_t * | th, | |
VALUE | iseqval | |||
) | [static] |
Definition at line 119 of file vm.c.
References rb_thread_struct::base_block, rb_env_t::block, rb_thread_struct::cfp, CHECK_STACK_OVERFLOW, rb_binding_t::env, GetBindingPtr, GetEnvPtr, GetISeqPtr, rb_iseq_struct::local_size, rb_cObject, rb_const_get(), rb_intern, rb_vm_make_env_object(), rb_iseq_struct::stack_max, and vm_set_eval_stack().
Referenced by rb_iseq_eval_main().
static void vm_set_top_stack | ( | rb_thread_t * | th, | |
VALUE | iseqval | |||
) | [static] |
Definition at line 79 of file vm.c.
References rb_thread_struct::cfp, CHECK_STACK_OVERFLOW, GetISeqPtr, rb_iseq_struct::iseq_encoded, ISEQ_TYPE_TOP, rb_iseq_struct::local_size, rb_eTypeError, rb_raise(), rb_vm_set_finish_env(), rb_control_frame_t::sp, rb_iseq_struct::stack_max, rb_thread_struct::top_self, rb_iseq_struct::type, VM_FRAME_MAGIC_TOP, and vm_push_frame().
Referenced by rb_iseq_eval().
Definition at line 647 of file vm.c.
References rb_thread_struct::cfp, GET_THREAD, and vm_cfp_svar_get().
Referenced by rb_backref_get(), and rb_lastline_get().
Definition at line 654 of file vm.c.
References rb_thread_struct::cfp, GET_THREAD, and vm_cfp_svar_set().
Referenced by rb_backref_set(), and rb_lastline_set().
static VALUE vm_yield | ( | rb_thread_t * | th, | |
int | argc, | |||
const VALUE * | argv | |||
) | [inline, static] |
Definition at line 585 of file vm.c.
References check_block(), invoke_block_from_c(), and rb_block_struct::self.
static VALUE vm_yield_with_cref | ( | rb_thread_t * | th, | |
int | argc, | |||
const VALUE * | argv, | |||
const NODE * | cref | |||
) | [inline, static] |
Definition at line 578 of file vm.c.
References check_block(), invoke_block_from_c(), and rb_block_struct::self.
const rb_data_type_t env_data_type [static] |
Definition at line 33 of file vm.c.
Referenced by Init_ISeq(), and Init_VM().
size_t rb_gc_stack_maxsize |
Definition at line 36 of file vm.c.
Referenced by Init_VM(), and rb_threadptr_exec_event_hooks().
rb_vm_t* ruby_current_vm = 0 |
Definition at line 39 of file vm.c.
Referenced by rb_vm_inc_const_missing_count().
char ruby_vm_redefined_flag[BOP_LAST_] |
Definition at line 41 of file vm.c.
Referenced by rb_vm_check_redefinition_opt_method().
const rb_data_type_t thread_data_type [static] |
int thread_recycle_stack_count = 0 [static] |
VALUE* thread_recycle_stack_slot[RECYCLE_MAX] [static] |
const rb_data_type_t vm_data_type [static] |
st_table* vm_opt_method_table = 0 [static] |