Ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5ad0e4688e963d9de019557c78feed9)
Data Structures | Macros | Functions | Variables
proc.c File Reference
#include "eval_intern.h"
#include "internal.h"
#include "gc.h"
#include "vm_core.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 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)
 
VALUE rb_proc_alloc (VALUE klass)
 
VALUE rb_obj_is_proc (VALUE proc)
 
VALUE rb_proc_lambda_p (VALUE procval)
 
VALUE rb_binding_alloc (VALUE klass)
 
VALUE rb_binding_new (void)
 
struct vm_ifuncrb_vm_ifunc_new (rb_block_call_func_t func, const void *data, int min_argc, int max_argc)
 
MJIT_FUNC_EXPORTED 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_kw (VALUE self, VALUE args, int kw_splat)
 
VALUE rb_proc_call (VALUE self, VALUE args)
 
VALUE rb_proc_call_with_block_kw (VALUE self, int argc, const VALUE *argv, VALUE passed_procval, int kw_splat)
 
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)
 
MJIT_FUNC_EXPORTED VALUE rb_iseq_location (const rb_iseq_t *iseq)
 
VALUE rb_proc_location (VALUE self)
 
VALUE rb_unnamed_parameters (int arity)
 
st_index_t rb_hash_proc (st_index_t hash, VALUE prc)
 
MJIT_FUNC_EXPORTED 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_kw (int argc, const VALUE *argv, VALUE method, int kw_splat)
 
VALUE rb_method_call (int argc, const VALUE *argv, VALUE method)
 
VALUE rb_method_call_with_block_kw (int argc, const VALUE *argv, VALUE method, VALUE passed_procval, int kw_splat)
 
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_method_definition_trb_method_def (VALUE method)
 
const rb_iseq_trb_method_iseq (VALUE method)
 
VALUE rb_method_entry_location (const rb_method_entry_t *me)
 
VALUE rb_method_location (VALUE method)
 
VALUE rb_proc_new (rb_block_call_func_t func, VALUE val)
 
VALUE rb_find_defined_class_by_owner (VALUE current_class, VALUE target_owner)
 
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 50 of file proc.c.

◆ check_argc

#define check_argc (   argc)    (argc)

Definition at line 944 of file proc.c.

◆ IS_METHOD_PROC_IFUNC

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

Definition at line 54 of file proc.c.

◆ MSG

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

◆ NO_CLOBBERED

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

Definition at line 23 of file proc.c.

◆ PROC_NEW_REQUIRES_BLOCK

#define PROC_NEW_REQUIRES_BLOCK   0

Definition at line 20 of file proc.c.

◆ UPDATE_REFERENCE

#define UPDATE_REFERENCE (   _ref)    UPDATE_TYPED_REFERENCE(VALUE, _ref)

Definition at line 29 of file proc.c.

◆ UPDATE_TYPED_REFERENCE

#define UPDATE_TYPED_REFERENCE (   _type,
  _ref 
)    *(_type*)&_ref = (_type)rb_gc_location((VALUE)_ref)

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

References klass, obj, ruby_binding_data_type, and TypedData_Make_Struct.

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

◆ rb_block_arity()

int rb_block_arity ( void  )

Definition at line 1144 of file proc.c.

◆ rb_block_lambda()

VALUE rb_block_lambda ( void  )

Definition at line 856 of file proc.c.

◆ rb_block_min_max_arity()

int rb_block_min_max_arity ( int max)

Definition at line 1178 of file proc.c.

◆ rb_block_proc()

VALUE rb_block_proc ( void  )

Definition at line 837 of file proc.c.

Referenced by rb_f_trace_var(), rb_method_call(), and rb_method_call_kw().

◆ rb_block_to_s()

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

Definition at line 1360 of file proc.c.

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

◆ 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 vm_ifunc::func, max_argc, min_argc, and rb_vm_ifunc_new().

◆ rb_func_proc_new()

MJIT_FUNC_EXPORTED VALUE rb_func_proc_new ( rb_block_call_func_t  func,
VALUE  val 
)

Definition at line 728 of file proc.c.

◆ rb_hash_proc()

st_index_t rb_hash_proc ( st_index_t  hash,
VALUE  prc 
)

Definition at line 1302 of file proc.c.

◆ rb_iseq_location()

MJIT_FUNC_EXPORTED VALUE rb_iseq_location ( const rb_iseq_t iseq)

