Ruby  2.4.2p198(2017-09-14revision59899)
Data Structures | Macros | Enumerations | Functions
vm_args.c File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  args_info
 
struct  fill_values_arg
 

Macros

#define IS_ARGS_SPLAT(ci)   ((ci)->flag & VM_CALL_ARGS_SPLAT)
 
#define IS_ARGS_KEYWORD(ci)   ((ci)->flag & VM_CALL_KWARG)
 
#define CALLER_SETUP_ARG(cfp, calling, ci)
 

Enumerations

enum  arg_setup_type { arg_setup_method, arg_setup_block, arg_setup_lambda }
 

Functions

 NORETURN (static void raise_argument_error(rb_thread_t *th, const rb_iseq_t *iseq, const VALUE exc))
 
 NORETURN (static void argument_arity_error(rb_thread_t *th, const rb_iseq_t *iseq, const int miss_argc, const int min_argc, const int max_argc))
 
 NORETURN (static void argument_kw_error(rb_thread_t *th, const rb_iseq_t *iseq, const char *error, const VALUE keys))
 
VALUE rb_keyword_error_new (const char *error, VALUE keys)
 
static VALUE method_missing (VALUE obj, ID id, int argc, const VALUE *argv, enum method_missing_reason call_status)
 
static int args_argc (struct args_info *args)
 
static void args_extend (struct args_info *args, const int min_argc)
 
static void args_reduce (struct args_info *args, int over_argc)
 
static int args_check_block_arg0 (struct args_info *args, rb_thread_t *th)
 
static void args_copy (struct args_info *args)
 
static const VALUEargs_rest_argv (struct args_info *args)
 
static VALUE args_rest_array (struct args_info *args)
 
static int keyword_hash_p (VALUE *kw_hash_ptr, VALUE *rest_hash_ptr, rb_thread_t *th)
 
static VALUE args_pop_keyword_hash (struct args_info *args, VALUE *kw_hash_ptr, rb_thread_t *th)
 
static int args_kw_argv_to_hash (struct args_info *args)
 
static void args_stored_kw_argv_to_hash (struct args_info *args)
 
static void args_setup_lead_parameters (struct args_info *args, int argc, VALUE *locals)
 
static void args_setup_post_parameters (struct args_info *args, int argc, VALUE *locals)
 
static int args_setup_opt_parameters (struct args_info *args, int opt_max, VALUE *locals)
 
static void args_setup_rest_parameter (struct args_info *args, VALUE *locals)
 
static VALUE make_unknown_kw_hash (const VALUE *passed_keywords, int passed_keyword_len, const VALUE *kw_argv)
 
static VALUE make_rest_kw_hash (const VALUE *passed_keywords, int passed_keyword_len, const VALUE *kw_argv)
 
static int args_setup_kw_parameters_lookup (const ID key, VALUE *ptr, const VALUE *const passed_keywords, VALUE *passed_values, const int passed_keyword_len)
 
static void args_setup_kw_parameters (VALUE *const passed_values, const int passed_keyword_len, const VALUE *const passed_keywords, const rb_iseq_t *const iseq, VALUE *const locals)
 
static void args_setup_kw_rest_parameter (VALUE keyword_hash, VALUE *locals)
 
static void args_setup_block_parameter (rb_thread_t *th, struct rb_calling_info *calling, VALUE *locals)
 
static int fill_keys_values (st_data_t key, st_data_t val, st_data_t ptr)
 
static int setup_parameters_complex (rb_thread_t *const th, const rb_iseq_t *const iseq, struct rb_calling_info *const calling, const struct rb_call_info *ci, VALUE *const locals, const enum arg_setup_type arg_setup_type)
 
static void raise_argument_error (rb_thread_t *th, const rb_iseq_t *iseq, const VALUE exc)
 
static void argument_arity_error (rb_thread_t *th, const rb_iseq_t *iseq, const int miss_argc, const int min_argc, const int max_argc)
 
static void argument_kw_error (rb_thread_t *th, const rb_iseq_t *iseq, const char *error, const VALUE keys)
 
static void vm_caller_setup_arg_splat (rb_control_frame_t *cfp, struct rb_calling_info *calling)
 
static void vm_caller_setup_arg_kw (rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci)
 
static VALUE vm_to_proc (VALUE proc)
 
