Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Enumerations | Functions
vm_eval.c File Reference

Go to the source code of this file.

## Data Structures
struct | local_var_list
struct | rescue_funcall_args
struct | iter_method_arg
struct | eval_string_wrap_arg

## Macros
#define | id_mesg idMesg
#define | type_case(t) t: return #t

## Typedefs
typedef enum call_type | call_type

## Enumerations
enum | call_type { CALL_PUBLIC, CALL_FCALL, CALL_VCALL, CALL_PUBLIC_KW, CALL_FCALL_KW, CALL_TYPE_MAX, CALL_PUBLIC, CALL_FCALL, CALL_VCALL, CALL_PUBLIC_KW, CALL_FCALL_KW, CALL_TYPE_MAX }

## Functions
VALUE | vm_exec (rb_execution_context_t *ec, int mjit_enable_p)
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)
MJIT_FUNC_EXPORTED VALUE | rb_adjust_argv_kw_splat (int *argc, const VALUE **argv, int *kw_splat)
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)
VALUE | rb_call_super_kw (int argc, const VALUE *argv, int kw_splat)
VALUE | rb_call_super (int argc, const VALUE *argv)
VALUE | rb_current_receiver (void)
VALUE | rb_check_funcall_kw (VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
VALUE | rb_check_funcall (VALUE recv, ID mid, int argc, const VALUE *argv)
VALUE | rb_check_funcall_default (VALUE recv, ID mid, int argc, const VALUE *argv, VALUE def)
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_check_funcall_with_hook (VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg)
const char * | rb_type_str (enum ruby_value_type type)
| NORETURN (static void uncallable_object(VALUE recv, ID mid))
| NORETURN (static void raise_method_missing(rb_execution_context_t *ec, int argc, const VALUE *argv, VALUE obj, enum method_missing_reason call_status))
MJIT_FUNC_EXPORTED VALUE | rb_make_no_method_exception (VALUE exc, VALUE format, VALUE obj, int argc, const VALUE *argv, int priv)
VALUE | rb_apply (VALUE recv, ID mid, VALUE args)
| Calls a method. More...
VALUE | rb_funcall (VALUE recv, ID mid, int n,...)
| Calls a method. More...
VALUE | rb_funcallv (VALUE recv, ID mid, int argc, const VALUE *argv)
| Calls a method. More...
VALUE | rb_funcallv_kw (VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
VALUE | rb_funcallv_public (VALUE recv, ID mid, int argc, const VALUE *argv)
| Calls a method. More...
VALUE | rb_funcallv_public_kw (VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
VALUE | rb_funcall_passing_block (VALUE recv, ID mid, int argc, const VALUE *argv)
VALUE | rb_funcall_passing_block_kw (VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
VALUE | rb_funcall_with_block (VALUE recv, ID mid, int argc, const VALUE *argv, VALUE passed_procval)
VALUE | rb_funcall_with_block_kw (VALUE recv, ID mid, int argc, const VALUE *argv, VALUE passed_procval, int kw_splat)
VALUE | rb_f_send (int argc, VALUE *argv, VALUE recv)
VALUE | rb_yield_1 (VALUE val)
VALUE | rb_yield (VALUE val)
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_yield_splat (VALUE values)
VALUE | rb_yield_splat_kw (VALUE values, int kw_splat)
VALUE | rb_yield_force_blockarg (VALUE values)
VALUE | rb_yield_block (RB_BLOCK_CALL_FUNC_ARGLIST(val, arg))
VALUE | rb_iterate (VALUE(*it_proc)(VALUE), VALUE data1, rb_block_call_func_t bl_proc, VALUE data2)
VALUE | rb_block_call (VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, VALUE data2)
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_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_check_block_call (VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, VALUE data2)
VALUE | rb_each (VALUE obj)
void | rb_parser_warn_location (VALUE, int)
VALUE | rb_f_eval (int argc, const VALUE *argv, VALUE self)
VALUE | ruby_eval_string_from_file (const char *str, const char *filename)
VALUE | rb_eval_string (const char *str)
| Evaluates the given string in an isolated binding. More...
VALUE | rb_eval_string_protect (const char *str, int *pstate)
| Evaluates the given string in an isolated binding. More...
VALUE | rb_eval_string_wrap (const char *str, int *pstate)
| Evaluates the given string under a module binding in an isolated binding. More...
VALUE | rb_eval_cmd_kw (VALUE cmd, VALUE arg, int kw_splat)
VALUE | rb_eval_cmd (VALUE cmd, VALUE arg, int _level)
VALUE | rb_yield_refine_block (VALUE refinement, VALUE refinements)
VALUE | rb_obj_instance_eval (int argc, const VALUE *argv, VALUE self)
VALUE | rb_obj_instance_exec (int argc, const VALUE *argv, VALUE self)
VALUE | rb_mod_module_eval (int argc, const VALUE *argv, VALUE mod)
VALUE | rb_mod_module_exec (int argc, const VALUE *argv, VALUE mod)
void | rb_throw_obj (VALUE tag, VALUE value)
void | rb_throw (const char *tag, VALUE val)
VALUE | rb_catch (const char *tag, rb_block_call_func_t func, VALUE data)
VALUE | rb_catch_protect (VALUE t, rb_block_call_func *func, VALUE data, enum ruby_tag_type *stateptr)
VALUE | rb_catch_obj (VALUE t, rb_block_call_func_t func, VALUE data)
VALUE | rb_current_realfilepath (void)
void | Init_vm_eval (void)

## Macro Definition Documentation

## ◆ id_mesg

#define id_mesg idMesg

Definition at line 29 of file vm_eval.c.

## ◆ type_case

#define type_case | ( |  | t | ) | t: return #t

## Typedef Documentation

## ◆ call_type

typedef enum call_type call_type

## Enumeration Type Documentation

## ◆ call_type

enum call_type

Enumerator
CALL_PUBLIC |
CALL_FCALL |
CALL_VCALL |
CALL_PUBLIC_KW |
CALL_FCALL_KW |
CALL_TYPE_MAX |
CALL_PUBLIC |
CALL_FCALL |
CALL_VCALL |
CALL_PUBLIC_KW |
CALL_FCALL_KW |
CALL_TYPE_MAX |

Definition at line 31 of file vm_eval.c.

## Function Documentation

## ◆ Init_vm_eval()

void Init_vm_eval | ( | void |  | ) |

Definition at line 2470 of file vm_eval.c.

References rb_define_global_function(), and rb_f_eval().

## ◆ NORETURN() [1/2]

NORETURN | ( | static void | raise_method_missingrb_execution_context_t *ec, int argc, const VALUE *argv, VALUE obj, enum method_missing_reason call_status | ) |

## ◆ NORETURN() [2/2]

NORETURN | ( | static void | uncallable_objectVALUE recv, ID mid | ) |

## ◆ rb_adjust_argv_kw_splat()

MJIT_FUNC_EXPORTED VALUE rb_adjust_argv_kw_splat | ( | int * | argc,
|  | const VALUE ** | argv,
|  | int * | kw_splat
| ) |  |

Definition at line 237 of file vm_eval.c.

References argc, n, ptr, rb_empty_keyword_given_p(), RB_PASS_CALLED_KEYWORDS, RB_PASS_EMPTY_KEYWORDS, and v.

Referenced by rb_block_call_kw(), rb_fiber_start(), rb_funcall_passing_block_kw(), rb_funcallv_kw(), rb_funcallv_public_kw(), rb_proc_call_kw(), rb_proc_call_with_block_kw(), rb_vm_call_kw(), and rb_yield_block().

## ◆ rb_apply()

VALUE rb_apply | ( | VALUE | recv,
|  | ID | mid,
|  | VALUE | args
| ) |  |

Calls a method.

Parameters

  recv | receiver of the method
  mid | an ID that represents the name of the method
  args | an Array object which contains method arguments

Precondition
  args must refer an Array object.

Definition at line 890 of file vm_eval.c.

References argc, argv, OBJ_FREEZE, RARRAY_LENINT, rb_ary_subseq, and RBASIC_CLEAR_CLASS.

## ◆ rb_catch_protect()

VALUE rb_catch_protect | ( | VALUE | t,
|  | rb_block_call_func * | func,
|  | VALUE | data,
|  | enum ruby_tag_type * | stateptr
| ) |  |

Definition at line 2324 of file vm_eval.c.

## ◆ rb_check_block_call()

VALUE rb_check_block_call | ( | VALUE | obj,
|  | ID | mid,
|  | int | argc,
|  | const VALUE * | argv,
|  | rb_block_call_func_t | bl_proc,
|  | VALUE | data2
| ) |  |

Definition at line 1528 of file vm_eval.c.

References arg, argc, argv, iter_method_arg::mid, obj, and rb_iterate().

## ◆ rb_check_funcall()

VALUE rb_check_funcall | ( | VALUE | recv,
|  | ID | mid,
|  | int | argc,
|  | const VALUE * | argv
| ) |  |

Definition at line 505 of file vm_eval.c.

Referenced by rb_get_message(), rb_iseq_load_iseq(), and rb_range_values().

## ◆ rb_check_funcall_default()

VALUE rb_check_funcall_default | ( | VALUE | recv,
|  | ID | mid,
|  | int | argc,
|  | const VALUE * | argv,
|  | VALUE | def
| ) |  |

Definition at line 533 of file vm_eval.c.

Referenced by rb_get_path_check_to_string().

## ◆ rb_check_funcall_kw()

VALUE rb_check_funcall_kw | ( | VALUE | recv,
|  | ID | mid,
|  | int | argc,
|  | const VALUE * | argv,
|  | int | kw_splat
| ) |  |

Definition at line 499 of file vm_eval.c.

## ◆ rb_check_funcall_with_hook()

VALUE rb_check_funcall_with_hook | ( | VALUE | recv,
|  | ID | mid,
|  | int | argc,
|  | const VALUE * | argv,
|  | rb_check_funcall_hook * | hook,
|  | VALUE | arg
| ) |  |

Definition at line 565 of file vm_eval.c.

References arg, argc, argv, rescue_funcall_args::mid, rb_check_funcall_with_hook_kw(), RB_NO_KEYWORDS, and rescue_funcall_args::recv.

## ◆ rb_check_funcall_with_hook_kw()

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
| ) |  |

Definition at line 539 of file vm_eval.c.

References CLASS_OF, rescue_funcall_args::ec, GET_EC, klass, me, rescue_funcall_args::recv, and rescue_funcall_args::respond.

Referenced by rb_check_funcall_with_hook().

## ◆ rb_current_realfilepath()

VALUE rb_current_realfilepath | ( | void |  | ) |

Definition at line 2460 of file vm_eval.c.

References rb_execution_context_struct::cfp, cfp, and GET_EC.

Referenced by rb_f_require_relative().

## ◆ rb_eval_cmd()

VALUE rb_eval_cmd | ( | VALUE | cmd,
|  | VALUE | arg,
|  | int | _level
| ) |  |

Definition at line 1822 of file vm_eval.c.

References arg, rb_eval_cmd_kw(), RB_NO_KEYWORDS, and rb_warn().

## ◆ rb_eval_cmd_kw()

VALUE rb_eval_cmd_kw | ( | VALUE | cmd,
|  | VALUE | arg,
|  | int | kw_splat
| ) |  |

Definition at line 1799 of file vm_eval.c.

References arg, EC_EXEC_TAG, EC_PUSH_TAG, GET_EC, idCall, Qnil, RARRAY_CONST_PTR, RARRAY_LENINT, rb_funcallv_kw(), RB_TYPE_P, T_STRING, and TAG_NONE.

Referenced by rb_eval_cmd().

## ◆ rb_f_eval()

VALUE rb_f_eval | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | self
| ) |  |

Definition at line 1668 of file vm_eval.c.

References argc, argv, NIL_P, NUM2INT, Qundef, rb_scan_args, SafeStringValue, src, and StringValue().

Referenced by Init_vm_eval().

## ◆ rb_f_send()

VALUE rb_f_send | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | recv
| ) |  |

Definition at line 1188 of file vm_eval.c.

## ◆ rb_lambda_call()

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
| ) |  |

