18 #include "ruby/config.h" 40 callable_class_p(
VALUE klass)
42 #if VM_CHECK_MODE >= 2 43 if (!klass)
return FALSE;
74 vm_check_frame_detail(
VALUE type,
int req_block,
int req_me,
int req_cref,
VALUE specval,
VALUE cref_or_me,
int is_cframe,
const rb_iseq_t *iseq)
87 rb_bug(
"vm_push_frame: specval (%p) should be a block_ptr on %x frame", (
void *)specval, magic);
89 if (!req_block && (type & VM_ENV_FLAG_LOCAL) != 0) {
90 rb_bug(
"vm_push_frame: specval (%p) should not be a block_ptr on %x frame", (
void *)specval, magic);
95 rb_bug(
"vm_push_frame: (%s) should be method entry on %x frame",
rb_obj_info(cref_or_me), magic);
99 if (req_cref && cref_or_me_type !=
imemo_cref) {
100 rb_bug(
"vm_push_frame: (%s) should be CREF on %x frame",
rb_obj_info(cref_or_me), magic);
108 rb_bug(
"vm_push_frame: (%s) should be false or cref on %x frame",
rb_obj_info(cref_or_me), magic);
117 if (!callable_method_entry_p(me)) {
118 rb_bug(
"vm_push_frame: ment (%s) should be callable on %x frame.",
rb_obj_info(cref_or_me), magic);
124 RUBY_VM_NORMAL_ISEQ_P(iseq) );
127 VM_ASSERT(is_cframe == !RUBY_VM_NORMAL_ISEQ_P(iseq));
140 #define CHECK(magic, req_block, req_me, req_cref, is_cframe) \ 142 vm_check_frame_detail(type, req_block, req_me, req_cref, \ 143 specval, cref_or_me, is_cframe, iseq); \ 145 switch (given_magic) {
159 rb_bug(
"vm_push_frame: unknown type (%x)", (
unsigned int)given_magic);
164 #define vm_check_frame(a, b, c, d) 199 for (i=0; i < local_size; i++) {
214 #if VM_DEBUG_BP_CHECK 215 cfp->bp_check = sp + 1;
237 return vm_push_frame(th, iseq, type,
self, specval, cref_or_me, pc, sp, local_size, stack_max);
266 err_mess =
rb_sprintf(
"wrong number of arguments (given %d, expected %d)", argc, min);
269 err_mess =
rb_sprintf(
"wrong number of arguments (given %d, expected %d+)", argc, min);
272 err_mess =
rb_sprintf(
"wrong number of arguments (given %d, expected %d..%d)", argc, min, max);
317 #if VM_CHECK_MODE > 0 319 vm_svar_valid_p(
VALUE svar)
375 return svar->lastline;
377 return svar->backref;
379 const VALUE ary = svar->others;
414 VALUE ary = svar->others;
450 rb_bug(
"unexpected back-ref");
466 #if VM_CHECK_MODE > 0 480 #if VM_CHECK_MODE > 0 481 rb_bug(
"check_method_entry: svar should not be there:");
512 #if VM_CHECK_MODE == 0 520 #if VM_CHECK_MODE > 0 534 #if VM_CHECK_MODE > 0 535 rb_bug(
"check_method_entry: svar should not be there:");
583 const VALUE v = *vptr;
603 rb_bug(
"cref_replace_with_duplicated_cref_each_frame: unreachable");
629 rb_bug(
"vm_cref_dup: unreachable");
643 rb_bug(
"rb_vm_get_cref: unreachable");
672 *new_cref_ptr = new_cref;
677 *new_cref_ptr = new_cref;
680 *new_cref_ptr =
NULL;
747 rb_warn(
"not defined at the refinement, but at the outer class/module");
763 if (orig_klass ==
Qnil) {
790 if (am == klass)
break;
792 if (is_defined)
return 1;
795 goto search_continue;
841 rb_bug(
"vm_get_cvar_base: no cref");
850 rb_warn(
"class variable access from toplevel");
875 #ifndef USE_IC_FOR_IVAR 876 #define USE_IC_FOR_IVAR 1 904 if (
st_lookup(iv_index_tbl,
id, &index)) {
955 else if (index >= INT_MAX) {
1016 escape_cfp = reg_cfp;
1018 while (base_iseq->
body->
type != ISEQ_TYPE_BLOCK) {
1021 ep = escape_cfp->
ep;
1022 base_iseq = escape_cfp->
iseq;
1040 while (escape_cfp < eocfp) {
1041 if (escape_cfp->
ep == ep) {
1048 for (i=0; i < ct->size; i++) {
1052 if (entry->
cont == epc) {
1073 for (i = 0; i <
level; i++) {
1082 int in_class_frame = 0;
1084 escape_cfp = reg_cfp;
1086 while (escape_cfp < eocfp) {
1093 if (lep == target_lep &&
1100 if (lep == target_lep) {
1103 if (in_class_frame) {
1108 const VALUE *tep = current_ep;
1110 while (target_lep != tep) {
1111 if (escape_cfp->
ep == tep) {
1122 case ISEQ_TYPE_MAIN:
1123 if (toplevel)
goto valid_return;
1125 case ISEQ_TYPE_EVAL:
1126 case ISEQ_TYPE_CLASS:
1135 if (escape_cfp->
ep == target_lep && escape_cfp->
iseq->
body->
type == ISEQ_TYPE_METHOD) {
1147 rb_bug(
"isns(throw): unsupport throw type");
1163 return vm_throw_start(th, reg_cfp, state, flag, level, throwobj);
1173 int is_splat = flag & 0x01;
1174 rb_num_t space_size = num + is_splat;
1183 cfp->
sp += space_size;
1193 for (i=0; i<num-
len; i++) {
1197 for (j=0; i<num; i++, j++) {
1198 VALUE v = ptr[len - j - 1];
1208 VALUE *bptr = &base[space_size - 1];
1210 for (i=0; i<num; i++) {
1212 for (; i<num; i++) {
1238 #if OPT_INLINE_METHOD_CACHE 1249 #if OPT_INLINE_METHOD_CACHE 1268 #ifndef NO_BIG_INLINE 1349 rb_bug(
"check_match: unreachable");
1354 #if defined(_MSC_VER) && _MSC_VER < 1300 1355 #define CHECK_CMP_NAN(a, b) if (isnan(a) || isnan(b)) return Qfalse; 1357 #define CHECK_CMP_NAN(a, b) 1399 #if VM_DEBUG_BP_CHECK 1400 if (bp != cfp->bp_check) {
1401 fprintf(stderr,
"bp_check: %ld, bp: %ld\n",
1404 rb_bug(
"vm_base_ptr: unreachable");
1435 #if VM_CHECK_MODE > 0 1502 int opt_pc,
int param_size,
int local_size)
1514 int opt_pc,
int param_size,
int local_size)
1519 VALUE *sp = argv + param_size;
1520 cfp->
sp = argv - 1 ;
1525 local_size - param_size,
1539 VALUE *sp_orig, *sp;
1557 sp_orig = sp = cfp->
sp;
1560 sp[0] = calling->
recv;
1565 *sp++ = src_argv[i];
1595 return (*
func)(recv);
1601 return (*
func)(recv, argv[0]);
1607 return (*
func)(recv, argv[0], argv[1]);
1613 return (*
func)(recv, argv[0], argv[1], argv[2]);
1619 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3]);
1625 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4]);
1631 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
1637 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
1643 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]);
1649 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8]);
1655 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9]);
1661 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]);
1667 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11]);
1673 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11], argv[12]);
1679 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11], argv[12], argv[13]);
1685 return (*
func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11], argv[12], argv[13], argv[14]);
1689 #define VM_PROFILE 0 1694 VM_PROFILE_R2C_CALL,
1695 VM_PROFILE_R2C_POPF,
1696 VM_PROFILE_C2C_CALL,
1697 VM_PROFILE_C2C_POPF,
1700 static int vm_profile_counter[VM_PROFILE_COUNT];
1701 #define VM_PROFILE_UP(x) (vm_profile_counter[VM_PROFILE_##x]++) 1702 #define VM_PROFILE_ATEXIT() atexit(vm_profile_show_result) 1704 vm_profile_show_result(
void)
1706 fprintf(stderr,
"VM Profile results: \n");
1707 fprintf(stderr,
"r->c call: %d\n", vm_profile_counter[VM_PROFILE_R2C_CALL]);
1708 fprintf(stderr,
"r->c popf: %d\n", vm_profile_counter[VM_PROFILE_R2C_POPF]);
1709 fprintf(stderr,
"c->c call: %d\n", vm_profile_counter[VM_PROFILE_C2C_CALL]);
1710 fprintf(stderr,
"c->c popf: %d\n", vm_profile_counter[VM_PROFILE_C2C_POPF]);
1713 #define VM_PROFILE_UP(x) 1714 #define VM_PROFILE_ATEXIT() 1721 #if VM_DEBUG_VERIFY_METHOD_CACHE 1726 # define METHOD_BUG(t) case VM_METHOD_TYPE_##t: rb_bug("wrong method type: " #t) 1728 METHOD_BUG(ATTRSET);
1730 METHOD_BUG(BMETHOD);
1733 METHOD_BUG(OPTIMIZED);
1734 METHOD_BUG(MISSING);
1735 METHOD_BUG(REFINED);
1761 block_handler, (
VALUE)me,
1762 0, th->
cfp->
sp, 0, 0);
1766 reg_cfp->
sp -= argc + 1;
1768 val = (*cfunc->
invoker)(cfunc->
func, recv, argc, reg_cfp->
sp + 1);
1770 if (reg_cfp != th->
cfp + 1) {
1771 rb_bug(
"vm_call_cfunc - cfp consistency error");
1782 #if OPT_CALL_CFUNC_WITHOUT_FRAME 1792 th->passed_calling = calling;
1793 reg_cfp->
sp -= argc + 1;
1794 ci->aux.inc_sp = argc + 1;
1796 val = (*cfunc->
invoker)(cfunc->
func, recv, argc, argv);
1799 if (reg_cfp == th->
cfp) {
1800 if (
UNLIKELY(th->passed_ci != ci)) {
1801 rb_bug(
"vm_call_cfunc_latter: passed_ci error (ci: %p, passed_ci: %p)", ci, th->passed_ci);
1807 rb_bug(
"vm_call_cfunc_latter: cfp consistency error (%p, %p)", reg_cfp, th->
cfp+1);
1832 !(ci->kw_arg !=
NULL)) {
1835 val = vm_call_cfunc_latter(th, reg_cfp, calling);
1854 if (calling->call != vm_call_general) {
1903 argc = calling->
argc;
1906 cfp->
sp += - argc - 1;
1932 i = calling->
argc - 1;
1934 if (calling->
argc == 0) {
1945 ci_entry.
ci = *orig_ci;
1950 cc_entry = *orig_cc;
1963 ci->
mid = idMethodMissing;
1989 argc = calling->
argc;
1993 cfp->
sp -= argc + 1;
2008 argc = calling->
argc+1;
2011 ci_entry.
mid = idMethodMissing;
2015 cc_entry = *orig_cc;
2055 if (
NIL_P(refinements)) {
2076 }
while (cfp->
iseq != local_iseq);
2084 VALUE klass = current_class;
2089 while (
RTEST(klass)) {
2091 if (owner == target_owner) {
2097 return current_class;
2124 VM_ASSERT(callable_method_entry_p(cme));
2142 VM_ASSERT(callable_method_entry_p(cme));
2194 case OPTIMIZED_METHOD_TYPE_SEND:
2197 case OPTIMIZED_METHOD_TYPE_CALL:
2201 rb_bug(
"vm_call_method: unsupported optimized method type (%d)",
2219 if (
NIL_P(refinement)) {
2220 goto no_refinement_dispatch;
2225 if (cc->
call == vm_call_super_method) {
2229 goto no_refinement_dispatch;
2242 no_refinement_dispatch:
2253 rb_bug(
"vm_call_method: unsupported method type (%d)", cc->
me->
def->
type);
2262 if (ci->
mid == idMethodMissing) {
2332 if (cc->
call != vm_call_super_method)
rb_bug(
"bug");
2343 klass =
RBASIC(klass)->klass;
2359 VALUE current_defined_class, klass;
2378 RBASIC(current_defined_class)->klass : current_defined_class;
2381 "self has wrong type to call super in this context: " 2388 "implicit argument passing of super from method defined" 2389 " by define_method() is not supported." 2390 " Specify all arguments explicitly.");
2432 blockarg = block_handler;
2452 int is_lambda =
FALSE;
2461 else if (argc == 0) {
2475 0, th->
cfp->
sp, 0, 0);
2476 val = (*ifunc->
func)(arg, ifunc->
data, argc, argv, blockarg);
2506 VALUE ary, arg0 = argv[0];
2522 calling->
argc == 1 &&
2534 for (i=calling->
argc; i<iseq->body->param.lead_num; i++) argv[i] =
Qnil;
2559 calling = &calling_entry;
2602 argc = calling->
argc;
2616 argc = calling->
argc;
2646 int is_lambda =
FALSE;
2648 if ((type != ISEQ_TYPE_METHOD && type != ISEQ_TYPE_CLASS) ||
2684 rb_bug(
"vm_make_proc_with_iseq: unreachable");
2730 args[0] = obj; args[1] =
Qfalse;
2834 rb_bug(
"unimplemented defined? type (VM)");
2838 if (expr_type != 0) {
RUBY_EXTERN VALUE rb_cString
static int VM_ENV_ESCAPED_P(const VALUE *ep)
static VALUE vm_call_bmethod_body(rb_thread_t *th, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, const VALUE *argv)
rb_control_frame_t * rb_vm_get_ruby_level_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp)
static const VALUE * VM_CF_LEP(const rb_control_frame_t *const cfp)
#define UNDEFINED_METHOD_ENTRY_P(me)
ID rb_check_id(volatile VALUE *)
Returns ID for the given name if it is interned already, or 0.
#define RUBY_VM_CHECK_INTS(th)
VALUE rb_reg_match_last(VALUE)
static VALUE call_cfunc_0(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
VALUE rb_ary_entry(VALUE ary, long offset)
RUBY_EXTERN VALUE rb_cFloat
#define RUBY_EVENT_C_RETURN
VALUE rb_proc_call_with_block(VALUE, int argc, const VALUE *argv, VALUE)
void rb_bug(const char *fmt,...)
static VALUE vm_defined(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_num_t op_type, VALUE obj, VALUE needstr, VALUE v)
static VALUE vm_get_iclass(rb_control_frame_t *cfp, VALUE klass)
static VALUE make_no_method_exception(VALUE exc, VALUE format, VALUE obj, int argc, const VALUE *argv, int priv)
VALUE rb_str_equal(VALUE str1, VALUE str2)
const rb_callable_method_entry_t * rb_callable_method_entry_with_refinements(VALUE klass, ID id)
static VALUE vm_throw_continue(rb_thread_t *th, VALUE err)
static int setup_parameters_complex(rb_thread_t *const th, const rb_iseq_t *const iseq, struct rb_calling_info *const calling, const struct rb_call_info *ci, VALUE *const locals, const enum arg_setup_type arg_setup_type)
static VALUE vm_call_zsuper(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, VALUE klass)
static VALUE lep_svar_get(rb_thread_t *th, const VALUE *lep, rb_num_t key)
const rb_callable_method_entry_t * me
static int vm_env_cref_by_cref(const VALUE *ep)
static rb_cref_t * rb_vm_get_cref(const VALUE *ep)
static int max(int a, int b)
static VALUE vm_get_const_base(const VALUE *ep)
static VALUE find_refinement(VALUE refinements, VALUE klass)
static const rb_iseq_t * def_iseq_ptr(rb_method_definition_t *def)
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)
#define GetProcPtr(obj, ptr)
static int VM_FRAME_FINISHED_P(const rb_control_frame_t *cfp)
#define vm_check_frame(a, b, c, d)
static VALUE vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, int opt_pc)
static void lep_svar_set(rb_thread_t *th, const VALUE *lep, rb_num_t key, VALUE val)
enum method_missing_reason method_missing_reason
union iseq_inline_cache_entry::@193 ic_value
static const rb_iseq_t * rb_iseq_check(const rb_iseq_t *iseq)
struct rb_method_definition_struct *const def
static int block_proc_is_lambda(const VALUE procval)
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2)
static int CREF_PUSHED_BY_EVAL(const rb_cref_t *cref)
static VALUE call_cfunc_10(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
struct rb_iseq_constant_body::@196::@197 flags
static void vm_expandarray(rb_control_frame_t *cfp, VALUE ary, rb_num_t num, int flag)
static void lep_svar_write(rb_thread_t *th, const VALUE *lep, const struct vm_svar *svar)
VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, int argc, const VALUE *argv, VALUE passed_block_handler)
#define VM_BLOCK_HANDLER_NONE
static const rb_callable_method_entry_t * aliased_callable_method_entry(const rb_callable_method_entry_t *me)
#define GET_BLOCK_HANDLER()
SSL_METHOD *(* func)(void)
static VALUE VM_BH_TO_SYMBOL(VALUE block_handler)
VALUE rb_iseq_defined_string(enum defined_type type)
struct rb_iseq_constant_body * body
static void argument_arity_error(rb_thread_t *th, const rb_iseq_t *iseq, const int miss_argc, const int min_argc, const int max_argc)
static VALUE vm_call0(rb_thread_t *, VALUE, ID, int, const VALUE *, const rb_callable_method_entry_t *)
static VALUE vm_invoke_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci)
#define ROBJECT_IV_INDEX_TBL(o)
static const rb_cref_t * vm_get_const_key_cref(const VALUE *ep)
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_ivar_get(VALUE, ID)
static void method_definition_set(const rb_method_entry_t *me, rb_method_definition_t *def, void *opts)
static VALUE vm_call_method_missing(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *orig_ci, struct rb_call_cache *orig_cc)
struct rb_iseq_constant_body::@196 param
parameter information
VALUE rb_obj_is_kind_of(VALUE, VALUE)
static rb_callable_method_entry_t * check_method_entry(VALUE obj, int can_be_svar)
int rb_const_defined(VALUE, ID)
#define VM_CALL_ARGS_SPLAT
void rb_vm_localjump_error(const char *mesg, VALUE value, int reason)
static VALUE CREF_REFINEMENTS(const rb_cref_t *cref)
VALUE rb_hash_lookup(VALUE hash, VALUE key)
#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)
#define STACK_ADDR_FROM_TOP(n)
#define GET_GLOBAL_METHOD_STATE()
static VALUE vm_getinstancevariable(VALUE obj, ID id, IC ic)
VALUE rb_reg_match_post(VALUE)
static VALUE vm_once_clear(VALUE data)
static int VM_ENV_LOCAL_P(const VALUE *ep)
RUBY_EXTERN VALUE rb_cProc
static VALUE vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static int VM_FRAME_RUBYFRAME_P(const rb_control_frame_t *cfp)
static VALUE vm_search_const_defined_class(const VALUE cbase, ID id)
static const VALUE * VM_EP_LEP(const VALUE *ep)
static VALUE vm_call_ivar(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
VALUE rb_ivar_defined(VALUE, ID)
PUREFUNC(static rb_callable_method_entry_t *check_method_entry(VALUE obj, int can_be_svar))
VALUE rb_reg_last_match(VALUE)
static VALUE call_cfunc_11(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
#define IS_ARGS_KEYWORD(ci)
static void vm_env_write_slowpath(const VALUE *ep, int index, VALUE v)
#define VM_ENV_DATA_INDEX_ME_CREF
#define RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, klass, id)
#define THROW_DATA_P(err)
static rb_control_frame_t * vm_push_frame(rb_thread_t *th, const rb_iseq_t *iseq, VALUE type, VALUE self, VALUE specval, VALUE cref_or_me, const VALUE *pc, VALUE *sp, int local_size, int stack_max)
static int vm_callee_setup_block_arg(rb_thread_t *th, struct rb_calling_info *calling, const struct rb_call_info *ci, const rb_iseq_t *iseq, VALUE *argv, const enum arg_setup_type arg_setup_type)
static VALUE vm_getivar(VALUE obj, ID id, IC ic, struct rb_call_cache *cc, int is_attr)
static void vm_check_if_namespace(VALUE klass)
RUBY_SYMBOL_EXPORT_BEGIN typedef unsigned long st_data_t
VALUE rb_vm_make_proc(rb_thread_t *th, const struct rb_captured_block *captured, VALUE klass)
enum iseq_catch_table_entry::catch_type type
const VALUE * iseq_encoded
void rb_exc_raise(VALUE mesg)
static const struct rb_captured_block * VM_BH_TO_CAPT_BLOCK(VALUE block_handler)
const rb_callable_method_entry_t * rb_vm_frame_method_entry(const rb_control_frame_t *cfp)
#define RB_TYPE_P(obj, type)
static VALUE opt_eq_func(VALUE recv, VALUE obj, CALL_INFO ci, CALL_CACHE cc)
static VALUE vm_get_cbase(const VALUE *ep)
static VALUE call_cfunc_15(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
#define BASIC_OP_UNREDEFINED_P(op, klass)
VALUE rb_cvar_defined(VALUE, ID)
static void vm_search_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, struct rb_call_info *ci, struct rb_call_cache *cc)
struct rb_cref_struct *const next
static rb_cref_t * check_cref(VALUE obj, int can_be_svar)
static VALUE vm_proc_to_block_handler(VALUE procval)
#define IS_ARGS_SPLAT(ci)
static VALUE vm_invoke_iseq_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, int is_lambda, const struct rb_captured_block *captured)
static int VM_BH_ISEQ_BLOCK_P(VALUE block_handler)
enum method_missing_reason method_missing_reason
VALUE(* vm_call_handler)(struct rb_thread_struct *th, struct rb_control_frame_struct *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static int vm_callee_setup_block_arg_arg0_splat(rb_control_frame_t *cfp, const rb_iseq_t *iseq, VALUE *argv, VALUE ary)
unsigned int local_table_size
VALUE rb_gvar_defined(struct rb_global_entry *)
RUBY_EXTERN VALUE rb_cObject
static VALUE * vm_base_ptr(const rb_control_frame_t *cfp)
#define CALLER_SETUP_ARG(cfp, calling, ci)
RUBY_EXTERN VALUE rb_cBasicObject
VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, VALUE passed_proc)
union rb_call_cache::@195 aux
static VALUE vm_invoke_symbol_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, VALUE symbol)
#define CHECK_CMP_NAN(a, b)
static VALUE VM_BH_FROM_PROC(VALUE procval)
static VALUE vm_call_opt_send(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *orig_ci, struct rb_call_cache *orig_cc)
static VALUE vm_call_general(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
ALWAYS_INLINE(static VALUE vm_getivar(VALUE, ID, IC, struct rb_call_cache *, int))
static VALUE vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_num_t throw_state, VALUE throwobj)
struct rb_method_definition_struct *const def
void rb_ary_store(VALUE ary, long idx, VALUE val)
static VALUE call_cfunc_2(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static const struct rb_captured_block * VM_BH_TO_ISEQ_BLOCK(VALUE block_handler)
static const rb_control_frame_t * rb_vm_search_cf_from_ep(const rb_thread_t *const th, const rb_control_frame_t *cfp, const VALUE *const ep)
int rb_public_const_defined_from(VALUE klass, ID id)
static int is_cref(const VALUE v, int can_be_svar)
static vm_call_handler vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, const int local_size)
#define ALLOCA_N(type, n)
const VALUE defined_class
#define RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, klass, id)
#define VM_GUARDED_PREV_EP(ep)
RUBY_EXTERN VALUE rb_cModule
#define MEMCPY(p1, p2, type, n)
VALUE rb_obj_alloc(VALUE)
#define RUBY_EVENT_C_CALL
static VALUE call_cfunc_1(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static VALUE vm_block_handler_to_proc(rb_thread_t *th, VALUE block_handler)
VALUE rb_struct_aset(VALUE, VALUE, VALUE)
static VALUE call_cfunc_9(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static VALUE call_cfunc_3(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
void rb_vm_pop_frame(rb_thread_t *th)
struct iseq_inline_storage_entry::@194 once
#define VM_ENV_DATA_INDEX_SPECVAL
VALUE rb_obj_equal(VALUE obj1, VALUE obj2)
static VALUE vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
#define RCLASS_REFINED_CLASS(c)
static VALUE vm_invoke_bmethod(rb_thread_t *th, rb_proc_t *proc, VALUE self, int argc, const VALUE *argv, VALUE block_handler)
VALUE rb_const_get(VALUE, ID)
static rb_cref_t * vm_cref_push(rb_thread_t *th, VALUE klass, const VALUE *ep, int pushed_by_eval)
static rb_cref_t * vm_env_cref(const VALUE *ep)
VALUE rb_ary_to_ary(VALUE obj)
#define STRING_REDEFINED_OP_FLAG
#define RARRAY_CONST_PTR(a)
static const struct rb_block * vm_proc_block(VALUE procval)
static void VM_FORCE_WRITE(const VALUE *ptr, VALUE v)
#define CI_SET_FASTPATH(cc, func, enabled)
static int vm_pop_frame(rb_thread_t *th, rb_control_frame_t *cfp, const VALUE *ep)
VALUE(* invoker)(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
union rb_method_definition_struct::@144 body
static VALUE call_cfunc_13(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static VALUE vm_once_exec(VALUE iseq)
VALUE rb_sprintf(const char *format,...)
const rb_callable_method_entry_t * rb_callable_method_entry(VALUE klass, ID id)
static rb_cref_t * CREF_NEXT(const rb_cref_t *cref)
#define RICLASS_IS_ORIGIN
const rb_method_entry_t * rb_method_entry(VALUE klass, ID id)
static VALUE vm_get_cvar_base(const rb_cref_t *cref, rb_control_frame_t *cfp)
void rb_raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj, int call_status)
static enum rb_block_handler_type vm_block_handler_type(VALUE block_handler)
#define MEMMOVE(p1, p2, type, n)
static VALUE CREF_CLASS(const rb_cref_t *cref)
#define VMDEBUG
VM Debug Level.
static void VM_STACK_ENV_WRITE(const VALUE *ep, int index, VALUE v)
VALUE rb_ivar_set(VALUE, ID, VALUE)
rb_control_frame_t *FUNC_FASTCALL() rb_vm_opt_struct_aref(rb_thread_t *th, rb_control_frame_t *reg_cfp)
VALUE rb_sym_to_proc(VALUE sym)
#define METHOD_ENTRY_VISI(me)
int rb_autoloading_value(VALUE mod, ID id, VALUE *value)
#define EXEC_EVENT_HOOK(th_, flag_, self_, id_, called_id_, klass_, data_)
static void vm_search_method(const struct rb_call_info *ci, struct rb_call_cache *cc, VALUE recv)
const VALUE defined_class
void rb_obj_copy_ivar(VALUE dest, VALUE obj)
VALUE ruby_vm_special_exception_copy(VALUE exc)
static VALUE find_defined_class_by_owner(VALUE current_class, VALUE target_owner)
static enum rb_block_type vm_block_type(const struct rb_block *block)
const struct rb_method_entry_struct *const original_me
static VALUE VM_BH_FROM_IFUNC_BLOCK(const struct rb_captured_block *captured)
#define VM_ENV_DATA_INDEX_FLAGS
static VALUE check_match(VALUE pattern, VALUE target, enum vm_check_match_type type)
VALUE rb_check_funcall(VALUE, ID, int, const VALUE *)
static VALUE call_cfunc_m2(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static const rb_method_cfunc_t * vm_method_cfunc_entry(const rb_callable_method_entry_t *me)
const struct vm_ifunc * ifunc
static VALUE vm_search_normal_superclass(VALUE klass)
void rb_const_warn_if_deprecated(const rb_const_entry_t *ce, VALUE klass, ID id)
static VALUE call_cfunc_12(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static VALUE call_cfunc_5(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static rb_control_frame_t * current_method_entry(rb_thread_t *th, rb_control_frame_t *cfp)
static rb_method_definition_t * method_definition_create(rb_method_type_t type, ID mid)
static VALUE vm_call_iseq_setup_tailcall_0start(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static VALUE double_cmp_le(double a, double b)
VALUE rb_equal_opt(VALUE obj1, VALUE obj2)
enum rb_iseq_constant_body::iseq_type type
static void vm_env_write(const VALUE *ep, int index, VALUE v)
#define RUBY_VM_END_CONTROL_FRAME(th)
static VALUE double_cmp_gt(double a, double b)
VALUE rb_class_real(VALUE cl)
const rb_callable_method_entry_t * passed_bmethod_me
struct rb_captured_block captured
register unsigned int len
static VALUE vm_getspecial(rb_thread_t *th, const VALUE *lep, rb_num_t key, rb_num_t type)
static VALUE call_cfunc_7(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static unsigned long VM_FRAME_TYPE(const rb_control_frame_t *cfp)
static VALUE double_cmp_ge(double a, double b)
const rb_callable_method_entry_t * rb_callable_method_entry_without_refinements(VALUE klass, ID id)
static enum defined_type check_respond_to_missing(VALUE obj, VALUE v)
static VALUE vm_invoke_ifunc_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, const struct rb_captured_block *captured)
static int VM_BH_FROM_CFP_P(VALUE block_handler, const rb_control_frame_t *cfp)
void rb_vm_rewrite_cref(rb_cref_t *cref, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr)
static VALUE vm_call_method_nome(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static rb_cref_t * cref_replace_with_duplicated_cref_each_frame(const VALUE *vptr, int can_be_svar, VALUE parent)
static VALUE VM_BH_TO_PROC(VALUE block_handler)
int rb_const_defined_at(VALUE, ID)
rb_const_entry_t * rb_const_lookup(VALUE klass, ID id)
#define UNLIMITED_ARGUMENTS
static void vm_setinstancevariable(VALUE obj, ID id, VALUE val, IC ic)
const struct iseq_catch_table * catch_table
const rb_callable_method_entry_t * rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class)
#define RARRAY_AREF(a, i)
static const rb_callable_method_entry_t * refined_method_callable_without_refinement(const rb_callable_method_entry_t *me)
static VALUE vm_callee_setup_block_arg_arg0_check(VALUE *argv)
static VALUE call_cfunc_m1(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static rb_cref_t * vm_cref_new(VALUE klass, rb_method_visibility_t visi, int module_func, rb_cref_t *prev_cref, int pushed_by_eval)
rb_control_frame_t * rb_vm_push_frame(rb_thread_t *th, const rb_iseq_t *iseq, VALUE type, VALUE self, VALUE specval, VALUE cref_or_me, const VALUE *pc, VALUE *sp, int local_size, int stack_max)
static int simple_iseq_p(const rb_iseq_t *iseq)
#define RBASIC_CLASS(obj)
#define FLOAT_REDEFINED_OP_FLAG
VALUE rb_check_array_type(VALUE ary)
VALUE rb_struct_aref(VALUE, VALUE)
void rb_error_arity(int argc, int min, int max)
struct rb_iseq_struct * local_iseq
static int vm_callee_setup_arg(rb_thread_t *th, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, const rb_iseq_t *iseq, VALUE *argv, int param_size, int local_size)
static rb_cref_t * vm_cref_dup(const rb_cref_t *cref)
static VALUE call_cfunc_14(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static int THROW_DATA_STATE(const struct vm_throw_data *obj)
static VALUE rb_arity_error_new(int argc, int min, int max)
static VALUE VM_BH_FROM_SYMBOL(VALUE symbol)
int rb_method_basic_definition_p(VALUE, ID)
#define RB_BUILTIN_TYPE(x)
static VALUE vm_setivar(VALUE obj, ID id, VALUE val, IC ic, struct rb_call_cache *cc, int is_attr)
struct rb_thread_struct * running_thread
static VALUE vm_call_method_each_type(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static VALUE vm_call_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
#define INTEGER_REDEFINED_OP_FLAG
static VALUE call_cfunc_6(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
#define VM_UNREACHABLE(func)
const char * rb_obj_info(VALUE obj)
static VALUE vm_get_ev_const(rb_thread_t *th, VALUE orig_klass, ID id, int is_defined)
static void VM_ENV_FLAGS_UNSET(const VALUE *ep, VALUE flag)
void rb_notimplement(void)
static VALUE vm_yield_with_cfunc(rb_thread_t *th, const struct rb_captured_block *captured, VALUE self, int argc, const VALUE *argv, VALUE block_handler)
static enum method_missing_reason ci_missing_reason(const struct rb_call_info *ci)
void rb_gc_writebarrier_remember(VALUE obj)
static VALUE vm_call_attrset(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static VALUE call_cfunc_4(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static rb_cref_t * method_entry_cref(rb_callable_method_entry_t *me)
const struct rb_iseq_struct * parent_iseq
static VALUE vm_call_bmethod(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
VALUE rb_reg_match_pre(VALUE)
static VALUE VM_BH_FROM_ISEQ_BLOCK(const struct rb_captured_block *captured)
static VALUE vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, int opt_pc, int param_size, int local_size)
static VALUE vm_yield_with_symbol(rb_thread_t *th, VALUE symbol, int argc, const VALUE *argv, VALUE block_handler)
static VALUE vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, int opt_pc, int param_size, int local_size)
NOINLINE(static void vm_env_write_slowpath(const VALUE *ep, int index, VALUE v))
static struct rb_captured_block * VM_CFP_TO_CAPTURED_BLOCK(const rb_control_frame_t *cfp)
static rb_cref_t * vm_cref_new_use_prev(VALUE klass, rb_method_visibility_t visi, int module_func, rb_cref_t *prev_cref, int pushed_by_eval)
void rb_warning(const char *fmt,...)
static rb_control_frame_t * vm_get_ruby_level_caller_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp)
#define rb_check_frozen(obj)
static void vm_ensure_not_refinement_module(VALUE self)
static void vm_super_outside(void)
void rb_vm_env_write(const VALUE *ep, int index, VALUE v)
VALUE rb_str_intern(VALUE)
static VALUE vm_make_proc_with_iseq(const rb_iseq_t *blockiseq)
rb_control_frame_t *FUNC_FASTCALL() rb_vm_opt_struct_aset(rb_thread_t *th, rb_control_frame_t *reg_cfp)
enum rb_method_definition_struct::@144::method_optimized_type optimize_type
const rb_iseq_t *const iseqptr
#define SPECIAL_CONST_P(x)
VALUE rb_public_const_get_from(VALUE klass, ID id)
static int check_cfunc(const rb_callable_method_entry_t *me, VALUE(*func)())
#define CHECK_VM_STACK_OVERFLOW(cfp, margin)
static VALUE VM_CF_BLOCK_HANDLER(const rb_control_frame_t *const cfp)
static VALUE vm_call_opt_call(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static struct vm_svar * lep_svar(rb_thread_t *th, const VALUE *lep)
int rb_method_boundp(VALUE, ID, int)
const struct rb_method_entry_struct *const orig_me
static VALUE vm_call_iseq_setup_normal_0start(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static VALUE vm_call_cfunc_with_frame(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static VALUE VM_ENV_ENVVAL(const VALUE *ep)
struct rb_global_entry * rb_global_entry(ID)
rb_method_refined_t refined
static VALUE vm_throw_start(rb_thread_t *const th, rb_control_frame_t *const reg_cfp, enum ruby_tag_type state, const int flag, const rb_num_t level, const VALUE throwobj)
void rb_gc_verify_internal_consistency(void)
static VALUE vm_call_iseq_setup(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
static const VALUE * VM_ENV_PREV_EP(const VALUE *ep)
void rb_warn(const char *fmt,...)
#define CHECK_VM_STACK_OVERFLOW0(cfp, sp, margin)
union rb_captured_block::@202 code
VALUE rb_autoload_load(VALUE, ID)
static int vm_yield_setup_args(rb_thread_t *th, const rb_iseq_t *iseq, const int argc, VALUE *argv, VALUE block_handler, enum arg_setup_type arg_setup_type)
static VALUE call_cfunc_8(VALUE(*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
static VALUE double_cmp_lt(double a, double b)
#define RB_OBJ_WRITE(a, slot, b)
VALUE rb_reg_nth_match(int, VALUE)
static rb_cref_t * vm_cref_replace_with_duplicated_cref(const VALUE *ep)
VALUE rb_attr_get(VALUE, ID)
static void vm_stackoverflow(void)
static struct vm_svar * svar_new(VALUE obj)
static const struct rb_captured_block * VM_BH_TO_IFUNC_BLOCK(VALUE block_handler)
VALUE rb_obj_class(VALUE)
static struct vm_throw_data * THROW_DATA_NEW(VALUE val, const rb_control_frame_t *cf, VALUE st)