summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eval.c40
-rw-r--r--vm.c10
-rw-r--r--vm_core.h2
-rw-r--r--vm_eval.c4
4 files changed, 28 insertions, 28 deletions
diff --git a/eval.c b/eval.c
index 178b8f6696..ab1bcf5ff2 100644
--- a/eval.c
+++ b/eval.c
@@ -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;
diff --git a/vm.c b/vm.c
index eba1791c45..25ee6d0b1b 100644
--- a/vm.c
+++ b/vm.c
@@ -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();
diff --git a/vm_core.h b/vm_core.h
index 7c04d5f022..87b8b20923 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -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);
diff --git a/vm_eval.c b/vm_eval.c
index c2b9dc532f..48b20d777f 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -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;