ruby-changes:55342
From: k0kubun <ko1@a...>
Date: Sun, 14 Apr 2019 21:25:28 +0900 (JST)
Subject: [ruby-changes:55342] k0kubun:r67550 (trunk): Share optimization cancel handlers
k0kubun 2019-04-14 21:25:23 +0900 (Sun, 14 Apr 2019) New Revision: 67550 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67550 Log: Share optimization cancel handlers $ benchmark-driver benchmark.yml --rbenv='before --jit;after --jit' -v --output=all --repeat-count=12 before --jit: ruby 2.7.0dev (2019-04-14 trunk 67549) +JIT [x86_64-linux] after --jit: ruby 2.7.0dev (2019-04-14 trunk 67549) +JIT [x86_64-linux] last_commit=Share optimization cancel handlers Calculating ------------------------------------- before --jit after --jit Optcarrot Lan_Master.nes 69.55360655447375 74.15329176797863 fps 73.74545038318978 79.60903046141544 75.85637357897092 82.00930075612054 77.10594124022951 82.56228187301674 78.67350527368366 83.37512204205953 79.97235230767613 83.41521927993719 81.03050342478066 84.20227901852776 81.61308297895094 84.73733526226468 82.06805141753206 85.27884867863791 82.46493179193394 85.36558922650367 83.85259832896313 85.39993587223481 84.02325292922997 85.63649355214602 Modified files: trunk/mjit_compile.c trunk/tool/ruby_vm/views/_mjit_compile_ivar.erb trunk/tool/ruby_vm/views/_mjit_compile_send.erb Index: mjit_compile.c =================================================================== --- mjit_compile.c (revision 67549) +++ mjit_compile.c (revision 67550) @@ -190,6 +190,19 @@ static void https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L190 compile_cancel_handler(FILE *f, const struct rb_iseq_constant_body *body, struct compile_status *status) { unsigned int i; + + fprintf(f, "\nsend_cancel:\n"); + fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_send_inline);\n"); + fprintf(f, " rb_mjit_iseq_compile_info(original_iseq->body)->disable_send_cache = true;\n"); + fprintf(f, " rb_mjit_recompile_iseq(original_iseq);\n"); + fprintf(f, " goto cancel;\n"); + + fprintf(f, "\nivar_cancel:\n"); + fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_ivar_inline);\n"); + fprintf(f, " rb_mjit_iseq_compile_info(original_iseq->body)->disable_ivar_cache = true;\n"); + fprintf(f, " rb_mjit_recompile_iseq(original_iseq);\n"); + fprintf(f, " goto cancel;\n"); + fprintf(f, "\ncancel:\n"); fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel);\n"); if (status->local_stack_p) { Index: tool/ruby_vm/views/_mjit_compile_send.erb =================================================================== --- tool/ruby_vm/views/_mjit_compile_send.erb (revision 67549) +++ tool/ruby_vm/views/_mjit_compile_send.erb (revision 67550) @@ -38,10 +38,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_send.erb#L38 fprintf(f, " RCLASS_SERIAL(CLASS_OF(stack[%d])) != %"PRI_SERIALT_PREFIX"u)) {\n", b->stack_size - 1 - argc, cc_copy->class_serial); fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos); fprintf(f, " reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size); - fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_send_inline);\n"); - fprintf(f, " rb_mjit_iseq_compile_info(original_iseq->body)->disable_send_cache = true;\n"); - fprintf(f, " rb_mjit_recompile_iseq(original_iseq);\n"); - fprintf(f, " goto cancel;\n"); + fprintf(f, " goto send_cancel;\n"); fprintf(f, " }\n"); % # JIT: move sp and pc if necessary Index: tool/ruby_vm/views/_mjit_compile_ivar.erb =================================================================== --- tool/ruby_vm/views/_mjit_compile_ivar.erb (revision 67549) +++ tool/ruby_vm/views/_mjit_compile_ivar.erb (revision 67550) @@ -43,9 +43,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_ivar.erb#L43 fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos); fprintf(f, " reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size); fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_ivar);\n"); - fprintf(f, " rb_mjit_iseq_compile_info(original_iseq->body)->disable_ivar_cache = true;\n"); - fprintf(f, " rb_mjit_recompile_iseq(original_iseq);\n"); - fprintf(f, " goto cancel;\n"); + fprintf(f, " goto ivar_cancel;\n"); fprintf(f, " }\n"); % # compiler: Move JIT compiler's internal stack pointer -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/