Skip to content

Commit

Permalink
delete mk_call_iseq_optimized.rb
Browse files Browse the repository at this point in the history
To generate what is necessary via generic_erb.rb instead.
  • Loading branch information
shyouhei committed May 10, 2020
1 parent a6f8589 commit 191cfcc
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 75 deletions.
4 changes: 2 additions & 2 deletions common.mk
Expand Up @@ -1085,9 +1085,9 @@ known_errors.inc: $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_
$(ECHO) generating $@
$(Q) $(BASERUBY) $(tooldir)/generic_erb.rb -c -o $@ $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_errors.def

vm_call_iseq_optimized.inc: $(tooldir)/mk_call_iseq_optimized.rb
vm_call_iseq_optimized.inc: $(srcdir)/template/call_iseq_optimized.inc.tmpl
$(ECHO) generating $@
$(Q) $(BASERUBY) $(tooldir)/mk_call_iseq_optimized.rb > $@
$(Q) $(BASERUBY) $(tooldir)/generic_erb.rb -c -o $@ $<

$(MINIPRELUDE_C): $(COMPILE_PRELUDE) $(BUILTIN_RB_SRCS)
$(ECHO) generating $@
Expand Down
68 changes: 68 additions & 0 deletions template/call_iseq_optimized.inc.tmpl
@@ -0,0 +1,68 @@
/* -*- c -*- */
% P = (0..3)
% L = (0..5)
%
% def fname param, local
% "vm_call_iseq_setup_normal_0start_#{param}params_#{local}locals"
% end
#if 1 /* enable or disable this optimization */

/* DO NOT EDIT THIS FILE DIRECTLY
*
* This file is generated by tool/generic_erb.rb
* with template/call_iseq_optimized.inc.tmpl
*/

% P.each{|param|
% L.each{|local|
static VALUE
<%= fname(param, local) %>(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, struct rb_call_data *cd)
{
RB_DEBUG_COUNTER_INC(ccf_iseq_fix);
return vm_call_iseq_setup_normal(ec, cfp, calling, vm_cc_cme(cd->cc), 0, <%= param %>, <%= local %>);
}

% }
% }
/* vm_call_iseq_handlers[param][local] */
static const vm_call_handler vm_call_iseq_handlers[][<%= L.to_a.size %>] = {
% P.each{|param|
{
% L.each{|local|
<%= fname(param, local) %>,
% }
},
% }
};

static inline vm_call_handler
vm_call_iseq_setup_func(const struct rb_callinfo *ci, const int param_size, const int local_size)
{
if (UNLIKELY(vm_ci_flag(ci) & 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];
}
else {
return &vm_call_iseq_setup_normal_0start;
}
}

#else

static inline vm_call_handler
vm_call_iseq_setup_func(const struct rb_callinfo *ci, const int param_size, const int local_size)
{
if (UNLIKELY(vm_ci_flag(ci) & VM_CALL_TAILCALL)) {
return &vm_call_iseq_setup_tailcall_0start;
}
else {
return &vm_call_iseq_setup_normal_0start;
}
}
#endif
73 changes: 0 additions & 73 deletions tool/mk_call_iseq_optimized.rb

This file was deleted.

0 comments on commit 191cfcc

Please sign in to comment.