diff options
Diffstat (limited to 'yjit/src/yjit.rs')
-rw-r--r-- | yjit/src/yjit.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs index c2647d55f7..a9ecc24a80 100644 --- a/yjit/src/yjit.rs +++ b/yjit/src/yjit.rs @@ -8,6 +8,7 @@ use crate::stats::incr_counter; use crate::stats::with_compile_time; use std::os::raw; +use crate::log::Log; /// Is YJIT on? The interpreter uses this variable to decide whether to trigger /// compilation. See jit_exec() and jit_compile(). @@ -167,7 +168,7 @@ pub extern "C" fn rb_yjit_code_gc(_ec: EcPtr, _ruby_self: VALUE) -> VALUE { /// Enable YJIT compilation, returning true if YJIT was previously disabled #[no_mangle] -pub extern "C" fn rb_yjit_enable(_ec: EcPtr, _ruby_self: VALUE, gen_stats: VALUE, print_stats: VALUE) -> VALUE { +pub extern "C" fn rb_yjit_enable(_ec: EcPtr, _ruby_self: VALUE, gen_stats: VALUE, print_stats: VALUE, gen_log: VALUE, print_log: VALUE) -> VALUE { with_vm_lock(src_loc!(), || { // Initialize and enable YJIT if gen_stats.test() { @@ -176,6 +177,19 @@ pub extern "C" fn rb_yjit_enable(_ec: EcPtr, _ruby_self: VALUE, gen_stats: VALUE OPTIONS.print_stats = print_stats.test(); } } + + if gen_log.test() { + unsafe { + if print_log.test() { + OPTIONS.log = Some(LogOutput::Stderr); + } else { + OPTIONS.log = Some(LogOutput::MemoryOnly); + } + + Log::init(); + } + } + yjit_init(); // Add "+YJIT" to RUBY_DESCRIPTION |