static VALUE refine_sym_proc_call (RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
 
static void vm_caller_setup_arg_block (const rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, rb_iseq_t *blockiseq, const int is_super)
 

Macro Definition Documentation

◆ CALLER_SETUP_ARG

#define CALLER_SETUP_ARG (   cfp,
  calling,
  ci 
)
Value:
do { \
if (UNLIKELY(IS_ARGS_SPLAT(ci))) vm_caller_setup_arg_splat((cfp), (calling)); \
if (UNLIKELY(IS_ARGS_KEYWORD(ci))) vm_caller_setup_arg_kw((cfp), (calling), (ci)); \
} while (0)
static void vm_caller_setup_arg_splat(rb_control_frame_t *cfp, struct rb_calling_info *calling)
Definition: vm_args.c:734
#define IS_ARGS_KEYWORD(ci)
Definition: vm_args.c:863
#define IS_ARGS_SPLAT(ci)
Definition: vm_args.c:862
static void vm_caller_setup_arg_kw(rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci)
Definition: vm_args.c:756
#define UNLIKELY(x)
Definition: ffi_common.h:126

Definition at line 865 of file vm_args.c.

Referenced by vm_call_bmethod(), vm_call_cfunc(), vm_call_cfunc_with_frame(), vm_call_method_each_type(), vm_call_method_missing(), vm_call_opt_call(), vm_call_opt_send(), vm_callee_setup_arg(), vm_callee_setup_block_arg(), vm_invoke_ifunc_block(), and vm_invoke_symbol_block().

◆ IS_ARGS_KEYWORD

#define IS_ARGS_KEYWORD (   ci)    ((ci)->flag & VM_CALL_KWARG)

Definition at line 863 of file vm_args.c.

Referenced by vm_callee_setup_arg().

◆ IS_ARGS_SPLAT

#define IS_ARGS_SPLAT (   ci)    ((ci)->flag & VM_CALL_ARGS_SPLAT)

Definition at line 862 of file vm_args.c.

Referenced by vm_callee_setup_arg().

Enumeration Type Documentation

◆ arg_setup_type

Enumerator
arg_setup_method 
arg_setup_block 
arg_setup_lambda 

Definition at line 30 of file vm_args.c.

Function Documentation

◆ args_argc()

static int args_argc ( struct args_info args)
inlinestatic

Definition at line 37 of file vm_args.c.

References args_info::argc, Qfalse, RARRAY_LENINT, args_info::rest, and args_info::rest_index.

Referenced by setup_parameters_complex().

◆ args_check_block_arg0()

static int args_check_block_arg0 ( struct args_info args,
rb_thread_t th 
)
inlinestatic

◆ args_copy()

static void args_copy ( struct args_info args)
inlinestatic

◆ args_extend()

static void args_extend ( struct args_info args,
const int  min_argc 
)
inlinestatic

◆ args_kw_argv_to_hash()

static int args_kw_argv_to_hash ( struct args_info args)
static

◆ args_pop_keyword_hash()

static VALUE args_pop_keyword_hash ( struct args_info args,
VALUE kw_hash_ptr,
rb_thread_t th 
)
static

◆ args_reduce()

static void args_reduce ( struct args_info args,
int  over_argc 
)
inlinestatic

◆ args_rest_argv()

static const VALUE* args_rest_argv ( struct args_info args)
inlinestatic

Definition at line 155 of file vm_args.c.

References RARRAY_CONST_PTR, args_info::rest, and args_info::rest_index.

Referenced by args_setup_lead_parameters().

◆ args_rest_array()

static VALUE args_rest_array ( struct args_info args)
inlinestatic

◆ args_setup_block_parameter()

static void args_setup_block_parameter ( rb_thread_t th,
struct rb_calling_info calling,
VALUE locals 
)
inlinestatic

◆ args_setup_kw_parameters()

static void args_setup_kw_parameters ( VALUE *const  passed_values,
const int  passed_keyword_len,
const VALUE *const  passed_keywords,
const rb_iseq_t *const  iseq,
VALUE *const  locals 
)
static

◆ args_setup_kw_parameters_lookup()

static int args_setup_kw_parameters_lookup ( const ID  key,
VALUE ptr,
const VALUE *const  passed_keywords,
VALUE passed_values,
const int  passed_keyword_len 
)
inlinestatic

Definition at line 380 of file vm_args.c.

References FALSE, ID2SYM, Qundef, and TRUE.

Referenced by args_setup_kw_parameters().

◆ args_setup_kw_rest_parameter()

static void args_setup_kw_rest_parameter ( VALUE  keyword_hash,
VALUE locals 
)
inlinestatic

Definition at line 472 of file vm_args.c.

References NIL_P, rb_hash_dup(), and rb_hash_new().

Referenced by setup_parameters_complex().

◆ args_setup_lead_parameters()

static void args_setup_lead_parameters ( struct args_info args,
int  argc,
VALUE locals 
)
inlinestatic

Definition at line 282 of file vm_args.c.

References args_info::argc, args_rest_argv(), args_info::argv, and args_info::rest_index.

Referenced by setup_parameters_complex().

◆ args_setup_opt_parameters()

