diff --git a/benchmark/lib/benchmark_driver/runner/mjit_exec.rb b/benchmark/lib/benchmark_driver/runner/mjit_exec.rb index eac3dfba84..121791eb2b 100644 --- a/benchmark/lib/benchmark_driver/runner/mjit_exec.rb +++ b/benchmark/lib/benchmark_driver/runner/mjit_exec.rb @@ -2,7 +2,7 @@ require 'benchmark_driver/struct' require 'benchmark_driver/metric' require 'erb' -# A special runner dedicated for measuring mjit_exec overhead. +# A special runner dedicated for measuring jit_exec overhead. class BenchmarkDriver::Runner::MjitExec METRIC = BenchmarkDriver::Metric.new(name: 'Iteration per second', unit: 'i/s') @@ -12,8 +12,8 @@ class BenchmarkDriver::Runner::MjitExec :metrics, # @param [Array] :num_methods, # @param [Integer] num_methods - The number of methods to be defined :loop_count, # @param [Integer] loop_count - :from_jit, # @param [TrueClass,FalseClass] from_jit - Whether the mjit_exec() is from JIT or not - :to_jit, # @param [TrueClass,FalseClass] to_jit - Whether the mjit_exec() is to JIT or not + :from_jit, # @param [TrueClass,FalseClass] from_jit - Whether the jit_exec() is from JIT or not + :to_jit, # @param [TrueClass,FalseClass] to_jit - Whether the jit_exec() is to JIT or not ) # Dynamically fetched and used by `BenchmarkDriver::JobParser.parse` class << JobParser = Module.new diff --git a/debug_counter.h b/debug_counter.h index 3f0dec948f..c6f4176e97 100644 --- a/debug_counter.h +++ b/debug_counter.h @@ -347,8 +347,8 @@ RB_DEBUG_COUNTER(vm_sync_lock_enter_nb) RB_DEBUG_COUNTER(vm_sync_lock_enter_cr) RB_DEBUG_COUNTER(vm_sync_barrier) -/* mjit_exec() counts */ -RB_DEBUG_COUNTER(mjit_exec) +/* jit_exec() counts */ +RB_DEBUG_COUNTER(jit_exec) RB_DEBUG_COUNTER(mjit_exec_not_added) RB_DEBUG_COUNTER(mjit_exec_not_ready) RB_DEBUG_COUNTER(mjit_exec_not_compiled) diff --git a/mjit.h b/mjit.h index 344b20b901..045612d7be 100644 --- a/mjit.h +++ b/mjit.h @@ -120,7 +120,7 @@ static inline struct mjit_cont *mjit_cont_new(rb_execution_context_t *ec){return static inline void mjit_cont_free(struct mjit_cont *cont){} static inline void mjit_free_iseq(const rb_iseq_t *iseq){} static inline void mjit_mark(void){} -static inline VALUE mjit_exec(rb_execution_context_t *ec) { return Qundef; /* unreachable */ } +static inline VALUE jit_exec(rb_execution_context_t *ec) { return Qundef; /* unreachable */ } static inline void mjit_child_after_fork(void){} #define mjit_enabled false diff --git a/mjit_compile.c b/mjit_compile.c index 390e3d2850..1bf5beb6a3 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -370,7 +370,7 @@ mjit_compile_body(FILE *f, const rb_iseq_t *iseq, struct compile_status *status) } // Simulate `opt_pc` in setup_parameters_complex. Other PCs which may be passed by catch tables - // are not considered since vm_exec doesn't call mjit_exec for catch tables. + // are not considered since vm_exec doesn't call jit_exec for catch tables. if (body->param.flags.has_opt) { int i; fprintf(f, "\n"); diff --git a/test/ruby/test_mjit.rb b/test/ruby/test_mjit.rb index 02be88aa32..3a1dcf7f09 100644 --- a/test/ruby/test_mjit.rb +++ b/test/ruby/test_mjit.rb @@ -749,7 +749,7 @@ class TestMJIT < Test::Unit::TestCase end def a - # Calling #b should be vm_exec, not direct mjit_exec. + # Calling #b should be vm_exec, not direct jit_exec. # Otherwise `1` on local variable would be purged. 1 + b end diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb index 8900ee6425..316974a7e6 100644 --- a/tool/ruby_vm/views/_mjit_compile_send.erb +++ b/tool/ruby_vm/views/_mjit_compile_send.erb @@ -90,7 +90,7 @@ fprintf(f, " val = vm_exec(ec, true);\n"); } else { - fprintf(f, " if ((val = mjit_exec(ec)) == Qundef) {\n"); + fprintf(f, " if ((val = jit_exec(ec)) == Qundef) {\n"); fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); // This is vm_call0_body's code after vm_call_iseq_setup fprintf(f, " val = vm_exec(ec, false);\n"); fprintf(f, " }\n"); diff --git a/vm.c b/vm.c index 394fa33388..8cab8b9b57 100644 --- a/vm.c +++ b/vm.c @@ -379,12 +379,12 @@ static VALUE vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, VALUE s #if USE_MJIT # 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)); +NOINLINE(static COLDFUNC VALUE mjit_check_iseq(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_iseq_constant_body *body)); # else -static inline VALUE mjit_exec_slowpath(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_iseq_constant_body *body); +static inline VALUE mjit_check_iseq(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_iseq_constant_body *body); # endif static VALUE -mjit_exec_slowpath(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_iseq_constant_body *body) +mjit_check_iseq(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_iseq_constant_body *body) { uintptr_t func_i = (uintptr_t)(body->jit_func); ASSUME(func_i <= LAST_JIT_ISEQ_FUNC); @@ -414,7 +414,7 @@ mjit_exec_slowpath(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_ // If it is not, add ISEQ to the compilation queue and return Qundef for MJIT. // YJIT compiles on the thread running the iseq. static inline VALUE -mjit_exec(rb_execution_context_t *ec) +jit_exec(rb_execution_context_t *ec) { const rb_iseq_t *iseq = ec->cfp->iseq; struct rb_iseq_constant_body *body = ISEQ_BODY(iseq); @@ -442,7 +442,7 @@ mjit_exec(rb_execution_context_t *ec) if (!(mjit_call_p || yjit_enabled)) return Qundef; - RB_DEBUG_COUNTER_INC(mjit_exec); + RB_DEBUG_COUNTER_INC(jit_exec); mjit_func_t func = body->jit_func; @@ -458,7 +458,7 @@ mjit_exec(rb_execution_context_t *ec) # else RB_DEBUG_COUNTER_INC(mjit_frame_VM2VM); # endif - return mjit_exec_slowpath(ec, iseq, body); + return mjit_check_iseq(ec, iseq, body); } # ifdef MJIT_HEADER @@ -2286,8 +2286,8 @@ hook_before_rewind(rb_execution_context_t *ec, const rb_control_frame_t *cfp, void *code; // }; - If mjit_exec is already called before calling vm_exec, `mjit_enable_p` should - be FALSE to avoid calling `mjit_exec` twice. + If jit_exec is already called before calling vm_exec, `jit_enable_p` should + be FALSE to avoid calling `jit_exec` twice. */ static inline VALUE @@ -2303,7 +2303,7 @@ struct rb_vm_exec_context { VALUE initial; VALUE result; enum ruby_tag_type state; - bool mjit_enable_p; + bool jit_enable_p; }; static void @@ -2332,7 +2332,7 @@ vm_exec_bottom_main(void *context) struct rb_vm_exec_context *ctx = (struct rb_vm_exec_context *)context; ctx->state = TAG_NONE; - if (!ctx->mjit_enable_p || (ctx->result = mjit_exec(ctx->ec)) == Qundef) { + if (!ctx->jit_enable_p || (ctx->result = jit_exec(ctx->ec)) == Qundef) { ctx->result = vm_exec_core(ctx->ec, ctx->initial); } vm_exec_enter_vm_loop(ctx->ec, ctx, ctx->tag, true); @@ -2347,12 +2347,12 @@ vm_exec_bottom_rescue(void *context) } VALUE -vm_exec(rb_execution_context_t *ec, bool mjit_enable_p) +vm_exec(rb_execution_context_t *ec, bool jit_enable_p) { struct rb_vm_exec_context ctx = { .ec = ec, .initial = 0, .result = Qundef, - .mjit_enable_p = mjit_enable_p, + .jit_enable_p = jit_enable_p, }; struct rb_wasm_try_catch try_catch; @@ -2374,7 +2374,7 @@ vm_exec(rb_execution_context_t *ec, bool mjit_enable_p) #else VALUE -vm_exec(rb_execution_context_t *ec, bool mjit_enable_p) +vm_exec(rb_execution_context_t *ec, bool jit_enable_p) { enum ruby_tag_type state; VALUE result = Qundef; @@ -2384,7 +2384,7 @@ vm_exec(rb_execution_context_t *ec, bool mjit_enable_p) _tag.retval = Qnil; if ((state = EC_EXEC_TAG()) == TAG_NONE) { - if (!mjit_enable_p || (result = mjit_exec(ec)) == Qundef) { + if (!jit_enable_p || (result = jit_exec(ec)) == Qundef) { result = vm_exec_core(ec, initial); } goto vm_loop_start; /* fallback to the VM */ diff --git a/vm_core.h b/vm_core.h index 717f116800..45ec111155 100644 --- a/vm_core.h +++ b/vm_core.h @@ -489,7 +489,7 @@ struct rb_iseq_constant_body { /* The following fields are MJIT related info. */ VALUE (*jit_func)(struct rb_execution_context_struct *, struct rb_control_frame_struct *); /* function pointer for loaded native code */ - long unsigned total_calls; /* number of total calls with `mjit_exec()` */ + long unsigned total_calls; /* number of total calls with `jit_exec()` */ struct rb_mjit_unit *jit_unit; #endif diff --git a/vm_eval.c b/vm_eval.c index c7669cbb85..db8ca455d9 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -20,7 +20,7 @@ static inline VALUE vm_yield_with_cref(rb_execution_context_t *ec, int argc, con static inline VALUE vm_yield(rb_execution_context_t *ec, int argc, const VALUE *argv, int kw_splat); static inline VALUE vm_yield_with_block(rb_execution_context_t *ec, int argc, const VALUE *argv, VALUE block_handler, int kw_splat); static inline VALUE vm_yield_force_blockarg(rb_execution_context_t *ec, VALUE args); -VALUE vm_exec(rb_execution_context_t *ec, bool mjit_enable_p); +VALUE vm_exec(rb_execution_context_t *ec, bool jit_enable_p); static void vm_set_eval_stack(rb_execution_context_t * th, const rb_iseq_t *iseq, const rb_cref_t *cref, const struct rb_block *base_block); static int vm_collect_local_variables_in_heap(const VALUE *dfp, const struct local_var_list *vars); diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 837c71ffd5..68362ddf60 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -4783,16 +4783,16 @@ vm_sendish( #ifdef MJIT_HEADER /* When calling ISeq which may catch an exception from JIT-ed - code, we should not call mjit_exec directly to prevent the + code, we should not call jit_exec directly to prevent the caller frame from being canceled. That's because the caller frame may have stack values in the local variables and the cancelling the caller frame will purge them. But directly - calling mjit_exec is faster... */ + calling jit_exec is faster... */ if (ISEQ_BODY(GET_ISEQ())->catch_except_p) { VM_ENV_FLAGS_SET(GET_EP(), VM_FRAME_FLAG_FINISH); return vm_exec(ec, true); } - else if ((val = mjit_exec(ec)) == Qundef) { + else if ((val = jit_exec(ec)) == Qundef) { VM_ENV_FLAGS_SET(GET_EP(), VM_FRAME_FLAG_FINISH); return vm_exec(ec, false); } @@ -4801,9 +4801,8 @@ vm_sendish( } #else /* When calling from VM, longjmp in the callee won't purge any - JIT-ed caller frames. So it's safe to directly call - mjit_exec. */ - return mjit_exec(ec); + JIT-ed caller frames. So it's safe to directly call jit_exec. */ + return jit_exec(ec); #endif } diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs index 192e9753d9..bfa9188d3e 100644 --- a/yjit/src/yjit.rs +++ b/yjit/src/yjit.rs @@ -22,7 +22,7 @@ pub extern "C" fn rb_yjit_parse_option(str_ptr: *const raw::c_char) -> bool { } /// Is YJIT on? The interpreter uses this function to decide whether to increment -/// ISEQ call counters. See mjit_exec(). +/// ISEQ call counters. See jit_exec(). /// This is used frequently since it's used on every method call in the interpreter. #[no_mangle] pub extern "C" fn rb_yjit_enabled_p() -> raw::c_int {