Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Functions | Variables
proc.c File Reference
#include "eval_intern.h"
#include "internal.h"
#include "gc.h"
#include "iseq.h"

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)
 
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)
 
VALUE rb_proc_lambda_p (VALUE procval)
 
VALUE rb_binding_alloc (VALUE klass)
 
VALUE rb_binding_new (void)
 
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)
 
VALUE rb_block_proc (void)
 
VALUE rb_block_lambda (void)
 
VALUE rb_proc_call (VALUE self, VALUE args)
 
VALUE rb_proc_call_with_block (VALUE self, int argc, const VALUE *argv, VALUE passed_procval)
 
int rb_proc_arity (VALUE self)
 
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)
 
VALUE rb_proc_location (VALUE self)
 
st_index_t rb_hash_proc (st_index_t hash, VALUE prc)
 
VALUE rb_sym_to_proc (VALUE sym)
 
VALUE rb_block_to_s (VALUE self, const struct rb_block *block, const char *additional_info)
 
VALUE rb_obj_is_method (VALUE m)
 
void rb_method_name_error (VALUE klass, VALUE str)
 
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)
 
VALUE rb_method_call (int argc, const VALUE *argv, VALUE method)
 
VALUE rb_method_call_with_block (int argc, const VALUE *argv, VALUE method, VALUE passed_procval)
 
int rb_method_entry_arity (const rb_method_entry_t *me)
 
int rb_mod_method_arity (VALUE mod, ID id)
 
int rb_obj_method_arity (VALUE obj, ID id)
 
const rb_iseq_trb_method_iseq (VALUE method)
 
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)
 
VALUE rb_proc_new (VALUE(*func)(ANYARGS), VALUE val)
 
rb_cref_trb_vm_cref_new_toplevel (void)
 
void Init_Proc (void)
 
void Init_Binding (void)
 

Variables

VALUE rb_cUnboundMethod
 
VALUE rb_cMethod
 
VALUE rb_cBinding
 
VALUE rb_cProc
 
const rb_data_type_t ruby_binding_data_type
 

Macro Definition Documentation

◆ attached

#define attached   id__attached__

Definition at line 46 of file proc.c.

Referenced by rb_method_name_error().

◆ check_argc

#define check_argc (   argc)    (argc)

Definition at line 868 of file proc.c.

Referenced by rb_proc_call().

◆ IS_METHOD_PROC_IFUNC

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

Definition at line 50 of file proc.c.

◆ MSG

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

Referenced by rb_method_name_error().

◆ NO_CLOBBERED

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

Definition at line 22 of file proc.c.

◆ PROC_NEW_REQUIRES_BLOCK

#define PROC_NEW_REQUIRES_BLOCK   0

Definition at line 19 of file proc.c.

Function Documentation

◆ Init_Binding()

void Init_Binding ( void  )

◆ Init_Proc()

void Init_Proc ( void  )

◆ rb_binding_alloc()

VALUE rb_binding_alloc ( VALUE  klass)

Definition at line 300 of file proc.c.

References TypedData_Make_Struct.

◆ rb_binding_new()

VALUE rb_binding_new ( void  )

◆ rb_block_arity()

int rb_block_arity ( void  )

Definition at line 1036 of file proc.c.

◆ rb_block_lambda()

VALUE rb_block_lambda ( void  )

Definition at line 794 of file proc.c.

◆ rb_block_min_max_arity()

int rb_block_min_max_arity ( int *  max)

◆ rb_block_proc()

VALUE rb_block_proc ( void  )

Definition at line 780 of file proc.c.

Referenced by rb_f_trace_var(), and rb_method_call().

◆ rb_block_to_s()

VALUE rb_block_to_s ( VALUE  self,
const struct rb_block block,
const char *  additional_info 
)

Definition at line 1248 of file proc.c.

References PRIsVALUE, rb_obj_class(), and rb_sprintf().

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

References rb_vm_ifunc_new().

◆ rb_func_proc_new()

VALUE rb_func_proc_new ( rb_block_call_func_t  func,
VALUE  val 
)

Definition at line 669 of file proc.c.

◆ rb_hash_proc()

st_index_t rb_hash_proc ( st_index_t  hash,
VALUE  prc 
)

Definition at line 1188 of file proc.c.

◆ rb_method_call()

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

Definition at line 2075 of file proc.c.

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

◆ rb_method_call_with_block()

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

◆ rb_method_entry_arity()

int rb_method_entry_arity ( const rb_method_entry_t me)

Definition at line 2334 of file proc.c.

◆ rb_method_entry_location()

VALUE rb_method_entry_location ( const rb_method_entry_t me)

Definition at line 2494 of file proc.c.

