27static VALUE rb_eUncaughtThrow;
28static ID id_result, id_tag, id_value;
85 vm_push_frame(ec, 0, frame_flags, recv,
105 return vm_call0_cfunc_with_frame(ec,
calling, cd,
argv);
117 calling->block_handler = vm_passed_block_handler(ec);
148 rb_warn(
"Passing the keyword argument as the last hash parameter is deprecated");
182 CC_SET_ME(
cc, refined_method_callable_without_refinement(
cc->
me));
200 CC_SET_ME(
cc, aliased_callable_method_entry(
cc->
me));
204 vm_passed_block_handler_set(ec,
calling->block_handler);
257 rb_warn(
"Keyword flag passed calling internal method, but last entry is not a hash, unsetting keyword flag");
282 if (VM_FRAME_RUBYFRAME_P(
cfp)) {
283 rb_bug(
"vm_call_super: should not be reached");
302 return vm_call_super(ec,
argc,
argv, kw_splat);
318 if (!ec || !(
cfp = ec->
cfp)) {
384 me = rb_search_method_entry(recv, mid);
409check_funcall_exec(
VALUE v)
461 ret = basic_obj_respond_to_missing(
ec,
klass,
recv,
463 if (!
RTEST(ret))
return def;
486 args.
argv = new_args;
489 check_funcall_failed, (
VALUE)&args,
522 if (!check_funcall_callable(
ec,
me)) {
525 if (ret ==
Qundef) ret = def;
553 if (!check_funcall_callable(
ec,
me)) {
574#define type_case(t) t: return #t
620 "method `%"PRIsVALUE"' called on unexpected immediate object (%p)",
621 mname, (
void *)
recv);
623 else if ((flags =
RBASIC(
recv)->flags) == 0) {
625 "method `%"PRIsVALUE"' called on terminated object (%p)",
626 mname, (
void *)
recv);
630 "method `%"PRIsVALUE"' called on broken T_?""?""?(0x%02x) object"
636 "method `%"PRIsVALUE"' called on hidden %s object"
638 mname, typestr, (
void *)
recv, flags);
642 "method `%"PRIsVALUE"' called on unexpected %s object"
644 mname, typestr, (
void *)
recv, flags);
813 format =
rb_fstring_lit(
"protected method `%s' called for %s%s%s");
816 format =
rb_fstring_lit(
"undefined local variable or method `%s' for %s%s%s");
820 format =
rb_fstring_lit(
"super: no superclass method `%s' for %s%s%s");
870 if (!
klass)
goto missing;
934 for (
i = 0;
i <
n;
i++) {
1010 vm_search_method(cd, recv);
1013 return vm_call0_body(
1052 if (!
NIL_P(passed_procval)) {
1053 vm_passed_block_handler_set(
GET_EC(), passed_procval);
1062 if (!
NIL_P(passed_procval)) {
1063 vm_passed_block_handler_set(
GET_EC(), passed_procval);
1076 if (RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(ec, prev_cfp))
return NULL;
1078 return prev_cfp->
sp + 1;
1087 VALUE ret, vargv = 0;
1113 VALUE *tmp_argv = current_vm_stack_arg(ec,
argv);
1118 else if (
argc > 1) {
1135 ret = rb_call0(ec, recv,
id,
argc,
argv, scope,
self);
1158 ret = send_internal(
argc,
argv, recv, scope);
1233 return rb_yield_0(1, &val);
1240 return rb_yield_0(0, 0);
1247#undef rb_yield_values
1252 return rb_yield_0(0, 0);
1261 for (
i=0;
i<
n;
i++) {
1266 return rb_yield_0(
n,
argv);
1279 return rb_yield_0_kw(
argc,
argv, kw_splat);
1311 return vm_yield_force_blockarg(
GET_EC(), values);
1378rb_f_loop(
VALUE self)
1391 const struct vm_ifunc *
const ifunc,
1415 retval = (*it_proc) (data1);
1421 if (
cfp == escape_cfp) {
1428 if (state ==
TAG_RETRY)
goto iter_retry;
1429 retval = THROW_DATA_VAL(
err);
1447 return rb_iterate0(it_proc, data1,
1448 bl_proc ? rb_vm_ifunc_proc_new(bl_proc, (
void *)data2) : 0,
1515 return rb_iterate0(iterate_method, (
VALUE)&
arg, block,
GET_EC());
1553 const rb_iseq_t *
const parent = vm_block_iseq(base_block);
1567 fname = pathobj_path(bind->
pathobj);
1582 parent, ISEQ_TYPE_EVAL,
NULL);
1609 block.as.captured = *VM_CFP_TO_CAPTURED_BLOCK(
cfp);
1610 block.as.captured.self =
self;
1611 block.as.captured.code.iseq =
cfp->
iseq;
1614 iseq = eval_make_iseq(
src, file, line,
NULL, &block);
1620 if (!cref && block.as.captured.code.val) {
1621 rb_cref_t *orig_cref = vm_get_cref(vm_block_ep(&block));
1622 cref = vm_cref_dup(orig_cref);
1624 vm_set_eval_stack(ec,
iseq, cref, &block);
1644 vm_bind_update_env(scope, bind, vm_make_env_object(ec, ec->
cfp));
1689 return eval_string_with_cref(
self,
src,
NULL, file, line);
1691 return eval_string_with_scope(scope,
src, file, line);
1749eval_string_wrap_protect(
VALUE data)
1826 rb_warn(
"rb_eval_cmd will be removed in Ruby 3.0");
1838 VALUE new_block_handler = 0;
1843 int is_lambda =
FALSE;
1853 new_captured = *captured;
1854 new_block_handler = VM_BH_FROM_ISEQ_BLOCK(&new_captured);
1858 new_captured = *captured;
1859 new_block_handler = VM_BH_FROM_IFUNC_BLOCK(&new_captured);
1872 new_captured.self =
self;
1878 cref = vm_cref_push(ec, under,
ep,
TRUE);
1879 ret = vm_yield_with_cref(ec,
argc,
argv, kw_splat, cref, is_lambda);
1891 rb_bug(
"rb_yield_refine_block: an iseq block is required");
1896 VALUE new_block_handler = VM_BH_FROM_ISEQ_BLOCK(&new_captured);
1899 CREF_REFINEMENTS_SET(cref, refinements);
1901 new_captured.
self = refinement;
1912 return eval_string_with_cref(
self,
src, cref, file, line);
1920 return yield_under(
klass,
self, 1, &
self, kw_splat);
1936 return eval_under(
klass,
self,
code, file, line);
1941singleton_class_for_eval(
VALUE self)
1992 VALUE klass = singleton_class_for_eval(
self);
1999 VALUE klass = singleton_class_for_eval(
self);
2024 VALUE klass = singleton_class_for_eval(
self);
2031 VALUE klass = singleton_class_for_eval(
self);
2168 VALUE tag = uncaught_throw_tag(
exc);
2228 return rb_yield_0(1, &
tag);
2328 return vm_catch_protect(t, func, data, stateptr,
GET_EC());
2390rb_f_local_variables(
VALUE _)
2397 local_var_list_init(&
vars);
2404 if (!VM_ENV_LOCAL_P(
cfp->
ep)) {
2406 const VALUE *ep = VM_CF_PREV_EP(
cfp);
2408 if (vm_collect_local_variables_in_heap(ep, &
vars)) {
2412 while (
cfp->
ep != ep) {
2421 return local_var_list_finish(&
vars);
2447rb_f_block_given_p(
VALUE _)
2505 rb_define_method(rb_eUncaughtThrow,
"initialize", uncaught_throw_init, -1);
#define rb_ary_subseq(ary, beg, len)
char str[HTML_ESCAPE_MAX_LEN+1]
void rb_extend_object(VALUE, VALUE)
Extend the object with the module.
VALUE rb_define_class(const char *, VALUE)
Defines a top-level class.
VALUE rb_singleton_class(VALUE)
Returns the singleton class of obj.
VALUE rb_module_new(void)
VALUE rb_special_singleton_class(VALUE)
int rb_block_given_p(void)
Determines if the current method is given a block.
VALUE rb_call_super_kw(int argc, const VALUE *argv, int kw_splat)
VALUE rb_eval_string(const char *str)
Evaluates the given string in an isolated binding.
VALUE rb_funcallv(VALUE recv, ID mid, int argc, const VALUE *argv)
Calls a method.
VALUE rb_mKernel
Kernel module.
VALUE rb_funcallv_kw(VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
VALUE rb_block_call_kw(VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, VALUE data2, int kw_splat)
VALUE rb_cBasicObject
BasicObject class.
VALUE rb_cObject
Object class.
VALUE rb_current_receiver(void)
VALUE rb_funcall(VALUE recv, ID mid, int n,...)
Calls a method.
VALUE rb_funcall_with_block(VALUE recv, ID mid, int argc, const VALUE *argv, VALUE passed_procval)
VALUE rb_funcall_passing_block(VALUE recv, ID mid, int argc, const VALUE *argv)
VALUE rb_catch(const char *tag, rb_block_call_func_t func, VALUE data)
VALUE rb_iterate(VALUE(*it_proc)(VALUE), VALUE data1, rb_block_call_func_t bl_proc, VALUE data2)
VALUE rb_yield_values(int n,...)
VALUE rb_yield_values2(int argc, const VALUE *argv)
VALUE rb_yield_values_kw(int argc, const VALUE *argv, int kw_splat)
VALUE rb_funcallv_public_kw(VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
VALUE rb_funcall_passing_block_kw(VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
VALUE rb_funcall_with_block_kw(VALUE recv, ID mid, int argc, const VALUE *argv, VALUE passed_procval, int kw_splat)
VALUE rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
VALUE rb_eval_string_wrap(const char *str, int *pstate)
Evaluates the given string under a module binding in an isolated binding.
VALUE rb_yield_splat(VALUE values)
VALUE rb_yield_splat_kw(VALUE values, int kw_splat)
VALUE rb_cModule
Module class.
VALUE rb_block_call(VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, VALUE data2)
VALUE rb_eval_string_protect(const char *str, int *pstate)
Evaluates the given string in an isolated binding.
VALUE rb_yield(VALUE val)
VALUE rb_catch_obj(VALUE t, rb_block_call_func_t func, VALUE data)
VALUE rb_funcallv_public(VALUE recv, ID mid, int argc, const VALUE *argv)
Calls a method.
VALUE rb_call_super(int argc, const VALUE *argv)
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_rescue2(VALUE(*)(VALUE), VALUE, VALUE(*)(VALUE, VALUE), VALUE,...)
An equivalent of rescue clause.
void rb_exc_raise(VALUE mesg)
Raises an exception in the current thread.
void rb_bug(const char *fmt,...)
VALUE rb_nomethod_err_new(VALUE mesg, VALUE recv, VALUE method, VALUE args, int priv)
VALUE rb_protect(VALUE(*)(VALUE), VALUE, int *)
Protects a function call from potential global escapes from the function.
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method)
void rb_warn(const char *fmt,...)
VALUE rb_obj_alloc(VALUE)
Allocates an instance of klass.
VALUE rb_class_new_instance(int, const VALUE *, VALUE)
Allocates and initializes an instance of klass.
VALUE rb_obj_class(VALUE)
Equivalent to Object#class in Ruby.
VALUE rb_obj_clone(VALUE)
Almost same as Object::clone.
VALUE rb_obj_is_kind_of(VALUE, VALUE)
Determines if obj is a kind of c.
MJIT_STATIC void rb_vm_pop_cfunc_frame(void)
VALUE type(ANYARGS)
ANYARGS-ed function type.
unsigned char buf[MIME_BUF_SIZE]
rb_cref_t * rb_vm_cref_new_toplevel(void)
unsigned short first_lineno
const struct rb_block block
const struct rb_callable_method_entry_struct * me
struct rb_method_definition_struct *const def
const VALUE defined_class
const struct vm_ifunc * ifunc
union rb_captured_block::@53 code
enum method_missing_reason method_missing_reason
unsigned int local_table_size
rb_iseq_location_t location
struct rb_iseq_constant_body * body
VALUE(* invoker)(VALUE recv, int argc, const VALUE *argv, VALUE(*func)())
enum method_optimized_type optimize_type
union rb_method_definition_struct::@41 body
rb_method_refined_t refined
struct rb_method_entry_struct * orig_me
rb_execution_context_t * ec
unsigned int respond_to_missing
rb_execution_context_t * ec
const rb_method_entry_t * me
IFUNC (Internal FUNCtion)
int rb_is_local_id(ID id)
VALUE rb_vm_top_self(void)
MJIT_FUNC_EXPORTED const rb_callable_method_entry_t * rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me)
MJIT_STATIC void rb_vm_pop_frame(rb_execution_context_t *ec)
MJIT_STATIC const rb_callable_method_entry_t * rb_vm_frame_method_entry(const rb_control_frame_t *cfp)
VALUE rb_f_send(int argc, VALUE *argv, VALUE recv)
VALUE rb_eval_cmd(VALUE cmd, VALUE arg, int _level)
VALUE rb_yield_1(VALUE val)
MJIT_FUNC_EXPORTED VALUE rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj, int argc, const VALUE *argv, int priv)
VALUE vm_exec(rb_execution_context_t *ec, int mjit_enable_p)
MJIT_FUNC_EXPORTED VALUE rb_vm_call_kw(rb_execution_context_t *ec, VALUE recv, VALUE id, int argc, const VALUE *argv, const rb_callable_method_entry_t *me, int kw_splat)
NORETURN(static void uncallable_object(VALUE recv, ID mid))
const char * rb_type_str(enum ruby_value_type type)
VALUE rb_obj_instance_exec(int argc, const VALUE *argv, VALUE self)
VALUE rb_check_block_call(VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, VALUE data2)
VALUE rb_check_funcall(VALUE recv, ID mid, int argc, const VALUE *argv)
VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements)
VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self)
VALUE rb_check_funcall_kw(VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
VALUE rb_check_funcall_default(VALUE recv, ID mid, int argc, const VALUE *argv, VALUE def)
void rb_throw(const char *tag, VALUE val)
VALUE rb_yield_force_blockarg(VALUE values)
VALUE rb_check_funcall_with_hook_kw(VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg, int kw_splat)
VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, enum ruby_tag_type *stateptr)
VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg)
VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, int min_argc, int max_argc, VALUE data2)
VALUE rb_mod_module_eval(int argc, const VALUE *argv, VALUE mod)
MJIT_FUNC_EXPORTED VALUE rb_adjust_argv_kw_splat(int *argc, const VALUE **argv, int *kw_splat)
VALUE rb_yield_block(RB_BLOCK_CALL_FUNC_ARGLIST(val, arg))
VALUE rb_mod_module_exec(int argc, const VALUE *argv, VALUE mod)
VALUE ruby_eval_string_from_file(const char *str, const char *filename)
VALUE rb_obj_instance_eval(int argc, const VALUE *argv, VALUE self)
MJIT_FUNC_EXPORTED VALUE rb_vm_call0(rb_execution_context_t *ec, VALUE recv, ID id, int argc, const VALUE *argv, const rb_callable_method_entry_t *me, int kw_splat)
VALUE rb_eval_cmd_kw(VALUE cmd, VALUE arg, int kw_splat)
void rb_parser_warn_location(VALUE, int)
VALUE rb_apply(VALUE recv, ID mid, VALUE args)
Calls a method.
VALUE rb_current_realfilepath(void)
void rb_throw_obj(VALUE tag, VALUE value)
MJIT_STATIC void rb_ec_stack_overflow(rb_execution_context_t *ec, int crit)