From 868f03cce1a2d7a4df9b03b8338e3af4c69041d0 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 14 Mar 2023 14:00:19 -0700 Subject: [PATCH] Remove unused jit_enable_p flag This was used only by MJIT. --- internal/vm.h | 2 -- vm.c | 23 +++++++++-------------- vm_eval.c | 8 ++++---- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/internal/vm.h b/internal/vm.h index 11595b21d8..7943027946 100644 --- a/internal/vm.h +++ b/internal/vm.h @@ -58,8 +58,6 @@ VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements); VALUE ruby_vm_special_exception_copy(VALUE); PUREFUNC(st_table *rb_vm_fstring_table(void)); -VALUE vm_exec(struct rb_execution_context_struct *, bool); /* used in JIT-ed code */ - /* vm_eval.c */ VALUE rb_current_realfilepath(void); VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE); diff --git a/vm.c b/vm.c index b848730b22..3c18c9c5a5 100644 --- a/vm.c +++ b/vm.c @@ -52,7 +52,7 @@ int ruby_assert_critical_section_entered = 0; VALUE rb_str_concat_literals(size_t, const VALUE*); -VALUE vm_exec(rb_execution_context_t *, bool); +VALUE vm_exec(rb_execution_context_t *); extern const char *const rb_debug_counter_names[]; @@ -1381,7 +1381,7 @@ invoke_block(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE self, cons ec->cfp->sp + arg_size, ISEQ_BODY(iseq)->local_table_size - arg_size, ISEQ_BODY(iseq)->stack_max); - return vm_exec(ec, true); + return vm_exec(ec); } static VALUE @@ -1402,7 +1402,7 @@ invoke_bmethod(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE self, co ISEQ_BODY(iseq)->stack_max); VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); - ret = vm_exec(ec, true); + ret = vm_exec(ec); return ret; } @@ -2268,9 +2268,6 @@ hook_before_rewind(rb_execution_context_t *ec, const rb_control_frame_t *cfp, VALUE *ep; // ep void *code; // }; - - 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 @@ -2286,7 +2283,6 @@ struct rb_vm_exec_context { VALUE initial; VALUE result; enum ruby_tag_type state; - bool jit_enable_p; }; static void @@ -2315,7 +2311,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->jit_enable_p || UNDEF_P(ctx->result = jit_exec(ctx->ec))) { + if (UNDEF_P(ctx->result = jit_exec(ctx->ec))) { ctx->result = vm_exec_core(ctx->ec, ctx->initial); } vm_exec_enter_vm_loop(ctx->ec, ctx, ctx->tag, true); @@ -2330,12 +2326,11 @@ vm_exec_bottom_rescue(void *context) } VALUE -vm_exec(rb_execution_context_t *ec, bool jit_enable_p) +vm_exec(rb_execution_context_t *ec) { struct rb_vm_exec_context ctx = { .ec = ec, .initial = 0, .result = Qundef, - .jit_enable_p = jit_enable_p, }; struct rb_wasm_try_catch try_catch; @@ -2357,7 +2352,7 @@ vm_exec(rb_execution_context_t *ec, bool jit_enable_p) #else VALUE -vm_exec(rb_execution_context_t *ec, bool jit_enable_p) +vm_exec(rb_execution_context_t *ec) { enum ruby_tag_type state; VALUE result = Qundef; @@ -2367,7 +2362,7 @@ vm_exec(rb_execution_context_t *ec, bool jit_enable_p) _tag.retval = Qnil; if ((state = EC_EXEC_TAG()) == TAG_NONE) { - if (!jit_enable_p || UNDEF_P(result = jit_exec(ec))) { + if (UNDEF_P(result = jit_exec(ec))) { result = vm_exec_core(ec, initial); } goto vm_loop_start; /* fallback to the VM */ @@ -2616,7 +2611,7 @@ rb_iseq_eval(const rb_iseq_t *iseq) rb_execution_context_t *ec = GET_EC(); VALUE val; vm_set_top_stack(ec, iseq); - val = vm_exec(ec, true); + val = vm_exec(ec); return val; } @@ -2627,7 +2622,7 @@ rb_iseq_eval_main(const rb_iseq_t *iseq) VALUE val; vm_set_main_stack(ec, iseq); - val = vm_exec(ec, true); + val = vm_exec(ec); return val; } diff --git a/vm_eval.c b/vm_eval.c index d8c48dd6e2..bacf91f5eb 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -21,7 +21,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 jit_enable_p); +VALUE vm_exec(rb_execution_context_t *ec); 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); @@ -201,7 +201,7 @@ vm_call0_body(rb_execution_context_t *ec, struct rb_calling_info *calling, const vm_call_iseq_setup(ec, reg_cfp, calling); VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); - return vm_exec(ec, true); /* CHECK_INTS in this function */ + return vm_exec(ec); // CHECK_INTS in this function } case VM_METHOD_TYPE_NOTIMPLEMENTED: case VM_METHOD_TYPE_CFUNC: @@ -1698,7 +1698,7 @@ eval_string_with_cref(VALUE self, VALUE src, rb_cref_t *cref, VALUE file, int li vm_set_eval_stack(ec, iseq, cref, &block); /* kick */ - return vm_exec(ec, true); + return vm_exec(ec); } static VALUE @@ -1719,7 +1719,7 @@ eval_string_with_scope(VALUE scope, VALUE src, VALUE file, int line) } /* kick */ - return vm_exec(ec, true); + return vm_exec(ec); } /*