From 15b81edd86a760331cb551b39882fab6fb9f4e37 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Mon, 21 Dec 2020 22:05:58 -0800 Subject: [PATCH] MJIT is enabled whenever an MJIT header is used ``` $ benchmark-driver -v --rbenv 'before --jit;after --jit' --repeat-count=4 --alternate --output=all benchmark.yml before --jit: ruby 3.0.0dev (2020-12-22T05:16:39Z master 692af8e8f8) +JIT [x86_64-linux] after --jit: ruby 3.0.0dev (2020-12-22T06:05:59Z master d2ca23fdbc) +JIT [x86_64-linux] last_commit=MJIT is enabled whenever an MJIT header is used Calculating ------------------------------------- before --jit after --jit Optcarrot 180 frames 86.61115328062763 91.49245232931852 fps 90.18653732453176 92.31139517827663 91.29817884736318 93.84437713805814 92.76118222412521 93.91929147901106 ``` --- mjit.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mjit.h b/mjit.h index a523bc9512..dd23cf7caa 100644 --- a/mjit.h +++ b/mjit.h @@ -187,7 +187,11 @@ mjit_exec(rb_execution_context_t *ec) void mjit_child_after_fork(void); +# ifdef MJIT_HEADER +#define mjit_enabled true +# else // MJIT_HEADER extern bool mjit_enabled; +# endif // MJIT_HEADER VALUE mjit_pause(bool wait_p); VALUE mjit_resume(void); void mjit_finish(bool close_handle_p); @@ -207,7 +211,7 @@ static inline void mjit_remove_class_serial(rb_serial_t class_serial){} static inline VALUE mjit_exec(rb_execution_context_t *ec) { return Qundef; /* unreachable */ } static inline void mjit_child_after_fork(void){} -#define mjit_enabled 0 +#define mjit_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){}