Don't increment instr/exit counters if stats not requested

This commit is contained in:
Maxime Chevalier-Boisvert 2021-02-08 15:40:36 -05:00 committed by Alan Wu
parent 21c4dd037d
commit 6341fc21b2
2 changed files with 12 additions and 10 deletions

View File

@ -69,10 +69,11 @@ ujit_gen_exit(jitstate_t* jit, ctx_t* ctx, codeblock_t* cb, VALUE* exit_pc)
mov(cb, RAX, const_ptr_opnd(exit_pc)); mov(cb, RAX, const_ptr_opnd(exit_pc));
mov(cb, member_opnd(REG_CFP, rb_control_frame_t, pc), RAX); mov(cb, member_opnd(REG_CFP, rb_control_frame_t, pc), RAX);
#if RUBY_DEBUG // Accumulate stats about interpreter exits
mov(cb, RDI, const_ptr_opnd(exit_pc)); if (rb_ujit_opts.gen_stats) {
call_ptr(cb, RSI, (void *)&rb_ujit_count_side_exit_op); mov(cb, RDI, const_ptr_opnd(exit_pc));
#endif call_ptr(cb, RSI, (void *)&rb_ujit_count_side_exit_op);
}
// Write the post call bytes // Write the post call bytes
cb_write_post_call_bytes(cb); cb_write_post_call_bytes(cb);
@ -187,11 +188,12 @@ ujit_gen_block(ctx_t* ctx, block_t* block)
break; break;
} }
#if RUBY_DEBUG // Accumulate stats about instructions executed
// Count instructions executed by the JIT if (rb_ujit_opts.gen_stats) {
mov(cb, REG0, const_ptr_opnd((void *)&rb_ujit_exec_insns_count)); // Count instructions executed by the JIT
add(cb, mem_opnd(64, REG0, 0), imm_opnd(1)); mov(cb, REG0, const_ptr_opnd((void *)&rb_ujit_exec_insns_count));
#endif add(cb, mem_opnd(64, REG0, 0), imm_opnd(1));
}
//fprintf(stderr, "compiling %d: %s\n", insn_idx, insn_name(opcode)); //fprintf(stderr, "compiling %d: %s\n", insn_idx, insn_name(opcode));
//print_str(cb, insn_name(opcode)); //print_str(cb, insn_name(opcode));

View File

@ -126,7 +126,7 @@ ruby_show_version(void)
} }
if (rb_ujit_enabled_p()) { if (rb_ujit_enabled_p()) {
fputs("ujit is enabled\n", stdout); fputs("uJIT is enabled\n", stdout);
} }
#ifdef RUBY_LAST_COMMIT_TITLE #ifdef RUBY_LAST_COMMIT_TITLE
fputs("last_commit=" RUBY_LAST_COMMIT_TITLE, stdout); fputs("last_commit=" RUBY_LAST_COMMIT_TITLE, stdout);