2015-10-23 13:53:53 -04:00
|
|
|
|
|
|
|
puts <<EOS
|
2017-11-09 18:02:52 -05:00
|
|
|
/* -*- c -*- */
|
2015-10-23 13:53:53 -04:00
|
|
|
#if 1 /* enable or disable this optimization */
|
|
|
|
|
|
|
|
/* DO NOT EDIT THIS FILE DIRECTLY
|
|
|
|
*
|
2017-07-04 13:27:40 -04:00
|
|
|
* This file is generated by tool/mk_call_iseq_optimized.rb
|
2015-10-23 13:53:53 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
EOS
|
|
|
|
|
|
|
|
P = (0..3)
|
2016-07-28 07:02:30 -04:00
|
|
|
L = (0..5)
|
2015-10-23 13:53:53 -04:00
|
|
|
|
|
|
|
def fname param, local
|
|
|
|
"vm_call_iseq_setup_normal_0start_#{param}params_#{local}locals"
|
|
|
|
end
|
2015-10-23 19:37:44 -04:00
|
|
|
|
2015-10-23 13:53:53 -04:00
|
|
|
P.each{|param|
|
|
|
|
L.each{|local|
|
|
|
|
puts <<EOS
|
|
|
|
static VALUE
|
2019-10-24 05:08:52 -04:00
|
|
|
#{fname(param, local)}(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, struct rb_call_data *cd)
|
2015-10-23 13:53:53 -04:00
|
|
|
{
|
2019-03-22 03:57:26 -04:00
|
|
|
RB_DEBUG_COUNTER_INC(ccf_iseq_fix);
|
2020-01-08 02:14:01 -05:00
|
|
|
return vm_call_iseq_setup_normal(ec, cfp, calling, vm_cc_cme(cd->cc), 0, #{param}, #{local});
|
2015-10-23 13:53:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
EOS
|
|
|
|
#
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
puts <<EOS
|
|
|
|
/* vm_call_iseq_handlers[param][local] */
|
|
|
|
static const vm_call_handler vm_call_iseq_handlers[][#{L.to_a.size}] = {
|
|
|
|
#{P.map{|param| '{' + L.map{|local| fname(param, local)}.join(",\n ") + '}'}.join(",\n")}
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline vm_call_handler
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
vm_call_iseq_setup_func(const struct rb_callinfo *ci, const int param_size, const int local_size)
|
2015-10-23 13:53:53 -04:00
|
|
|
{
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
if (UNLIKELY(vm_ci_flag(ci) & VM_CALL_TAILCALL)) {
|
2016-03-25 21:34:35 -04:00
|
|
|
return &vm_call_iseq_setup_tailcall_0start;
|
2015-10-23 13:53:53 -04:00
|
|
|
}
|
|
|
|
else if (0) { /* to disable optimize */
|
2016-03-25 21:34:35 -04:00
|
|
|
return &vm_call_iseq_setup_normal_0start;
|
2015-10-23 13:53:53 -04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (param_size <= #{P.end} &&
|
|
|
|
local_size <= #{L.end}) {
|
2016-07-28 07:02:30 -04:00
|
|
|
VM_ASSERT(local_size >= 0);
|
|
|
|
return vm_call_iseq_handlers[param_size][local_size];
|
2015-10-23 13:53:53 -04:00
|
|
|
}
|
2016-03-25 21:34:35 -04:00
|
|
|
return &vm_call_iseq_setup_normal_0start;
|
2015-10-23 13:53:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static inline vm_call_handler
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
vm_call_iseq_setup_func(const struct rb_callinfo *ci, const int param_size, const int local_size)
|
2015-10-23 13:53:53 -04:00
|
|
|
{
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
if (UNLIKELY(vm_ci_flag(ci) & VM_CALL_TAILCALL)) {
|
2016-03-25 21:34:35 -04:00
|
|
|
return &vm_call_iseq_setup_tailcall_0start;
|
2015-10-23 13:53:53 -04:00
|
|
|
}
|
|
|
|
else {
|
2016-03-25 21:34:35 -04:00
|
|
|
return &vm_call_iseq_setup_normal_0start;
|
2015-10-23 13:53:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
EOS
|