summaryrefslogtreecommitdiff
path: root/yarvcore.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-02 12:49:35 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-02 12:49:35 +0000
commitee457d92c2d99d85f61346ccd7dd3a6c21b294b6 (patch)
treeb4be9dc0cdc75cfb3f7c329855251f83352b931e /yarvcore.h
parent0a75feb94adbce32b35e23e11b58ace9a2a3e924 (diff)
* compile.c: rename iseq_translate_direct_threaded_code()
to iseq_translate_threaded_code(). * eval_intern.h, yarvcore.h: mv EXEC_EVENT_HOOK() and exec_event_hooks() to yarvcore.h. * insnhelper.ci, vm.c: mv yarv_finish_insn_seq to vm.c. * insns.def (opt_call_c_function): fix to use RESTORE_REGS(). * iseq.c (rb_iseq_build_for_ruby2cext): fix to allocate iseq. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'yarvcore.h')
-rw-r--r--yarvcore.h28
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_ */