ruby-changes:50264
From: k0kubun <ko1@a...>
Date: Mon, 12 Feb 2018 14:04:30 +0900 (JST)
Subject: [ruby-changes:50264] k0kubun:r62382 (trunk): mjit.c: print JIT failure
k0kubun 2018-02-12 14:04:24 +0900 (Mon, 12 Feb 2018) New Revision: 62382 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62382 Log: mjit.c: print JIT failure mjit_compile.inc.erb: show unsupported insn name on --jit-verbose=1 too. Also, removed osboleted workaround. Now some insn-related functions are declared with MAYBE_UNUSED. Modified files: trunk/mjit.c trunk/tool/ruby_vm/views/mjit_compile.inc.erb Index: tool/ruby_vm/views/mjit_compile.inc.erb =================================================================== --- tool/ruby_vm/views/mjit_compile.inc.erb (revision 62381) +++ tool/ruby_vm/views/mjit_compile.inc.erb (revision 62382) @@ -53,10 +53,8 @@ switch (insn) { https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/mjit_compile.inc.erb#L53 % # 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: - if (mjit_opts.warnings || mjit_opts.verbose >= 3) - /* passing excessive arguments to suppress warning in insns_info.inc as workaround... */ - fprintf(stderr, "MJIT warning: Failed to compile instruction: %s (%s: %d...)\n", - insn_name(insn), insn_op_types(insn), insn_len(insn) > 0 ? insn_op_type(insn, 0) : 0); + if (mjit_opts.warnings || mjit_opts.verbose) + fprintf(stderr, "MJIT warning: Skipped to compile unsupported instruction: %s\n", insn_name(insn)); status->success = FALSE; break; } Index: mjit.c =================================================================== --- mjit.c (revision 62381) +++ mjit.c (revision 62382) @@ -735,6 +735,14 @@ header_name_end(const char *s) https://github.com/ruby/ruby/blob/trunk/mjit.c#L735 } #endif +static void +print_jit_result(const char *result, const struct rb_mjit_unit *unit, const double duration, const char *c_file) +{ + verbose(1, "JIT %s (%.1fms): %s@%s:%d -> %s", result, + duration, RSTRING_PTR(unit->iseq->body->location.label), + RSTRING_PTR(rb_iseq_path(unit->iseq)), FIX2INT(unit->iseq->body->location.first_lineno), c_file); +} + /* Compile ISeq in UNIT and return function pointer of JIT-ed code. It may return NOT_COMPILABLE_JIT_ISEQ_FUNC if something went wrong. */ static mjit_func_t @@ -830,6 +838,7 @@ convert_unit_to_func(struct rb_mjit_unit https://github.com/ruby/ruby/blob/trunk/mjit.c#L838 if (!success) { if (!mjit_opts.save_temps) remove(c_file); + print_jit_result("failure", unit, 0, c_file); return (mjit_func_t)NOT_COMPILABLE_JIT_ISEQ_FUNC; } @@ -853,8 +862,7 @@ convert_unit_to_func(struct rb_mjit_unit https://github.com/ruby/ruby/blob/trunk/mjit.c#L862 CRITICAL_SECTION_START(3, "end of jit"); add_to_list(node, &active_units); if (unit->iseq) - verbose(1, "JIT success (%.1fms): %s@%s:%d -> %s", end_time - start_time, RSTRING_PTR(unit->iseq->body->location.label), - RSTRING_PTR(rb_iseq_path(unit->iseq)), FIX2INT(unit->iseq->body->location.first_lineno), c_file); + print_jit_result("success", unit, end_time - start_time, c_file); CRITICAL_SECTION_FINISH(3, "end of jit"); } return (mjit_func_t)func; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/