[前][次][番号順一覧][スレッド一覧]

ruby-changes:63696

From: Takashi <ko1@a...>
Date: Mon, 23 Nov 2020 13:22:55 +0900 (JST)
Subject: [ruby-changes:63696] 55866565c2 (master): Combine mjit.h and internal/mjit.h

https://git.ruby-lang.org/ruby.git/commit/?id=55866565c2

From 55866565c24765a1722e2c415a6776f3f77e89d0 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sun, 22 Nov 2020 20:09:42 -0800
Subject: Combine mjit.h and internal/mjit.h

It's very hard to remember which mjit.h has what.

diff --git a/common.mk b/common.mk
index c23df49..226400b 100644
--- a/common.mk
+++ b/common.mk
@@ -3200,7 +3200,6 @@ cont.$(OBJEXT): $(top_srcdir)/internal/compilers.h https://github.com/ruby/ruby/blob/trunk/common.mk#L3200
 cont.$(OBJEXT): $(top_srcdir)/internal/cont.h
 cont.$(OBJEXT): $(top_srcdir)/internal/gc.h
 cont.$(OBJEXT): $(top_srcdir)/internal/imemo.h
-cont.$(OBJEXT): $(top_srcdir)/internal/mjit.h
 cont.$(OBJEXT): $(top_srcdir)/internal/proc.h
 cont.$(OBJEXT): $(top_srcdir)/internal/scheduler.h
 cont.$(OBJEXT): $(top_srcdir)/internal/serial.h
@@ -5216,7 +5215,6 @@ eval.$(OBJEXT): $(top_srcdir)/internal/hash.h https://github.com/ruby/ruby/blob/trunk/common.mk#L5215
 eval.$(OBJEXT): $(top_srcdir)/internal/imemo.h
 eval.$(OBJEXT): $(top_srcdir)/internal/inits.h
 eval.$(OBJEXT): $(top_srcdir)/internal/io.h
-eval.$(OBJEXT): $(top_srcdir)/internal/mjit.h
 eval.$(OBJEXT): $(top_srcdir)/internal/object.h
 eval.$(OBJEXT): $(top_srcdir)/internal/scheduler.h
 eval.$(OBJEXT): $(top_srcdir)/internal/serial.h
@@ -8418,7 +8416,6 @@ mjit.$(OBJEXT): $(top_srcdir)/internal/file.h https://github.com/ruby/ruby/blob/trunk/common.mk#L8416
 mjit.$(OBJEXT): $(top_srcdir)/internal/gc.h
 mjit.$(OBJEXT): $(top_srcdir)/internal/hash.h
 mjit.$(OBJEXT): $(top_srcdir)/internal/imemo.h
-mjit.$(OBJEXT): $(top_srcdir)/internal/mjit.h
 mjit.$(OBJEXT): $(top_srcdir)/internal/serial.h
 mjit.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
 mjit.$(OBJEXT): $(top_srcdir)/internal/vm.h
@@ -10001,7 +9998,6 @@ process.$(OBJEXT): $(top_srcdir)/internal/eval.h https://github.com/ruby/ruby/blob/trunk/common.mk#L9998
 process.$(OBJEXT): $(top_srcdir)/internal/gc.h
 process.$(OBJEXT): $(top_srcdir)/internal/hash.h
 process.$(OBJEXT): $(top_srcdir)/internal/imemo.h
-process.$(OBJEXT): $(top_srcdir)/internal/mjit.h
 process.$(OBJEXT): $(top_srcdir)/internal/object.h
 process.$(OBJEXT): $(top_srcdir)/internal/process.h
 process.$(OBJEXT): $(top_srcdir)/internal/scheduler.h
@@ -10175,6 +10171,7 @@ process.$(OBJEXT): {$(VPATH)}internal/xmalloc.h https://github.com/ruby/ruby/blob/trunk/common.mk#L10171
 process.$(OBJEXT): {$(VPATH)}io.h
 process.$(OBJEXT): {$(VPATH)}method.h
 process.$(OBJEXT): {$(VPATH)}missing.h
+process.$(OBJEXT): {$(VPATH)}mjit.h
 process.$(OBJEXT): {$(VPATH)}node.h
 process.$(OBJEXT): {$(VPATH)}onigmo.h
 process.$(OBJEXT): {$(VPATH)}oniguruma.h
