ruby-changes:72993
From: Takashi <ko1@a...>
Date: Sat, 20 Aug 2022 15:57:43 +0900 (JST)
Subject: [ruby-changes:72993] 485019c2bd (master): Rename mjit_exec to jit_exec (#6262)
https://git.ruby-lang.org/ruby.git/commit/?id=485019c2bd From 485019c2bd02794b484500c78919b0d1230e4a84 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Fri, 19 Aug 2022 23:57:17 -0700 Subject: Rename mjit_exec to jit_exec (#6262) * Rename mjit_exec to jit_exec * Rename mjit_exec_slowpath to mjit_check_iseq * Remove mjit_exec references from comments --- benchmark/lib/benchmark_driver/runner/mjit_exec.rb | 6 ++--- debug_counter.h | 4 ++-- mjit.h | 2 +- mjit_compile.c | 2 +- test/ruby/test_mjit.rb | 2 +- tool/ruby_vm/views/_mjit_compile_send.erb | 2 +- vm.c | 28 +++++++++++----------- vm_core.h | 2 +- vm_eval.c | 2 +- vm_insnhelper.c | 11 ++++----- yjit/src/yjit.rs | 2 +- 11 files changed, 31 insertions(+), 32 deletions(-) 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' https://github.com/ruby/ruby/blob/trunk/benchmark/lib/benchmark_driver/runner/mjit_exec.rb#L2 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 https://github.com/ruby/ruby/blob/trunk/benchmark/lib/benchmark_driver/runner/mjit_exec.rb#L12 :metrics, # @param [Array<BenchmarkDriver::Metric>] :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) https://github.com/ruby/ruby/blob/trunk/debug_counter.h#L347 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 https://github.com/ruby/ruby/blob/trunk/mjit.h#L120 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) https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L370 } // 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_mjit.rb#L749 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 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_send.erb#L90 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 https://github.com/ruby/ruby/blob/trunk/vm.c#L379 #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_ https://github.com/ruby/ruby/blob/trunk/vm.c#L414 // 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L442 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L458 # 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, https://github.com/ruby/ruby/blob/trunk/vm.c#L2286 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 { https://github.com/ruby/ruby/blob/trunk/vm.c#L2303 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L2332 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L2347 } 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L2374 #e (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/