diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-28 14:27:49 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-28 14:27:49 +0000 |
commit | 478770b81a1839d17de0c75edbb84bc937d97f91 (patch) | |
tree | fb3e3b2351ee24ff78d21116d18b9604c4a53fa0 /vm_trace.c | |
parent | 6ea99f4571a52a0de5232a41f17ef7533d14e910 (diff) | |
download | ruby-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 'vm_trace.c')
-rw-r--r-- | vm_trace.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/vm_trace.c b/vm_trace.c index 0f2323284f..7b8c76b3b4 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -304,31 +304,31 @@ rb_threadptr_exec_event_hooks_orig(rb_trace_arg_t *trace_arg, int pop_p) rb_thread_t *th = trace_arg->th; if (trace_arg->event & RUBY_INTERNAL_EVENT_MASK) { - if (th->trace_arg && (th->trace_arg->event & RUBY_INTERNAL_EVENT_MASK)) { + if (th->ec.trace_arg && (th->ec.trace_arg->event & RUBY_INTERNAL_EVENT_MASK)) { /* skip hooks because this thread doing INTERNAL_EVENT */ } else { - rb_trace_arg_t *prev_trace_arg = th->trace_arg; + rb_trace_arg_t *prev_trace_arg = th->ec.trace_arg; th->vm->trace_running++; - th->trace_arg = trace_arg; + th->ec.trace_arg = trace_arg; exec_hooks_unprotected(th, &th->event_hooks, trace_arg); exec_hooks_unprotected(th, &th->vm->event_hooks, trace_arg); - th->trace_arg = prev_trace_arg; + th->ec.trace_arg = prev_trace_arg; th->vm->trace_running--; } } else { - if (th->trace_arg == 0 && /* check reentrant */ + if (th->ec.trace_arg == NULL && /* check reentrant */ trace_arg->self != rb_mRubyVMFrozenCore /* skip special methods. TODO: remove it. */) { - const VALUE errinfo = th->errinfo; + const VALUE errinfo = th->ec.errinfo; const VALUE old_recursive = th->ec.local_storage_recursive_hash; int state = 0; th->ec.local_storage_recursive_hash = th->ec.local_storage_recursive_hash_for_trace; - th->errinfo = Qnil; + th->ec.errinfo = Qnil; th->vm->trace_running++; - th->trace_arg = trace_arg; + th->ec.trace_arg = trace_arg; { /* thread local traces */ state = exec_hooks_protected(th, &th->event_hooks, trace_arg); @@ -338,10 +338,10 @@ rb_threadptr_exec_event_hooks_orig(rb_trace_arg_t *trace_arg, int pop_p) state = exec_hooks_protected(th, &th->vm->event_hooks, trace_arg); if (state) goto terminate; - th->errinfo = errinfo; + th->ec.errinfo = errinfo; } terminate: - th->trace_arg = 0; + th->ec.trace_arg = NULL; th->vm->trace_running--; th->ec.local_storage_recursive_hash_for_trace = th->ec.local_storage_recursive_hash; @@ -379,12 +379,12 @@ rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg) VALUE result = Qnil; rb_thread_t *volatile th = GET_THREAD(); enum ruby_tag_type state; - const int tracing = th->trace_arg ? 1 : 0; + const int tracing = th->ec.trace_arg ? 1 : 0; rb_trace_arg_t dummy_trace_arg; dummy_trace_arg.event = 0; if (!tracing) th->vm->trace_running++; - if (!th->trace_arg) th->trace_arg = &dummy_trace_arg; + if (!th->ec.trace_arg) th->ec.trace_arg = &dummy_trace_arg; raised = rb_threadptr_reset_raised(th); @@ -398,7 +398,7 @@ rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg) rb_threadptr_set_raised(th); } - if (th->trace_arg == &dummy_trace_arg) th->trace_arg = 0; + if (th->ec.trace_arg == &dummy_trace_arg) th->ec.trace_arg = 0; if (!tracing) th->vm->trace_running--; if (state) { @@ -703,7 +703,7 @@ tpptr(VALUE tpval) static rb_trace_arg_t * get_trace_arg(void) { - rb_trace_arg_t *trace_arg = GET_THREAD()->trace_arg; + rb_trace_arg_t *trace_arg = GET_THREAD()->ec.trace_arg; if (trace_arg == 0) { rb_raise(rb_eRuntimeError, "access from outside"); } @@ -1307,7 +1307,7 @@ static VALUE tracepoint_inspect(VALUE self) { rb_tp_t *tp = tpptr(self); - rb_trace_arg_t *trace_arg = GET_THREAD()->trace_arg; + rb_trace_arg_t *trace_arg = GET_THREAD()->ec.trace_arg; if (trace_arg) { switch (trace_arg->event) { @@ -1591,9 +1591,9 @@ rb_postponed_job_flush(rb_vm_t *vm) rb_thread_t *th = GET_THREAD(); const unsigned long block_mask = POSTPONED_JOB_INTERRUPT_MASK|TRAP_INTERRUPT_MASK; unsigned long saved_mask = th->interrupt_mask & block_mask; - VALUE saved_errno = th->errinfo; + VALUE saved_errno = th->ec.errinfo; - th->errinfo = Qnil; + th->ec.errinfo = Qnil; /* mask POSTPONED_JOB dispatch */ th->interrupt_mask |= block_mask; { @@ -1611,5 +1611,5 @@ rb_postponed_job_flush(rb_vm_t *vm) } /* restore POSTPONED_JOB mask */ th->interrupt_mask &= ~(saved_mask ^ block_mask); - th->errinfo = saved_errno; + th->ec.errinfo = saved_errno; } |