ruby  2.7.4
About: Ruby is an interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). Stable release of 2.7 series.
  Fossies Dox: ruby-2.7.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

proc.c File Reference
#include "eval_intern.h"
#include "internal.h"
#include "gc.h"
#include "vm_core.h"
#include "iseq.h"
Include dependency graph for proc.c:

Go to the source code of this file.

Data Structures

struct  METHOD
 
struct  cfunc_proc_t
 

Macros

#define PROC_NEW_REQUIRES_BLOCK   0
 proc.c - Proc, Binding, Env More...
 
#define NO_CLOBBERED(v)   (*(volatile VALUE *)&(v))
 
#define UPDATE_TYPED_REFERENCE(_type, _ref)   *(_type*)&_ref = (_type)rb_gc_location((VALUE)_ref)
 
#define UPDATE_REFERENCE(_ref)   UPDATE_TYPED_REFERENCE(VALUE, _ref)
 
#define attached   id__attached__
 
#define IS_METHOD_PROC_IFUNC(ifunc)   ((ifunc)->func == bmcall)
 
#define check_argc(argc)   (argc)
 
#define MSG(s)   rb_fstring_lit("undefined method `%1$s' for"s" `%2$s'")
 

Functions

const rb_cref_trb_vm_cref_in_context (VALUE self, VALUE cbase)
  More...
 
static int method_arity (VALUE)
  More...
 
static int method_min_max_arity (VALUE, int *max)
  More...
 
static void block_mark (const struct rb_block *block)
  More...
 
static void block_compact (struct rb_block *block)
  More...
 
static void proc_compact (void *ptr)
  More...
 
static void proc_mark (void *ptr)
  More...
 
static size_t proc_memsize (const void *ptr)
  More...
 
VALUE rb_proc_alloc (VALUE klass)
  More...
 
VALUE rb_obj_is_proc (VALUE proc)
  More...
 
static VALUE proc_clone (VALUE self)
  More...
 
VALUE rb_proc_lambda_p (VALUE procval)
  More...
 
static void binding_free (void *ptr)
  More...
 
static void binding_mark (void *ptr)
  More...
 
static void binding_compact (void *ptr)
  More...
 
static size_t binding_memsize (const void *ptr)
 
VALUE rb_binding_alloc (VALUE klass)
  More...
 
static VALUE binding_dup (VALUE self)
  More...
 
static VALUE binding_clone (VALUE self)
  More...
 
VALUE rb_binding_new (void)
  More...
 
static VALUE rb_f_binding (VALUE self)
  More...
 
static VALUE bind_eval (int argc, VALUE *argv, VALUE bindval)
  More...
 
static const VALUEget_local_variable_ptr (const rb_env_t **envp, ID lid)
  More...
 
static ID check_local_id (VALUE bindval, volatile VALUE *pname)
  More...
 
static VALUE bind_local_variables (VALUE bindval)
  More...
 
static VALUE bind_local_variable_get (VALUE bindval, VALUE sym)
  More...
 
static VALUE bind_local_variable_set (VALUE bindval, VALUE sym, VALUE val)
  More...
 
static VALUE bind_local_variable_defined_p (VALUE bindval, VALUE sym)
  More...
 
static VALUE bind_receiver (VALUE bindval)
  More...
 
static VALUE bind_location (VALUE bindval)
  More...
 
static VALUE cfunc_proc_new (VALUE klass, VALUE ifunc, int8_t is_lambda)
  More...
 
static VALUE sym_proc_new (VALUE klass, VALUE sym)
  More...
 
struct vm_ifuncrb_vm_ifunc_new (rb_block_call_func_t func, const void *data, int min_argc, int max_argc)
  More...
 
VALUE rb_func_proc_new (rb_block_call_func_t func, VALUE val)
  More...
 
VALUE rb_func_lambda_new (rb_block_call_func_t func, VALUE val, int min_argc, int max_argc)
  More...
 
static VALUE proc_new (VALUE klass, int8_t is_lambda, int8_t kernel)
  More...
 
static VALUE rb_proc_s_new (int argc, VALUE *argv, VALUE klass)
  More...
 
VALUE rb_block_proc (void)
  More...
 
static VALUE f_proc (VALUE _)
  More...
 
VALUE rb_block_lambda (void)
  More...
 
static VALUE f_lambda (VALUE _)
  More...
 
VALUE rb_proc_call_kw (VALUE self, VALUE args, int kw_splat)
  More...
 
VALUE rb_proc_call (VALUE self, VALUE args)
  More...
 
static VALUE proc_to_block_handler (VALUE procval)
  More...
 
VALUE rb_proc_call_with_block_kw (VALUE self, int argc, const VALUE *argv, VALUE passed_procval, int kw_splat)
  More...
 
VALUE rb_proc_call_with_block (VALUE self, int argc, const VALUE *argv, VALUE passed_procval)
  More...
 
static VALUE proc_arity (VALUE self)
  More...
 
static int rb_iseq_min_max_arity (const rb_iseq_t *iseq, int *max)
  More...
 
static int rb_vm_block_min_max_arity (const struct rb_block *block, int *max)
  More...
 
static int rb_proc_min_max_arity (VALUE self, int *max)
  More...
 
int rb_proc_arity (VALUE self)
  More...
 
static void block_setup (struct rb_block *block, VALUE block_handler)
  More...
 
int rb_block_arity (void)
  More...
 
int rb_block_min_max_arity (int *max)
  More...
 
const rb_iseq_trb_proc_get_iseq (VALUE self, int *is_proc)
  More...
 
