Ruby  2.4.2p198(2017-09-14revision59899)
Data Structures | Macros | Functions | Variables
proc.c File Reference
#include "eval_intern.h"
#include "internal.h"
#include "gc.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
 
#define NO_CLOBBERED(v)   (*(volatile VALUE *)&(v))
 
#define attached   id__attached__
 
#define IS_METHOD_PROC_IFUNC(ifunc)   ((ifunc)->func == bmcall)
 
#define check_argc(argc)   (argc)
 
#define MSG(s)   rb_fstring_cstr("undefined method `%1$s' for"s" `%2$s'")
 

Functions

const rb_cref_trb_vm_cref_in_context (VALUE self, VALUE cbase)
 
static VALUE bmcall (VALUE, VALUE, int, VALUE *, VALUE)
 
static int method_arity (VALUE)
 
static int method_min_max_arity (VALUE, int *max)
 
static VALUE proc_to_s_ (VALUE self, const rb_proc_t *proc)
 
static void block_mark (const struct rb_block *block)
 
static void proc_mark (void *ptr)
 
static size_t proc_memsize (const void *ptr)
 
VALUE rb_proc_alloc (VALUE klass)
 
VALUE rb_obj_is_proc (VALUE proc)
 
VALUE rb_proc_create (VALUE klass, const struct rb_block *block, int8_t safe_level, int8_t is_from_method, int8_t is_lambda)
 
static VALUE proc_dup (VALUE self)
 
static VALUE proc_clone (VALUE self)
 
VALUE rb_proc_lambda_p (VALUE procval)
 
static void binding_free (void *ptr)
 
static void binding_mark (void *ptr)
 
static size_t binding_memsize (const void *ptr)
 
VALUE rb_binding_alloc (VALUE klass)
 
static VALUE binding_dup (VALUE self)
 
static VALUE binding_clone (VALUE self)
 
VALUE rb_binding_new (void)
 
static VALUE rb_f_binding (VALUE self)
 
static VALUE bind_eval (int argc, VALUE *argv, VALUE bindval)
 
static const VALUEget_local_variable_ptr (const rb_env_t **envp, ID lid)
 
static ID check_local_id (VALUE bindval, volatile VALUE *pname)
 
static VALUE bind_local_variables (VALUE bindval)
 
static VALUE bind_local_variable_get (VALUE bindval, VALUE sym)
 
static VALUE bind_local_variable_set (VALUE bindval, VALUE sym, VALUE val)
 
static VALUE bind_local_variable_defined_p (VALUE bindval, VALUE sym)
 
static VALUE bind_receiver (VALUE bindval)
 
static VALUE cfunc_proc_new (VALUE klass, VALUE ifunc, int8_t is_lambda)
 
static VALUE sym_proc_new (VALUE klass, VALUE sym)
 
struct vm_ifuncrb_vm_ifunc_new (VALUE(*func)(ANYARGS), const void *data, int min_argc, int max_argc)
 
VALUE rb_func_proc_new (rb_block_call_func_t func, VALUE val)
 
VALUE rb_func_lambda_new (rb_block_call_func_t func, VALUE val, int min_argc, int max_argc)
 
static VALUE proc_new (VALUE klass, int8_t is_lambda)
 
static VALUE rb_proc_s_new (int argc, VALUE *argv, VALUE klass)
 
VALUE rb_block_proc (void)
 
VALUE rb_block_lambda (void)
 
VALUE rb_proc_call (VALUE self, VALUE args)
 
static VALUE proc_to_block_handler (VALUE procval)
 
VALUE rb_proc_call_with_block (VALUE self, int argc, const VALUE *argv, VALUE passed_procval)
 
static VALUE proc_arity (VALUE self)
 
static int rb_iseq_min_max_arity (const rb_iseq_t *iseq, int *max)
 
static int rb_vm_block_min_max_arity (const struct rb_block *block, int *max)
 
static int rb_proc_min_max_arity (VALUE self, int *max)
 
int rb_proc_arity (VALUE self)
 
static void block_setup (struct rb_block *block, VALUE block_handler)
 
int rb_block_arity (void)
 
