1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
卜部昌平 2020-07-13 12:27:53 +09:00
parent 16bc9bf7e8
commit 927fe2422f
3 changed files with 4 additions and 4 deletions

View file

@ -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) {\

View file

@ -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");'

View file

@ -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'