static VALUE iseq_location (const rb_iseq_t *iseq)
  More...
 
VALUE rb_iseq_location (const rb_iseq_t *iseq)
  More...
 
VALUE rb_proc_location (VALUE self)
  More...
 
VALUE rb_unnamed_parameters (int arity)
  More...
 
static VALUE rb_proc_parameters (VALUE self)
  More...
 
st_index_t rb_hash_proc (st_index_t hash, VALUE prc)
  More...
 
VALUE rb_sym_to_proc (VALUE sym)
  More...
 
static VALUE proc_hash (VALUE self)
  More...
 
VALUE rb_block_to_s (VALUE self, const struct rb_block *block, const char *additional_info)
  More...
 
static VALUE proc_to_s (VALUE self)
  More...
 
static VALUE proc_to_proc (VALUE self)
  More...
 
static void bm_mark (void *ptr)
  More...
 
static void bm_compact (void *ptr)
  More...
 
static size_t bm_memsize (const void *ptr)
 
VALUE rb_obj_is_method (VALUE m)
  More...
 
static int respond_to_missing_p (VALUE klass, VALUE obj, VALUE sym, int scope)
  More...
 
static VALUE mnew_missing (VALUE klass, VALUE obj, ID id, VALUE mclass)
  More...
 
static VALUE mnew_missing_by_name (VALUE klass, VALUE obj, VALUE *name, int scope, VALUE mclass)
  More...
 
static VALUE mnew_internal (const rb_method_entry_t *me, VALUE klass, VALUE iclass, VALUE obj, ID id, VALUE mclass, int scope, int error)
  More...
 
static VALUE mnew_from_me (const rb_method_entry_t *me, VALUE klass, VALUE iclass, VALUE obj, ID id, VALUE mclass, int scope)
  More...
 
