зеркало из https://github.com/github/ruby.git
Skip compiling at_exit without --mjit-stats
This commit is contained in:
Родитель
e4a824f769
Коммит
5760f7fd3c
|
@ -27,12 +27,6 @@ module RubyVM::MJIT
|
|||
stats
|
||||
end
|
||||
|
||||
at_exit do
|
||||
if C.mjit_opts.stats
|
||||
print_stats
|
||||
end
|
||||
end
|
||||
|
||||
class << self
|
||||
private
|
||||
|
||||
|
|
8
mjit.c
8
mjit.c
|
@ -63,6 +63,7 @@ struct mjit_options mjit_opts;
|
|||
|
||||
// true if MJIT is enabled.
|
||||
bool mjit_enabled = false;
|
||||
bool mjit_stats_enabled = false;
|
||||
// true if JIT-ed code should be called. When `ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS`
|
||||
// and `mjit_call_p == false`, any JIT-ed code execution is cancelled as soon as possible.
|
||||
bool mjit_call_p = false;
|
||||
|
@ -394,6 +395,13 @@ mjit_finish(bool close_handle_p)
|
|||
// TODO: implement
|
||||
}
|
||||
|
||||
// Same as `RubyVM::MJIT::C.enabled?`, but this is used before mjit_init.
|
||||
static VALUE
|
||||
mjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self)
|
||||
{
|
||||
return RBOOL(mjit_stats_enabled);
|
||||
}
|
||||
|
||||
#include "mjit.rbinc"
|
||||
|
||||
#endif // USE_MJIT
|
||||
|
|
6
mjit.h
6
mjit.h
|
@ -125,11 +125,8 @@ extern void rb_mjit_before_ractor_spawn(void);
|
|||
extern void rb_mjit_tracing_invalidate_all(rb_event_flag_t new_iseq_events);
|
||||
extern void rb_mjit_collect_vm_usage_insn(int insn);
|
||||
|
||||
# ifdef MJIT_HEADER
|
||||
#define mjit_enabled true
|
||||
# else // MJIT_HEADER
|
||||
extern bool mjit_enabled;
|
||||
# endif // MJIT_HEADER
|
||||
extern bool mjit_stats_enabled;
|
||||
VALUE mjit_pause(bool wait_p);
|
||||
VALUE mjit_resume(void);
|
||||
void mjit_finish(bool close_handle_p);
|
||||
|
@ -150,6 +147,7 @@ static inline void rb_mjit_constant_ic_update(const rb_iseq_t *const iseq, IC ic
|
|||
static inline void rb_mjit_tracing_invalidate_all(rb_event_flag_t new_iseq_events) {}
|
||||
|
||||
#define mjit_enabled false
|
||||
#define mjit_stats_enabled false
|
||||
static inline VALUE mjit_pause(bool wait_p){ return Qnil; } // unreachable
|
||||
static inline VALUE mjit_resume(void){ return Qnil; } // unreachable
|
||||
static inline void mjit_finish(bool close_handle_p){}
|
||||
|
|
4
mjit.rb
4
mjit.rb
|
@ -13,6 +13,10 @@ module RubyVM::MJIT
|
|||
def self.resume
|
||||
Primitive.cexpr! 'mjit_resume()'
|
||||
end
|
||||
|
||||
if Primitive.mjit_stats_enabled_p
|
||||
at_exit { print_stats }
|
||||
end
|
||||
end
|
||||
|
||||
if RubyVM::MJIT.enabled?
|
||||
|
|
2
ruby.c
2
ruby.c
|
@ -1615,6 +1615,8 @@ ruby_opt_init(ruby_cmdline_options_t *opt)
|
|||
// rb_call_builtin_inits depends on RubyVM::MJIT.enabled?
|
||||
if (opt->mjit.on)
|
||||
mjit_enabled = true;
|
||||
if (opt->mjit.stats)
|
||||
mjit_stats_enabled = true;
|
||||
#endif
|
||||
|
||||
Init_ext(); /* load statically linked extensions before rubygems */
|
||||
|
|
Загрузка…
Ссылка в новой задаче