diff options
| author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-07-09 21:43:42 +0900 |
|---|---|---|
| committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-07-13 08:56:18 +0900 |
| commit | f66e0212efe4f6572d5e81741e831ab735cc2fee (patch) | |
| tree | 94b45502a7d483489b697c3966b7d75e9cfd9b40 /tool/ruby_vm/views/mjit_compile.inc.erb | |
| parent | 5d02c1dd14648d95178ac5ec756f5b03fe00d549 (diff) | |
precalc invokebuiltin destinations
Noticed that struct rb_builtin_function is a purely compile-time
constant. MJIT can eliminate some runtime calculations by statically
generate dedicated C code generator for each builtin functions.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3305
Diffstat (limited to 'tool/ruby_vm/views/mjit_compile.inc.erb')
| -rw-r--r-- | tool/ruby_vm/views/mjit_compile.inc.erb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb index c8f9aca777..e3be549181 100644 --- a/tool/ruby_vm/views/mjit_compile.inc.erb +++ b/tool/ruby_vm/views/mjit_compile.inc.erb @@ -67,13 +67,9 @@ switch (insn) { { % # opt_invokebuiltin_delegate_leave also implements leave insn. We need to handle it here for inlining. % if insn.name == 'opt_invokebuiltin_delegate_leave' - RB_BUILTIN bf = (RB_BUILTIN)operands[0]; - rb_num_t index = (rb_num_t)operands[0]; fprintf(f, "{\n"); fprintf(f, " VALUE val;\n"); - fprintf(f, " RB_BUILTIN bf = (RB_BUILTIN)0x%"PRIxVALUE";\n", operands[0]); - fprintf(f, " rb_num_t index = (rb_num_t)0x%"PRIxVALUE";\n", operands[1]); - fprintf(f, <%= rstring2cstr(insn.expr.expr.lines.find { |l| l =~ / vm_invoke_builtin_delegate\(/ }).gsub("\n", '\n') %>); +<%= render 'mjit_compile_invokebuiltin', locals: { insn: insn } -%> fprintf(f, " stack[0] = val;\n"); fprintf(f, "}\n"); % else |
