43 if (!def)
return Qnil;
60 *reg_cfp->
sp++ = recv;
61 for (i = 0; i <
argc; i++) {
62 *reg_cfp->
sp++ = argv[
i];
76 recv, (
VALUE)blockptr, 0, reg_cfp->
sp, 0, 1);
81 if (reg_cfp != th->
cfp + 1) {
82 rb_bug(
"cfp consistency error - call0");
113 if (!(def = me->
def))
return Qnil;
127 case OPTIMIZED_METHOD_TYPE_SEND:
130 case OPTIMIZED_METHOD_TYPE_CALL: {
144 rb_bug(
"vm_call0: unsupported method type (%d)", def->
type);
155 return vm_call0(th, recv,
id, argc, argv, me);
177 rb_bug(
"vm_call_super: should not be reached");
185 return vm_call0(th, recv,
id, argc, argv, me);
208 #define NOEX_OK NOEX_NOSUPER
236 return vm_call0(th, recv, mid, argc, argv, me);
279 if (arity < 1 || arity > 3) arity = 2;
308 return vm_call0(th, recv, mid, argc, argv, me);
320 #define type_case(t) case t: return #t;
347 default:
return NULL;
361 "method `%s' called on unexpected immediate object (%p)",
364 flags =
RBASIC(recv)->flags;
365 klass =
RBASIC(recv)->klass;
368 "method `%s' called on terminated object"
377 "method `%s' called on hidden %s object"
379 rb_id2name(mid), typestr, (
void *)recv, flags, klass);
382 "method `%s' called on unexpected %s object"
383 " (%p flags=0x%"PRIxVALUE
" klass=0x%"PRIxVALUE
")",
384 rb_id2name(mid), typestr, (
void *)recv, flags, klass);
387 "method `%s' called on broken T_???" "(0x%02x) object"
388 " (%p flags=0x%"PRIxVALUE
" klass=0x%"PRIxVALUE
")",
389 rb_id2name(mid), type, (
void *)recv, flags, klass);
409 if (oid != idMethodMissing) {
418 VALUE defined_class = klass;
421 defined_class =
RBASIC(defined_class)->klass;
460 VALUE obj,
int call_status));
503 #define NOEX_MISSING 0x80
507 int last_call_status)
511 const char *format = 0;
513 if (argc == 0 || !
SYMBOL_P(argv[0])) {
522 format =
"private method `%s' called for %s";
525 format =
"protected method `%s' called for %s";
528 format =
"undefined local variable or method `%s' for %s";
532 format =
"super: no superclass method `%s' for %s";
535 format =
"undefined method `%s' for %s";
573 if (
id == idMethodMissing) {
595 result =
rb_funcall2(obj, idMethodMissing, argc + 1, nargv);
602 VALUE obj,
int call_status)
650 for (i = 0; i < n; i++) {
651 argv[
i] = va_arg(ar,
VALUE);
700 if (!
NIL_P(pass_procval)) {
706 block = &pass_proc->
block;
725 vid = *argv++; argc--;
804 for (i=0; i<n; i++) {
805 argv[
i] = va_arg(args,
VALUE);
891 blockptr->
iseq = (
void *)node;
899 retval = (*it_proc) (data1);
907 if (cdfp == escape_dfp) {
913 while (th->
cfp != cfp) {
915 printf(
"skipped frame: %s\n", vm_frametype_name(th->
cfp));
933 if (cdfp == escape_dfp) {
998 volatile int parse_in_eval;
999 volatile int mild_compile_error;
1011 volatile VALUE iseqval;
1013 if (scope !=
Qnil) {
1017 if (strcmp(file,
"(eval)") == 0 && bind->
filename !=
Qnil) {
1024 "wrong argument type %s (expected Binding)",
1076 if (strcmp(file,
"(eval)") == 0) {
1077 VALUE mesg, errat, bt2;
1132 VALUE src, scope, vfile, vline;
1133 const char *file =
"(eval)";
1136 rb_scan_args(argc, argv,
"13", &src, &scope, &vfile, &vline);
1141 "Insecure: can't modify trusted binding");
1287 const char *file =
"(eval)";
1303 "wrong number of arguments: %s(src) or %s{..}",
1312 return eval_under(klass,
self, argv[0], file, line);
1470 if (tt->
tag == tag) {
1574 th->
cfp = saved_cfp;
1639 if (
NIL_P(method)) {
1640 fprintf(fp,
"\tfrom %s:%d:in unknown method\n",
1644 fprintf(fp,
"\tfrom %s:%d:in `%s'\n",
1722 if (cfp->
lfp != cfp->
dfp) {
1730 while (cfp->
dfp != dfp) {
1772 (cfp->
lfp[0] & 0x02) == 0 &&
VALUE rb_f_public_send(int argc, VALUE *argv, VALUE recv)
const rb_block_t * passed_block
VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc, const VALUE *argv, const rb_method_entry_t *me)
#define RSTRING_LEN(string)
VALUE rb_ary_unshift(VALUE ary, VALUE item)
#define UNDEFINED_METHOD_ENTRY_P(me)
VALUE rb_make_backtrace(void)
static VALUE vm_search_normal_superclass(VALUE klass, VALUE recv)
VALUE rb_ary_new4(long n, const VALUE *elts)
static int vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, VALUE ary)
#define RUBY_EVENT_C_RETURN
void rb_bug(const char *fmt,...)
static NODE * vm_cref_push(rb_thread_t *th, VALUE klass, int noex, rb_block_t *blockptr)
static VALUE iterate_method(VALUE obj)
static VALUE rb_call0(VALUE recv, ID mid, int argc, const VALUE *argv, call_type scope, VALUE self)
static VALUE rb_vm_set_finish_env(rb_thread_t *th)
static rb_control_frame_t * vm_get_ruby_level_caller_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
VALUE rb_current_realfilepath(void)
VALUE rb_mod_module_eval(int argc, VALUE *argv, VALUE mod)
union rb_method_definition_struct::@39 body
VALUE rb_yield_values(int n,...)
static void stack_check(void)
static VALUE check_funcall(VALUE recv, ID mid, int argc, VALUE *argv)
#define VM_FRAME_MAGIC_CFUNC
static VALUE send_internal(int argc, const VALUE *argv, VALUE recv, call_type scope)
static VALUE vm_call0(rb_thread_t *th, VALUE recv, VALUE id, int argc, const VALUE *argv, const rb_method_entry_t *me)
void rb_throw(const char *tag, VALUE val)
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)
#define GetProcPtr(obj, ptr)
VALUE rb_eval_string_protect(const char *str, int *state)
VALUE rb_yield_splat(VALUE values)
VALUE rb_str_cat(VALUE, const char *, long)
VALUE rb_call_super(int argc, const VALUE *argv)
#define GET_THROWOBJ_CATCH_POINT(obj)
static void raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj, int last_call_status)
void rb_define_private_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
ID rb_frame_this_func(void)
VALUE rb_f_eval(int argc, VALUE *argv, VALUE self)
VALUE rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method)
#define TH_JUMP_TAG(th, st)
static VALUE check_funcall_failed(struct rescue_funcall_args *args, VALUE e)
VALUE rb_ary_push(VALUE ary, VALUE item)
int rb_backtrace_each(rb_backtrace_iter_func *iter, void *arg)
VALUE rb_ary_tmp_new(long capa)
#define RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp)
VALUE rb_catch_obj(VALUE tag, VALUE(*func)(), VALUE data)
VALUE rb_protect(VALUE(*proc)(VALUE), VALUE data, int *state)
#define RSTRING_PTR(string)
void rb_raise(VALUE exc, const char *fmt,...)
#define VM_FRAME_TYPE(cfp)
static VALUE rb_yield_0(int argc, const VALUE *argv)
void rb_str_update(VALUE, long, long, VALUE)
VALUE rb_ary_clear(VALUE ary)
#define new_args(f, o, r, p, b)
VALUE rb_obj_is_kind_of(VALUE, VALUE)
#define RARRAY_LEN(ARRAY)
static VALUE vm_yield(rb_thread_t *th, int argc, const VALUE *argv)
VALUE rb_catch(const char *tag, VALUE(*func)(), VALUE data)
static VALUE catch_i(VALUE tag, VALUE data)
static int print_backtrace(void *arg, VALUE file, int line, VALUE method)
#define GetEnvPtr(obj, ptr)
void rb_define_global_function(const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a global function.
VALUE rb_eval_string_wrap(const char *str, int *state)
rb_control_frame_t * rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
#define CHECK_STACK_OVERFLOW(cfp, margin)
const rb_method_entry_t * me
const char * rb_obj_classname(VALUE)
static rb_control_frame_t * vm_push_frame(rb_thread_t *th, const rb_iseq_t *iseq, VALUE type, VALUE self, VALUE specval, const VALUE *pc, VALUE *sp, VALUE *lfp, int local_size)
VALUE rb_check_funcall(VALUE recv, ID mid, int argc, VALUE *argv)
void rb_exc_raise(VALUE mesg)
VALUE rb_singleton_class(VALUE obj)
Returns the singleton class of obj.
#define RUBY_VM_CHECK_INTS()
RUBY_EXTERN VALUE rb_cBinding
VALUE rb_class_new_instance(int, VALUE *, VALUE)
static VALUE rb_f_local_variables(void)
int rb_block_given_p(void)
static VALUE rb_f_catch(int argc, VALUE *argv)
VALUE rb_mod_module_exec(int argc, VALUE *argv, VALUE mod)
static void vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp, VALUE recv, int argc, const rb_block_t *blockptr, VALUE flag, const rb_method_entry_t *me)
void rb_raise_method_missing(rb_thread_t *th, int argc, VALUE *argv, VALUE obj, int call_status)
RUBY_EXTERN VALUE rb_cObject
#define GetBindingPtr(obj, ptr)
RUBY_EXTERN VALUE rb_cBasicObject
VALUE rb_funcall(VALUE recv, ID mid, int n,...)
Calls a method.
VALUE rb_funcall2(VALUE recv, ID mid, int argc, const VALUE *argv)
Calls a method.
static int rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type scope, VALUE self)
static VALUE rb_f_caller(int argc, VALUE *argv)
RUBY_EXTERN VALUE rb_mKernel
int ruby_stack_check(void)
#define PASS_PASSED_BLOCK()
VALUE rb_get_backtrace(VALUE info)
static const char * rb_type_str(enum ruby_value_type type)
int rb_method_entry_arity(const rb_method_entry_t *me)
#define ALLOCA_N(type, n)
RUBY_EXTERN VALUE rb_cModule
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)
#define MEMCPY(p1, p2, type, n)
VALUE rb_obj_alloc(VALUE)
#define RUBY_EVENT_C_CALL
RUBY_FUNC_EXPORTED VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp)
static VALUE rb_f_loop(VALUE self)
void rb_throw_obj(VALUE tag, VALUE value)
static VALUE call_cfunc(VALUE(*func)(), VALUE recv, int len, int argc, const VALUE *argv)
#define GC_GUARDED_PTR(p)
VALUE rb_const_get(VALUE, ID)
SSL_METHOD *(* func)(void)
static VALUE vm_exec(rb_thread_t *th)
#define RB_GC_GUARD(object)
rb_method_entry_t * rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex)
VALUE rb_eval_string(const char *str)
VALUE rb_iterate(VALUE(*it_proc)(VALUE), VALUE data1, VALUE(*bl_proc)(ANYARGS), VALUE data2)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
#define rb_thread_raised_set(th, f)
VALUE rb_ivar_set(VALUE, ID, VALUE)
VALUE rb_f_send(int argc, VALUE *argv, VALUE recv)
static VALUE vm_call_bmethod(rb_thread_t *th, VALUE recv, int argc, const VALUE *argv, const rb_block_t *blockptr, const rb_method_entry_t *me)
static VALUE eval_under(VALUE under, VALUE self, VALUE src, const char *file, int line)
static VALUE rb_f_throw(int argc, VALUE *argv)
static void vm_pop_frame(rb_thread_t *th)
VALUE rb_funcall3(VALUE recv, ID mid, int argc, const VALUE *argv)
Calls a method.
const char * rb_class2name(VALUE)
void rb_extend_object(VALUE obj, VALUE module)
VALUE rb_obj_instance_eval(int argc, VALUE *argv, VALUE self)
static VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const NODE *cref)
static VALUE vm_call_super(rb_thread_t *th, int argc, const VALUE *argv)
VALUE rb_rescue2(VALUE(*b_proc)(ANYARGS), VALUE data1, VALUE(*r_proc)(ANYARGS), VALUE data2,...)
#define RARRAY_PTR(ARRAY)
int rb_backtrace_iter_func(void *, VALUE, int, VALUE)
#define RARRAY_LENINT(ary)
VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE *argv, VALUE(*bl_proc)(ANYARGS), VALUE data2)
rb_method_entry_t * rb_method_entry(VALUE klass, ID id)
#define NEW_THROW_OBJECT(val, pt, st)
int rb_respond_to(VALUE, ID)
void rb_set_safe_level_force(int)
enum rb_thread_status status
#define va_init_list(a, b)
static VALUE loop_i(void)
#define EXEC_EVENT_HOOK(th, flag, self, id, klass)
enum rb_method_definition_struct::@39::method_optimized_type optimize_type
VALUE rb_thread_backtrace(VALUE thval)
VALUE rb_obj_instance_exec(int argc, VALUE *argv, VALUE self)
VALUE rb_module_new(void)
VALUE rb_funcall_with_block(VALUE recv, ID mid, int argc, const VALUE *argv, VALUE pass_procval)
rb_method_definition_t * def
VALUE rb_check_array_type(VALUE ary)
static VALUE eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char *volatile file, volatile int line)
static int vm_backtrace_each(rb_thread_t *th, int lev, void(*init)(void *), rb_backtrace_iter_func *iter, void *arg)
static rb_method_entry_t * rb_search_method_entry(VALUE recv, ID mid)
static VALUE yield_under(VALUE under, VALUE self, VALUE values)
static VALUE vm_backtrace(rb_thread_t *th, int lev)
int rb_method_basic_definition_p(VALUE, ID)
void rb_trap_restore_mask(void)
static VALUE eval_string(VALUE self, VALUE src, VALUE scope, const char *file, int line)
VALUE rb_apply(VALUE recv, ID mid, VALUE args)
Calls a method.
static VALUE rb_call(VALUE recv, ID mid, int argc, const VALUE *argv, call_type scope)
VALUE rb_yield_values2(int argc, const VALUE *argv)
VALUE rb_funcall_passing_block(VALUE recv, ID mid, int argc, const VALUE *argv)
static VALUE specific_eval(int argc, VALUE *argv, VALUE klass, VALUE self)
#define GetThreadPtr(obj, ptr)
#define rb_thread_raised_p(th, f)
#define RETURN_ENUMERATOR(obj, argc, argv)
#define SafeStringValue(v)
VALUE rb_f_block_given_p(void)
NORETURN(static void raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj, int call_status))
#define GetISeqPtr(obj, ptr)
VALUE rb_yield(VALUE val)
const char * rb_id2name(ID id)
#define StringValuePtr(v)
#define PASS_PASSED_BLOCK_TH(th)
static VALUE rb_method_missing(int argc, const VALUE *argv, VALUE obj)
static void vm_set_eval_stack(rb_thread_t *th, VALUE iseqval, const NODE *cref)
#define GC_GUARDED_PTR_REF(p)
#define CONST_ID(var, str)
#define SPECIAL_CONST_P(x)
VALUE rb_eval_cmd(VALUE cmd, VALUE arg, int level)
int method_missing_reason
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE rb_str_append(VALUE, VALUE)
VALUE rb_iseq_disasm(VALUE self)
VALUE rb_str_new2(const char *)
static VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)
VALUE rb_obj_clone(VALUE)
VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line)
static VALUE check_funcall_exec(struct rescue_funcall_args *args)
VALUE rb_attr_get(VALUE, ID)
#define NODE_FL_CREF_PUSHED_BY_EVAL