diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2021-02-08 15:40:36 -0500 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:28 -0400 |
commit | 6341fc21b2e15dca82253da41047ce37409508fc (patch) | |
tree | 52a3a5fa89142672a127810473db8ffb264d6434 | |
parent | 21c4dd037d3f9c20dda281883b8d43fc2226d550 (diff) |
Don't increment instr/exit counters if stats not requested
-rw-r--r-- | ujit_codegen.c | 20 | ||||
-rw-r--r-- | version.c | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/ujit_codegen.c b/ujit_codegen.c index bb5c336d6d..b9d2a0a7cb 100644 --- a/ujit_codegen.c +++ b/ujit_codegen.c @@ -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, member_opnd(REG_CFP, rb_control_frame_t, pc), RAX); -#if RUBY_DEBUG - mov(cb, RDI, const_ptr_opnd(exit_pc)); - call_ptr(cb, RSI, (void *)&rb_ujit_count_side_exit_op); -#endif + // Accumulate stats about interpreter exits + if (rb_ujit_opts.gen_stats) { + mov(cb, RDI, const_ptr_opnd(exit_pc)); + call_ptr(cb, RSI, (void *)&rb_ujit_count_side_exit_op); + } // Write the post call bytes cb_write_post_call_bytes(cb); @@ -187,11 +188,12 @@ ujit_gen_block(ctx_t* ctx, block_t* block) break; } -#if RUBY_DEBUG - // Count instructions executed by the JIT - mov(cb, REG0, const_ptr_opnd((void *)&rb_ujit_exec_insns_count)); - add(cb, mem_opnd(64, REG0, 0), imm_opnd(1)); -#endif + // Accumulate stats about instructions executed + if (rb_ujit_opts.gen_stats) { + // Count instructions executed by the JIT + mov(cb, REG0, const_ptr_opnd((void *)&rb_ujit_exec_insns_count)); + add(cb, mem_opnd(64, REG0, 0), imm_opnd(1)); + } //fprintf(stderr, "compiling %d: %s\n", insn_idx, insn_name(opcode)); //print_str(cb, insn_name(opcode)); @@ -126,7 +126,7 @@ ruby_show_version(void) } if (rb_ujit_enabled_p()) { - fputs("ujit is enabled\n", stdout); + fputs("uJIT is enabled\n", stdout); } #ifdef RUBY_LAST_COMMIT_TITLE fputs("last_commit=" RUBY_LAST_COMMIT_TITLE, stdout); |