ruby-changes:64449
From: Takashi <ko1@a...>
Date: Tue, 22 Dec 2020 14:18:33 +0900 (JST)
Subject: [ruby-changes:64449] 692af8e8f8 (master): Prefer stdbool in vm_exec
https://git.ruby-lang.org/ruby.git/commit/?id=692af8e8f8 From 692af8e8f8b5f9965450d8f2577f435feaa6f80d Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Mon, 21 Dec 2020 21:16:19 -0800 Subject: Prefer stdbool in vm_exec Make the code a bit modern and consistent with some other places. diff --git a/internal/vm.h b/internal/vm.h index 6a525b8..eb193a2 100644 --- a/internal/vm.h +++ b/internal/vm.h @@ -61,7 +61,7 @@ MJIT_STATIC VALUE ruby_vm_special_exception_copy(VALUE); https://github.com/ruby/ruby/blob/trunk/internal/vm.h#L61 PUREFUNC(st_table *rb_vm_fstring_table(void)); MJIT_SYMBOL_EXPORT_BEGIN -VALUE vm_exec(struct rb_execution_context_struct *, int); /* used in JIT-ed code */ +VALUE vm_exec(struct rb_execution_context_struct *, bool); /* used in JIT-ed code */ MJIT_SYMBOL_EXPORT_END /* vm_eval.c */ diff --git a/mjit_compile.c b/mjit_compile.c index 7e715b7..dc18886 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -280,7 +280,7 @@ compile_inlined_cancel_handler(FILE *f, const struct rb_iseq_constant_body *body https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L280 } // We're not just returning Qundef here so that caller's normal cancel handler can // push back `stack` to `cfp->sp`. - fprintf(f, " return vm_exec(ec, FALSE);\n"); + fprintf(f, " return vm_exec(ec, false);\n"); } // Print the block to cancel JIT execution. diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb index 382e8a3..d1540f6 100644 --- a/tool/ruby_vm/views/_mjit_compile_send.erb +++ b/tool/ruby_vm/views/_mjit_compile_send.erb @@ -85,12 +85,12 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_send.erb#L85 fprintf(f, " vm_call_iseq_setup_normal(ec, reg_cfp, &calling, cc_cme, 0, %d, %d);\n", iseq->body->param.size, iseq->body->local_table_size); if (iseq->body->catch_except_p) { fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); - fprintf(f, " val = vm_exec(ec, TRUE);\n"); + fprintf(f, " val = vm_exec(ec, true);\n"); } else { fprintf(f, " if ((val = mjit_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, " val = vm_exec(ec, false);\n"); fprintf(f, " }\n"); } } diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb index f622467..937cb4a 100644 --- a/tool/ruby_vm/views/mjit_compile.inc.erb +++ b/tool/ruby_vm/views/mjit_compile.inc.erb @@ -37,7 +37,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/mjit_compile.inc.erb#L37 % # GET_SP(): refers to `reg_cfp->sp`, or `(stack + stack_size)` if local_stack_p % # GET_SELF(): refers to `cfp_self` % # GET_LEP(): refers to `VM_EP_LEP(reg_cfp->ep)` -% # EXEC_EC_CFP(): refers to `val = vm_exec(ec, TRUE)` with frame setup +% # EXEC_EC_CFP(): refers to `val = vm_exec(ec, true)` with frame setup % # CALL_METHOD(): using `GET_CFP()` and `EXEC_EC_CFP()` % # TOPN(): refers to `reg_cfp->sp`, or `*(stack + (stack_size - num - 1))` if local_stack_p % # STACK_ADDR_FROM_TOP(): refers to `reg_cfp->sp`, or `stack + (stack_size - num)` if local_stack_p diff --git a/vm.c b/vm.c index 5fc0338..3e775f8 100644 --- a/vm.c +++ b/vm.c @@ -57,7 +57,7 @@ RUBY_FUNC_EXPORTED https://github.com/ruby/ruby/blob/trunk/vm.c#L57 #else MJIT_FUNC_EXPORTED #endif -VALUE vm_exec(rb_execution_context_t *, int); +VALUE vm_exec(rb_execution_context_t *, bool); PUREFUNC(static inline const VALUE *VM_EP_LEP(const VALUE *)); static inline const VALUE * @@ -1262,7 +1262,7 @@ invoke_block(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE self, cons https://github.com/ruby/ruby/blob/trunk/vm.c#L1262 ec->cfp->sp + arg_size, iseq->body->local_table_size - arg_size, iseq->body->stack_max); - return vm_exec(ec, TRUE); + return vm_exec(ec, true); } static VALUE @@ -1292,7 +1292,7 @@ invoke_bmethod(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE self, co https://github.com/ruby/ruby/blob/trunk/vm.c#L1292 me->def->original_id, me->called_id, me->owner, Qnil, FALSE); } VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); - ret = vm_exec(ec, TRUE); + ret = vm_exec(ec, true); EXEC_EVENT_HOOK(ec, RUBY_EVENT_RETURN, self, me->def->original_id, me->called_id, me->owner, ret); if ((hooks = me->def->body.bmethod.hooks) != NULL && @@ -2151,7 +2151,7 @@ vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, https://github.com/ruby/ruby/blob/trunk/vm.c#L2151 VALUE errinfo, VALUE *initial); VALUE -vm_exec(rb_execution_context_t *ec, int mjit_enable_p) +vm_exec(rb_execution_context_t *ec, bool mjit_enable_p) { enum ruby_tag_type state; VALUE result = Qundef; @@ -2408,7 +2408,7 @@ rb_iseq_eval(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/vm.c#L2408 rb_execution_context_t *ec = GET_EC(); VALUE val; vm_set_top_stack(ec, iseq); - val = vm_exec(ec, TRUE); + val = vm_exec(ec, true); return val; } @@ -2419,7 +2419,7 @@ rb_iseq_eval_main(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/vm.c#L2419 VALUE val; vm_set_main_stack(ec, iseq); - val = vm_exec(ec, TRUE); + val = vm_exec(ec, true); return val; } diff --git a/vm_eval.c b/vm_eval.c index afd3338..b5ee1d2 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 https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L20 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, int mjit_enable_p); +VALUE vm_exec(rb_execution_context_t *ec, bool mjit_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); @@ -137,7 +137,7 @@ vm_call0_body(rb_execution_context_t *ec, struct rb_calling_info *calling, const https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L137 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, true); /* CHECK_INTS in this function */ } case VM_METHOD_TYPE_NOTIMPLEMENTED: case VM_METHOD_TYPE_CFUNC: @@ -1544,7 +1544,7 @@ eval_string_with_cref(VALUE self, VALUE src, rb_cref_t *cref, VALUE file, int li https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1544 vm_set_eval_stack(ec, iseq, cref, &block); /* kick */ - return vm_exec(ec, TRUE); + return vm_exec(ec, true); } static VALUE @@ -1565,7 +1565,7 @@ eval_string_with_scope(VALUE scope, VALUE src, VALUE file, int line) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1565 } /* kick */ - return vm_exec(ec, TRUE); + return vm_exec(ec, true); } /* -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/