ruby-changes:48393
From: ko1 <ko1@a...>
Date: Sat, 28 Oct 2017 19:43:34 +0900 (JST)
Subject: [ruby-changes:48393] ko1:r60507 (trunk): `th` -> `ec` for rb_vm_rewind_cfp.
ko1 2017-10-28 19:43:30 +0900 (Sat, 28 Oct 2017) New Revision: 60507 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60507 Log: `th` -> `ec` for rb_vm_rewind_cfp. * vm.c (rb_vm_rewind_cfp): accepts `ec` instead of `th`. Modified files: trunk/eval.c trunk/vm.c trunk/vm_core.h trunk/vm_eval.c Index: vm_core.h =================================================================== --- vm_core.h (revision 60506) +++ vm_core.h (revision 60507) @@ -1547,7 +1547,7 @@ VALUE rb_name_err_mesg_new(VALUE mesg, V https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1547 void rb_vm_stack_to_heap(rb_thread_t *th); void ruby_thread_init_stack(rb_thread_t *th); int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp); -void rb_vm_rewind_cfp(rb_thread_t *th, rb_control_frame_t *cfp); +void rb_vm_rewind_cfp(rb_execution_context_t *ec, rb_control_frame_t *cfp); VALUE rb_vm_bh_to_procval(rb_execution_context_t *ec, VALUE block_handler); void rb_vm_register_special_exception_str(enum ruby_special_exceptions sp, VALUE exception_class, VALUE mesg); Index: vm_eval.c =================================================================== --- vm_eval.c (revision 60506) +++ vm_eval.c (revision 60507) @@ -1136,7 +1136,7 @@ rb_iterate0(VALUE (* it_proc) (VALUE), V https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1136 const rb_control_frame_t *const escape_cfp = THROW_DATA_CATCH_FRAME(err); if (cfp == escape_cfp) { - rb_vm_rewind_cfp(th, cfp); + rb_vm_rewind_cfp(th->ec, cfp); state = 0; th->ec->tag->state = TAG_NONE; @@ -1995,7 +1995,7 @@ vm_catch_protect(VALUE tag, rb_block_cal https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1995 val = (*func)(tag, data, 1, (const VALUE *)&tag, Qnil); } else if (state == TAG_THROW && THROW_DATA_VAL((struct vm_throw_data *)th->ec->errinfo) == tag) { - rb_vm_rewind_cfp(th, saved_cfp); + rb_vm_rewind_cfp(th->ec, saved_cfp); val = th->ec->tag->retval; th->ec->errinfo = Qnil; state = 0; Index: eval.c =================================================================== --- eval.c (revision 60506) +++ eval.c (revision 60507) @@ -896,13 +896,13 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), V https://github.com/ruby/ruby/blob/trunk/eval.c#L896 VALUE (* r_proc) (ANYARGS), VALUE data2, ...) { enum ruby_tag_type state; - rb_thread_t * volatile th = GET_THREAD(); - rb_control_frame_t *volatile cfp = th->ec->cfp; + rb_execution_context_t * volatile ec = GET_EC(); + rb_control_frame_t *volatile cfp = ec->cfp; volatile VALUE result = Qfalse; - volatile VALUE e_info = th->ec->errinfo; + volatile VALUE e_info = ec->errinfo; va_list args; - EC_PUSH_TAG(th->ec); + EC_PUSH_TAG(ec); if ((state = EC_EXEC_TAG()) == TAG_NONE) { retry_entry: result = (*b_proc) (data1); @@ -911,13 +911,13 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), V https://github.com/ruby/ruby/blob/trunk/eval.c#L911 /* escape from r_proc */ if (state == TAG_RETRY) { state = 0; - th->ec->errinfo = Qnil; + ec->errinfo = Qnil; result = Qfalse; goto retry_entry; } } else { - rb_vm_rewind_cfp(th, cfp); + rb_vm_rewind_cfp(ec, cfp); if (state == TAG_RAISE) { int handle = FALSE; @@ -925,7 +925,7 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), V https://github.com/ruby/ruby/blob/trunk/eval.c#L925 va_init_list(args, data2); while ((eclass = va_arg(args, VALUE)) != 0) { - if (rb_obj_is_kind_of(th->ec->errinfo, eclass)) { + if (rb_obj_is_kind_of(ec->errinfo, eclass)) { handle = TRUE; break; } @@ -936,15 +936,15 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), V https://github.com/ruby/ruby/blob/trunk/eval.c#L936 result = Qnil; state = 0; if (r_proc) { - result = (*r_proc) (data2, th->ec->errinfo); + result = (*r_proc) (data2, ec->errinfo); } - th->ec->errinfo = e_info; + ec->errinfo = e_info; } } } EC_POP_TAG(); if (state) - EC_JUMP_TAG(th->ec, state); + EC_JUMP_TAG(ec, state); return result; } @@ -993,24 +993,24 @@ rb_protect(VALUE (* proc) (VALUE), VALUE https://github.com/ruby/ruby/blob/trunk/eval.c#L993 { volatile VALUE result = Qnil; volatile enum ruby_tag_type state; - rb_thread_t * volatile th = GET_THREAD(); - rb_control_frame_t *volatile cfp = th->ec->cfp; + rb_execution_context_t * volatile ec = GET_EC(); + rb_control_frame_t *volatile cfp = ec->cfp; struct rb_vm_protect_tag protect_tag; rb_jmpbuf_t org_jmpbuf; - protect_tag.prev = th->ec->protect_tag; + protect_tag.prev = ec->protect_tag; - EC_PUSH_TAG(th->ec); - th->ec->protect_tag = &protect_tag; - MEMCPY(&org_jmpbuf, &(th)->root_jmpbuf, rb_jmpbuf_t, 1); + EC_PUSH_TAG(ec); + ec->protect_tag = &protect_tag; + MEMCPY(&org_jmpbuf, &rb_ec_thread_ptr(ec)->root_jmpbuf, rb_jmpbuf_t, 1); if ((state = EC_EXEC_TAG()) == TAG_NONE) { - SAVE_ROOT_JMPBUF(th, result = (*proc) (data)); + SAVE_ROOT_JMPBUF(rb_ec_thread_ptr(ec), result = (*proc) (data)); } else { - rb_vm_rewind_cfp(th, cfp); + rb_vm_rewind_cfp(ec, cfp); } - MEMCPY(&(th)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1); - th->ec->protect_tag = protect_tag.prev; + MEMCPY(&rb_ec_thread_ptr(ec)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1); + ec->protect_tag = protect_tag.prev; EC_POP_TAG(); if (pstate != NULL) *pstate = state; Index: vm.c =================================================================== --- vm.c (revision 60506) +++ vm.c (revision 60507) @@ -542,15 +542,15 @@ rb_vm_pop_cfunc_frame(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L542 } void -rb_vm_rewind_cfp(rb_thread_t *th, rb_control_frame_t *cfp) +rb_vm_rewind_cfp(rb_execution_context_t *ec, rb_control_frame_t *cfp) { /* check skipped frame */ - while (th->ec->cfp != cfp) { + while (ec->cfp != cfp) { #if VMDEBUG - printf("skipped frame: %s\n", vm_frametype_name(th->ec->cfp)); + printf("skipped frame: %s\n", vm_frametype_name(ec->cfp)); #endif - if (VM_FRAME_TYPE(th->ec->cfp) != VM_FRAME_MAGIC_CFUNC) { - rb_vm_pop_frame(th->ec); + if (VM_FRAME_TYPE(ec->cfp) != VM_FRAME_MAGIC_CFUNC) { + rb_vm_pop_frame(ec); } else { /* unlikely path */ rb_vm_pop_cfunc_frame(); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/