mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
c96f809729
* vm_core.h (vm_call_handler): fix to accept `ec` instead of `th`. * vm_args.c: the following functions accept `ec` instead of `th`. * raise_argument_error * argument_arity_error * argument_kw_error * setup_parameters_complex * vm_eval.c: ditto. * vm_call0 * vm_call0_cfunc_with_frame * vm_call0_cfunc * vm_call0_body * vm_insnhelper.c: ditto * vm_call_iseq_setup_tailcall_0start * vm_call_iseq_setup_normal_0start * vm_callee_setup_arg * vm_call_iseq_setup * vm_call_iseq_setup_2 * vm_call_iseq_setup_normal * vm_call_iseq_setup_tailcall * vm_cfp_consistent_p * vm_call_cfunc_with_frame * vm_call_cfunc * vm_call_ivar * vm_call_attrset * vm_call_bmethod_body * vm_call_bmethod * vm_call_opt_send * vm_call_opt_call * vm_call_method_missing * vm_call_zsuper * current_method_entry * vm_call_method_each_type * vm_call_method_nome * vm_call_method * vm_call_general * vm_call_super_method * tool/mk_call_iseq_optimized.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
72 lines
1.7 KiB
Ruby
72 lines
1.7 KiB
Ruby
|
|
puts <<EOS
|
|
#if 1 /* enable or disable this optimization */
|
|
|
|
/* DO NOT EDIT THIS FILE DIRECTLY
|
|
*
|
|
* This file is generated by tool/mk_call_iseq_optimized.rb
|
|
*/
|
|
|
|
EOS
|
|
|
|
P = (0..3)
|
|
L = (0..5)
|
|
|
|
def fname param, local
|
|
"vm_call_iseq_setup_normal_0start_#{param}params_#{local}locals"
|
|
end
|
|
|
|
P.each{|param|
|
|
L.each{|local|
|
|
puts <<EOS
|
|
static VALUE
|
|
#{fname(param, local)}(rb_execution_context_t *ec, 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(ec, 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)) {
|
|
return &vm_call_iseq_setup_tailcall_0start;
|
|
}
|
|
else if (0) { /* to disable optimize */
|
|
return &vm_call_iseq_setup_normal_0start;
|
|
}
|
|
else {
|
|
if (param_size <= #{P.end} &&
|
|
local_size <= #{L.end}) {
|
|
VM_ASSERT(local_size >= 0);
|
|
return vm_call_iseq_handlers[param_size][local_size];
|
|
}
|
|
return &vm_call_iseq_setup_normal_0start;
|
|
}
|
|
}
|
|
|
|
#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)) {
|
|
return &vm_call_iseq_setup_tailcall_0start;
|
|
}
|
|
else {
|
|
return &vm_call_iseq_setup_normal_0start;
|
|
}
|
|
}
|
|
#endif
|
|
EOS
|