Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
#include "eval_intern.h"
#include "gc.h"
#include "internal.h"
#include "internal/compile.h"
#include "internal/cont.h"
#include "internal/error.h"
#include "internal/eval.h"
#include "internal/inits.h"
#include "internal/object.h"
#include "internal/parse.h"
#include "internal/proc.h"
#include "internal/re.h"
#include "internal/symbol.h"
#include "internal/vm.h"
#include "internal/sanitizers.h"
#include "iseq.h"
#include "mjit.h"
#include "ruby/st.h"
#include "ruby/vm.h"
#include "vm_core.h"
#include "vm_callinfo.h"
#include "vm_debug.h"
#include "vm_exec.h"
#include "vm_insnhelper.h"
#include "ractor_core.h"
#include "vm_sync.h"
#include "builtin.h"
#include "probes.h"
#include "probes_helper.h"
#include "vm_insnhelper.c"
#include "vm_exec.c"
#include "vm_method.c"
#include "vm_eval.c"
#include "vm_call_iseq_optimized.inc"
Go to the source code of this file.
Data Structures | |
struct | collect_outer_variable_name_data |
Macros | |
#define | vm_exec rb_vm_exec |
#define | PROCDEBUG 0 |
#define | ruby_vm_redefined_flag GET_VM()->redefined_flag |
#define | S(s) sym_##s = ID2SYM(rb_intern_const(#s)) |
#define | SET(name, attr) |
#define | OP(mid_, bop_) (mid = id##mid_, bop = BOP_##bop_, ruby_vm_redefined_flag[bop] = 0) |
#define | C(k) add_opt_method(rb_c##k, mid, bop) |
#define | SET(name) rb_hash_aset(result, ID2SYM(rb_intern(#name)), SIZET2NUM(vm->default_params.name)); |
#define | thread_data_type ruby_threadptr_data_type |
#define | REWIND_CFP(expr) |
#define C | ( | k | ) | add_opt_method(rb_c##k, mid, bop) |
#define OP | ( | mid_, | |
bop_ | |||
) | (mid = id##mid_, bop = BOP_##bop_, ruby_vm_redefined_flag[bop] = 0) |
#define REWIND_CFP | ( | expr | ) |
#define S | ( | s | ) | sym_##s = ID2SYM(rb_intern_const(#s)) |
#define SET | ( | name | ) | rb_hash_aset(result, ID2SYM(rb_intern(#name)), SIZET2NUM(vm->default_params.name)); |
#define SET | ( | name, | |
attr | |||
) |
#define thread_data_type ruby_threadptr_data_type |
void Init_BareVM | ( | void | ) |
Definition at line 3702 of file vm.c.
References rb_vm_struct::barrier_cond, rb_thread_struct::ec, EXIT_FAILURE, Init_native_thread(), rb_vm_struct::lock, rb_vm_struct::main_ractor, MEMZERO, rb_vm_struct::negative_cme_table, rb_vm_struct::objspace, rb_vm_struct::ractor, rb_thread_struct::ractor, rb_id_table_create(), rb_native_cond_initialize(), rb_native_mutex_initialize(), rb_objspace_alloc(), rb_ractor_main_alloc(), ruby_current_vm_ptr, ruby_mimmalloc(), ruby_thread_init_stack(), rb_vm_struct::sync, rb_vm_struct::terminate_cond, and rb_thread_struct::vm.
Referenced by ruby_setup().
void Init_top_self | ( | void | ) |
Definition at line 3758 of file vm.c.
References rb_cObject, rb_define_alias(), rb_define_singleton_method, rb_obj_alloc(), rb_singleton_class(), rb_vm_top_self(), and rb_vm_struct::top_self.
void Init_VM | ( | void | ) |
Definition at line 3342 of file vm.c.
References rb_iseq_struct::body, rb_execution_context_struct::cfp, CLASS_OF, rb_thread_struct::ec, rb_control_frame_struct::ep, FALSE, id_core_hash_merge_kwd, id_core_hash_merge_ptr, id_core_raise, id_core_set_method_alias, id_core_set_postexe, id_core_set_variable_alias, id_core_undef_method, Init_vm_backtrace(), rb_control_frame_struct::iseq, rb_iseq_constant_body::iseq_encoded, rb_vm_struct::main_ractor, rb_vm_struct::main_thread, METHOD_VISI_PRIVATE, METHOD_VISI_PUBLIC, NULL, rb_vm_struct::objspace, OPTIMIZED_METHOD_TYPE_BLOCK_CALL, rb_control_frame_struct::pc, Qnil, rb_vm_struct::ractor, rb_thread_struct::ractor, rb_add_method(), rb_ary_new(), rb_ary_push(), rb_binding_new(), rb_block_param_proxy, rb_cBasicObject, rb_class_new(), rb_cObject, rb_cRubyVM, rb_cThread, rb_define_class(), rb_define_const(), rb_define_global_const(), rb_define_method, rb_define_method_id, rb_define_module_under(), rb_define_singleton_method, rb_fstring_lit, rb_gc_register_mark_object(), rb_insns_name_array(), rb_iseq_new(), rb_mRubyVMFrozenCore, rb_obj_alloc(), rb_obj_freeze(), rb_objspace_gc_enable(), rb_ractor_main_setup(), rb_set_class_path(), rb_singleton_class(), rb_str_new2, rb_undef_alloc_func(), rb_undef_method(), rb_vm_top_self(), RBASIC, ruby_current_vm_ptr, rb_vm_struct::self, rb_control_frame_struct::self, rb_thread_struct::self, T_ICLASS, thread_data_type, rb_thread_struct::top_self, rb_thread_struct::top_wrapper, TypedData_Wrap_Struct, rb_thread_struct::vm, VM_ENV_DATA_INDEX_ME_CREF, VM_FRAME_FLAG_CFRAME, and VM_METHOD_TYPE_OPTIMIZED.
void Init_vm_objects | ( | void | ) |
Definition at line 3731 of file vm.c.
References rb_vm_struct::defined_module_hash, rb_vm_struct::frozen_strings, rb_vm_struct::loading_table, rb_vm_struct::mark_object_ary, rb_ary_tmp_new(), rb_fstring_hash_type, st_init_numtable, st_init_strtable, and st_init_table_with_size.
Referenced by ruby_setup().
|
pure virtual |
|
pure virtual |
References rb_insns_name().
VALUE rb_backref_get | ( | void | ) |
Definition at line 1544 of file vm.c.
References VM_SVAR_BACKREF.
Referenced by date__httpdate(), date__iso8601(), date__jisx0301(), date__parse(), date__rfc2822(), date__rfc3339(), date__xmlschema(), rb_backref_set_string(), rb_f_global_variables(), and rb_reg_start_with_p().
void rb_backref_set | ( | VALUE | val | ) |
Definition at line 1550 of file vm.c.
References VM_SVAR_BACKREF.
Referenced by date__httpdate(), date__iso8601(), date__jisx0301(), date__parse(), date__rfc2822(), date__rfc3339(), date__xmlschema(), rb_backref_set_string(), rb_reg_eqq(), rb_reg_match2(), and rb_reg_start_with_p().
const VALUE * rb_binding_add_dynavars | ( | VALUE | bindval, |
rb_binding_t * | bind, | ||
int | dyncount, | ||
const ID * | dynvars | ||
) |
Definition at line 1203 of file vm.c.
References ALLOCV_END, ALLOCV_N, rb_binding_t::block, rb_iseq_struct::body, rb_execution_context_struct::cfp, rb_ast_body_struct::compile_option, env, rb_iseq_location_struct::label, rb_ast_body_struct::line_count, rb_iseq_constant_body::location, MEMCPY, NODE_SCOPE, NULL, numberof, rb_binding_t::pathobj, rb_fstring_lit, rb_iseq_new(), rb_iseq_new_top(), rb_node_init(), rb_vm_pop_frame(), and rb_ast_body_struct::root.
int rb_dtrace_setup | ( | rb_execution_context_t * | ec, |
VALUE | klass, | ||
ID | id, | ||
struct ruby_dtrace_method_hook_args * | args | ||
) |
Definition at line 431 of file vm.c.
References BUILTIN_TYPE, ruby_dtrace_method_hook_args::classname, FALSE, ruby_dtrace_method_hook_args::filename, FL_SINGLETON, FL_TEST, ruby_dtrace_method_hook_args::klass, rb_callcache::klass, ruby_dtrace_method_hook_args::line_no, ruby_dtrace_method_hook_args::methodname, name, ruby_dtrace_method_hook_args::name, NIL_P, rb_attr_get(), rb_class_path(), rb_ec_frame_method_id_and_class(), rb_id2name(), rb_source_location_cstr(), RBASIC, StringValuePtr, T_CLASS, T_ICLASS, T_MODULE, and TRUE.
void rb_ec_clear_vm_stack | ( | rb_execution_context_t * | ec | ) |
Definition at line 3047 of file vm.c.
References rb_execution_context_struct::cfp, NULL, and rb_ec_set_vm_stack().
Referenced by rb_threadptr_root_fiber_terminate().
int rb_ec_frame_method_id_and_class | ( | const rb_execution_context_t * | ec, |
ID * | idp, | ||
ID * | called_idp, | ||
VALUE * | klassp | ||
) |
Definition at line 2440 of file vm.c.
References rb_execution_context_struct::cfp, and rb_vm_control_frame_id_and_class().
Referenced by rb_dtrace_setup(), and rb_frame_method_id_and_class().
void rb_ec_initialize_vm_stack | ( | rb_execution_context_t * | ec, |
VALUE * | stack, | ||
size_t | size | ||
) |
Definition at line 3031 of file vm.c.
References rb_execution_context_struct::cfp, NULL, Qnil, rb_ec_set_vm_stack(), VM_BLOCK_HANDLER_NONE, VM_ENV_FLAG_LOCAL, VM_FRAME_FLAG_CFRAME, VM_FRAME_FLAG_FINISH, VM_FRAME_MAGIC_DUMMY, rb_execution_context_struct::vm_stack, and rb_execution_context_struct::vm_stack_size.
|
inline |
Definition at line 3024 of file vm.c.
References rb_execution_context_struct::vm_stack, and rb_execution_context_struct::vm_stack_size.
Referenced by rb_ec_clear_vm_stack(), and rb_ec_initialize_vm_stack().
void rb_execution_context_mark | ( | const rb_execution_context_t * | ec | ) |
Definition at line 2835 of file vm.c.
References rb_control_frame_struct::block_code, rb_execution_context_struct::cfp, rb_control_frame_struct::ep, rb_execution_context_struct::errinfo, rb_control_frame_struct::iseq, rb_execution_context_struct::local_storage, rb_execution_context_struct::local_storage_recursive_hash, rb_execution_context_struct::local_storage_recursive_hash_for_trace, rb_execution_context_struct::machine, NULL, rb_execution_context_struct::private_const_reference, rb_gc_mark(), rb_gc_mark_locations(), rb_gc_mark_machine_stack(), rb_gc_mark_movable(), rb_gc_mark_vm_stack_values(), rb_id_table_foreach_values(), rb_execution_context_struct::root_svar, RUBY_MARK_UNLESS_NULL, RUBY_VM_PREVIOUS_CONTROL_FRAME, rb_control_frame_struct::self, rb_control_frame_struct::sp, rb_execution_context_struct::stack_end, rb_execution_context_struct::stack_start, VM_ASSERT, VM_ENV_DATA_INDEX_ENV, VM_ENV_DATA_INDEX_ME_CREF, VM_ENV_FLAG_ESCAPED, rb_execution_context_struct::vm_stack, and rb_execution_context_struct::vm_stack_size.
Referenced by rb_fiber_mark_self().
void rb_execution_context_update | ( | const rb_execution_context_t * | ec | ) |
Definition at line 2785 of file vm.c.
References rb_control_frame_struct::block_code, rb_execution_context_struct::cfp, rb_control_frame_struct::ep, rb_control_frame_struct::iseq, long(), rb_gc_location(), RUBY_VM_PREVIOUS_CONTROL_FRAME, rb_control_frame_struct::self, rb_control_frame_struct::sp, VM_ASSERT, VM_ENV_DATA_INDEX_ENV, VM_ENV_DATA_INDEX_ME_CREF, VM_ENV_FLAG_ESCAPED, rb_execution_context_struct::vm_stack, and rb_execution_context_struct::vm_stack_size.
Referenced by rb_fiber_update_self().
void rb_fiber_mark_self | ( | rb_fiber_t * | fib | ) |
void rb_fiber_update_self | ( | rb_fiber_t * | fib | ) |
Definition at line 980 of file cont.c.
References rb_fiber_struct::cont, rb_execution_context_update(), rb_gc_location(), rb_context_struct::saved_ec, and rb_context_struct::self.
Definition at line 2446 of file vm.c.
References rb_ec_frame_method_id_and_class().
VALUE rb_insn_operand_intern | ( | const rb_iseq_t * | iseq, |
VALUE | insn, | ||
int | op_no, | ||
VALUE | op, | ||
int | len, | ||
size_t | pos, | ||
VALUE * | pnop, | ||
VALUE | child | ||
) |
Definition at line 2403 of file vm.c.
References vm_exec.
Referenced by rb_load_with_builtin_functions().
Definition at line 885 of file vm.c.
References rb_iseq_struct::body, and rb_iseq_constant_body::parent_iseq.
Referenced by rb_iseqw_local_variables().
void rb_iter_break | ( | void | ) |
VALUE rb_lastline_get | ( | void | ) |
Definition at line 1556 of file vm.c.
References VM_SVAR_LASTLINE.
Referenced by rb_io_print(), and rb_reg_match2().
void rb_lastline_set | ( | VALUE | val | ) |
rb_serial_t rb_next_class_serial | ( | void | ) |
Definition at line 366 of file vm.c.
References NEXT_CLASS_SERIAL.
Definition at line 3003 of file vm.c.
References Qfalse, Qtrue, rb_typeddata_is_kind_of(), and thread_data_type.
Referenced by rb_objspace_call_finalizer().
Definition at line 956 of file vm.c.
References rb_proc_t::block, FL_SET_RAW, GetProcPtr, rb_proc_t::is_from_method, rb_proc_t::is_lambda, rb_cProc, RB_GC_GUARD, RB_OBJ_SHAREABLE_P, and RUBY_FL_SHAREABLE.
Referenced by Init_Proc(), and rb_proc_isolate().
Definition at line 1097 of file vm.c.
References rb_proc_dup(), and rb_proc_isolate_bang().
Definition at line 1055 of file vm.c.
References collect_outer_variable_name_data::ary, rb_proc_t::block, block_type_iseq, rb_iseq_struct::body, FL_SET_RAW, rb_proc_t::is_isolated, rb_captured_block::iseq, collect_outer_variable_name_data::isolate, rb_iseq_constant_body::outer_variables, Qfalse, rb_ary_join(), rb_eArgError, rb_eRuntimeError, rb_id_table_foreach(), rb_raise(), rb_str_new2, RTYPEDDATA_DATA, RUBY_FL_SHAREABLE, rb_captured_block::self, str, StringValueCStr, TRUE, rb_block::type, VM_ASSERT, and collect_outer_variable_name_data::yield.
Referenced by rb_proc_isolate().
Definition at line 1105 of file vm.c.
References collect_outer_variable_name_data::ary, rb_proc_t::block, block_type_iseq, rb_iseq_struct::body, FL_SET_RAW, rb_proc_t::is_isolated, collect_outer_variable_name_data::isolate, rb_iseq_constant_body::outer_variables, Qfalse, rb_ary_join(), rb_eArgError, rb_eRuntimeError, rb_id_table_foreach(), rb_raise(), rb_str_new2, collect_outer_variable_name_data::read_only, RTYPEDDATA_DATA, RUBY_FL_SHAREABLE, str, StringValueCStr, TRUE, rb_block::type, and collect_outer_variable_name_data::yield.
VALUE * rb_ruby_debug_ptr | ( | void | ) |
Definition at line 3775 of file vm.c.
References rb_ractor_struct::debug.
VALUE * rb_ruby_verbose_ptr | ( | void | ) |
Definition at line 3768 of file vm.c.
References rb_ractor_struct::verbose.
Definition at line 1600 of file vm.c.
References rb_execution_context_struct::cfp, rb_control_frame_struct::iseq, Qnil, rb_iseq_path(), rb_vm_get_ruby_level_next_cfp(), and rb_vm_get_sourceline().
Referenced by rb_source_location_cstr().
Definition at line 1616 of file vm.c.
References NIL_P, NULL, rb_source_location(), and RSTRING_PTR.
Referenced by rb_bug_for_fatal_signal(), rb_bug_without_die(), and rb_dtrace_setup().
const char * rb_sourcefile | ( | void | ) |
Definition at line 1571 of file vm.c.
References rb_execution_context_struct::cfp, rb_control_frame_struct::iseq, rb_iseq_path(), rb_vm_get_ruby_level_next_cfp(), and RSTRING_PTR.
Referenced by rb_autoload_load().
int rb_sourceline | ( | void | ) |
Definition at line 1586 of file vm.c.
References rb_execution_context_struct::cfp, rb_vm_get_ruby_level_next_cfp(), and rb_vm_get_sourceline().
Definition at line 3114 of file vm.c.
Referenced by rb_thread_create(), and rb_thread_create_ractor().
void rb_threadptr_root_fiber_release | ( | rb_thread_t * | th | ) |
Definition at line 2110 of file cont.c.
References rb_fiber_struct::cont, rb_thread_struct::ec, FIBER_CONTEXT, rb_execution_context_struct::fiber_ptr, NULL, rb_thread_struct::ractor, rb_thread_struct::root_fiber, rb_context_struct::self, rb_context_struct::type, and VM_ASSERT.
void rb_threadptr_root_fiber_setup | ( | rb_thread_t * | th | ) |
Definition at line 2091 of file cont.c.
References rb_fiber_struct::blocking, rb_fiber_struct::cont, rb_thread_struct::ec, FIBER_CONTEXT, rb_execution_context_struct::fiber_ptr, FIBER_RESUMED, MEMZERO, rb_bug(), rb_fiber_init_mjit_cont(), ruby_mimmalloc(), rb_context_struct::saved_ec, strerror(), rb_execution_context_struct::thread_ptr, and rb_context_struct::type.
Definition at line 2622 of file vm.c.
References rb_vm_struct::defined_module_hash, st_insert, and TRUE.
Referenced by rb_define_class(), rb_define_class_id_under(), and rb_define_module().
Definition at line 921 of file vm.c.
References rb_block::as, block_type_ifunc, block_type_iseq, block_type_proc, block_type_symbol, rb_block::captured, rb_captured_block::code, rb_captured_block::ep, rb_block::proc, RB_OBJ_WRITE, rb_vm_block_ep_update(), rb_captured_block::self, rb_block::symbol, and rb_captured_block::val.
Definition at line 326 of file vm.c.
References rb_block::as, rb_block::captured, rb_captured_block::ep, Qundef, and RB_OBJ_WRITTEN.
Referenced by rb_vm_block_copy().
VALUE rb_vm_call_cfunc | ( | VALUE | recv, |
VALUE(*)(VALUE) | func, | ||
VALUE | arg, | ||
VALUE | block_handler, | ||
VALUE | filename | ||
) |
Definition at line 2452 of file vm.c.
References rb_execution_context_struct::cfp, Qnil, rb_iseq_new(), rb_vm_pop_frame(), rb_control_frame_struct::sp, VM_ENV_FLAG_LOCAL, VM_FRAME_FLAG_FINISH, and VM_FRAME_MAGIC_TOP.
VALUE rb_vm_cbase | ( | void | ) |
Definition at line 1665 of file vm.c.
References rb_execution_context_struct::cfp, rb_control_frame_struct::ep, rb_eRuntimeError, rb_raise(), and rb_vm_get_ruby_level_next_cfp().
int rb_vm_cframe_keyword_p | ( | const rb_control_frame_t * | cfp | ) |
Definition at line 120 of file vm.c.
Referenced by rb_keyword_given_p().
void rb_vm_check_redefinition_by_prepend | ( | VALUE | klass | ) |
Definition at line 1873 of file vm.c.
References rb_id_table_foreach(), RCLASS_M_TBL, and RCLASS_ORIGIN.
Referenced by rb_prepend_module().
int rb_vm_control_frame_id_and_class | ( | const rb_control_frame_t * | cfp, |
ID * | idp, | ||
ID * | called_idp, | ||
VALUE * | klassp | ||
) |
Definition at line 2424 of file vm.c.
References rb_callable_method_entry_struct::called_id, rb_callable_method_entry_struct::def, FALSE, rb_method_definition_struct::original_id, rb_callable_method_entry_struct::owner, rb_vm_frame_method_entry(), and TRUE.
Referenced by rb_ec_frame_method_id_and_class().
Definition at line 1640 of file vm.c.
References rb_execution_context_struct::cfp, rb_control_frame_struct::ep, NULL, rb_vm_get_ruby_level_next_cfp(), and rb_control_frame_struct::self.
Referenced by rb_attr().
rb_cref_t * rb_vm_cref_replace_with_duplicated_cref | ( | void | ) |
Definition at line 1631 of file vm.c.
References rb_execution_context_struct::cfp, rb_control_frame_struct::ep, and rb_vm_get_ruby_level_next_cfp().
void rb_vm_each_stack_value | ( | void * | ptr, |
void(*)(VALUE, void *) | cb, | ||
void * | ctx | ||
) |
Definition at line 2501 of file vm.c.
References rb_execution_context_struct::cfp, rb_ractor_struct::cnt, rb_thread_struct::ec, NULL, ptr, rb_vm_struct::ractor, rb_ractor_struct::set, rb_vm_struct::set, rb_control_frame_struct::sp, rb_ractor_struct::threads, VM_ASSERT, and rb_execution_context_struct::vm_stack.
const struct rb_callcache * rb_vm_empty_cc | ( | void | ) |
Definition at line 4100 of file vm.c.
Referenced by rb_iseq_mark().
Definition at line 830 of file vm.c.
Referenced by rb_vmdebug_env_dump_raw().
Definition at line 93 of file vm.c.
Referenced by rb_vm_proc_local_ep().
VALUE rb_vm_frame_block_handler | ( | const rb_control_frame_t * | cfp | ) |
Definition at line 126 of file vm.c.
Referenced by rb_block_arity(), rb_block_given_p(), rb_block_min_max_arity(), and rb_block_pair_yield_optimizable().
st_table * rb_vm_fstring_table | ( | void | ) |
Definition at line 3787 of file vm.c.
Referenced by Init_String(), and rb_str_free().
rb_control_frame_t * rb_vm_get_binding_creatable_next_cfp | ( | const rb_execution_context_t * | ec, |
const rb_control_frame_t * | cfp | ||
) |
Definition at line 577 of file vm.c.
References rb_control_frame_struct::iseq, and RUBY_VM_PREVIOUS_CONTROL_FRAME.
Referenced by rb_tracearg_binding(), rb_vm_make_binding(), and rb_vm_stack_to_heap().
rb_control_frame_t * rb_vm_get_ruby_level_next_cfp | ( | const rb_execution_context_t * | ec, |
const rb_control_frame_t * | cfp | ||
) |
Definition at line 589 of file vm.c.
References RUBY_VM_PREVIOUS_CONTROL_FRAME.
Referenced by rb_method_definition_set(), rb_source_location(), rb_sourcefile(), rb_sourceline(), rb_tracearg_parameters(), rb_vm_cbase(), rb_vm_cref_in_context(), rb_vm_cref_replace_with_duplicated_cref(), and rb_vm_make_binding().
void rb_vm_inc_const_missing_count | ( | void | ) |
Definition at line 425 of file vm.c.
References ruby_vm_const_missing_count.
Referenced by rb_const_missing().
VALUE rb_vm_invoke_bmethod | ( | rb_execution_context_t * | ec, |
rb_proc_t * | proc, | ||
VALUE | self, | ||
int | argc, | ||
const VALUE * | argv, | ||
int | kw_splat, | ||
VALUE | block_handler, | ||
const rb_callable_method_entry_t * | me | ||
) |
Definition at line 1468 of file vm.c.
References argc, argv, rb_block::proc, and TRUE.
Referenced by rb_vm_invoke_proc(), and rb_vm_invoke_proc_with_self().
VALUE rb_vm_invoke_proc | ( | rb_execution_context_t * | ec, |
rb_proc_t * | proc, | ||
int | argc, | ||
const VALUE * | argv, | ||
int | kw_splat, | ||
VALUE | passed_block_handler | ||
) |
Definition at line 1475 of file vm.c.
References argc, argv, NULL, rb_block::proc, and rb_vm_invoke_bmethod().
Referenced by rb_fiber_start(), rb_proc_call(), rb_proc_call_kw(), rb_proc_call_with_block(), and rb_proc_call_with_block_kw().
VALUE rb_vm_invoke_proc_with_self | ( | rb_execution_context_t * | ec, |
rb_proc_t * | proc, | ||
VALUE | self, | ||
int | argc, | ||
const VALUE * | argv, | ||
int | kw_splat, | ||
VALUE | passed_block_handler | ||
) |
Definition at line 1490 of file vm.c.
References argc, argv, NULL, rb_block::proc, and rb_vm_invoke_bmethod().
void rb_vm_jump_tag_but_local_jump | ( | int | state | ) |
Definition at line 1750 of file vm.c.
References EC_JUMP_TAG, NIL_P, Qundef, rb_exc_raise(), and rb_vm_make_jump_tag_but_local_jump().
VALUE rb_vm_make_binding | ( | const rb_execution_context_t * | ec, |
const rb_control_frame_t * | src_cfp | ||
) |
Definition at line 1172 of file vm.c.
References rb_block::as, rb_binding_t::block, rb_iseq_struct::body, rb_block::captured, rb_captured_block::code, rb_binding_t::first_lineno, GetBindingPtr, rb_captured_block::iseq, rb_control_frame_struct::iseq, rb_iseq_constant_body::location, rb_iseq_location_struct::pathobj, rb_binding_t::pathobj, rb_binding_alloc(), rb_cBinding, rb_eRuntimeError, RB_OBJ_WRITE, rb_raise(), rb_vm_get_binding_creatable_next_cfp(), rb_vm_get_ruby_level_next_cfp(), rb_vm_get_sourceline(), RUBY_VM_PREVIOUS_CONTROL_FRAME, rb_captured_block::self, and rb_control_frame_struct::self.
Referenced by rb_binding_new(), and rb_tracearg_binding().
Definition at line 1718 of file vm.c.
References Qnil, Qundef, TAG_BREAK, TAG_NEXT, TAG_REDO, TAG_RETRY, and TAG_RETURN.
Referenced by rb_fiber_start(), and rb_vm_jump_tag_but_local_jump().
VALUE rb_vm_make_proc_lambda | ( | const rb_execution_context_t * | ec, |
const struct rb_captured_block * | captured, | ||
VALUE | klass, | ||
int8_t | is_lambda | ||
) |
Definition at line 1152 of file vm.c.
References block_type_ifunc, block_type_iseq, rb_captured_block::code, rb_captured_block::ep, FALSE, imemo_ifunc, imemo_iseq, rb_captured_block::val, and VM_ASSERT.
void rb_vm_mark | ( | void * | ptr | ) |
Definition at line 2538 of file vm.c.
References rb_vm_struct::cmd, rb_vm_struct::coverages, rb_vm_struct::defined_module_hash, rb_vm_struct::expanded_load_path, rb_vm_struct::global_cc_cache_table, len, rb_vm_struct::load_path, rb_vm_struct::load_path_check_cache, rb_vm_struct::load_path_snapshot, rb_vm_struct::loaded_features, rb_vm_struct::loaded_features_snapshot, rb_vm_struct::loading_table, rb_vm_struct::mark_object_ary, rb_vm_struct::negative_cme_table, NULL, rb_vm_struct::orig_progname, ptr, rb_vm_struct::ractor, RARRAY_CONST_PTR, RARRAY_LEN, rb_gc_mark(), rb_gc_mark_movable(), rb_gc_mark_values(), rb_id_table_foreach_values(), rb_mark_tbl(), RUBY_GC_INFO, RUBY_MARK_ENTER, RUBY_MARK_LEAVE, RUBY_MARK_MOVABLE_UNLESS_NULL, RUBY_NSIG, rb_vm_struct::set, rb_vm_struct::top_self, rb_vm_struct::trap_list, VM_ASSERT, and VM_GLOBAL_CC_CACHE_TABLE_SIZE.
void rb_vm_pop_cfunc_frame | ( | void | ) |
Definition at line 625 of file vm.c.
References rb_callable_method_entry_struct::called_id, rb_execution_context_struct::cfp, rb_callable_method_entry_struct::def, rb_control_frame_struct::ep, EXEC_EVENT_HOOK, rb_method_definition_struct::original_id, rb_callable_method_entry_struct::owner, Qnil, rb_vm_frame_method_entry(), RUBY_DTRACE_CMETHOD_RETURN_HOOK, RUBY_EVENT_C_RETURN, and rb_control_frame_struct::self.
Referenced by rb_mod_const_missing(), and rb_vm_rewind_cfp().
void rb_vm_register_special_exception_str | ( | enum ruby_special_exceptions | sp, |
VALUE | cls, | ||
VALUE | mesg | ||
) |
Definition at line 2612 of file vm.c.
References OBJ_FREEZE, rb_exc_new3, rb_gc_register_mark_object(), rb_obj_freeze(), and rb_vm_struct::special_exceptions.
void rb_vm_rewind_cfp | ( | rb_execution_context_t * | ec, |
rb_control_frame_t * | cfp | ||
) |
Definition at line 639 of file vm.c.
References rb_execution_context_struct::cfp, rb_vm_pop_cfunc_frame(), rb_vm_pop_frame(), and VM_FRAME_MAGIC_CFUNC.
Referenced by rb_protect(), and rb_vrescue2().
void rb_vm_set_progname | ( | VALUE | filename | ) |
Definition at line 3690 of file vm.c.
References rb_thread_struct::ec, rb_control_frame_struct::iseq, rb_thread_struct::ractor, rb_iseq_pathobj_set(), rb_iseq_realpath(), rb_str_dup(), rb_execution_context_struct::vm_stack, and rb_execution_context_struct::vm_stack_size.
Referenced by ruby_script(), and ruby_set_script_name().
void rb_vm_stack_to_heap | ( | rb_execution_context_t * | ec | ) |
Definition at line 820 of file vm.c.
References rb_execution_context_struct::cfp, rb_vm_get_binding_creatable_next_cfp(), and RUBY_VM_PREVIOUS_CONTROL_FRAME.
Referenced by rb_debug_inspector_open().
VALUE rb_vm_top_self | ( | void | ) |
Definition at line 3752 of file vm.c.
Referenced by Init_eval(), Init_eval_method(), Init_Proc(), Init_top_self(), Init_VM(), rb_eval_cmd_kw(), rb_eval_string_wrap(), and ruby_eval_string_from_file().
void rb_vm_update_references | ( | void * | ptr | ) |
Definition at line 2474 of file vm.c.
References rb_vm_struct::coverages, rb_vm_struct::expanded_load_path, rb_vm_struct::frozen_strings, rb_vm_struct::load_path, rb_vm_struct::load_path_check_cache, rb_vm_struct::load_path_snapshot, rb_vm_struct::loaded_features, rb_vm_struct::loaded_features_snapshot, rb_vm_struct::mark_object_ary, rb_vm_struct::orig_progname, ptr, rb_gc_location(), rb_gc_update_tbl_refs(), and rb_vm_struct::top_self.
void ruby_vm_at_exit | ( | void(*)(ruby_vm_t *) | func | ) |
ruby_vm_at_exit registers a function func to be invoked when a VM passed away.
Functions registered this way runs in reverse order of registration, just like END {} block does. The difference is its timing to be triggered. ruby_vm_at_exit functions runs when a VM passed away, while END {} blocks runs just before a VM is passing away.
You cannot register a function to another VM than where you are in. So where to register is intuitive, omitted. OTOH the argument func cannot know which VM it is in because at the time of invocation, the VM has already died and there is no execution context. The VM itself is passed as the first argument to it.
[in] | func | the function to register. |
Definition at line 658 of file vm.c.
References ALLOC, rb_vm_struct::at_exit, rb_at_exit_list::func, and rb_at_exit_list::next.
Definition at line 2639 of file vm.c.
References rb_vm_struct::frozen_strings, rb_vm_struct::loading_table, rb_vm_struct::main_thread, NULL, rb_vm_struct::objspace, rb_vm_struct::ractor, RB_ALTSTACK_FREE, rb_fiber_reset_root_local_storage(), rb_native_mutex_destroy(), rb_objspace_free(), ruby_current_vm_ptr, RUBY_FREE_ENTER, RUBY_FREE_LEAVE, ruby_mimfree(), st_foreach, st_free_table, rb_vm_struct::waitpid_lock, and rb_vm_struct::workqueue_lock.
VALUE vm_exec | ( | rb_execution_context_t * | ec, |
bool | mjit_enable_p | ||
) |
Definition at line 2151 of file vm.c.
References EC_EXEC_TAG, EC_POP_TAG, EC_PUSH_TAG, rb_execution_context_struct::errinfo, Qnil, Qundef, RAISED_STACKOVERFLOW, rb_ec_raised_reset, rb_execution_context_struct::tag, TAG_NONE, and VM_ASSERT.
VALUE rb_cRubyVM |
Definition at line 373 of file vm.c.
Referenced by Init_ast(), Init_builtin(), Init_ISeq(), and Init_VM().
VALUE rb_cThread |
Definition at line 374 of file vm.c.
Referenced by Init_Thread(), Init_VM(), Init_vm_backtrace(), Init_vm_trace(), InitVM_process(), rb_thread_create(), and rb_thread_create_ractor().
|
extern |
Definition at line 287 of file string.c.
Referenced by Init_vm_objects().
|
extern |
|
extern |
VALUE rb_mRubyVMFrozenCore |
Definition at line 375 of file vm.c.
Referenced by Init_VM(), and rb_exec_event_hooks().
native_tls_key_t ruby_current_ec_key |
Definition at line 400 of file vm.c.
Referenced by rb_check_stack_overflow().
Definition at line 380 of file vm.c.
Referenced by Init_BareVM(), Init_VM(), and ruby_vm_destruct().
rb_ractor_t* ruby_single_main_ractor |
Definition at line 381 of file vm.c.
Referenced by rb_ractor_main_alloc().
const rb_data_type_t ruby_threadptr_data_type |
rb_serial_t ruby_vm_class_serial = 1 |
VALUE ruby_vm_const_missing_count = 0 |
Definition at line 379 of file vm.c.
Referenced by rb_vm_inc_const_missing_count().
rb_event_flag_t ruby_vm_event_enabled_global_flags |
Definition at line 404 of file vm.c.
Referenced by rb_iseq_init_trace().
rb_event_flag_t ruby_vm_event_flags |
unsigned int ruby_vm_event_local_num |
Definition at line 405 of file vm.c.
Referenced by rb_tracepoint_disable().
rb_serial_t ruby_vm_global_constant_state = 1 |