2015-10-23 13:53:53 -04:00
|
|
|
|
|
|
|
puts <<EOS
|
|
|
|
#if 1 /* enable or disable this optimization */
|
|
|
|
|
|
|
|
/* DO NOT EDIT THIS FILE DIRECTLY
|
|
|
|
*
|
2016-07-02 17:01:04 -04:00
|
|
|
* This file is generated by tool/mkcall_iseq.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
|
|
|
|
#{fname(param, local)}(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
|
|
|
|
{
|
|
|
|
return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, #{param}, #{local});
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, const int local_size)
|
|
|
|
{
|
|
|
|
if (UNLIKELY(ci->flag & 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
|
|
|
|
vm_call_iseq_setup_func(const struct rb_call_info *ci, struct rb_call_cache *cc)
|
|
|
|
{
|
|
|
|
if (UNLIKELY(ci->flag & 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
|