Definition at line 1501 of file vm_eval.c.

References arg, argc, argv, max_argc, min_argc, obj, rb_eArgError, rb_raise(), and rb_vm_ifunc_new().

## ◆ rb_make_no_method_exception()

MJIT_FUNC_EXPORTED VALUE rb_make_no_method_exception | ( | VALUE | exc,
|  | VALUE | format,
|  | VALUE | obj,
|  | int | argc,
|  | const VALUE * | argv,
|  | int | priv
| ) |  |

Definition at line 772 of file vm_eval.c.

References argc, argv, exc, name, obj, rb_ary_new4, rb_eNoMethodError, rb_fstring_lit, rb_name_err_new(), and rb_nomethod_err_new().

## ◆ rb_mod_module_eval()

VALUE rb_mod_module_eval | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | mod
| ) |  |

Definition at line 2067 of file vm_eval.c.

## ◆ rb_mod_module_exec()

VALUE rb_mod_module_exec | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | mod
| ) |  |

Definition at line 2101 of file vm_eval.c.

## ◆ rb_obj_instance_eval()

VALUE rb_obj_instance_eval | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | self
| ) |  |

Definition at line 1995 of file vm_eval.c.

References klass.

## ◆ rb_obj_instance_exec()

VALUE rb_obj_instance_exec | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | self
| ) |  |

