Remove an unused argument in vm_exec_core

This commit is contained in:
Takashi Kokubun 2023-07-27 17:31:12 -07:00
parent 38be9a9b72
commit 8c7cf2de98
2 changed files with 11 additions and 15 deletions

20
vm.c
View File

@ -2297,8 +2297,7 @@ hook_before_rewind(rb_execution_context_t *ec, const rb_control_frame_t *cfp,
*/ */
static inline VALUE static inline VALUE
vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, VALUE errinfo);
VALUE errinfo, VALUE *initial);
// for non-Emscripten Wasm build, use vm_exec with optimized setjmp for runtime performance // for non-Emscripten Wasm build, use vm_exec with optimized setjmp for runtime performance
#if defined(__wasm__) && !defined(__EMSCRIPTEN__) #if defined(__wasm__) && !defined(__EMSCRIPTEN__)
@ -2306,7 +2305,6 @@ vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state,
struct rb_vm_exec_context { struct rb_vm_exec_context {
rb_execution_context_t *ec; rb_execution_context_t *ec;
struct rb_vm_tag *tag; struct rb_vm_tag *tag;
VALUE initial;
VALUE result; VALUE result;
enum ruby_tag_type state; enum ruby_tag_type state;
}; };
@ -2321,9 +2319,9 @@ vm_exec_enter_vm_loop(rb_execution_context_t *ec, struct rb_vm_exec_context *ctx
ctx->result = ec->errinfo; ctx->result = ec->errinfo;
rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW | RAISED_NOMEMORY); rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW | RAISED_NOMEMORY);
while (UNDEF_P(ctx->result = vm_exec_handle_exception(ec, ctx->state, ctx->result, &ctx->initial))) { while (UNDEF_P(ctx->result = vm_exec_handle_exception(ec, ctx->state, ctx->result))) {
/* caught a jump, exec the handler */ /* caught a jump, exec the handler */
ctx->result = vm_exec_core(ec, ctx->initial); ctx->result = vm_exec_core(ec);
vm_loop_start: vm_loop_start:
VM_ASSERT(ec->tag == _tag); VM_ASSERT(ec->tag == _tag);
/* when caught `throw`, `tag.state` is set. */ /* when caught `throw`, `tag.state` is set. */
@ -2339,7 +2337,7 @@ vm_exec_bottom_main(void *context)
ctx->state = TAG_NONE; ctx->state = TAG_NONE;
if (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); ctx->result = vm_exec_core(ctx->ec);
} }
vm_exec_enter_vm_loop(ctx->ec, ctx, ctx->tag, true); vm_exec_enter_vm_loop(ctx->ec, ctx, ctx->tag, true);
} }
@ -2383,23 +2381,22 @@ vm_exec(rb_execution_context_t *ec)
{ {
enum ruby_tag_type state; enum ruby_tag_type state;
VALUE result = Qundef; VALUE result = Qundef;
VALUE initial = 0;
EC_PUSH_TAG(ec); EC_PUSH_TAG(ec);
_tag.retval = Qnil; _tag.retval = Qnil;
if ((state = EC_EXEC_TAG()) == TAG_NONE) { if ((state = EC_EXEC_TAG()) == TAG_NONE) {
if (UNDEF_P(result = jit_exec(ec))) { if (UNDEF_P(result = jit_exec(ec))) {
result = vm_exec_core(ec, initial); result = vm_exec_core(ec);
} }
goto vm_loop_start; /* fallback to the VM */ goto vm_loop_start; /* fallback to the VM */
} }
else { else {
result = ec->errinfo; result = ec->errinfo;
rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW | RAISED_NOMEMORY); rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW | RAISED_NOMEMORY);
while (UNDEF_P(result = vm_exec_handle_exception(ec, state, result, &initial))) { while (UNDEF_P(result = vm_exec_handle_exception(ec, state, result))) {
/* caught a jump, exec the handler */ /* caught a jump, exec the handler */
result = vm_exec_core(ec, initial); result = vm_exec_core(ec);
vm_loop_start: vm_loop_start:
VM_ASSERT(ec->tag == &_tag); VM_ASSERT(ec->tag == &_tag);
/* when caught `throw`, `tag.state` is set. */ /* when caught `throw`, `tag.state` is set. */
@ -2413,8 +2410,7 @@ vm_exec(rb_execution_context_t *ec)
#endif #endif
static inline VALUE static inline VALUE
vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, VALUE errinfo)
VALUE errinfo, VALUE *initial)
{ {
struct vm_throw_data *err = (struct vm_throw_data *)errinfo; struct vm_throw_data *err = (struct vm_throw_data *)errinfo;

View File

@ -42,7 +42,7 @@ static void vm_analysis_insn(int insn);
#if !OPT_CALL_THREADED_CODE #if !OPT_CALL_THREADED_CODE
static VALUE static VALUE
vm_exec_core(rb_execution_context_t *ec, VALUE initial) vm_exec_core(rb_execution_context_t *ec)
{ {
#if defined(__GNUC__) && defined(__i386__) #if defined(__GNUC__) && defined(__i386__)
DECL_SC_REG(const VALUE *, pc, "di"); DECL_SC_REG(const VALUE *, pc, "di");
@ -112,7 +112,7 @@ vm_exec_core(rb_execution_context_t *ec, VALUE initial)
const void ** const void **
rb_vm_get_insns_address_table(void) rb_vm_get_insns_address_table(void)
{ {
return (const void **)vm_exec_core(0, 0); return (const void **)vm_exec_core(0);
} }
#else /* OPT_CALL_THREADED_CODE */ #else /* OPT_CALL_THREADED_CODE */
@ -127,7 +127,7 @@ rb_vm_get_insns_address_table(void)
} }
static VALUE static VALUE
vm_exec_core(rb_execution_context_t *ec, VALUE initial) vm_exec_core(rb_execution_context_t *ec)
{ {
register rb_control_frame_t *reg_cfp = ec->cfp; register rb_control_frame_t *reg_cfp = ec->cfp;
rb_thread_t *th; rb_thread_t *th;