Ruby: vm_args.c Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

vm_args.c
Go to the documentation of this file.
1/**********************************************************************
2
3 vm_args.c - process method call arguments.
4
5 $Author$
6
7 Copyright (C) 2014- Yukihiro Matsumoto
8
9**********************************************************************/
10
11 NORETURN(static void raise_argument_error(rb_execution_context_t *ec, const rb_iseq_t *iseq, const VALUE exc));
12 NORETURN(static void argument_arity_error(rb_execution_context_t *ec, const rb_iseq_t *iseq, const int miss_argc, const int min_argc, const int max_argc));
13 NORETURN(static void argument_kw_error(rb_execution_context_t *ec, const rb_iseq_t *iseq, const char *error, const VALUE keys));
14 VALUE rb_keyword_error_new(const char *error, VALUE keys); /* class.c */
15static VALUE method_missing(rb_execution_context_t *ec, VALUE obj, ID id, int argc, const VALUE *argv,
16 enum method_missing_reason call_status, int kw_splat);
17#if !defined(_MSC_VER) || !defined(MJIT_HEADER)
18 MJIT_FUNC_EXPORTED
19#endif
20const rb_callable_method_entry_t *rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me);
21
22 struct args_info {
23 /* basic args info */
24 VALUE *argv;
25 int argc;
26
27 /* additional args info */
28 int rest_index;
29 int rest_dupped;
30 const struct rb_callinfo_kwarg *kw_arg;
31 VALUE *kw_argv;
32 VALUE rest;
33};
34
35 enum arg_setup_type {
36 arg_setup_method,
37 arg_setup_block
38};
39
40static inline void
41arg_rest_dup(struct args_info *args)
42{
43 if (!args->rest_dupped) {
44 args->rest = rb_ary_dup(args->rest);
45 args->rest_dupped = TRUE;
46 }
47}
48
49static inline int
50args_argc(struct args_info *args)
51{
52 if (args->rest == Qfalse) {
53 return args->argc;
54 }
55 else {
56 return args->argc + RARRAY_LENINT(args->rest) - args->rest_index;
57 }
58}
59
60static inline void
61args_extend(struct args_info *args, const int min_argc)
62{
63 int i;
64
65 if (args->rest) {
66 arg_rest_dup(args);
67 VM_ASSERT(args->rest_index == 0);
68 for (i=args->argc + RARRAY_LENINT(args->rest); i<min_argc; i++) {
69 rb_ary_push(args->rest, Qnil);
70 }
71 }
72 else {
73 for (i=args->argc; i<min_argc; i++) {
74 args->argv[args->argc++] = Qnil;
75 }
76 }
77}
78
79static inline void
80args_reduce(struct args_info *args, int over_argc)
81{
82 if (args->rest) {
83 const long len = RARRAY_LEN(args->rest);
84
85 if (len > over_argc) {
86 arg_rest_dup(args);
87 rb_ary_resize(args->rest, len - over_argc);
88 return;
89 }
90 else {
91 args->rest = Qfalse;
92 over_argc -= len;
93 }
94 }
95
96 VM_ASSERT(args->argc >= over_argc);
97 args->argc -= over_argc;
98}
99
100static inline int
101args_check_block_arg0(struct args_info *args)
102{
103 VALUE ary = Qnil;
104
105 if (args->rest && RARRAY_LEN(args->rest) == 1) {
106 VALUE arg0 = RARRAY_AREF(args->rest, 0);
107 ary = rb_check_array_type(arg0);
108 }
109 else if (args->argc == 1) {
110 VALUE arg0 = args->argv[0];
111 ary = rb_check_array_type(arg0);
112 args->argv[0] = arg0; /* see: https://bugs.ruby-lang.org/issues/8484 */
113 }
114
115 if (!NIL_P(ary)) {
116 args->rest = ary;
117 args->rest_index = 0;
118 args->argc = 0;
119 return TRUE;
120 }
121
122 return FALSE;
123}
124
125static inline void
126args_copy(struct args_info *args)
127{
128 if (args->rest != Qfalse) {
129 int argc = args->argc;
130 args->argc = 0;
131 arg_rest_dup(args);
132
133 /*
134 * argv: [m0, m1, m2, m3]
135 * rest: [a0, a1, a2, a3, a4, a5]
136 * ^
137 * rest_index
138 *
139 * #=> first loop
140 *
141 * argv: [m0, m1]
142 * rest: [m2, m3, a2, a3, a4, a5]
143 * ^
144 * rest_index
145 *
146 * #=> 2nd loop
147 *
148 * argv: [] (argc == 0)
149 * rest: [m0, m1, m2, m3, a2, a3, a4, a5]
150 * ^
151 * rest_index
152 */
153 while (args->rest_index > 0 && argc > 0) {
154 RARRAY_ASET(args->rest, --args->rest_index, args->argv[--argc]);
155 }
156 while (argc > 0) {
157 rb_ary_unshift(args->rest, args->argv[--argc]);
158 }
159 }
160 else if (args->argc > 0) {
161 args->rest = rb_ary_new_from_values(args->argc, args->argv);
162 args->rest_index = 0;
163 args->rest_dupped = TRUE;
164 args->argc = 0;
165 }
166}
167
168static inline const VALUE *
169args_rest_argv(struct args_info *args)
170{
171 return RARRAY_CONST_PTR_TRANSIENT(args->rest) + args->rest_index;
172}
173
174static inline VALUE
175args_rest_array(struct args_info *args)
176{
177 VALUE ary;
178
179 if (args->rest) {
180 ary = rb_ary_behead(args->rest, args->rest_index);
181 args->rest_index = 0;
182 args->rest = 0;
183 }
184 else {
185 ary = rb_ary_new();
186 }
187 return ary;
188}
189
190static int
191args_kw_argv_to_hash(struct args_info *args)
192{
193 const struct rb_callinfo_kwarg *kw_arg = args->kw_arg;
194 const VALUE *const passed_keywords = kw_arg->keywords;
195 const int kw_len = kw_arg->keyword_len;
196 VALUE h = rb_hash_new_with_size(kw_len);
197 const int kw_start = args->argc - kw_len;
198 const VALUE * const kw_argv = args->argv + kw_start;
199 int i;
200
201 args->argc = kw_start + 1;
202 for (i=0; i<kw_len; i++) {
203 rb_hash_aset(h, passed_keywords[i], kw_argv[i]);
204 }
205
206 args->argv[args->argc - 1] = h;
207
208 return args->argc;
209}
210
211static inline void
212args_setup_lead_parameters(struct args_info *args, int argc, VALUE *locals)
213{
214 if (args->argc >= argc) {
215 /* do noting */
216 args->argc -= argc;
217 args->argv += argc;
218 }
219 else {
220 int i, j;
221 const VALUE *argv = args_rest_argv(args);
222
223 for (i=args->argc, j=0; i<argc; i++, j++) {
224 locals[i] = argv[j];
225 }
226 args->rest_index += argc - args->argc;
227 args->argc = 0;
228 }
229}
230
231static inline void
232args_setup_post_parameters(struct args_info *args, int argc, VALUE *locals)
233{
234 long len;
235 len = RARRAY_LEN(args->rest);
236 MEMCPY(locals, RARRAY_CONST_PTR_TRANSIENT(args->rest) + len - argc, VALUE, argc);
237 rb_ary_resize(args->rest, len - argc);
238}
239
240static inline int
241args_setup_opt_parameters(struct args_info *args, int opt_max, VALUE *locals)
242{
243 int i;
244
245 if (args->argc >= opt_max) {
246 args->argc -= opt_max;
247 args->argv += opt_max;
248 i = opt_max;
249 }
250 else {
251 int j;
252 i = args->argc;
253 args->argc = 0;
254
255 if (args->rest) {
256 int len = RARRAY_LENINT(args->rest);
257 const VALUE *argv = RARRAY_CONST_PTR_TRANSIENT(args->rest);
258
259 for (; i<opt_max && args->rest_index < len; i++, args->rest_index++) {
260 locals[i] = argv[args->rest_index];
261 }
262 }
263
264 /* initialize by nil */
265 for (j=i; j<opt_max; j++) {
266 locals[j] = Qnil;
267 }
268 }
269
270 return i;
271}
272
273static inline void
274args_setup_rest_parameter(struct args_info *args, VALUE *locals)
275{
276 *locals = args_rest_array(args);
277}
278
279static VALUE
280make_unknown_kw_hash(const VALUE *passed_keywords, int passed_keyword_len, const VALUE *kw_argv)
281{
282 int i;
283 VALUE obj = rb_ary_tmp_new(1);
284
285 for (i=0; i<passed_keyword_len; i++) {
286 if (kw_argv[i] != Qundef) {
287 rb_ary_push(obj, passed_keywords[i]);
288 }
289 }
290 return obj;
291}
292
293static VALUE
294make_rest_kw_hash(const VALUE *passed_keywords, int passed_keyword_len, const VALUE *kw_argv)
295{
296 int i;
297 VALUE obj = rb_hash_new_with_size(passed_keyword_len);
298
299 for (i=0; i<passed_keyword_len; i++) {
300 if (kw_argv[i] != Qundef) {
301 rb_hash_aset(obj, passed_keywords[i], kw_argv[i]);
302 }
303 }
304 return obj;
305}
306
307static inline int
308args_setup_kw_parameters_lookup(const ID key, VALUE *ptr, const VALUE *const passed_keywords, VALUE *passed_values, const int passed_keyword_len)
309{
310 int i;
311 const VALUE keyname = ID2SYM(key);
312
313 for (i=0; i<passed_keyword_len; i++) {
314 if (keyname == passed_keywords[i]) {
315 *ptr = passed_values[i];
316 passed_values[i] = Qundef;
317 return TRUE;
318 }
319 }
320
321 return FALSE;
322}
323
324#define KW_SPECIFIED_BITS_MAX (32-1) /* TODO: 32 -> Fixnum's max bits */
325
326static void
327args_setup_kw_parameters(rb_execution_context_t *const ec, const rb_iseq_t *const iseq,
328 VALUE *const passed_values, const int passed_keyword_len, const VALUE *const passed_keywords,
329 VALUE *const locals)
330{
331 const ID *acceptable_keywords = iseq->body->param.keyword->table;
332 const int req_key_num = iseq->body->param.keyword->required_num;
333 const int key_num = iseq->body->param.keyword->num;
334 const VALUE * const default_values = iseq->body->param.keyword->default_values;
335 VALUE missing = 0;
336 int i, di, found = 0;
337 int unspecified_bits = 0;
338 VALUE unspecified_bits_value = Qnil;
339
340 for (i=0; i<req_key_num; i++) {
341 ID key = acceptable_keywords[i];
342 if (args_setup_kw_parameters_lookup(key, &locals[i], passed_keywords, passed_values, passed_keyword_len)) {
343 found++;
344 }
345 else {
346 if (!missing) missing = rb_ary_tmp_new(1);
347 rb_ary_push(missing, ID2SYM(key));
348 }
349 }
350
351 if (missing) argument_kw_error(ec, iseq, "missing", missing);
352
353 for (di=0; i<key_num; i++, di++) {
354 if (args_setup_kw_parameters_lookup(acceptable_keywords[i], &locals[i], passed_keywords, passed_values, passed_keyword_len)) {
355 found++;
356 }
357 else {
358 if (default_values[di] == Qundef) {
359 locals[i] = Qnil;
360
361 if (LIKELY(i < KW_SPECIFIED_BITS_MAX)) {
362 unspecified_bits |= 0x01 << di;
363 }
364 else {
365 if (NIL_P(unspecified_bits_value)) {
366 /* fixnum -> hash */
367 int j;
368 unspecified_bits_value = rb_hash_new();
369
370 for (j=0; j<KW_SPECIFIED_BITS_MAX; j++) {
371 if (unspecified_bits & (0x01 << j)) {
372 rb_hash_aset(unspecified_bits_value, INT2FIX(j), Qtrue);
373 }
374 }
375 }
376 rb_hash_aset(unspecified_bits_value, INT2FIX(di), Qtrue);
377 }
378 }
379 else {
380 locals[i] = default_values[di];
381 }
382 }
383 }
384
385 if (iseq->body->param.flags.has_kwrest) {
386 const int rest_hash_index = key_num + 1;
387 locals[rest_hash_index] = make_rest_kw_hash(passed_keywords, passed_keyword_len, passed_values);
388 }
389 else {
390 if (found != passed_keyword_len) {
391 VALUE keys = make_unknown_kw_hash(passed_keywords, passed_keyword_len, passed_values);
392 argument_kw_error(ec, iseq, "unknown", keys);
393 }
394 }
395
396 if (NIL_P(unspecified_bits_value)) {
397 unspecified_bits_value = INT2FIX(unspecified_bits);
398 }
399 locals[key_num] = unspecified_bits_value;
400}
401
402static inline void
403args_setup_kw_rest_parameter(VALUE keyword_hash, VALUE *locals, int kw_flag)
404{
405 if (NIL_P(keyword_hash)) {
406 keyword_hash = rb_hash_new();
407 }
408 else if (!(kw_flag & VM_CALL_KW_SPLAT_MUT)) {
409 keyword_hash = rb_hash_dup(keyword_hash);
410 }
411 locals[0] = keyword_hash;
412}
413
414static inline void
415args_setup_block_parameter(const rb_execution_context_t *ec, struct rb_calling_info *calling, VALUE *locals)
416{
417 VALUE block_handler = calling->block_handler;
418 *locals = rb_vm_bh_to_procval(ec, block_handler);
419}
420
421 struct fill_values_arg {
422 VALUE *keys;
423 VALUE *vals;
424 int argc;
425};
426
427static int
428fill_keys_values(st_data_t key, st_data_t val, st_data_t ptr)
429{
430 struct fill_values_arg *arg = (struct fill_values_arg *)ptr;
431 int i = arg->argc++;
432 arg->keys[i] = (VALUE)key;
433 arg->vals[i] = (VALUE)val;
434 return ST_CONTINUE;
435}
436
437static inline int
438ignore_keyword_hash_p(VALUE keyword_hash, const rb_iseq_t * const iseq, unsigned int * kw_flag, VALUE * converted_keyword_hash)
439{
440 if (!RB_TYPE_P(keyword_hash, T_HASH)) {
441 keyword_hash = rb_to_hash_type(keyword_hash);
442 }
443 if (!(*kw_flag & VM_CALL_KW_SPLAT_MUT) &&
444 (iseq->body->param.flags.has_kwrest ||
445 iseq->body->param.flags.ruby2_keywords)) {
446 *kw_flag |= VM_CALL_KW_SPLAT_MUT;
447 keyword_hash = rb_hash_dup(keyword_hash);
448 }
449 *converted_keyword_hash = keyword_hash;
450 return !(iseq->body->param.flags.has_kw) &&
451 !(iseq->body->param.flags.has_kwrest) &&
452 RHASH_EMPTY_P(keyword_hash);
453}
454
455static int
456setup_parameters_complex(rb_execution_context_t * const ec, const rb_iseq_t * const iseq,
457 struct rb_calling_info *const calling,
458 const struct rb_callinfo *ci,
459 VALUE * const locals, const enum arg_setup_type arg_setup_type)
460{
461 const int min_argc = iseq->body->param.lead_num + iseq->body->param.post_num;
462 const int max_argc = (iseq->body->param.flags.has_rest == FALSE) ? min_argc + iseq->body->param.opt_num : UNLIMITED_ARGUMENTS;
463 int given_argc;
464 unsigned int kw_flag = vm_ci_flag(ci) & (VM_CALL_KWARG | VM_CALL_KW_SPLAT | VM_CALL_KW_SPLAT_MUT);
465 int opt_pc = 0, allow_autosplat = !kw_flag;
466 struct args_info args_body, *args;
467 VALUE keyword_hash = Qnil;
468 VALUE * const orig_sp = ec->cfp->sp;
469 unsigned int i;
470 VALUE flag_keyword_hash = 0;
471 VALUE converted_keyword_hash = 0;
472
473 vm_check_canary(ec, orig_sp);
474 /*
475 * Extend SP for GC.
476 *
477 * [pushed values] [uninitialized values]
478 * <- ci->argc -->
479 * <- iseq->body->param.size------------>
480 * ^ locals ^ sp
481 *
482 * =>
483 * [pushed values] [initialized values ]
484 * <- ci->argc -->
485 * <- iseq->body->param.size------------>
486 * ^ locals ^ sp
487 */
488 for (i=calling->argc; i<iseq->body->param.size; i++) {
489 locals[i] = Qnil;
490 }
491 ec->cfp->sp = &locals[i];
492
493 /* setup args */
494 args = &args_body;
495 given_argc = args->argc = calling->argc;
496 args->argv = locals;
497 args->rest_dupped = FALSE;
498
499 if (kw_flag & VM_CALL_KWARG) {
500 args->kw_arg = vm_ci_kwarg(ci);
501
502 if (iseq->body->param.flags.has_kw) {
503 int kw_len = args->kw_arg->keyword_len;
504 /* copy kw_argv */
505 args->kw_argv = ALLOCA_N(VALUE, kw_len);
506 args->argc -= kw_len;
507 given_argc -= kw_len;
508 MEMCPY(args->kw_argv, locals + args->argc, VALUE, kw_len);
509 }
510 else {
511 args->kw_argv = NULL;
512 given_argc = args_kw_argv_to_hash(args);
513 kw_flag |= VM_CALL_KW_SPLAT | VM_CALL_KW_SPLAT_MUT;
514 }
515 }
516 else {
517 args->kw_arg = NULL;
518 args->kw_argv = NULL;
519 }
520
521 if (vm_ci_flag(ci) & VM_CALL_ARGS_SPLAT) {
522 VALUE rest_last = 0;
523 int len;
524 args->rest = locals[--args->argc];
525 args->rest_index = 0;
526 len = RARRAY_LENINT(args->rest);
527 given_argc += len - 1;
528 rest_last = RARRAY_AREF(args->rest, len - 1);
529
530 if (!kw_flag && len > 0) {
531 if (RB_TYPE_P(rest_last, T_HASH) &&
532 (((struct RHash *)rest_last)->basic.flags & RHASH_PASS_AS_KEYWORDS)) {
533 rest_last = rb_hash_dup(rest_last);
534 kw_flag |= VM_CALL_KW_SPLAT | VM_CALL_KW_SPLAT_MUT;
535 }
536 else {
537 rest_last = 0;
538 }
539 }
540
541 if (kw_flag & VM_CALL_KW_SPLAT) {
542 if (ignore_keyword_hash_p(rest_last, iseq, &kw_flag, &converted_keyword_hash)) {
543 arg_rest_dup(args);
544 rb_ary_pop(args->rest);
545 given_argc--;
546 kw_flag &= ~(VM_CALL_KW_SPLAT | VM_CALL_KW_SPLAT_MUT);
547 }
548 else {
549 if (rest_last != converted_keyword_hash) {
550 rest_last = converted_keyword_hash;
551 arg_rest_dup(args);
552 RARRAY_ASET(args->rest, len - 1, rest_last);
553 }
554
555 if (iseq->body->param.flags.ruby2_keywords && rest_last) {
556 flag_keyword_hash = rest_last;
557 }
558 else if (iseq->body->param.flags.has_kw || iseq->body->param.flags.has_kwrest) {
559 arg_rest_dup(args);
560 rb_ary_pop(args->rest);
561 given_argc--;
562 keyword_hash = rest_last;
563 }
564 }
565 }
566 }
567 else {
568 if (kw_flag & VM_CALL_KW_SPLAT) {
569 VALUE last_arg = args->argv[args->argc-1];
570 if (ignore_keyword_hash_p(last_arg, iseq, &kw_flag, &converted_keyword_hash)) {
571 args->argc--;
572 given_argc--;
573 kw_flag &= ~(VM_CALL_KW_SPLAT | VM_CALL_KW_SPLAT_MUT);
574 }
575 else {
576 if (last_arg != converted_keyword_hash) {
577 last_arg = converted_keyword_hash;
578 args->argv[args->argc-1] = last_arg;
579 }
580
581 if (iseq->body->param.flags.ruby2_keywords) {
582 flag_keyword_hash = last_arg;
583 }
584 else if (iseq->body->param.flags.has_kw || iseq->body->param.flags.has_kwrest) {
585 args->argc--;
586 given_argc--;
587 keyword_hash = last_arg;
588 }
589 }
590 }
591 args->rest = Qfalse;
592 }
593
594 if (flag_keyword_hash && RB_TYPE_P(flag_keyword_hash, T_HASH)) {
595 ((struct RHash *)flag_keyword_hash)->basic.flags |= RHASH_PASS_AS_KEYWORDS;
596 }
597
598 if (kw_flag && iseq->body->param.flags.accepts_no_kwarg) {
599 rb_raise(rb_eArgError, "no keywords accepted");
600 }
601
602
603 switch (arg_setup_type) {
604 case arg_setup_method:
605 break; /* do nothing special */
606 case arg_setup_block:
607 if (given_argc == (keyword_hash == Qnil ? 1 : 2) &&
608 allow_autosplat &&
609 (min_argc > 0 || iseq->body->param.opt_num > 1) &&
610 !iseq->body->param.flags.ambiguous_param0 &&
611 args_check_block_arg0(args)) {
612 given_argc = RARRAY_LENINT(args->rest);
613 }
614 break;
615 }
616
617 /* argc check */
618 if (given_argc < min_argc) {
619 if (arg_setup_type == arg_setup_block) {
620 CHECK_VM_STACK_OVERFLOW(ec->cfp, min_argc);
621 given_argc = min_argc;
622 args_extend(args, min_argc);
623 }
624 else {
625 argument_arity_error(ec, iseq, given_argc, min_argc, max_argc);
626 }
627 }
628
629 if (given_argc > max_argc && max_argc != UNLIMITED_ARGUMENTS) {
630 if (arg_setup_type == arg_setup_block) {
631 /* truncate */
632 args_reduce(args, given_argc - max_argc);
633 given_argc = max_argc;
634 }
635 else {
636 argument_arity_error(ec, iseq, given_argc, min_argc, max_argc);
637 }
638 }
639
640 if (iseq->body->param.flags.has_lead) {
641 args_setup_lead_parameters(args, iseq->body->param.lead_num, locals + 0);
642 }
643
644 if (iseq->body->param.flags.has_rest || iseq->body->param.flags.has_post){
645 args_copy(args);
646 }
647
648 if (iseq->body->param.flags.has_post) {
649 args_setup_post_parameters(args, iseq->body->param.post_num, locals + iseq->body->param.post_start);
650 }
651
652 if (iseq->body->param.flags.has_opt) {
653 int opt = args_setup_opt_parameters(args, iseq->body->param.opt_num, locals + iseq->body->param.lead_num);
654 opt_pc = (int)iseq->body->param.opt_table[opt];
655 }
656
657 if (iseq->body->param.flags.has_rest) {
658 args_setup_rest_parameter(args, locals + iseq->body->param.rest_start);
659 }
660
661 if (iseq->body->param.flags.has_kw) {
662 VALUE * const klocals = locals + iseq->body->param.keyword->bits_start - iseq->body->param.keyword->num;
663
664 if (args->kw_argv != NULL) {
665 const struct rb_callinfo_kwarg *kw_arg = args->kw_arg;
666 args_setup_kw_parameters(ec, iseq, args->kw_argv, kw_arg->keyword_len, kw_arg->keywords, klocals);
667 }
668 else if (!NIL_P(keyword_hash)) {
669 int kw_len = rb_long2int(RHASH_SIZE(keyword_hash));
670 struct fill_values_arg arg;
671 /* copy kw_argv */
672 arg.keys = args->kw_argv = ALLOCA_N(VALUE, kw_len * 2);
673 arg.vals = arg.keys + kw_len;
674 arg.argc = 0;
675 rb_hash_foreach(keyword_hash, fill_keys_values, (VALUE)&arg);
676 VM_ASSERT(arg.argc == kw_len);
677 args_setup_kw_parameters(ec, iseq, arg.vals, kw_len, arg.keys, klocals);
678 }
679 else {
680 VM_ASSERT(args_argc(args) == 0);
681 args_setup_kw_parameters(ec, iseq, NULL, 0, NULL, klocals);
682 }
683 }
684 else if (iseq->body->param.flags.has_kwrest) {
685 args_setup_kw_rest_parameter(keyword_hash, locals + iseq->body->param.keyword->rest_start, kw_flag);
686 }
687 else if (!NIL_P(keyword_hash) && RHASH_SIZE(keyword_hash) > 0 && arg_setup_type == arg_setup_method) {
688 argument_kw_error(ec, iseq, "unknown", rb_hash_keys(keyword_hash));
689 }
690
691 if (iseq->body->param.flags.has_block) {
692 if (iseq->body->local_iseq == iseq) {
693 /* Do nothing */
694 }
695 else {
696 args_setup_block_parameter(ec, calling, locals + iseq->body->param.block_start);
697 }
698 }
699
700#if 0
701 {
702 int i;
703 for (i=0; i<iseq->body->param.size; i++) {
704 fprintf(stderr, "local[%d] = %p\n", i, (void *)locals[i]);
705 }
706 }
707#endif
708
709 ec->cfp->sp = orig_sp;
710 return opt_pc;
711}
712
713static void
714raise_argument_error(rb_execution_context_t *ec, const rb_iseq_t *iseq, const VALUE exc)
715{
716 VALUE at;
717
718 if (iseq) {
719 vm_push_frame(ec, iseq, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL, Qnil /* self */,
720 VM_BLOCK_HANDLER_NONE /* specval*/, Qfalse /* me or cref */,
721 iseq->body->iseq_encoded,
722 ec->cfp->sp, 0, 0 /* stack_max */);
723 at = rb_ec_backtrace_object(ec);
724 rb_backtrace_use_iseq_first_lineno_for_last_location(at);
725 rb_vm_pop_frame(ec);
726 }
727 else {
728 at = rb_ec_backtrace_object(ec);
729 }
730
731 rb_ivar_set(exc, idBt_locations, at);
732 rb_exc_set_backtrace(exc, at);
733 rb_exc_raise(exc);
734}
735
736static void
737argument_arity_error(rb_execution_context_t *ec, const rb_iseq_t *iseq, const int miss_argc, const int min_argc, const int max_argc)
738{
739 VALUE exc = rb_arity_error_new(miss_argc, min_argc, max_argc);
740 if (iseq->body->param.flags.has_kw) {
741 const struct rb_iseq_param_keyword *const kw = iseq->body->param.keyword;
742 const ID *keywords = kw->table;
743 int req_key_num = kw->required_num;
744 if (req_key_num > 0) {
745 static const char required[] = "; required keywords";
746 VALUE mesg = rb_attr_get(exc, idMesg);
747 rb_str_resize(mesg, RSTRING_LEN(mesg)-1);
748 rb_str_cat(mesg, required, sizeof(required) - 1 - (req_key_num == 1));
749 rb_str_cat_cstr(mesg, ":");
750 do {
751 rb_str_cat_cstr(mesg, " ");
752 rb_str_append(mesg, rb_id2str(*keywords++));
753 rb_str_cat_cstr(mesg, ",");
754 } while (--req_key_num);
755 RSTRING_PTR(mesg)[RSTRING_LEN(mesg)-1] = ')';
756 }
757 }
758 raise_argument_error(ec, iseq, exc);
759}
760
761static void
762argument_kw_error(rb_execution_context_t *ec, const rb_iseq_t *iseq, const char *error, const VALUE keys)
763{
764 raise_argument_error(ec, iseq, rb_keyword_error_new(error, keys));
765}
766
767static inline void
768vm_caller_setup_arg_splat(rb_control_frame_t *cfp, struct rb_calling_info *calling)
769{
770 int argc = calling->argc;
771 VALUE *argv = cfp->sp - argc;
772 VALUE ary = argv[argc-1];
773
774 vm_check_canary(GET_EC(), cfp->sp);
775 cfp->sp--;
776
777 if (!NIL_P(ary)) {
778 const VALUE *ptr = RARRAY_CONST_PTR_TRANSIENT(ary);
779 long len = RARRAY_LEN(ary), i;
780
781 CHECK_VM_STACK_OVERFLOW(cfp, len);
782
783 for (i = 0; i < len; i++) {
784 *cfp->sp++ = ptr[i];
785 }
786 calling->argc += i - 1;
787 }
788}
789
790static inline void
791vm_caller_setup_arg_kw(rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_callinfo *ci)
792{
793 const VALUE *const passed_keywords = vm_ci_kwarg(ci)->keywords;
794 const int kw_len = vm_ci_kwarg(ci)->keyword_len;
795 const VALUE h = rb_hash_new_with_size(kw_len);
796 VALUE *sp = cfp->sp;
797 int i;
798
799 for (i=0; i<kw_len; i++) {
800 rb_hash_aset(h, passed_keywords[i], (sp - kw_len)[i]);
801 }
802 (sp-kw_len)[0] = h;
803
804 cfp->sp -= kw_len - 1;
805 calling->argc -= kw_len - 1;
806 calling->kw_splat = 1;
807}
808
809static VALUE
810vm_to_proc(VALUE proc)
811{
812 if (UNLIKELY(!rb_obj_is_proc(proc))) {
813 VALUE b;
814 const rb_callable_method_entry_t *me =
815 rb_callable_method_entry_with_refinements(CLASS_OF(proc), idTo_proc, NULL);
816
817 if (me) {
818 b = rb_vm_call0(GET_EC(), proc, idTo_proc, 0, NULL, me, RB_NO_KEYWORDS);
819 }
820 else {
821 /* NOTE: calling method_missing */
822 b = rb_check_convert_type_with_id(proc, T_DATA, "Proc", idTo_proc);
823 }
824
825 if (NIL_P(b) || !rb_obj_is_proc(b)) {
826 rb_raise(rb_eTypeError,
827 "wrong argument type %s (expected Proc)",
828 rb_obj_classname(proc));
829 }
830 return b;
831 }
832 else {
833 return proc;
834 }
835}
836
837static VALUE
838refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
839{
840 VALUE obj;
841 ID mid;
842 const rb_callable_method_entry_t *me = 0; /* for hidden object case */
843 rb_execution_context_t *ec;
844 const VALUE symbol = RARRAY_AREF(callback_arg, 0);
845 const VALUE refinements = RARRAY_AREF(callback_arg, 1);
846 int kw_splat = RB_PASS_CALLED_KEYWORDS;
847 VALUE klass;
848
849 if (argc-- < 1) {
850 rb_raise(rb_eArgError, "no receiver given");
851 }
852 obj = *argv++;
853
854 mid = SYM2ID(symbol);
855 for (klass = CLASS_OF(obj); klass; klass = RCLASS_SUPER(klass)) {
856 me = rb_callable_method_entry(klass, mid);
857 if (me) {
858 me = rb_resolve_refined_method_callable(refinements, me);
859 if (me) break;
860 }
861 }
862
863 ec = GET_EC();
864 if (!NIL_P(blockarg)) {
865 vm_passed_block_handler_set(ec, blockarg);
866 }
867 if (!me) {
868 return method_missing(ec, obj, mid, argc, argv, MISSING_NOENTRY, kw_splat);
869 }
870 return rb_vm_call0(ec, obj, mid, argc, argv, me, kw_splat);
871}
872
873static VALUE
874vm_caller_setup_arg_block(const rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
875 const struct rb_callinfo *ci, const rb_iseq_t *blockiseq, const int is_super)
876{
877 if (vm_ci_flag(ci) & VM_CALL_ARGS_BLOCKARG) {
878 VALUE block_code = *(--reg_cfp->sp);
879
880 if (NIL_P(block_code)) {
881 return VM_BLOCK_HANDLER_NONE;
882 }
883 else if (block_code == rb_block_param_proxy) {
884 VM_ASSERT(!VM_CFP_IN_HEAP_P(GET_EC(), reg_cfp));
885 VALUE handler = VM_CF_BLOCK_HANDLER(reg_cfp);
886 reg_cfp->block_code = (const void *) handler;
887 return handler;
888 }
889 else if (SYMBOL_P(block_code) && rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) {
890 const rb_cref_t *cref = vm_env_cref(reg_cfp->ep);
891 if (cref && !NIL_P(cref->refinements)) {
892 VALUE ref = cref->refinements;
893 VALUE func = rb_hash_lookup(ref, block_code);
894 if (NIL_P(func)) {
895 /* TODO: limit cached funcs */
896 VALUE callback_arg = rb_ary_tmp_new(2);
897 rb_ary_push(callback_arg, block_code);
898 rb_ary_push(callback_arg, ref);
899 OBJ_FREEZE_RAW(callback_arg);
900 func = rb_func_lambda_new(refine_sym_proc_call, callback_arg, 1, UNLIMITED_ARGUMENTS);
901 rb_hash_aset(ref, block_code, func);
902 }
903 block_code = func;
904 }
905 return block_code;
906 }
907 else {
908 return vm_to_proc(block_code);
909 }
910 }
911 else if (blockiseq != NULL) { /* likely */
912 struct rb_captured_block *captured = VM_CFP_TO_CAPTURED_BLOCK(reg_cfp);
913 captured->code.iseq = blockiseq;
914 return VM_BH_FROM_ISEQ_BLOCK(captured);
915 }
916 else {
917 if (is_super) {
918 return GET_BLOCK_HANDLER();
919 }
920 else {
921 return VM_BLOCK_HANDLER_NONE;
922 }
923 }
924}
rb_ary_new_from_values
VALUE rb_ary_new_from_values(long n, const VALUE *elts)
Definition: array.c:788
rb_ary_dup
VALUE rb_ary_dup(VALUE ary)
Definition: array.c:2666
rb_ary_push
VALUE rb_ary_push(VALUE ary, VALUE item)
Definition: array.c:1301
rb_ary_unshift
VALUE rb_ary_unshift(VALUE ary, VALUE item)
Definition: array.c:1654
rb_ary_behead
VALUE rb_ary_behead(VALUE ary, long n)
Definition: array.c:1521
rb_ary_new
VALUE rb_ary_new(void)
Definition: array.c:749
rb_check_array_type
VALUE rb_check_array_type(VALUE ary)
Definition: array.c:988
rb_ary_resize
VALUE rb_ary_resize(VALUE ary, long len)
expands or shrinks ary to len elements.
Definition: array.c:2235
rb_ary_pop
VALUE rb_ary_pop(VALUE ary)
Definition: array.c:1350
rb_ary_tmp_new
VALUE rb_ary_tmp_new(long capa)
Definition: array.c:846
NORETURN
#define NORETURN(x)
Definition: attributes.h:152
ptr
struct RIMemo * ptr
Definition: debug.c:88
MJIT_FUNC_EXPORTED
#define MJIT_FUNC_EXPORTED
Definition: dllexport.h:55
len
uint8_t len
Definition: escape.c:17
rb_ec_backtrace_object
VALUE rb_ec_backtrace_object(const rb_execution_context_t *ec)
Definition: vm_backtrace.c:770
RSTRING_LEN
#define RSTRING_LEN(string)
Definition: fbuffer.h:22
RSTRING_PTR
#define RSTRING_PTR(string)
Definition: fbuffer.h:19
UNLIKELY
#define UNLIKELY(x)
Definition: ffi_common.h:126
LIKELY
#define LIKELY(x)
Definition: ffi_common.h:125
CLASS_OF
#define CLASS_OF
Definition: globals.h:153
rb_cSymbol
VALUE rb_cSymbol
Definition: string.c:81
rb_keyword_error_new
VALUE rb_keyword_error_new(const char *error, VALUE keys)
Definition: class.c:2018
OBJ_FREEZE_RAW
#define OBJ_FREEZE_RAW
Definition: fl_type.h:135
rb_raise
void rb_raise(VALUE exc, const char *fmt,...)
Definition: error.c:2917
rb_exc_set_backtrace
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt)
Definition: error.c:1446
rb_exc_raise
void rb_exc_raise(VALUE mesg)
Raises an exception in the current thread.
Definition: eval.c:712
rb_eTypeError
VALUE rb_eTypeError
Definition: error.c:1057
rb_eArgError
VALUE rb_eArgError
Definition: error.c:1058
rb_check_convert_type_with_id
VALUE rb_check_convert_type_with_id(VALUE, int, const char *, ID)
Definition: object.c:2987
rb_to_hash_type
VALUE rb_to_hash_type(VALUE hash)
Definition: hash.c:1853
rb_hash_foreach
void rb_hash_foreach(VALUE hash, rb_foreach_func *func, VALUE farg)
Definition: hash.c:1498
rb_hash_new_with_size
VALUE rb_hash_new_with_size(st_index_t size)
Definition: hash.c:1544
rb_hash_keys
VALUE rb_hash_keys(VALUE hash)
Definition: hash.c:3549
rb_hash_aset
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
Definition: hash.c:2901
rb_hash_lookup
VALUE rb_hash_lookup(VALUE hash, VALUE key)
Definition: hash.c:2072
rb_hash_dup
VALUE rb_hash_dup(VALUE hash)
Definition: hash.c:1579
rb_hash_new
VALUE rb_hash_new(void)
Definition: hash.c:1538
UNLIMITED_ARGUMENTS
#define UNLIMITED_ARGUMENTS
Definition: error.h:29
rb_obj_is_proc
VALUE rb_obj_is_proc(VALUE)
Definition: proc.c:152
rb_str_resize
VALUE rb_str_resize(VALUE, long)
Definition: string.c:2859
rb_str_cat
VALUE rb_str_cat(VALUE, const char *, long)
Definition: string.c:2962
rb_str_append
VALUE rb_str_append(VALUE, VALUE)
Definition: string.c:3118
rb_str_cat_cstr
#define rb_str_cat_cstr(buf, str)
Definition: string.h:266
rb_attr_get
VALUE rb_attr_get(VALUE, ID)
Definition: variable.c:1242
rb_ivar_set
VALUE rb_ivar_set(VALUE, ID, VALUE)
Definition: variable.c:1493
ID2SYM
#define ID2SYM
Definition: symbol.h:44
SYM2ID
#define SYM2ID
Definition: symbol.h:45
RHASH_PASS_AS_KEYWORDS
@ RHASH_PASS_AS_KEYWORDS
Definition: hash.h:24
rb_func_lambda_new
VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc)
Definition: proc.c:742
rb_backtrace_use_iseq_first_lineno_for_last_location
void rb_backtrace_use_iseq_first_lineno_for_last_location(VALUE self)
Definition: vm_backtrace.c:821
method_missing_reason
method_missing_reason
Definition: vm.h:32
MISSING_NOENTRY
@ MISSING_NOENTRY
Definition: vm.h:33
rb_method_basic_definition_p
#define rb_method_basic_definition_p(...)
Definition: internal.h:78
int
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
RB_BLOCK_CALL_FUNC_ARGLIST
#define RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)
Definition: iterator.h:31
INT2FIX
#define INT2FIX
Definition: long.h:48
rb_long2int
#define rb_long2int
Definition: long.h:62
MEMCPY
#define MEMCPY(p1, p2, type, n)
Definition: memory.h:129
ALLOCA_N
#define ALLOCA_N(type, n)
Definition: memory.h:112
rb_callable_method_entry_with_refinements
const rb_callable_method_entry_t * rb_callable_method_entry_with_refinements(VALUE klass, ID id, VALUE *defined_class)
Definition: vm_method.c:1235
rb_callable_method_entry
const rb_callable_method_entry_t * rb_callable_method_entry(VALUE klass, ID id)
Definition: vm_method.c:1177
TRUE
#define TRUE
Definition: nkf.h:175
FALSE
#define FALSE
Definition: nkf.h:174
key
key
Definition: openssl_missing.h:185
RARRAY_AREF
#define RARRAY_AREF(a, i)
Definition: psych_emitter.c:7
RARRAY_LEN
#define RARRAY_LEN
Definition: rarray.h:52
RARRAY_CONST_PTR_TRANSIENT
#define RARRAY_CONST_PTR_TRANSIENT
Definition: rarray.h:54
RCLASS_SUPER
#define RCLASS_SUPER
Definition: rclass.h:33
NULL
#define NULL
Definition: regenc.h:69
RHASH_SIZE
#define RHASH_SIZE(h)
Definition: rhash.h:50
RHASH_EMPTY_P
#define RHASH_EMPTY_P(h)
Definition: rhash.h:51
rb_obj_classname
const char * rb_obj_classname(VALUE)
Definition: variable.c:308
argc
int argc
Definition: ruby.c:240
argv
char ** argv
Definition: ruby.c:241
RB_PASS_CALLED_KEYWORDS
#define RB_PASS_CALLED_KEYWORDS
Definition: scan_args.h:48
RB_NO_KEYWORDS
#define RB_NO_KEYWORDS
Definition: scan_args.h:46
Qundef
#define Qundef
Definition: special_consts.h:53
Qtrue
#define Qtrue
Definition: special_consts.h:52
Qnil
#define Qnil
Definition: special_consts.h:51
Qfalse
#define Qfalse
Definition: special_consts.h:50
NIL_P
#define NIL_P
Definition: special_consts.h:46
ST_CONTINUE
@ ST_CONTINUE
Definition: st.h:99
st_data_t
unsigned long st_data_t
Definition: st.h:22
RHash
Definition: hash.h:44
args_info
Definition: vm_args.c:22
args_info::argc
int argc
Definition: vm_args.c:25
args_info::kw_argv
VALUE * kw_argv
Definition: vm_args.c:31
args_info::argv
VALUE * argv
Definition: vm_args.c:24
args_info::kw_arg
const struct rb_callinfo_kwarg * kw_arg
Definition: vm_args.c:30
args_info::rest
VALUE rest
Definition: vm_args.c:32
args_info::rest_dupped
int rest_dupped
Definition: vm_args.c:29
args_info::rest_index
int rest_index
Definition: vm_args.c:28
fill_values_arg
Definition: vm_args.c:421
fill_values_arg::keys
VALUE * keys
Definition: vm_args.c:422
fill_values_arg::argc
int argc
Definition: vm_args.c:424
fill_values_arg::vals
VALUE * vals
Definition: vm_args.c:423
rb_callable_method_entry_struct
Definition: method.h:62
rb_callinfo_kwarg
Definition: vm_callinfo.h:45
rb_callinfo_kwarg::keyword_len
int keyword_len
Definition: vm_callinfo.h:46
rb_callinfo_kwarg::keywords
VALUE keywords[]
Definition: vm_callinfo.h:47
rb_callinfo
Definition: vm_callinfo.h:61
rb_calling_info
Definition: vm_core.h:248
rb_calling_info::argc
int argc
Definition: vm_core.h:253
rb_calling_info::kw_splat
int kw_splat
Definition: vm_core.h:254
rb_calling_info::block_handler
VALUE block_handler
Definition: vm_core.h:251
rb_captured_block
Definition: vm_core.h:736
rb_captured_block::iseq
const rb_iseq_t * iseq
Definition: vm_core.h:740
rb_captured_block::code
union rb_captured_block::@198 code
rb_control_frame_struct
Definition: vm_core.h:769
rb_control_frame_struct::sp
VALUE * sp
Definition: vm_core.h:771
rb_control_frame_struct::ep
const VALUE * ep
Definition: vm_core.h:774
rb_control_frame_struct::block_code
const void * block_code
Definition: vm_core.h:775
rb_cref_struct
CREF (Class REFerence)
Definition: method.h:44
rb_cref_struct::refinements
VALUE refinements
Definition: method.h:46
rb_execution_context_struct
Definition: vm_core.h:854
rb_execution_context_struct::cfp
rb_control_frame_t * cfp
Definition: vm_core.h:858
rb_iseq_constant_body::ruby2_keywords
unsigned int ruby2_keywords
Definition: vm_core.h:356
rb_iseq_constant_body::ambiguous_param0
unsigned int ambiguous_param0
Definition: vm_core.h:354
rb_iseq_constant_body::post_start
int post_start
Definition: vm_core.h:364
rb_iseq_constant_body::opt_table
const VALUE * opt_table
Definition: vm_core.h:368
rb_iseq_constant_body::size
unsigned int size
Definition: vm_core.h:359
rb_iseq_constant_body::keyword
const struct rb_iseq_constant_body::@188::rb_iseq_param_keyword * keyword
rb_iseq_constant_body::local_iseq
struct rb_iseq_struct * local_iseq
Definition: vm_core.h:412
rb_iseq_constant_body::block_start
int block_start
Definition: vm_core.h:366
rb_iseq_constant_body::has_block
unsigned int has_block
Definition: vm_core.h:352
rb_iseq_constant_body::has_kwrest
unsigned int has_kwrest
Definition: vm_core.h:351
rb_iseq_constant_body::has_post
unsigned int has_post
Definition: vm_core.h:349
rb_iseq_constant_body::opt_num
int opt_num
Definition: vm_core.h:362
rb_iseq_constant_body::flags
struct rb_iseq_constant_body::@188::@190 flags
rb_iseq_constant_body::lead_num
int lead_num
Definition: vm_core.h:361
rb_iseq_constant_body::iseq_encoded
VALUE * iseq_encoded
Definition: vm_core.h:319
rb_iseq_constant_body::accepts_no_kwarg
unsigned int accepts_no_kwarg
Definition: vm_core.h:355
rb_iseq_constant_body::rest_start
int rest_start
Definition: vm_core.h:363
rb_iseq_constant_body::has_kw
unsigned int has_kw
Definition: vm_core.h:350
rb_iseq_constant_body::post_num
int post_num
Definition: vm_core.h:365
rb_iseq_constant_body::param
struct rb_iseq_constant_body::@188 param
parameter information
rb_iseq_constant_body::has_opt
unsigned int has_opt
Definition: vm_core.h:347
rb_iseq_constant_body::has_lead
unsigned int has_lead
Definition: vm_core.h:346
rb_iseq_constant_body::has_rest
unsigned int has_rest
Definition: vm_core.h:348
rb_iseq_struct
Definition: vm_core.h:444
rb_iseq_struct::body
struct rb_iseq_constant_body * body
Definition: vm_core.h:448
error
void error(const char *msg)
Definition: untgz.c:593
VALUE
unsigned long VALUE
Definition: value.h:38
ID
unsigned long ID
Definition: value.h:39
T_DATA
#define T_DATA
Definition: value_type.h:59
T_HASH
#define T_HASH
Definition: value_type.h:64
SYMBOL_P
#define SYMBOL_P
Definition: value_type.h:87
rb_block_param_proxy
VALUE rb_block_param_proxy
Definition: vm.c:376
rb_resolve_refined_method_callable
const rb_callable_method_entry_t * rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me)
Definition: vm_method.c:1301
KW_SPECIFIED_BITS_MAX
#define KW_SPECIFIED_BITS_MAX
Definition: vm_args.c:324
arg_setup_type
arg_setup_type
Definition: vm_args.c:35
arg_setup_block
@ arg_setup_block
Definition: vm_args.c:37
arg_setup_method
@ arg_setup_method
Definition: vm_args.c:36
rb_id2str
#define rb_id2str(id)
Definition: vm_backtrace.c:30
VM_CALL_KW_SPLAT_MUT
#define VM_CALL_KW_SPLAT_MUT
Definition: vm_callinfo.h:43
VM_CALL_ARGS_BLOCKARG
#define VM_CALL_ARGS_BLOCKARG
Definition: vm_callinfo.h:32
VM_CALL_ARGS_SPLAT
#define VM_CALL_ARGS_SPLAT
Definition: vm_callinfo.h:31
VM_CALL_KWARG
#define VM_CALL_KWARG
Definition: vm_callinfo.h:37
VM_CALL_KW_SPLAT
#define VM_CALL_KW_SPLAT
Definition: vm_callinfo.h:38
rb_vm_pop_frame
void rb_vm_pop_frame(rb_execution_context_t *ec)
Definition: vm_insnhelper.c:419
VM_ASSERT
#define VM_ASSERT(expr)
Definition: vm_core.h:61
CHECK_VM_STACK_OVERFLOW
#define CHECK_VM_STACK_OVERFLOW(cfp, margin)
Definition: vm_core.h:1740
VM_BLOCK_HANDLER_NONE
#define VM_BLOCK_HANDLER_NONE
Definition: vm_core.h:1299
rb_vm_bh_to_procval
VALUE rb_vm_bh_to_procval(const rb_execution_context_t *ec, VALUE block_handler)
Definition: vm_insnhelper.c:474
VM_FRAME_MAGIC_DUMMY
@ VM_FRAME_MAGIC_DUMMY
Definition: vm_core.h:1186
VM_ENV_FLAG_LOCAL
@ VM_ENV_FLAG_LOCAL
Definition: vm_core.h:1200
rb_vm_call0
VALUE rb_vm_call0(rb_execution_context_t *ec, VALUE recv, ID id, int argc, const VALUE *argv, const rb_callable_method_entry_t *cme, int kw_splat)
Definition: vm_eval.c:46
vm_check_canary
#define vm_check_canary(ec, sp)
Definition: vm_insnhelper.c:290
GET_BLOCK_HANDLER
#define GET_BLOCK_HANDLER()
Definition: vm_insnhelper.h:129