summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-07-13 12:27:53 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-07-13 12:30:43 +0900
commit927fe2422fe8ca3ee50b76c3ee82d3238ea2daca (patch)
treef327c5a115e45c636fdb912cddd960f3521396c4
parent16bc9bf7e85ed301498ccdea04569af1808559c2 (diff)
mk_builtin_loader.rb: STACK_ADDR_FROM_TOP unusable
Stacks are emulated in MJIT, must not touch the original VM stack. See also http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3061353
-rw-r--r--builtin.h2
-rw-r--r--tool/mk_builtin_loader.rb4
-rw-r--r--tool/ruby_vm/views/_mjit_compile_invokebuiltin.erb2
3 files changed, 4 insertions, 4 deletions
diff --git a/builtin.h b/builtin.h
index 0da200f961..607458ea71 100644
--- a/builtin.h
+++ b/builtin.h
@@ -13,7 +13,7 @@ struct rb_builtin_function {
const char * const name;
// for jit
- void (*compiler)(FILE *, long);
+ void (*compiler)(FILE *, long, unsigned);
};
#define RB_BUILTIN_FUNCTION(_i, _name, _fname, _arity, _compiler) {\
diff --git a/tool/mk_builtin_loader.rb b/tool/mk_builtin_loader.rb
index 18fa36199e..271c47f9ad 100644
--- a/tool/mk_builtin_loader.rb
+++ b/tool/mk_builtin_loader.rb
@@ -286,7 +286,7 @@ def mk_builtin_header file
bs.each_pair{|func, (argc, cfunc_name)|
f.puts %'static void'
- f.puts %'mjit_compile_invokebuiltin_for_#{func}(FILE *f, long index)'
+ f.puts %'mjit_compile_invokebuiltin_for_#{func}(FILE *f, long index, unsigned stack_size)'
f.puts %'{'
if inlines.has_key? cfunc_name
f.puts %' fprintf(f, " MAYBE_UNUSED(VALUE) self = GET_SELF();\\n");'
@@ -304,7 +304,7 @@ def mk_builtin_header file
f.puts %' fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE#{decl});\\n");'
if argc > 0
f.puts %' if (index == -1) {'
- f.puts %' fprintf(f, " const VALUE *argv = STACK_ADDR_FROM_TOP(%d);\\n", #{argc});'
+ f.puts %' fprintf(f, " const VALUE *argv = &stack[%d];\\n", stack_size - #{argc});'
f.puts %' }'
f.puts %' else {'
f.puts %' fprintf(f, " const unsigned int lnum = GET_ISEQ()->body->local_table_size;\\n");'
diff --git a/tool/ruby_vm/views/_mjit_compile_invokebuiltin.erb b/tool/ruby_vm/views/_mjit_compile_invokebuiltin.erb
index a95a8a7438..29a21b17de 100644
--- a/tool/ruby_vm/views/_mjit_compile_invokebuiltin.erb
+++ b/tool/ruby_vm/views/_mjit_compile_invokebuiltin.erb
@@ -19,7 +19,7 @@
fprintf(f, " VALUE val;\n");
bf->compiler(f, <%=
insn.name == 'invokebuiltin' ? '-1' : '(rb_num_t)operands[1]'
- %>);
+ %>, b->stack_size);
fprintf(f, " stack[%u] = val;\n", sp - 1);
fprintf(f, "}\n");
% if insn.name != 'opt_invokebuiltin_delegate_leave'