diff options
author | Alan Wu <[email protected]> | 2021-10-26 15:15:46 -0400 |
---|---|---|
committer | Alan Wu <[email protected]> | 2021-10-27 13:00:05 -0400 |
commit | fdbae38546c6cd352e5becfd6c555ea22eb64b96 (patch) | |
tree | 230bc7a25b7c363ee91c3398e20f5bf0b24b4ab2 /yjit_iface.c | |
parent | 6875d6d1fa086fcec58c9d888cbacc1e108a0935 (diff) |
YJIT: move --yjit-stats at_exit call into Ruby
This change fixes `-v --yjit-stats`. Previously in this situation,
YJIT._print_stats wasn't defined as yjit.rb is not evaluated when there
is only "-v" and no Ruby code to run.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5022
Diffstat (limited to 'yjit_iface.c')
-rw-r--r-- | yjit_iface.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/yjit_iface.c b/yjit_iface.c index 870a8d1efd..d647cf1113 100644 --- a/yjit_iface.c +++ b/yjit_iface.c @@ -684,14 +684,6 @@ yjit_disasm(VALUE self, VALUE code, VALUE from) } #endif -static VALUE -at_exit_print_stats(RB_BLOCK_CALL_FUNC_ARGLIST(yieldarg, data)) -{ - // Defined in yjit.rb - rb_funcall(mYjit, rb_intern("_print_stats"), 0); - return Qnil; -} - // Primitive called in yjit.rb. Export all machine code comments as a Ruby array. static VALUE comments_for(rb_execution_context_t *ec, VALUE self, VALUE start_address, VALUE end_address) @@ -723,6 +715,12 @@ comments_for(rb_execution_context_t *ec, VALUE self, VALUE start_address, VALUE return comment_array; } +static VALUE +yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self) +{ + return RBOOL(YJIT_STATS && rb_yjit_opts.gen_stats); +} + // Primitive called in yjit.rb. Export all YJIT statistics as a Ruby hash. static VALUE get_yjit_stats(rb_execution_context_t *ec, VALUE self) @@ -1144,11 +1142,6 @@ rb_yjit_init(struct rb_yjit_options *options) #endif #endif - if (YJIT_STATS && rb_yjit_opts.gen_stats) { - // Setup at_exit callback for printing out counters - rb_block_call(rb_mKernel, rb_intern("at_exit"), 0, NULL, at_exit_print_stats, Qfalse); - } - // Make dependency tables method_lookup_dependency = st_init_numtable(); cme_validity_dependency = st_init_numtable(); |