@@ -15327,7 +15324,6 @@ vm.$(OBJEXT): $(top_srcdir)/internal/gc.h https://github.com/ruby/ruby/blob/trunk/common.mk#L15324
 vm.$(OBJEXT): $(top_srcdir)/internal/hash.h
 vm.$(OBJEXT): $(top_srcdir)/internal/imemo.h
 vm.$(OBJEXT): $(top_srcdir)/internal/inits.h
-vm.$(OBJEXT): $(top_srcdir)/internal/mjit.h
 vm.$(OBJEXT): $(top_srcdir)/internal/numeric.h
 vm.$(OBJEXT): $(top_srcdir)/internal/object.h
 vm.$(OBJEXT): $(top_srcdir)/internal/parse.h
diff --git a/mjit.h b/mjit.h
index 06eb300..21767a6 100644
--- a/mjit.h
+++ b/mjit.h
@@ -9,8 +9,9 @@ https://github.com/ruby/ruby/blob/trunk/mjit.h#L9
 **********************************************************************/
 
 #include "ruby/internal/config.h"
+#include "ruby/internal/stdbool.h"
 
-#if USE_MJIT
+# if USE_MJIT
 
 #include "debug_counter.h"
 #include "ruby.h"
@@ -112,11 +113,11 @@ mjit_target_iseq_p(struct rb_iseq_constant_body *body) https://github.com/ruby/ruby/blob/trunk/mjit.h#L113
         && body->iseq_size < JIT_ISEQ_SIZE_THRESHOLD;
 }
 
-#ifdef MJIT_HEADER
+#  ifdef MJIT_HEADER
 NOINLINE(static COLDFUNC VALUE mjit_exec_slowpath(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_iseq_constant_body *body));
-#else
+#  else
 static inline VALUE mjit_exec_slowpath(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_iseq_constant_body *body);
-#endif
+#  endif
 static VALUE
 mjit_exec_slowpath(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_iseq_constant_body *body)
 {
@@ -162,26 +163,32 @@ mjit_exec(rb_execution_context_t *ec) https://github.com/ruby/ruby/blob/trunk/mjit.h#L163
 
     mjit_func_t func = body->jit_func;
     if (UNLIKELY((uintptr_t)func <= LAST_JIT_ISEQ_FUNC)) {
-#     ifdef MJIT_HEADER
+#  ifdef MJIT_HEADER
         RB_DEBUG_COUNTER_INC(mjit_frame_JT2VM);
-#     else
+#  else
         RB_DEBUG_COUNTER_INC(mjit_frame_VM2VM);
-#     endif
+#  endif
         return mjit_exec_slowpath(ec, iseq, body);
     }
 
-# ifdef MJIT_HEADER
+#  ifdef MJIT_HEADER
     RB_DEBUG_COUNTER_INC(mjit_frame_JT2JT);
-# else
+#  else
     RB_DEBUG_COUNTER_INC(mjit_frame_VM2JT);
-# endif
+#  endif
     RB_DEBUG_COUNTER_INC(mjit_exec_call_func);
     return func(ec, ec->cfp);
 }
 
 void mjit_child_after_fork(void);
 
-#else // USE_MJIT
+extern bool mjit_enabled;
+VALUE mjit_pause(bool wait_p);
+VALUE mjit_resume(void);
+void mjit_finish(bool close_handle_p);
+
+# else // USE_MJIT
+
 static inline struct mjit_cont *mjit_cont_new(rb_execution_context_t *ec){return NULL;}
 static inline void mjit_cont_free(struct mjit_cont *cont){}
 static inline void mjit_gc_start_hook(void){}
@@ -193,5 +200,10 @@ static inline void mjit_remove_class_serial(rb_serial_t class_serial){} https://github.com/ruby/ruby/blob/trunk/mjit.h#L200
 static inline VALUE mjit_exec(rb_execution_context_t *ec) { return Qundef; /* unreachable */ }
 static inline void mjit_child_after_fork(void){}
 
-#endif // USE_MJIT
+#define mjit_enabled 0
+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){}
+
+# endif // USE_MJIT
 #endif // RUBY_MJIT_H
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]