Definition at line 2027 of file vm_eval.c.

References klass.

## ◆ rb_parser_warn_location()

void rb_parser_warn_location | ( | VALUE | ,
|  | int |
| ) |  |

Definition at line 19047 of file ripper.c.

References TypedData_Get_Struct.

## ◆ rb_throw()

void rb_throw | ( | const char * | tag,
|  | VALUE | val
| ) |  |

Definition at line 2218 of file vm_eval.c.

References rb_sym_intern_ascii_cstr, rb_throw_obj(), and rb_vm_tag::tag.

## ◆ rb_throw_obj()

void rb_throw_obj | ( | VALUE | tag,
|  | VALUE | value
| ) |  |

Definition at line 2193 of file vm_eval.c.

References GET_EC, numberof, rb_vm_tag::prev, rb_class_new_instance(), rb_exc_raise(), rb_str_new_cstr, rb_vm_tag::retval, rb_vm_tag::tag, and rb_execution_context_struct::tag.

Referenced by rb_throw().

## ◆ rb_type_str()

const char* rb_type_str | ( | enum ruby_value_type | type | ) |

Definition at line 572 of file vm_eval.c.

References NULL, T_ARRAY, T_BIGNUM, T_CLASS, T_COMPLEX, T_DATA, T_FALSE, T_FILE, T_FIXNUM, T_FLOAT, T_HASH, T_ICLASS, T_IMEMO, T_MASK, T_MATCH, T_MODULE, T_MOVED, T_NIL, T_NODE, T_NONE, T_OBJECT, T_RATIONAL, T_REGEXP, T_STRING, T_STRUCT, T_SYMBOL, T_TRUE, T_UNDEF, T_ZOMBIE, and type_case.

