diff options
Diffstat (limited to 'yarvcore.h')
-rw-r--r-- | yarvcore.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/yarvcore.h b/yarvcore.h index 3fdb7417ff..d72ed96951 100644 --- a/yarvcore.h +++ b/yarvcore.h @@ -719,4 +719,32 @@ void rb_thread_execute_interrupts(rb_thread_t *); #define RUBY_VM_CHECK_INTS() \ RUBY_VM_CHECK_INTS_TH(GET_THREAD()) +/* tracer */ +static void inline +exec_event_hooks(rb_event_hook_t *hook, rb_event_flag_t flag, VALUE self, ID id, VALUE klass) +{ + while (hook) { + if (flag & hook->flag) { + (*hook->func)(flag, hook->data, self, id, klass); + } + hook = hook->next; + } +} + +#define EXEC_EVENT_HOOK(th, flag, self, id, klass) do { \ + rb_event_flag_t wait_event__ = th->event_flags; \ + if (UNLIKELY(wait_event__)) { \ + if (wait_event__ & (flag | RUBY_EVENT_VM)) { \ + VALUE self__ = (self), klass__ = (klass); \ + ID id__ = (id); \ + if (wait_event__ & flag) { \ + exec_event_hooks(th->event_hooks, flag, self__, id__, klass__); \ + } \ + if (wait_event__ & RUBY_EVENT_VM) { \ + exec_event_hooks(th->vm->event_hooks, flag, self__, id__, klass__); \ + } \ + } \ + } \ +} while (0) + #endif /* _YARVCORE_H_INCLUDED_ */ |