aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-28 14:27:49 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-28 14:27:49 +0000
commit478770b81a1839d17de0c75edbb84bc937d97f91 (patch)
treefb3e3b2351ee24ff78d21116d18b9604c4a53fa0 /cont.c
parent6ea99f4571a52a0de5232a41f17ef7533d14e910 (diff)
downloadruby-478770b81a1839d17de0c75edbb84bc937d97f91.tar.gz
move fields to ec.
* vm_core.h (rb_thread.h): move errinfo and trace_arg to rb_execution_context_t. * cont.c (fiber_switch, rb_cont_call): do not restore "trace_arg" here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/cont.c b/cont.c
index 251b943110..32a4aa57b6 100644
--- a/cont.c
+++ b/cont.c
@@ -408,15 +408,12 @@ cont_save_thread(rb_context_t *cont, rb_thread_t *th)
{
rb_thread_t *sth = &cont->saved_thread;
+ VM_ASSERT(th->status == THREAD_RUNNABLE);
+
/* save thread context */
sth->ec = th->ec;
-
- VM_ASSERT(th->status == THREAD_RUNNABLE);
- sth->errinfo = th->errinfo;
sth->first_proc = th->first_proc;
- sth->trace_arg = th->trace_arg;
-
/* saved_thread->machine.stack_(start|end) should be NULL */
/* because it may happen GC afterward */
sth->machine.stack_start = 0;
@@ -548,6 +545,8 @@ cont_restore_thread(rb_context_t *cont)
th->ec.root_lep = sth->ec.root_lep;
th->ec.root_svar = sth->ec.root_svar;
th->ec.ensure_list = sth->ec.ensure_list;
+ th->ec.errinfo = sth->ec.errinfo;
+ th->ec.trace_arg = sth->ec.trace_arg;
}
else {
/* fiber */
@@ -556,7 +555,6 @@ cont_restore_thread(rb_context_t *cont)
th->fiber = (rb_fiber_t*)cont;
}
- th->errinfo = sth->errinfo;
th->first_proc = sth->first_proc;
VM_ASSERT(sth->status == THREAD_RUNNABLE);
@@ -1067,8 +1065,6 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
cont->argc = argc;
cont->value = make_passing_arg(argc, argv);
- /* restore `tracing' context. see [Feature #4347] */
- th->trace_arg = cont->saved_thread.trace_arg;
cont_restore_0(cont, &contval);
return Qnil; /* unreachable */
}
@@ -1261,7 +1257,7 @@ rb_fiber_start(void)
GetProcPtr(cont->saved_thread.first_proc, proc);
argv = (argc = cont->argc) > 1 ? RARRAY_CONST_PTR(args) : &args;
cont->value = Qnil;
- th->errinfo = Qnil;
+ th->ec.errinfo = Qnil;
th->ec.root_lep = rb_vm_proc_local_ep(cont->saved_thread.first_proc);
th->ec.root_svar = Qfalse;
fib->status = FIBER_RUNNING;
@@ -1273,10 +1269,10 @@ rb_fiber_start(void)
if (state) {
if (state == TAG_RAISE || state == TAG_FATAL) {
- rb_threadptr_pending_interrupt_enque(th, th->errinfo);
+ rb_threadptr_pending_interrupt_enque(th, th->ec.errinfo);
}
else {
- VALUE err = rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
+ VALUE err = rb_vm_make_jump_tag_but_local_jump(state, th->ec.errinfo);
if (!NIL_P(err))
rb_threadptr_pending_interrupt_enque(th, err);
}
@@ -1445,10 +1441,6 @@ fiber_switch(rb_fiber_t *fib, int argc, const VALUE *argv, int is_resume)
if (is_resume) {
fib->prev = fiber_current();
}
- else {
- /* restore `tracing' context. see [Feature #4347] */
- th->trace_arg = cont->saved_thread.trace_arg;
- }
cont->argc = argc;
cont->value = make_passing_arg(argc, argv);