static int args_setup_opt_parameters ( struct args_info args,
int  opt_max,
VALUE locals 
)
inlinestatic

◆ args_setup_post_parameters()

static void args_setup_post_parameters ( struct args_info args,
int  argc,
VALUE locals 
)
inlinestatic

Definition at line 302 of file vm_args.c.

References args_copy(), len, MEMCPY, RARRAY_CONST_PTR, RARRAY_LEN, rb_ary_resize(), and args_info::rest.

Referenced by setup_parameters_complex().

◆ args_setup_rest_parameter()

static void args_setup_rest_parameter ( struct args_info args,
VALUE locals 
)
inlinestatic

Definition at line 345 of file vm_args.c.

References args_copy(), and args_rest_array().

Referenced by setup_parameters_complex().

◆ args_stored_kw_argv_to_hash()

static void args_stored_kw_argv_to_hash ( struct args_info args)
static

◆ argument_arity_error()

static void argument_arity_error ( rb_thread_t th,
const rb_iseq_t iseq,
const int  miss_argc,
const int  min_argc,
const int  max_argc 
)
static

◆ argument_kw_error()

static void argument_kw_error ( rb_thread_t th,
const rb_iseq_t iseq,
const char *  error,
const VALUE  keys 
)
static

Definition at line 728 of file vm_args.c.

References raise_argument_error(), and rb_keyword_error_new().

Referenced by args_setup_kw_parameters().

◆ fill_keys_values()

static int fill_keys_values ( st_data_t  key,
st_data_t  val,
st_data_t  ptr 
)
static

◆ keyword_hash_p()

static int keyword_hash_p ( VALUE kw_hash_ptr,
VALUE rest_hash_ptr,
rb_thread_t th 
)
static

Definition at line 176 of file vm_args.c.

References FALSE, hash(), NIL_P, Qnil, rb_check_hash_type(), rb_extract_keywords(), and TRUE.

Referenced by args_pop_keyword_hash().

◆ make_rest_kw_hash()

static VALUE make_rest_kw_hash ( const VALUE passed_keywords,
int  passed_keyword_len,
const VALUE kw_argv 
)
static

Definition at line 366 of file vm_args.c.

References Qundef, rb_hash_aset(), and rb_hash_new().

Referenced by args_setup_kw_parameters().

◆ make_unknown_kw_hash()

static VALUE make_unknown_kw_hash ( const VALUE passed_keywords,
int  passed_keyword_len,
const VALUE kw_argv 
)
static

Definition at line 352 of file vm_args.c.

References Qundef, rb_ary_push(), and rb_ary_tmp_new().

Referenced by args_setup_kw_parameters().

◆ method_missing()

static VALUE method_missing ( VALUE  obj,
ID  id,
int  argc,
const VALUE argv,
enum method_missing_reason  call_status 
)
static

Referenced by refine_sym_proc_call().

◆ NORETURN() [1/3]

NORETURN ( static void   raise_argument_errorrb_thread_t *th, const rb_iseq_t *iseq, const VALUE exc)

◆ NORETURN() [2/3]

NORETURN ( static void   argument_arity_errorrb_thread_t *th, const rb_iseq_t *iseq, const int miss_argc, const int min_argc, const int max_argc)

◆ NORETURN() [3/3]

NORETURN ( static void   argument_kw_errorrb_thread_t *th, const rb_iseq_t *iseq, const char *error, const VALUE keys)

◆ raise_argument_error()

static void raise_argument_error ( rb_thread_t th,
const rb_iseq_t iseq,
const VALUE  exc 
)
static

◆ refine_sym_proc_call()

static VALUE refine_sym_proc_call ( RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)  )
static

◆ setup_parameters_complex()

static int setup_parameters_complex ( rb_thread_t *const  th,
const rb_iseq_t *const  iseq,
struct rb_calling_info *const  calling,
const struct rb_call_info ci,
VALUE *const  locals,
const enum arg_setup_type  arg_setup_type 
)
static

◆ vm_caller_setup_arg_block()

static void vm_caller_setup_arg_block ( const rb_thread_t th,
rb_control_frame_t reg_cfp,
struct rb_calling_info calling,
const struct rb_call_info ci,
rb_iseq_t blockiseq,
const int  is_super 
)
static

◆ vm_caller_setup_arg_kw()

static void vm_caller_setup_arg_kw ( rb_control_frame_t cfp,
struct rb_calling_info calling,
const struct rb_call_info ci 
)
inlinestatic

◆ vm_caller_setup_arg_splat()

static void vm_caller_setup_arg_splat ( rb_control_frame_t cfp,
struct rb_calling_info calling 
)
inlinestatic

◆ vm_to_proc()

static VALUE vm_to_proc ( VALUE  proc)
static