diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-03 00:52:30 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-03 00:52:30 +0000 |
commit | 9b6dec6cac17a507792add61247772ac76d23f48 (patch) | |
tree | eabcdf013c2ae5d5ddb255d03daff73473486dfa /tool/ruby_vm/views | |
parent | 6afea14043b0c0e603f26c89ae0d043f65852668 (diff) |
mjit_compile.inc.erb: verify stack consistency
on JIT compilation. r63092 was risky without this check.
mjit_compile.c: update comment about stack consistency check
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/ruby_vm/views')
-rw-r--r-- | tool/ruby_vm/views/mjit_compile.inc.erb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb index 9961b18453..f78c45385f 100644 --- a/tool/ruby_vm/views/mjit_compile.inc.erb +++ b/tool/ruby_vm/views/mjit_compile.inc.erb @@ -46,14 +46,25 @@ switch (insn) { % (RubyVM::BareInstructions.to_a + RubyVM::OperandsUnifications.to_a).each do |insn| % next if unsupported_insns.include?(insn.name) case BIN(<%= insn.name %>): -% if %w[opt_send_without_block send].include?(insn.name) -<%= render 'mjit_compile_send', locals: { insn: insn } -%> -% elsif %w[opt_aref].include?(insn.name) # experimental. TODO: increase insns and make the list automatically by finding DISPATCH_ORIGINAL_INSN -<%= render 'mjit_compile_send', locals: { insn: opt_send_without_block } -%> +% # Instruction-specific behavior in JIT +% case insn.name +% when 'opt_send_without_block', 'send' +<%= render 'mjit_compile_send', locals: { insn: insn } -%> +% when 'opt_aref' # experimental. TODO: increase insns and make the list automatically by finding DISPATCH_ORIGINAL_INSN +<%= render 'mjit_compile_send', locals: { insn: opt_send_without_block } -%> +% when 'leave' + if (b->stack_size != 1) { + if (mjit_opts.warnings || mjit_opts.verbose) + fprintf(stderr, "MJIT warning: Unexpected JIT stack_size on leave: %d\n", b->stack_size); + status->success = FALSE; + } % end +% +% # Main insn implementation generated by insns.def <%= render 'mjit_compile_insn', locals: { insn: insn, dispatched: false } -%> break; % end +% % # We don't support InstructionsUnifications yet because it's not used for now. % # We don't support TraceInstructions yet. There is no blocker for it but it's just not implemented. default: |