diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-28 10:43:30 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-28 10:43:30 +0000 |
commit | 9ca50884282cb91e0d6dba6a8dfcfd4fc0eceea5 (patch) | |
tree | 8edbfb4a6a4b4f156752643c3cf5715ef4232405 | |
parent | 796e1990beb5134e445606298fd86d9552a06f69 (diff) | |
download | ruby-9ca50884282cb91e0d6dba6a8dfcfd4fc0eceea5.tar.gz |
`th` -> `ec` for rb_vm_rewind_cfp.
* vm.c (rb_vm_rewind_cfp): accepts `ec` instead of `th`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | eval.c | 40 | ||||
-rw-r--r-- | vm.c | 10 | ||||
-rw-r--r-- | vm_core.h | 2 | ||||
-rw-r--r-- | vm_eval.c | 4 |
4 files changed, 28 insertions, 28 deletions
@@ -896,13 +896,13 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1, 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), VALUE data1, /* 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), VALUE data1, 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), VALUE data1, 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 data, int *pstate) { 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; @@ -542,15 +542,15 @@ rb_vm_pop_cfunc_frame(void) } 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(); @@ -1547,7 +1547,7 @@ VALUE rb_name_err_mesg_new(VALUE mesg, VALUE recv, VALUE method); 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); @@ -1136,7 +1136,7 @@ rb_iterate0(VALUE (* it_proc) (VALUE), VALUE data1, 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_call_func *func, VALUE data, 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; |