int rb_block_min_max_arity (int *max)
 
const rb_iseq_trb_proc_get_iseq (VALUE self, int *is_proc)
 
static VALUE iseq_location (const rb_iseq_t *iseq)
 
VALUE rb_proc_location (VALUE self)
 
static VALUE unnamed_parameters (int arity)
 
static VALUE rb_proc_parameters (VALUE self)
 
st_index_t rb_hash_proc (st_index_t hash, VALUE prc)
 
VALUE rb_sym_to_proc (VALUE sym)
 
static VALUE proc_hash (VALUE self)
 
static VALUE proc_to_s (VALUE self)
 
static VALUE proc_to_proc (VALUE self)
 
static void bm_mark (void *ptr)
 
static size_t bm_memsize (const void *ptr)
 
VALUE rb_obj_is_method (VALUE m)
 
static int respond_to_missing_p (VALUE klass, VALUE obj, VALUE sym, int scope)
 
static VALUE mnew_missing (VALUE klass, VALUE obj, ID id, VALUE mclass)
 
static VALUE mnew_internal (const rb_method_entry_t *me, VALUE klass, VALUE obj, ID id, VALUE mclass, int scope, int error)
 
static VALUE mnew_from_me (const rb_method_entry_t *me, VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
 
static VALUE mnew (VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
 
static VALUE method_entry_defined_class (const rb_method_entry_t *me)
 
static VALUE method_eq (VALUE method, VALUE other)
 
static VALUE method_hash (VALUE method)
 
static VALUE method_unbind (VALUE obj)
 
static VALUE method_receiver (VALUE obj)
 
static VALUE method_name (VALUE obj)
 
static VALUE method_original_name (VALUE obj)
 
static VALUE method_owner (VALUE obj)
 
void rb_method_name_error (VALUE klass, VALUE str)
 
static VALUE obj_method (VALUE obj, VALUE vid, int scope)
 
VALUE rb_obj_method (VALUE obj, VALUE vid)
 
VALUE rb_obj_public_method (VALUE obj, VALUE vid)
 
VALUE rb_obj_singleton_method (VALUE obj, VALUE vid)
 
static VALUE rb_mod_instance_method (VALUE mod, VALUE vid)
 
static VALUE rb_mod_public_instance_method (VALUE mod, VALUE vid)
 
static VALUE rb_mod_define_method (int argc, VALUE *argv, VALUE mod)
 
static VALUE rb_obj_define_method (int argc, VALUE *argv, VALUE obj)
 
static VALUE top_define_method (int argc, VALUE *argv, VALUE obj)
 
static VALUE method_clone (VALUE self)
 
VALUE rb_method_call (int argc, const VALUE *argv, VALUE method)
 
static const rb_callable_method_entry_tmethod_callable_method_entry (const struct METHOD *data)
 
static VALUE call_method_data (rb_thread_t *th, const struct METHOD *data, int argc, const VALUE *argv, VALUE passed_procval)
 
static VALUE call_method_data_safe (rb_thread_t *th, const struct METHOD *data, int argc, const VALUE *argv, VALUE passed_procval, int safe)
 
VALUE rb_method_call_with_block (int argc, const VALUE *argv, VALUE method, VALUE passed_procval)
 
static VALUE umethod_bind (VALUE method, VALUE recv)
 
static int rb_method_entry_min_max_arity (const rb_method_entry_t *me, int *max)
 
int rb_method_entry_arity (const rb_method_entry_t *me)
 
static VALUE method_arity_m (VALUE method)
 
static const rb_method_entry_toriginal_method_entry (VALUE mod, ID id)
 
int rb_mod_method_arity (VALUE mod, ID id)
 
int rb_obj_method_arity (VALUE obj, ID id)
 
static const rb_method_definition_tmethod_def (VALUE method)
 
static const rb_iseq_tmethod_def_iseq (const rb_method_definition_t *def)
 
const rb_iseq_trb_method_iseq (VALUE method)
 
static const rb_cref_tmethod_cref (VALUE method)
 
static VALUE method_def_location (const rb_method_definition_t *def)
 
VALUE rb_method_entry_location (const rb_method_entry_t *me)
 
VALUE rb_mod_method_location (VALUE mod, ID id)
 
VALUE rb_obj_method_location (VALUE obj, ID id)
 
VALUE rb_method_location (VALUE method)
 
static VALUE rb_method_parameters (VALUE method)
 
static VALUE method_inspect (VALUE method)
 
static VALUE mproc (VALUE method)
 
static VALUE mlambda (VALUE method)
 
VALUE rb_proc_new (VALUE(*func)(ANYARGS), VALUE val)
 
static VALUE method_to_proc (VALUE method)
 
static VALUE method_super_method (VALUE method)
 
static VALUE localjump_xvalue (VALUE exc)
 
static VALUE localjump_reason (VALUE exc)
 
rb_cref_trb_vm_cref_new_toplevel (void)
 
static const rb_env_tenv_clone (const rb_env_t *env, const rb_cref_t *cref)
 
static VALUE proc_binding (VALUE self)
 
static VALUE curry (VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
 
static VALUE make_curry_proc (VALUE proc, VALUE passed, VALUE arity)
 
static VALUE proc_curry (int argc, const VALUE *argv, VALUE self)
 
static VALUE rb_method_curry (int argc, const VALUE *argv, VALUE self)
 
void Init_Proc (void)
 
void Init_Binding (void)
 

Variables

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

Macro Definition Documentation

◆ attached

#define attached   id__attached__

Definition at line 45 of file proc.c.

Referenced by method_inspect(), and rb_method_name_error().

◆ check_argc

#define check_argc (   argc)    (argc)

Definition at line 875 of file proc.c.

Referenced by curry(), rb_block_lambda(), rb_method_entry_min_max_arity(), and rb_proc_call().

◆ IS_METHOD_PROC_IFUNC

#define IS_METHOD_PROC_IFUNC (   ifunc)    ((ifunc)->func == bmcall)

Definition at line 49 of file proc.c.

Referenced by proc_binding(), rb_proc_get_iseq(), and rb_vm_block_min_max_arity().

◆ MSG

#define MSG (   s)    rb_fstring_cstr("undefined method `%1$s' for"s" `%2$s'")

◆ NO_CLOBBERED

#define NO_CLOBBERED (   v)    (*(volatile VALUE *)&(v))

Definition at line 22 of file proc.c.

Referenced by call_method_data_safe().

◆ PROC_NEW_REQUIRES_BLOCK

#define PROC_NEW_REQUIRES_BLOCK   0

Definition at line 19 of file proc.c.

Function Documentation

◆ bind_eval()

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

Definition at line 385 of file proc.c.

References 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_receiver()

static VALUE bind_receiver ( VALUE  bindval)
static

Definition at line 604 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 332 of file proc.c.

References binding_dup(), and CLONESETUP.

Referenced by Init_Binding().

◆ binding_dup()

static VALUE binding_dup ( VALUE  self)
static

◆ binding_free()

static void binding_free ( void *  ptr)
static

Definition at line 266 of file proc.c.

References RUBY_FREE_ENTER, RUBY_FREE_LEAVE, and ruby_xfree().

◆ binding_mark()

static void binding_mark ( void *  ptr)
static

◆ binding_memsize()

static size_t binding_memsize ( const void *  ptr)
static

Definition at line 292 of file proc.c.

◆ block_mark()

static void block_mark ( const struct rb_block block)
static

◆ block_setup()

static void block_setup ( struct rb_block block,
VALUE  block_handler 
)
static

◆ bm_mark()

static void bm_mark ( void *  ptr)
static

Definition at line 1324 of file proc.c.

References METHOD::klass, METHOD::me, rb_gc_mark(), and METHOD::recv.

◆ bm_memsize()

static size_t bm_memsize ( const void *  ptr)
static

Definition at line 1333 of file proc.c.

◆ bmcall()

static VALUE bmcall ( VALUE  args,
VALUE  method,
int  argc,
VALUE argv,
VALUE  passed_proc 
)
static

Definition at line 2655 of file proc.c.

References rb_method_call_with_block().

Referenced by method_to_proc().

◆ call_method_data()

static VALUE call_method_data ( rb_thread_t th,
const struct METHOD data,
int  argc,
const VALUE argv,
VALUE  passed_procval 
)
inlinestatic

◆ call_method_data_safe()

static VALUE call_method_data_safe ( rb_thread_t th,
const struct METHOD data,
int  argc,
const VALUE argv,
VALUE  passed_procval,
int  safe 
)
static

◆ cfunc_proc_new()

static VALUE cfunc_proc_new ( VALUE  klass,
VALUE  ifunc,
int8_t  is_lambda 
)
static

◆ check_local_id()

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

◆ curry()

static VALUE curry ( VALUE  dummy,
VALUE  args,
int  argc,
VALUE argv,
VALUE  passed_proc 
)
static

◆ env_clone()

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

◆ get_local_variable_ptr()

static const VALUE* get_local_variable_ptr ( const rb_env_t **  envp,
ID  lid 
)
static

◆ Init_Binding()

void Init_Binding ( void  )

◆ Init_Proc()

void Init_Proc ( void  )

◆ iseq_location()

static VALUE iseq_location ( const rb_iseq_t iseq)
static

◆ localjump_reason()

static VALUE localjump_reason ( VALUE  exc)
static

Definition at line 2741 of file proc.c.

References rb_iv_get(), and rb_vm_cref_new_toplevel().

Referenced by Init_Proc().

◆ localjump_xvalue()

static VALUE localjump_xvalue ( VALUE  exc)
static

Definition at line 2727 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 2856 of file proc.c.

References 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

Definition at line 2388 of file proc.c.

References METHOD::me, rb_method_entry_arity(), and TypedData_Get_Struct.

Referenced by method_arity_m(), and rb_method_parameters().

◆ method_arity_m()

static VALUE method_arity_m ( VALUE  method)
static

Definition at line 2381 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 2089 of file proc.c.

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

Referenced by call_method_data().

◆ method_clone()

static VALUE method_clone ( VALUE  self)
static

◆ method_cref()

static const rb_cref_t* method_cref ( VALUE  method)
static

◆ method_def()

static const rb_method_definition_t* method_def ( VALUE  method)
inlinestatic

◆ method_def_iseq()

static const rb_iseq_t* method_def_iseq ( const rb_method_definition_t def)
static

◆ method_def_location()

static VALUE method_def_location ( const rb_method_definition_t def)
static

◆ 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

◆ method_hash()

static VALUE method_hash ( VALUE  method)
static

◆ method_inspect()

static VALUE method_inspect ( VALUE  method)
static

◆ method_min_max_arity()

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

Definition at line 2411 of file proc.c.

References METHOD::me, rb_method_entry_min_max_arity(), and TypedData_Get_Struct.

Referenced by rb_vm_block_min_max_arity().

◆ 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 1641 of file proc.c.

References METHOD::me, 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 1593 of file proc.c.

References METHOD::recv, and TypedData_Get_Struct.

Referenced by Init_Proc(), and proc_binding().

◆ method_super_method()

static VALUE method_super_method ( VALUE  method)
static

◆ method_to_proc()

static VALUE method_to_proc ( VALUE  method)
static

Definition at line 2677 of file proc.c.

References bmcall(), GetProcPtr, rb_proc_t::is_from_method, mlambda(), and rb_iterate().

Referenced by Init_Proc(), and rb_method_curry().

◆ method_unbind()

static VALUE method_unbind ( VALUE  obj)
static

◆ mlambda()

static VALUE mlambda ( VALUE  method)
static

Definition at line 2649 of file proc.c.

References 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  obj,
ID  id,
VALUE  mclass,
int  scope 
)
static

Definition at line 1447 of file proc.c.

References mnew_internal(), and TRUE.

Referenced by mnew(), and rb_obj_singleton_method().

◆ mnew_internal()

static VALUE mnew_internal ( const rb_method_entry_t me,
VALUE  klass,
VALUE  obj,
ID  id,
VALUE  mclass,
int  scope,
int  error 
)
static

◆ mnew_missing()

static VALUE mnew_missing ( VALUE  klass,
VALUE  obj,
ID  id,
VALUE  mclass 
)
static

◆ mproc()

static VALUE mproc ( VALUE  method)
static

Definition at line 2643 of file proc.c.

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

static const rb_method_entry_t* original_method_entry ( VALUE  mod,
ID  id 
)
static

◆ proc_arity()

static VALUE proc_arity ( VALUE  self)
static

Definition at line 953 of file proc.c.

References INT2FIX, and rb_proc_arity().

Referenced by Init_Proc().

◆ proc_binding()

static VALUE proc_binding ( VALUE  self)
static

◆ proc_clone()

static VALUE proc_clone ( VALUE  self)
static

Definition at line 146 of file proc.c.

References CLONESETUP, and proc_dup().

Referenced by Init_Proc().

◆ proc_curry()

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

◆ proc_dup()

static VALUE proc_dup ( VALUE  self)
static

◆ proc_hash()

static VALUE proc_hash ( VALUE  self)
static

Definition at line 1243 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 78 of file proc.c.

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

◆ proc_memsize()

static size_t proc_memsize ( const void *  ptr)
static

Definition at line 91 of file proc.c.

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

◆ proc_new()

static VALUE proc_new ( VALUE  klass,
int8_t  is_lambda 
)
static

◆ proc_to_block_handler()

static VALUE proc_to_block_handler ( VALUE  procval)
static

Definition at line 893 of file proc.c.

References NIL_P, and VM_BLOCK_HANDLER_NONE.

Referenced by call_method_data(), and rb_proc_call_with_block().

◆ proc_to_proc()

static VALUE proc_to_proc ( VALUE  self)
static

Definition at line 1318 of file proc.c.

Referenced by Init_Proc().

◆ proc_to_s()

static VALUE proc_to_s ( VALUE  self)
static

Definition at line 1261 of file proc.c.

References GetProcPtr, and proc_to_s_().

Referenced by Init_Proc().

◆ proc_to_s_()

static VALUE proc_to_s_ ( VALUE  self,
const rb_proc_t proc 
)
static

◆ rb_binding_alloc()

VALUE rb_binding_alloc ( VALUE  klass)

Definition at line 308 of file proc.c.

References TypedData_Make_Struct.

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

◆ rb_binding_new()

VALUE rb_binding_new ( void  )

Definition at line 340 of file proc.c.

References rb_thread_struct::cfp, GET_THREAD, and rb_vm_make_binding().

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

◆ rb_block_arity()

int rb_block_arity ( void  )

◆ rb_block_lambda()

VALUE rb_block_lambda ( void  )

Definition at line 801 of file proc.c.

References argc, argv, check_argc, proc_new(), rb_cProc, rb_eArgError, rb_raise(), and TRUE.

Referenced by Init_Proc(), Init_VM(), and rb_mod_define_method().

◆ rb_block_min_max_arity()

int rb_block_min_max_arity ( int *  max)

◆ rb_block_proc()

VALUE rb_block_proc ( void  )

◆ rb_f_binding()

static VALUE rb_f_binding ( VALUE  self)
static

Definition at line 363 of file proc.c.

References rb_binding_new().

Referenced by Init_Binding().

◆ 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 683 of file proc.c.

References cfunc_proc_new(), rb_cProc, and rb_vm_ifunc_new().

◆ rb_func_proc_new()

VALUE rb_func_proc_new ( rb_block_call_func_t  func,
VALUE  val 
)

Definition at line 676 of file proc.c.

References cfunc_proc_new(), rb_cProc, and rb_vm_ifunc_proc_new().

Referenced by rb_hash_to_proc(), and vm_caller_setup_arg_block().

◆ rb_hash_proc()

st_index_t rb_hash_proc ( st_index_t  hash,
VALUE  prc 
)

◆ rb_iseq_min_max_arity()

static int rb_iseq_min_max_arity ( const rb_iseq_t iseq,
int *  max 
)
inlinestatic

◆ rb_method_call()

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

Definition at line 2082 of file proc.c.

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

Referenced by Init_Proc(), and method_fallback().

◆ rb_method_call_with_block()

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

◆ rb_method_curry()

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

Definition at line 2990 of file proc.c.

References method_to_proc(), and proc_curry().

Referenced by Init_Proc().

◆ rb_method_entry_arity()

int rb_method_entry_arity ( const rb_method_entry_t me)

Definition at line 2341 of file proc.c.

References max(), and rb_method_entry_min_max_arity().

Referenced by method_arity(), rb_mod_method_arity(), and vm_respond_to().

◆ rb_method_entry_location()

VALUE rb_method_entry_location ( const rb_method_entry_t me)

Definition at line 2501 of file proc.c.

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

Referenced by rb_mod_method_location(), and vm_respond_to().

◆ rb_method_entry_min_max_arity()

static int rb_method_entry_min_max_arity ( const rb_method_entry_t me,
int *  max 
)
static

◆ rb_method_iseq()

const rb_iseq_t* rb_method_iseq ( VALUE  method)

Definition at line 2467 of file proc.c.

References method_def(), and method_def_iseq().

Referenced by iseqw_s_of(), proc_binding(), rb_method_parameters(), and rb_proc_get_iseq().

◆ rb_method_location()

VALUE rb_method_location ( VALUE  method)

Definition at line 2529 of file proc.c.

References method_def(), and method_def_location().

Referenced by Init_Proc().

◆ rb_method_name_error()

void rb_method_name_error ( VALUE  klass,
VALUE  str 
)

◆ rb_method_parameters()

static VALUE rb_method_parameters ( VALUE  method)
static

Definition at line 2554 of file proc.c.

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

Referenced by Init_Proc().

◆ rb_mod_define_method()

static VALUE rb_mod_define_method ( int  argc,
VALUE argv,
VALUE  mod 
)
static

◆ rb_mod_instance_method()

static VALUE rb_mod_instance_method ( VALUE  mod,
VALUE  vid 
)
static

Definition at line 1823 of file proc.c.

References FALSE, mnew(), 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 2420 of file proc.c.

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

Referenced by rb_obj_method_arity().

◆ rb_mod_method_location()

VALUE rb_mod_method_location ( VALUE  mod,
ID  id 
)

Definition at line 2508 of file proc.c.

References METHOD::me, original_method_entry(), and rb_method_entry_location().

Referenced by rb_obj_method_location().

◆ rb_mod_public_instance_method()

static VALUE rb_mod_public_instance_method ( VALUE  mod,
VALUE  vid 
)
static

Definition at line 1840 of file proc.c.

References mnew(), 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 2006 of file proc.c.

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

Referenced by Init_Proc().

◆ rb_obj_is_method()

VALUE rb_obj_is_method ( VALUE  m)

◆ rb_obj_is_proc()

VALUE rb_obj_is_proc ( VALUE  proc)

◆ rb_obj_method()

VALUE rb_obj_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1723 of file proc.c.

References FALSE, and obj_method().

Referenced by Init_Proc(), and wmap_allocate().

◆ rb_obj_method_arity()

int rb_obj_method_arity ( VALUE  obj,
ID  id 
)

Definition at line 2428 of file proc.c.

References CLASS_OF, and rb_mod_method_arity().

◆ rb_obj_method_location()

VALUE rb_obj_method_location ( VALUE  obj,
ID  id 
)

Definition at line 2515 of file proc.c.

References CLASS_OF, and rb_mod_method_location().

◆ rb_obj_public_method()

VALUE rb_obj_public_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1736 of file proc.c.

References obj_method(), and TRUE.

Referenced by Init_Proc().

◆ rb_obj_singleton_method()

VALUE rb_obj_singleton_method ( VALUE  obj,
VALUE  vid 
)

◆ rb_proc_alloc()

VALUE rb_proc_alloc ( VALUE  klass)

◆ rb_proc_arity()

int rb_proc_arity ( VALUE  self)

◆ rb_proc_call()

VALUE rb_proc_call ( VALUE  self,
VALUE  args 
)

◆ rb_proc_call_with_block()

VALUE rb_proc_call_with_block ( VALUE  self,
int  argc,
const VALUE argv,
VALUE  passed_procval 
)

◆ rb_proc_create()

VALUE rb_proc_create ( VALUE  klass,
const struct rb_block block,
int8_t  safe_level,
int8_t  is_from_method,
int8_t  is_lambda 
)

◆ rb_proc_get_iseq()

const rb_iseq_t* rb_proc_get_iseq ( VALUE  self,
int *  is_proc 
)

◆ rb_proc_lambda_p()

VALUE rb_proc_lambda_p ( VALUE  procval)

Definition at line 255 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 1147 of file proc.c.

References iseq_location(), and rb_proc_get_iseq().

Referenced by Init_Proc(), rb_thread_inspect(), and thread_initialize().

◆ rb_proc_min_max_arity()

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

Definition at line 1001 of file proc.c.

References rb_proc_t::block, GetProcPtr, 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 ( VALUE(*)(ANYARGS func,
VALUE  val 
)

Definition at line 2661 of file proc.c.

References func, mproc(), and rb_iterate().

Referenced by gc_stat_internal(), make_curry_proc(), rb_fiber_new(), rb_obj_info_dump(), and yielder_new().

◆ rb_proc_parameters()

static VALUE rb_proc_parameters ( VALUE  self)
static

Definition at line 1182 of file proc.c.

References rb_iseq_parameters(), rb_proc_arity(), rb_proc_get_iseq(), and 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 771 of file proc.c.

References FALSE, proc_new(), and rb_obj_call_init().

Referenced by Init_Proc().

◆ rb_sym_to_proc()

VALUE rb_sym_to_proc ( VALUE  sym)

◆ rb_vm_block_min_max_arity()

static int rb_vm_block_min_max_arity ( const struct rb_block block,
int *  max 
)
static

◆ rb_vm_cref_in_context()

const rb_cref_t* rb_vm_cref_in_context ( VALUE  self,
VALUE  cbase 
)

◆ rb_vm_cref_new_toplevel()

rb_cref_t* rb_vm_cref_new_toplevel ( void  )

Definition at line 253 of file vm.c.

References GET_THREAD, and vm_cref_new_toplevel().

Referenced by env_clone(), and localjump_reason().

◆ rb_vm_ifunc_new()

struct vm_ifunc* rb_vm_ifunc_new ( VALUE(*)(ANYARGS 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

◆ 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

◆ unnamed_parameters()

static VALUE unnamed_parameters ( int  arity)
static

Variable Documentation

◆ method_data_type

const rb_data_type_t method_data_type
static
Initial value:
= {
"method",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static size_t bm_memsize(const void *ptr)
Definition: proc.c:1333
static void bm_mark(void *ptr)
Definition: proc.c:1324
#define RUBY_TYPED_DEFAULT_FREE
Definition: ruby.h:1141

Definition at line 1338 of file proc.c.

◆ proc_data_type

const rb_data_type_t proc_data_type
static
Initial value:
= {
"proc",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static void proc_mark(void *ptr)
Definition: proc.c:78
#define RUBY_TYPED_WB_PROTECTED
Definition: ruby.h:1146
#define RUBY_TYPED_DEFAULT_FREE
Definition: ruby.h:1141
static size_t proc_memsize(const void *ptr)
Definition: proc.c:91

Definition at line 99 of file proc.c.

◆ proc_without_block

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

Definition at line 689 of file proc.c.

◆ rb_cBinding

VALUE rb_cBinding

Definition at line 38 of file proc.c.

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

◆ rb_cMethod

VALUE rb_cMethod

Definition at line 37 of file proc.c.

Referenced by Init_Proc(), obj_method(), rb_obj_singleton_method(), and umethod_bind().

◆ rb_cProc

VALUE rb_cProc

◆ rb_cUnboundMethod

VALUE rb_cUnboundMethod

◆ ruby_binding_data_type

const rb_data_type_t ruby_binding_data_type
Initial value:
= {
"binding",
{
},
}
static size_t binding_memsize(const void *ptr)
Definition: proc.c:292
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static void binding_free(void *ptr)
Definition: proc.c:266
static void binding_mark(void *ptr)
Definition: proc.c:278

Definition at line 297 of file proc.c.

Referenced by eval_string_with_cref().