Combine mjit.h and internal/mjit.h

It's very hard to remember which mjit.h has what.
This commit is contained in:
Takashi Kokubun 2020-11-22 20:09:42 -08:00
Родитель afd765f2ee
Коммит 55866565c2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 6FFC433B12EE23DD
2 изменённых файлов: 25 добавлений и 17 удалений

Просмотреть файл

@ -3200,7 +3200,6 @@ cont.$(OBJEXT): $(top_srcdir)/internal/compilers.h
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
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
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
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
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
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

36
mjit.h
Просмотреть файл

@ -9,8 +9,9 @@
**********************************************************************/
#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)
&& 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)
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){}
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