static VALUE mnew (VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
  More...
 
static VALUE method_entry_defined_class (const rb_method_entry_t *me)
  More...
 
static VALUE method_eq (VALUE method, VALUE other)
 Document-class: Method. More...
 
static VALUE method_hash (VALUE method)
  More...
 
static VALUE method_unbind (VALUE obj)
  More...
 
static VALUE method_receiver (VALUE obj)
  More...
 
static VALUE method_name (VALUE obj)
  More...
 
static VALUE method_original_name (VALUE obj)
  More...
 
static VALUE method_owner (VALUE obj)
  More...
 
void rb_method_name_error (VALUE klass, VALUE str)
  More...
 
static VALUE obj_method (VALUE obj, VALUE vid, int scope)
  More...
 
VALUE rb_obj_method (VALUE obj, VALUE vid)
  More...
 
VALUE rb_obj_public_method (VALUE obj, VALUE vid)
  More...
 
VALUE rb_obj_singleton_method (VALUE obj, VALUE vid)
  More...
 
static VALUE rb_mod_instance_method (VALUE mod, VALUE vid)
  More...
 
static VALUE rb_mod_public_instance_method (VALUE mod, VALUE vid)
  More...
 
static VALUE rb_mod_define_method (int argc, VALUE *argv, VALUE mod)
  More...
 
static VALUE rb_obj_define_method (int argc, VALUE *argv, VALUE obj)
  More...
 
static VALUE top_define_method (int argc, VALUE *argv, VALUE obj)
  More...
 
static VALUE method_clone (VALUE self)
  More...
 
static VALUE rb_method_call_pass_called_kw (int argc, const VALUE *argv, VALUE method)
  More...
 
VALUE rb_method_call_kw (int argc, const VALUE *argv, VALUE method, int kw_splat)
  More...
 
VALUE rb_method_call (int argc, const VALUE *argv, VALUE method)
  More...
 
static const rb_callable_method_entry_tmethod_callable_method_entry (const struct METHOD *data)
  More...
 
static VALUE call_method_data (rb_execution_context_t *ec, const struct METHOD *data, int argc, const VALUE *argv, VALUE passed_procval, int kw_splat)
  More...
 
VALUE rb_method_call_with_block_kw (int argc, const VALUE *argv, VALUE method, VALUE passed_procval, int kw_splat)
  More...
 
VALUE rb_method_call_with_block (int argc, const VALUE *argv, VALUE method, VALUE passed_procval)
  More...
 
static void convert_umethod_to_method_components (VALUE method, VALUE recv, VALUE *methclass_out, VALUE *klass_out, VALUE *iclass_out, const rb_method_entry_t **me_out)
 Document-class: UnboundMethod. More...
 
static VALUE umethod_bind (VALUE method, VALUE recv)
  More...
 
static VALUE umethod_bind_call (int argc, VALUE *argv, VALUE method)
  More...
 
static int rb_method_entry_min_max_arity (const rb_method_entry_t *me, int *max)
  More...
 
int rb_method_entry_arity (const rb_method_entry_t *me)
  More...
 
static VALUE method_arity_m (VALUE method)
  More...
 
static const rb_method_entry_toriginal_method_entry (VALUE mod, ID id)
  More...
 
int rb_mod_method_arity (VALUE mod, ID id)
  More...
 
int rb_obj_method_arity (VALUE obj, ID id)
  More...
 
const rb_method_definition_trb_method_def (VALUE method)
  More...
 
static const rb_iseq_tmethod_def_iseq (const rb_method_definition_t *def)
  More...
 
const rb_iseq_trb_method_iseq (VALUE method)
  More...
 
static const rb_cref_tmethod_cref (VALUE method)
  More...
 
static VALUE method_def_location (const rb_method_definition_t *def)
  More...
 
VALUE rb_method_entry_location (const rb_method_entry_t *me)
  More...
 
VALUE rb_method_location (VALUE method)
  More...
 
static VALUE rb_method_parameters (VALUE method)
  More...
 
static VALUE method_inspect (VALUE method)
  More...
 
static VALUE mproc (VALUE method)
  More...
 
static VALUE mlambda (VALUE method)
  More...
 
static VALUE bmcall (VALUE args, VALUE method, int argc, const VALUE *argv, VALUE blockarg)
  More...
 
VALUE rb_proc_new (rb_block_call_func_t func, VALUE val)
  More...
 
static VALUE method_to_proc (VALUE method)
  More...
 
VALUE rb_find_defined_class_by_owner (VALUE current_class, VALUE target_owner)
  More...
 
static VALUE method_super_method (VALUE method)
  More...
 
static VALUE localjump_xvalue (VALUE exc)
  More...
 
static VALUE localjump_reason (VALUE exc)
  More...
 
rb_cref_trb_vm_cref_new_toplevel (void)
  More...
 
static const rb_env_tenv_clone (const rb_env_t *env, const rb_cref_t *cref)
  More...
 
static VALUE proc_binding (VALUE self)
  More...
 
static VALUE make_curry_proc (VALUE proc, VALUE passed, VALUE arity)
  More...
 
static VALUE curry (VALUE _, VALUE args, int argc, const VALUE *argv, VALUE blockarg)
  More...
 
static VALUE proc_curry (int argc, const VALUE *argv, VALUE self)
  More...
 
static VALUE rb_method_curry (int argc, const VALUE *argv, VALUE self)
  More...
 
static VALUE compose (VALUE _, VALUE args, int argc, const VALUE *argv, VALUE blockarg)
  More...
 
static VALUE to_callable (VALUE f)
  More...
 
static VALUE rb_proc_compose_to_left (VALUE self, VALUE g)
  More...
 
static VALUE rb_proc_compose_to_right (VALUE self, VALUE g)
  More...
 
static VALUE proc_compose_to_left (VALUE self, VALUE g)
  More...
 
static VALUE proc_compose_to_right (VALUE self, VALUE g)
  More...
 
static VALUE rb_method_compose_to_left (VALUE self, VALUE g)
  More...
 
static VALUE rb_method_compose_to_right (VALUE self, VALUE g)
  More...
 
static VALUE proc_ruby2_keywords (VALUE procval)
  More...
 
void Init_Proc (void)
  More...
 
void Init_Binding (void)
  More...
 

Variables

VALUE rb_cUnboundMethod
  More...
 
VALUE rb_cMethod
  More...
 
VALUE rb_cBinding
  More...
 
VALUE rb_cProc
  More...
 
static rb_block_call_func bmcall
  More...
 
static const rb_data_type_t proc_data_type
  More...
 
const rb_data_type_t ruby_binding_data_type
  More...
 
static const char proc_without_block [] = "tried to create Proc object without a block"
  More...
 
static const rb_data_type_t method_data_type
  More...
 
static rb_block_call_func curry
  More...
 

Macro Definition Documentation

◆ PROC_NEW_REQUIRES_BLOCK

#define PROC_NEW_REQUIRES_BLOCK   0

proc.c - Proc, Binding, Env

$Author$ created at: Wed Jan 17 12:13:14 2007

Copyright (C) 2004-2007 Koichi Sasada

Definition at line 20 of file proc.c.

Function Documentation

◆ bind_eval()

static VALUE bind_eval ( int  argc,
VALUE argv,
VALUE  bindval 
)
static

Definition at line 409 of file proc.c.

References argc, argv, Qnil, rb_f_eval(), and rb_scan_args().

Referenced by Init_Binding().

◆ bind_local_variable_defined_p()

static VALUE bind_local_variable_defined_p ( VALUE  bindval,
VALUE  sym 
)
static

◆ bind_local_variable_get()

static VALUE bind_local_variable_get ( VALUE  bindval,
VALUE  sym 
)
static

◆ bind_local_variable_set()

static VALUE bind_local_variable_set ( VALUE  bindval,
VALUE  sym,
VALUE  val 
)
static

◆ bind_local_variables()

static VALUE bind_local_variables ( VALUE  bindval)
static

◆ bind_location()

static VALUE bind_location ( VALUE  bindval)
static

◆ bind_receiver()

static VALUE bind_receiver ( VALUE  bindval)
static

Definition at line 638 of file proc.c.

References rb_binding_t::block, GetBindingPtr, and vm_block_self().

Referenced by Init_Binding().

◆ binding_clone()

static VALUE binding_clone ( VALUE  self)
static

Definition at line 356 of file proc.c.

References binding_dup(), and CLONESETUP.

Referenced by Init_Binding().

◆ binding_compact()

static void binding_compact ( void ptr)
static

Definition at line 305 of file proc.c.

References rb_binding_t::block, block_compact(), rb_binding_t::pathobj, ptr, and UPDATE_REFERENCE.

◆ binding_dup()

◆ binding_free()

static void binding_free ( void ptr)
static

Definition at line 286 of file proc.c.

References ptr, RUBY_FREE_ENTER, RUBY_FREE_LEAVE, and ruby_xfree().

◆ binding_mark()

static void binding_mark ( void ptr)
static

◆ block_compact()

◆ block_mark()

◆ block_setup()

◆ bm_compact()

static void bm_compact ( void ptr)
static

◆ bm_mark()

static void bm_mark ( void ptr)
static

Definition at line 1422 of file proc.c.

References METHOD::iclass, METHOD::klass, METHOD::me, ptr, rb_gc_mark_movable(), and METHOD::recv.

◆ bmcall()

static VALUE bmcall ( VALUE  args,
VALUE  method,
int  argc,
const VALUE argv,
VALUE  blockarg 
)
static

Definition at line 2985 of file proc.c.

References argc, argv, rb_method_call_with_block_kw(), and RB_PASS_CALLED_KEYWORDS.

◆ call_method_data()

static VALUE call_method_data ( rb_execution_context_t ec,
const struct METHOD data,
int  argc,
const VALUE argv,
VALUE  passed_procval,
int  kw_splat 
)
inlinestatic

◆ cfunc_proc_new()

◆ check_local_id()

static ID check_local_id ( VALUE  bindval,
volatile VALUE pname 
)
static

◆ compose()

static VALUE compose ( VALUE  _,
VALUE  args,
int  argc,
const VALUE argv,
VALUE  blockarg 
)
static

◆ convert_umethod_to_method_components()

static void convert_umethod_to_method_components ( VALUE  method,
VALUE  recv,
VALUE methclass_out,
VALUE klass_out,
VALUE iclass_out,
const rb_method_entry_t **  me_out 
)
static

Document-class: UnboundMethod.

Ruby supports two forms of objectified methods. Class Method is used to represent methods that are associated with a particular object: these method objects are bound to that object. Bound method objects for an object can be created using Object::method.

Ruby also supports unbound methods; methods objects that are not associated with a particular object. These can be created either by calling Module::instance_method or by calling #unbind on a bound method object. The result of both of these is an UnboundMethod object.

Unbound methods can only be called after they are bound to an object. That object must be a kind_of? the method's original class.

class Square def area @side * @side end def initialize(side) @side = side end end

area_un = Square.instance_method(:area)

s = Square.new(12) area = area_un.bind(s) area.call #=> 144

Unbound methods are a reference to the method at the time it was objectified: subsequent changes to the underlying class will not affect the unbound method.

class Test def test :original end end um = Test.instance_method(:test) class Test def test :modified end end t = Test.new t.test #=> :modified um.bind(t).call #=> :original

Definition at line 2370 of file proc.c.

References rb_method_entry_struct::called_id, CLASS_OF, rb_method_entry_struct::defined_class, FL_SINGLETON, FL_TEST, METHOD::iclass, METHOD::klass, METHOD::me, method_data_type, rb_method_entry_struct::owner, PRIsVALUE, rb_class_search_ancestor(), rb_eTypeError, rb_include_class_new(), rb_method_entry_clone(), rb_method_entry_complement_defined_class(), rb_obj_is_kind_of(), rb_raise(), RB_TYPE_P, METHOD::recv, T_MODULE, and TypedData_Get_Struct.

Referenced by umethod_bind(), and umethod_bind_call().

◆ curry()

static VALUE curry ( VALUE  _,
VALUE  args,
int  argc,
const VALUE argv,
VALUE  blockarg 
)
static

◆ env_clone()

static const rb_env_t* env_clone ( const rb_env_t env,
const rb_cref_t cref 
)
static

◆ f_lambda()

static VALUE f_lambda ( VALUE  _)
static

Definition at line 870 of file proc.c.

References rb_block_lambda().

Referenced by Init_Proc().

◆ f_proc()

static VALUE f_proc ( VALUE  _)
static

Definition at line 850 of file proc.c.

References FALSE, proc_new(), rb_cProc, and TRUE.

Referenced by Init_Proc().

◆ get_local_variable_ptr()

◆ Init_Binding()

◆ Init_Proc()

void Init_Proc ( void  )

Definition at line 3916 of file proc.c.

References CLASS_OF, f_lambda(), f_proc(), idCall, localjump_reason(), localjump_xvalue(), method_arity_m(), method_clone(), method_eq(), method_hash(), method_inspect(), method_name(), method_original_name(), method_owner(), method_receiver(), method_super_method(), method_to_proc(), method_unbind(), METHOD_VISI_PUBLIC, OPTIMIZED_METHOD_TYPE_CALL, proc_arity(), proc_binding(), proc_clone(), proc_compose_to_left(), proc_compose_to_right(), proc_curry(), proc_hash(), proc_ruby2_keywords(), proc_to_proc(), proc_to_s(), rb_add_method(), rb_cMethod, rb_cModule, rb_cObject, rb_cProc, rb_cUnboundMethod, rb_define_alias(), rb_define_class(), rb_define_global_function(), rb_define_method(), rb_define_private_method(), rb_define_singleton_method(), rb_eException, rb_eLocalJumpError, rb_eStandardError, rb_eSysStackError, rb_intern, rb_method_call_pass_called_kw(), rb_method_compose_to_left(), rb_method_compose_to_right(), rb_method_curry(), rb_method_location(), rb_method_parameters(), rb_mKernel, rb_mod_define_method(), rb_mod_instance_method(), rb_mod_public_instance_method(), rb_obj_define_method(), rb_obj_method(), rb_obj_public_method(), rb_obj_singleton_method(), rb_proc_dup(), rb_proc_lambda_p(), rb_proc_location(), rb_proc_parameters(), rb_proc_s_new(), rb_singleton_class(), rb_undef_alloc_func(), rb_undef_method(), rb_vm_register_special_exception, rb_vm_top_self(), ruby_error_sysstack, top_define_method(), umethod_bind(), umethod_bind_call(), and VM_METHOD_TYPE_OPTIMIZED.

◆ iseq_location()

◆ localjump_reason()

static VALUE localjump_reason ( VALUE  exc)
static

Definition at line 3084 of file proc.c.

References rb_iv_get().

Referenced by Init_Proc().

◆ localjump_xvalue()

static VALUE localjump_xvalue ( VALUE  exc)
static

Definition at line 3070 of file proc.c.

References rb_iv_get().

Referenced by Init_Proc().

◆ make_curry_proc()

static VALUE make_curry_proc ( VALUE  proc,
VALUE  passed,
VALUE  arity 
)
static

Definition at line 3201 of file proc.c.

References curry, GetProcPtr, rb_proc_t::is_lambda, rb_ary_freeze(), rb_ary_new3, and rb_proc_new().

Referenced by curry(), and proc_curry().

◆ method_arity()

static int method_arity ( VALUE  method)
static

◆ method_arity_m()

static VALUE method_arity_m ( VALUE  method)
static

Definition at line 2605 of file proc.c.

References INT2FIX, and method_arity().

Referenced by Init_Proc().

◆ method_callable_method_entry()

static const rb_callable_method_entry_t* method_callable_method_entry ( const struct METHOD data)
static

Definition at line 2280 of file proc.c.

References rb_method_entry_struct::defined_class, METHOD::me, and rb_bug().

Referenced by call_method_data().

◆ method_clone()

◆ method_cref()

◆ method_def_iseq()

◆ method_def_location()

◆ method_entry_defined_class()

static VALUE method_entry_defined_class ( const rb_method_entry_t me)
inlinestatic

◆ method_eq()

static VALUE method_eq ( VALUE  method,
VALUE  other 
)
static

Document-class: Method.

Method objects are created by Object::method, and are associated with a particular object (not just with a class). They may be used to invoke the method within the object, and as a block associated with an iterator. They may also be unbound from one object (creating an UnboundMethod) and bound to another.

class Thing def square(n) n*n end end thing = Thing.new meth = thing.method(:square)

meth.call(9) #=> 81 [ 1, 2, 3 ].collect(&meth) #=> [1, 4, 9]

[ 1, 2, 3 ].each(&method(:puts)) #=> prints 1, 2, 3

require 'date' w[2017-03-01 2017-03-02].collect(&Date.method(:parse)) #=> [#<Date: 2017-03-01 ((2457814j,0s,0n),+0s,2299161j)>, #<Date: 2017-03-02 ((2457815j,0s,0n),+0s,2299161j)>]

Definition at line 1627 of file proc.c.

References Check_TypedStruct, CLASS_OF, DATA_PTR, METHOD::klass, METHOD::me, method_data_type, method_entry_defined_class(), Qfalse, Qtrue, rb_method_entry_eq(), rb_obj_is_method(), and METHOD::recv.

Referenced by Init_Proc().

◆ method_hash()

static VALUE method_hash ( VALUE  method)
static

◆ method_inspect()

◆ method_min_max_arity()

static int method_min_max_arity ( VALUE  method,
int *  max 
)
static

◆ method_name()

static VALUE method_name ( VALUE  obj)
static

◆ method_original_name()

static VALUE method_original_name ( VALUE  obj)
static

◆ method_owner()

static VALUE method_owner ( VALUE  obj)
static

Definition at line 1770 of file proc.c.

References METHOD::me, method_data_type, rb_method_entry_struct::owner, and TypedData_Get_Struct.

Referenced by Init_Proc().

◆ method_receiver()

static VALUE method_receiver ( VALUE  obj)
static

Definition at line 1713 of file proc.c.

References method_data_type, METHOD::recv, and TypedData_Get_Struct.

Referenced by Init_Proc(), and proc_binding().

◆ method_super_method()

◆ method_to_proc()

◆ method_unbind()

◆ mlambda()

static VALUE mlambda ( VALUE  method)
static

Definition at line 2979 of file proc.c.

References idLambda, rb_funcallv(), and rb_mRubyVMFrozenCore.

Referenced by method_to_proc().

◆ mnew()

static VALUE mnew ( VALUE  klass,
VALUE  obj,
ID  id,
VALUE  mclass,
int  scope 
)
static

◆ mnew_from_me()

static VALUE mnew_from_me ( const rb_method_entry_t me,
VALUE  klass,
VALUE  iclass,
VALUE  obj,
ID  id,
VALUE  mclass,
int  scope 
)
static

Definition at line 1560 of file proc.c.

References METHOD::iclass, METHOD::klass, METHOD::me, mnew_internal(), and TRUE.

Referenced by mnew(), and rb_obj_singleton_method().

◆ mnew_internal()

◆ mnew_missing()

◆ mnew_missing_by_name()

static VALUE mnew_missing_by_name ( VALUE  klass,
VALUE  obj,
VALUE name,
int  scope,
VALUE  mclass 
)
static

◆ mproc()

static VALUE mproc ( VALUE  method)
static

Definition at line 2973 of file proc.c.

References idProc, rb_funcallv(), and rb_mRubyVMFrozenCore.

Referenced by rb_proc_new().

◆ obj_method()

static VALUE obj_method ( VALUE  obj,
VALUE  vid,
int  scope 
)
static

◆ original_method_entry()

◆ proc_arity()

static VALUE proc_arity ( VALUE  self)
static

Definition at line 1054 of file proc.c.

References INT2FIX, and rb_proc_arity().

Referenced by Init_Proc().

◆ proc_binding()

◆ proc_clone()

static VALUE proc_clone ( VALUE  self)
static

Definition at line 164 of file proc.c.

References CLONESETUP, and rb_proc_dup().

Referenced by Init_Proc().

◆ proc_compact()

static void proc_compact ( void ptr)
static

Definition at line 105 of file proc.c.

References rb_proc_t::block, block_compact(), and ptr.

◆ proc_compose_to_left()

static VALUE proc_compose_to_left ( VALUE  self,
VALUE  g 
)
static

Definition at line 3388 of file proc.c.

References rb_proc_compose_to_left(), and to_callable().

Referenced by Init_Proc(), and rb_method_compose_to_left().

◆ proc_compose_to_right()

static VALUE proc_compose_to_right ( VALUE  self,
VALUE  g 
)
static

Definition at line 3441 of file proc.c.

References rb_proc_compose_to_right(), and to_callable().

Referenced by Init_Proc(), and rb_method_compose_to_right().

◆ proc_curry()

static VALUE proc_curry ( int  argc,
const VALUE argv,
VALUE  self 
)
static

◆ proc_hash()

static VALUE proc_hash ( VALUE  self)
static

Definition at line 1350 of file proc.c.

References hash(), rb_hash_end(), rb_hash_proc(), rb_hash_start(), and ST2FIX.

Referenced by Init_Proc().

◆ proc_mark()

static void proc_mark ( void ptr)
static

Definition at line 112 of file proc.c.

References rb_proc_t::block, block_mark(), ptr, and RUBY_MARK_LEAVE.

◆ proc_memsize()

static size_t proc_memsize ( const void ptr)
static

Definition at line 125 of file proc.c.

References rb_block::as, rb_proc_t::block, rb_block::captured, rb_captured_block::ep, and ptr.

◆ proc_new()

◆ proc_ruby2_keywords()

◆ proc_to_block_handler()

static VALUE proc_to_block_handler ( VALUE  procval)
static

Definition at line 980 of file proc.c.

References NIL_P, and VM_BLOCK_HANDLER_NONE.

Referenced by call_method_data(), rb_proc_call_with_block(), and rb_proc_call_with_block_kw().

◆ proc_to_proc()

static VALUE proc_to_proc ( VALUE  self)
static

Definition at line 1416 of file proc.c.

Referenced by Init_Proc().

◆ proc_to_s()

static VALUE proc_to_s ( VALUE  self)
static

Definition at line 1400 of file proc.c.

References rb_proc_t::block, GetProcPtr, rb_proc_t::is_lambda, NULL, and rb_block_to_s().

Referenced by Init_Proc().

◆ rb_binding_alloc()

VALUE rb_binding_alloc ( VALUE  klass)

Definition at line 331 of file proc.c.

References ruby_binding_data_type, and TypedData_Make_Struct.

Referenced by binding_dup(), proc_binding(), and rb_vm_make_binding().

◆ rb_binding_new()

VALUE rb_binding_new ( void  )

Definition at line 364 of file proc.c.

References rb_execution_context_struct::cfp, GET_EC, and rb_vm_make_binding().

Referenced by call_trace_func(), Init_VM(), and rb_f_binding().

◆ rb_block_arity()

◆ rb_block_lambda()

VALUE rb_block_lambda ( void  )

Definition at line 856 of file proc.c.

References FALSE, proc_new(), rb_cProc, and TRUE.

Referenced by f_lambda(), and rb_mod_define_method().

◆ rb_block_min_max_arity()

int rb_block_min_max_arity ( int *  max)

◆ rb_block_proc()

◆ rb_block_to_s()

◆ rb_f_binding()

static VALUE rb_f_binding ( VALUE  self)
static

Definition at line 387 of file proc.c.

References rb_binding_new().

Referenced by Init_Binding().

◆ rb_find_defined_class_by_owner()

VALUE rb_find_defined_class_by_owner ( VALUE  current_class,
VALUE  target_owner 
)

◆ rb_func_lambda_new()

VALUE rb_func_lambda_new ( rb_block_call_func_t  func,
VALUE  val,
int  min_argc,
int  max_argc 
)

Definition at line 735 of file proc.c.

References cfunc_proc_new(), vm_ifunc::func, rb_cProc, and rb_vm_ifunc_new().

Referenced by wmap_allocate().

◆ rb_func_proc_new()

VALUE rb_func_proc_new ( rb_block_call_func_t  func,
VALUE  val 
)

Definition at line 728 of file proc.c.

References cfunc_proc_new(), vm_ifunc::func, rb_cProc, and rb_vm_ifunc_proc_new().

Referenced by rb_hash_to_proc(), and vm_caller_setup_arg_block().

◆ rb_hash_proc()

◆ rb_iseq_location()

VALUE rb_iseq_location ( const rb_iseq_t iseq)

◆ rb_iseq_min_max_arity()

◆ rb_method_call()

VALUE rb_method_call ( int  argc,
const VALUE argv,
VALUE  method 
)

Definition at line 2273 of file proc.c.

References argc, argv, Qnil, rb_block_given_p(), rb_block_proc(), and rb_method_call_with_block().

Referenced by method_fallback().

◆ rb_method_call_kw()

VALUE rb_method_call_kw ( int  argc,
const VALUE argv,
VALUE  method,
int  kw_splat 
)

Definition at line 2266 of file proc.c.

References argc, argv, Qnil, rb_block_given_p(), rb_block_proc(), and rb_method_call_with_block_kw().

◆ rb_method_call_pass_called_kw()

static VALUE rb_method_call_pass_called_kw ( int  argc,
const VALUE argv,
VALUE  method 
)
static

◆ rb_method_call_with_block()

VALUE rb_method_call_with_block ( int  argc,
const VALUE argv,
VALUE  method,
VALUE  passed_procval 
)

Definition at line 2309 of file proc.c.

References argc, argv, rb_method_call_with_block_kw(), and RB_NO_KEYWORDS.

Referenced by rb_method_call().

◆ rb_method_call_with_block_kw()

VALUE rb_method_call_with_block_kw ( int  argc,
const VALUE argv,
VALUE  method,
VALUE  passed_procval,
int  kw_splat 
)

◆ rb_method_compose_to_left()

static VALUE rb_method_compose_to_left ( VALUE  self,
VALUE  g 
)
static

Definition at line 3484 of file proc.c.

References method_to_proc(), proc_compose_to_left(), and to_callable().

Referenced by Init_Proc().

◆ rb_method_compose_to_right()

static VALUE rb_method_compose_to_right ( VALUE  self,
VALUE  g 
)
static

Definition at line 3508 of file proc.c.

References method_to_proc(), proc_compose_to_right(), and to_callable().

Referenced by Init_Proc().

◆ rb_method_curry()

static VALUE rb_method_curry ( int  argc,
const VALUE argv,
VALUE  self 
)
static

Definition at line 3334 of file proc.c.

References argc, argv, method_to_proc(), and proc_curry().

Referenced by Init_Proc().

◆ rb_method_def()

◆ rb_method_entry_arity()

int rb_method_entry_arity ( const rb_method_entry_t me)

◆ rb_method_entry_location()

VALUE rb_method_entry_location ( const rb_method_entry_t me)

Definition at line 2725 of file proc.c.

References rb_method_entry_struct::def, METHOD::me, method_def_location(), and Qnil.

Referenced by vm_respond_to().

◆ rb_method_entry_min_max_arity()

◆ rb_method_iseq()

const rb_iseq_t* rb_method_iseq ( VALUE  method)

◆ rb_method_location()

VALUE rb_method_location ( VALUE  method)

Definition at line 2740 of file proc.c.

References method_def_location(), and rb_method_def().

Referenced by Init_Proc(), and method_inspect().

◆ rb_method_name_error()

◆ rb_method_parameters()

static VALUE rb_method_parameters ( VALUE  method)
static

Definition at line 2765 of file proc.c.

References method_arity(), rb_iseq_parameters(), rb_method_iseq(), and rb_unnamed_parameters().

Referenced by Init_Proc(), and method_inspect().

◆ rb_mod_define_method()

◆ rb_mod_instance_method()

static VALUE rb_mod_instance_method ( VALUE  mod,
VALUE  vid 
)
static

Definition at line 1961 of file proc.c.

References FALSE, mnew(), mod, Qundef, rb_check_id(), rb_cUnboundMethod, and rb_method_name_error().

Referenced by Init_Proc().

◆ rb_mod_method_arity()

int rb_mod_method_arity ( VALUE  mod,
ID  id 
)

Definition at line 2644 of file proc.c.

References METHOD::me, mod, original_method_entry(), and rb_method_entry_arity().

Referenced by rb_obj_method_arity().

◆ rb_mod_public_instance_method()

static VALUE rb_mod_public_instance_method ( VALUE  mod,
VALUE  vid 
)
static

Definition at line 1978 of file proc.c.

References mnew(), mod, Qundef, rb_check_id(), rb_cUnboundMethod, rb_method_name_error(), and TRUE.

Referenced by Init_Proc().

◆ rb_obj_define_method()

static VALUE rb_obj_define_method ( int  argc,
VALUE argv,
VALUE  obj 
)
static

Definition at line 2152 of file proc.c.

References argc, argv, METHOD::klass, rb_mod_define_method(), and rb_singleton_class().

Referenced by Init_Proc().

◆ rb_obj_is_method()

◆ rb_obj_is_proc()

◆ rb_obj_method()

VALUE rb_obj_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1861 of file proc.c.

References FALSE, and obj_method().

Referenced by Init_Proc(), and yielder_to_proc().

◆ rb_obj_method_arity()

int rb_obj_method_arity ( VALUE  obj,
ID  id 
)

Definition at line 2652 of file proc.c.

References CLASS_OF, and rb_mod_method_arity().

Referenced by rb_io_writev().

◆ rb_obj_public_method()

VALUE rb_obj_public_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1874 of file proc.c.

References obj_method(), and TRUE.

Referenced by Init_Proc().

◆ rb_obj_singleton_method()

◆ rb_proc_alloc()

VALUE rb_proc_alloc ( VALUE  klass)

Definition at line 145 of file proc.c.

References proc_data_type, and TypedData_Make_Struct.

Referenced by proc_create(), sym_proc_new(), and vm_proc_create_from_captured().

◆ rb_proc_arity()

int rb_proc_arity ( VALUE  self)

◆ rb_proc_call()

VALUE rb_proc_call ( VALUE  self,
VALUE  args 
)

◆ rb_proc_call_kw()

VALUE rb_proc_call_kw ( VALUE  self,
VALUE  args,
int  kw_splat 
)

◆ rb_proc_call_with_block()

◆ rb_proc_call_with_block_kw()

VALUE rb_proc_call_with_block_kw ( VALUE  self,
int  argc,
const VALUE argv,
VALUE  passed_procval,
int  kw_splat 
)

◆ rb_proc_compose_to_left()

static VALUE rb_proc_compose_to_left ( VALUE  self,
VALUE  g 
)
static

◆ rb_proc_compose_to_right()

static VALUE rb_proc_compose_to_right ( VALUE  self,
VALUE  g 
)
static

◆ rb_proc_get_iseq()

◆ rb_proc_lambda_p()

VALUE rb_proc_lambda_p ( VALUE  procval)

Definition at line 275 of file proc.c.

References GetProcPtr, rb_proc_t::is_lambda, Qfalse, and Qtrue.

Referenced by Init_Proc(), proc_curry(), set_proc_default(), and yield_under().

◆ rb_proc_location()

VALUE rb_proc_location ( VALUE  self)

Definition at line 1256 of file proc.c.

References iseq_location(), and rb_proc_get_iseq().

Referenced by Init_Proc(), and threadptr_invoke_proc_location().

◆ rb_proc_min_max_arity()

static int rb_proc_min_max_arity ( VALUE  self,
int *  max 
)
static

Definition at line 1104 of file proc.c.

References rb_proc_t::block, GetProcPtr, max(), and rb_vm_block_min_max_arity().

Referenced by proc_curry(), and rb_method_entry_min_max_arity().

◆ rb_proc_new()

VALUE rb_proc_new ( rb_block_call_func_t  func,
VALUE  val 
)

◆ rb_proc_parameters()

static VALUE rb_proc_parameters ( VALUE  self)
static

Definition at line 1291 of file proc.c.

References rb_iseq_parameters(), rb_proc_arity(), rb_proc_get_iseq(), and rb_unnamed_parameters().

Referenced by Init_Proc().

◆ rb_proc_s_new()

static VALUE rb_proc_s_new ( int  argc,
VALUE argv,
VALUE  klass 
)
static

Definition at line 828 of file proc.c.

References argc, argv, FALSE, proc_new(), rb_obj_call_init_kw(), and RB_PASS_CALLED_KEYWORDS.

Referenced by Init_Proc().

◆ rb_sym_to_proc()

◆ rb_unnamed_parameters()

VALUE rb_unnamed_parameters ( int  arity)

◆ rb_vm_block_min_max_arity()

◆ rb_vm_cref_in_context()

◆ rb_vm_cref_new_toplevel()

rb_cref_t* rb_vm_cref_new_toplevel ( void  )

Definition at line 298 of file vm.c.

References GET_EC, and vm_cref_new_toplevel().

Referenced by env_clone(), and eval_string_wrap_protect().

◆ rb_vm_ifunc_new()

struct vm_ifunc* rb_vm_ifunc_new ( rb_block_call_func_t  func,
const void data,
int  min_argc,
int  max_argc 
)

◆ respond_to_missing_p()

static int respond_to_missing_p ( VALUE  klass,
VALUE  obj,
VALUE  sym,
int  scope 
)
static

◆ sym_proc_new()

static VALUE sym_proc_new ( VALUE  klass,
VALUE  sym 
)
static

◆ to_callable()

◆ top_define_method()

static VALUE top_define_method ( int  argc,
VALUE argv,
VALUE  obj 
)
static

◆ umethod_bind()

static VALUE umethod_bind ( VALUE  method,
VALUE  recv 
)
static

◆ umethod_bind_call()

Variable Documentation

◆ bmcall

rb_block_call_func bmcall
static

Definition at line 46 of file proc.c.

Referenced by method_to_proc().

◆ curry

rb_block_call_func curry
static

Definition at line 3198 of file proc.c.

Referenced by make_curry_proc().

◆ method_data_type

const rb_data_type_t method_data_type
static
Initial value:
= {
"method",
{
},
0, 0, 1
}
static void bm_compact(void *ptr)
Definition: proc.c:1432
static void bm_mark(void *ptr)
Definition: proc.c:1422
static size_t bm_memsize(const void *ptr)
Definition: proc.c:1442
void(* RUBY_DATA_FUNC)(void *)
Definition: ruby.h:1184

Definition at line 1447 of file proc.c.

Referenced by convert_umethod_to_method_components(), method_arity(), method_clone(), method_eq(), method_hash(), method_inspect(), method_min_max_arity(), method_name(), method_original_name(), method_owner(), method_receiver(), method_super_method(), method_unbind(), mnew_internal(), mnew_missing(), rb_method_call_with_block_kw(), rb_method_def(), rb_obj_is_method(), and umethod_bind().

◆ proc_data_type

const rb_data_type_t proc_data_type
static
Initial value:
= {
"proc",
{
},
}
@ RUBY_FL_WB_PROTECTED
Definition: ruby.h:842
static size_t proc_memsize(const void *ptr)
Definition: proc.c:125
static void proc_compact(void *ptr)
Definition: proc.c:105
static void proc_mark(void *ptr)
Definition: proc.c:112

Definition at line 133 of file proc.c.

Referenced by cfunc_proc_new(), rb_obj_is_proc(), and rb_proc_alloc().

◆ proc_without_block

const char proc_without_block[] = "tried to create Proc object without a block"
static

Definition at line 741 of file proc.c.

Referenced by proc_new(), and rb_mod_define_method().

◆ ruby_binding_data_type

const rb_data_type_t ruby_binding_data_type
Initial value:
= {
"binding",
{
},
}
static void binding_mark(void *ptr)
Definition: proc.c:294
static void binding_free(void *ptr)
Definition: proc.c:286
static void binding_compact(void *ptr)
Definition: proc.c:305
static size_t binding_memsize(const void *ptr)
Definition: proc.c:314

Definition at line 319 of file proc.c.

Referenced by eval_string_with_scope(), and rb_binding_alloc().