Definition at line 1242 of file proc.c.

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

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

Definition at line 2296 of file proc.c.

References GET_EC, and TypedData_Get_Struct.

Referenced by rb_method_call_kw(), and rb_method_call_with_block().

◆ rb_method_def()

const rb_method_definition_t * rb_method_def ( VALUE  method)

Definition at line 2658 of file proc.c.

References TypedData_Get_Struct.

◆ rb_method_entry_arity()

int rb_method_entry_arity ( const rb_method_entry_t me)

Definition at line 2555 of file proc.c.

◆ rb_method_entry_location()

VALUE rb_method_entry_location ( const rb_method_entry_t me)

Definition at line 2725 of file proc.c.

References me, and Qnil.

◆ rb_method_iseq()

const rb_iseq_t * rb_method_iseq ( VALUE  method)

Definition at line 2691 of file proc.c.

◆ rb_method_location()

VALUE rb_method_location ( VALUE  method)

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

References me.

Referenced by rb_obj_method_arity().

◆ rb_obj_is_method()

VALUE rb_obj_is_method ( VALUE  m)

Definition at line 1459 of file proc.c.

References rb_typeddata_is_kind_of().

◆ rb_obj_is_proc()

VALUE rb_obj_is_proc ( VALUE  proc)

Definition at line 152 of file proc.c.

References rb_typeddata_is_kind_of().

◆ rb_obj_method()

VALUE rb_obj_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1861 of file proc.c.

◆ rb_obj_method_arity()

int rb_obj_method_arity ( VALUE  obj,
ID  id 
)

Definition at line 2652 of file proc.c.

References CLASS_OF, obj, and rb_mod_method_arity().

◆ rb_obj_public_method()

VALUE rb_obj_public_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1874 of file proc.c.

◆ rb_obj_singleton_method()

VALUE rb_obj_singleton_method ( VALUE  obj,
VALUE  vid 
)

Definition at line 1904 of file proc.c.

References klass, me, NIL_P, obj, rb_check_id(), rb_name_err_raise, rb_singleton_class_get(), and RCLASS_ORIGIN.

◆ rb_proc_alloc()

VALUE rb_proc_alloc ( VALUE  klass)

Definition at line 145 of file proc.c.

References klass, and TypedData_Make_Struct.

◆ rb_proc_arity()

int rb_proc_arity ( VALUE  self)

Definition at line 1112 of file proc.c.

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

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

Definition at line 1000 of file proc.c.

References argc, argv, GET_EC, GetProcPtr, RB_NO_KEYWORDS, and rb_vm_invoke_proc().

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

Definition at line 986 of file proc.c.

References argc, argv, GET_EC, GetProcPtr, rb_adjust_argv_kw_splat(), rb_vm_invoke_proc(), and v.

◆ rb_proc_get_iseq()

const rb_iseq_t * rb_proc_get_iseq ( VALUE  self,
int is_proc 
)

Definition at line 1194 of file proc.c.

References GetProcPtr, and rb_block::proc.

Referenced by rb_resolve_me_location().

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

◆ rb_proc_location()

VALUE rb_proc_location ( VALUE  self)

Definition at line 1256 of file proc.c.

◆ rb_proc_new()

VALUE rb_proc_new ( rb_block_call_func_t  func,
VALUE  val 
)

Definition at line 2991 of file proc.c.

References rb_iterate().

◆ rb_sym_to_proc()

MJIT_FUNC_EXPORTED VALUE rb_sym_to_proc ( VALUE  sym)

◆ rb_unnamed_parameters()

VALUE rb_unnamed_parameters ( int  arity)

Definition at line 1262 of file proc.c.

References CONST_ID, ID2SYM, n, OBJ_FREEZE, rb_ary_new2, rb_ary_new3, rb_ary_push(), and rb_ary_store().

◆ 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 11594 of file rb_mjit_min_header-2.7.7.h.

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

Variable Documentation

◆ ruby_binding_data_type

const rb_data_type_t ruby_binding_data_type
Initial value:
= {
"binding",
{
binding_mark,
binding_free,
binding_memsize,
binding_compact,
},
}
#define RUBY_TYPED_WB_PROTECTED
#define RUBY_TYPED_FREE_IMMEDIATELY

Definition at line 319 of file proc.c.

Referenced by rb_binding_alloc().