References Qnil.

◆ rb_method_iseq()

const rb_iseq_t* rb_method_iseq ( VALUE  method)

Definition at line 2460 of file proc.c.

◆ rb_method_location()

VALUE rb_method_location ( VALUE  method)

Definition at line 2522 of file proc.c.

◆ rb_method_name_error()

void rb_method_name_error ( VALUE  klass,
VALUE  str 
)

◆ rb_mod_method_arity()

int rb_mod_method_arity ( VALUE  mod,
ID  id 
)

Definition at line 2413 of file proc.c.

Referenced by rb_obj_method_arity().

◆ rb_mod_method_location()

VALUE rb_mod_method_location ( VALUE  mod,
ID  id 
)

Definition at line 2501 of file proc.c.

Referenced by rb_obj_method_location().

◆ rb_obj_is_method()

VALUE rb_obj_is_method ( VALUE  m)

Definition at line 1338 of file proc.c.

References Qfalse, Qtrue, and rb_typeddata_is_kind_of().

◆ rb_obj_is_proc()

VALUE rb_obj_is_proc ( VALUE  proc)

Definition at line 116 of file proc.c.

References METHOD::klass, Qfalse, Qtrue, rb_proc_create(), and rb_typeddata_is_kind_of().

◆ rb_obj_method()

VALUE rb_obj_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1716 of file proc.c.

◆ rb_obj_method_arity()

int rb_obj_method_arity ( VALUE  obj,
ID  id 
)

Definition at line 2421 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 2508 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 1729 of file proc.c.

◆ rb_obj_singleton_method()

VALUE rb_obj_singleton_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1759 of file proc.c.

References METHOD::klass, METHOD::me, NIL_P, rb_check_id(), and rb_singleton_class_get().

◆ rb_proc_alloc()

VALUE rb_proc_alloc ( VALUE  klass)

Definition at line 109 of file proc.c.

References TypedData_Make_Struct.

Referenced by rb_proc_create(), and rb_proc_create_from_captured().

◆ rb_proc_arity()

int rb_proc_arity ( VALUE  self)

Definition at line 1004 of file proc.c.

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

Definition at line 892 of file proc.c.

References GET_THREAD, GetProcPtr, and rb_vm_invoke_proc().

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

Definition at line 851 of file vm.c.

References GET_THREAD, rb_proc_alloc(), RTYPEDDATA_DATA, and VM_ASSERT.

Referenced by rb_obj_is_proc().

◆ rb_proc_get_iseq()

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

Definition at line 1086 of file proc.c.

References rb_proc_t::block, GetProcPtr, rb_proc_t::is_lambda, and rb_block::proc.

◆ rb_proc_lambda_p()

VALUE rb_proc_lambda_p ( VALUE  procval)

Definition at line 254 of file proc.c.

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

◆ rb_proc_location()

VALUE rb_proc_location ( VALUE  self)

Definition at line 1142 of file proc.c.

◆ rb_proc_new()

VALUE rb_proc_new ( VALUE(*)(ANYARGS func,
VALUE  val 
)

Definition at line 2649 of file proc.c.

References rb_iterate().

◆ rb_sym_to_proc()

VALUE rb_sym_to_proc ( VALUE  sym)

Definition at line 1198 of file proc.c.

References id, Qfalse, Qnil, RARRAY_PTR, rb_ary_store(), rb_ary_tmp_new(), rb_gc_register_mark_object(), and SYM2ID.

Referenced by rb_sym_proc_call().

◆ 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 254 of file vm.c.

◆ rb_vm_ifunc_new()

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

Definition at line 640 of file proc.c.

References CHAR_BIT, IFUNC_NEW, rb_eRangeError, rb_raise(), SIZEOF_VALUE, and UNLIMITED_ARGUMENTS.

Referenced by rb_func_lambda_new(), and rb_lambda_call().

Variable Documentation

◆ rb_cBinding

VALUE rb_cBinding

Definition at line 39 of file proc.c.

Referenced by Init_Binding().

◆ rb_cMethod

VALUE rb_cMethod

Definition at line 38 of file proc.c.

◆ rb_cProc

VALUE rb_cProc

Definition at line 40 of file proc.c.

Referenced by Init_Proc().

◆ rb_cUnboundMethod

VALUE rb_cUnboundMethod

Definition at line 37 of file proc.c.

◆ ruby_binding_data_type

const rb_data_type_t ruby_binding_data_type
Initial value:
= {
"binding",
{
binding_mark,
binding_free,
binding_memsize,
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1138
#define RUBY_TYPED_WB_PROTECTED
Definition: ruby.h:1139

Definition at line 289 of file proc.c.