Referenced by rb_insn_operand_intern().

## ◆ rb_vm_call0()

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
| ) |  |

Definition at line 46 of file vm_eval.c.

References argc, calling, cc, ci, rb_callable_method_entry_struct::def, id, rb_calling_info::kw_splat, me, rb_method_definition_struct::method_serial, Qundef, rb_calling_info::recv, and VM_CALL_KW_SPLAT.

Referenced by rb_vm_call_kw().

## ◆ rb_vm_call_kw()

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
| ) |  |

Definition at line 265 of file vm_eval.c.

References argc, argv, me, rb_adjust_argv_kw_splat(), rb_free_tmp_buffer(), rb_vm_call0(), and v.

## ◆ rb_yield_1()

VALUE rb_yield_1 | ( | VALUE | val | ) |

Definition at line 1231 of file vm_eval.c.

## ◆ rb_yield_block()

VALUE rb_yield_block | ( | RB_BLOCK_CALL_FUNC_ARGLIST(val, arg) |  | ) |

Definition at line 1315 of file vm_eval.c.

References argc, argv, rb_adjust_argv_kw_splat(), RB_PASS_CALLED_KEYWORDS, and v.

## ◆ rb_yield_force_blockarg()

VALUE rb_yield_force_blockarg | ( | VALUE | values | ) |

Definition at line 1309 of file vm_eval.c.

## ◆ rb_yield_refine_block()

VALUE rb_yield_refine_block | ( | VALUE | refinement,
|  | VALUE | refinements
| ) |  |

Definition at line 1883 of file vm_eval.c.

References block_handler, and GET_EC.

## ◆ ruby_eval_string_from_file()

VALUE ruby_eval_string_from_file | ( | const char * | str,
|  | const char * | filename
| ) |  |

Note
  This function name is not stable.

Definition at line 1694 of file vm_eval.c.

References rb_str_new_cstr.

Referenced by rb_eval_string().

## ◆ vm_exec()

VALUE vm_exec | ( | rb_execution_context_t * | ec,
|  | int | mjit_enable_p
| ) |  |

Definition at line 1909 of file vm.c.