From a73894337a830cdd32a913964f3150bc35269975 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 19 Apr 2007 10:37:08 +0000 Subject: * eval.c, node.h, thread.c, yarvcore.[ch], eval_intern.h: support set_trace_func (incomplete. id and klass don't be passed). And support Thread#set_trace_func which hook only specified thread and Thread#add_trace_func which add new trace func instead of replace old one. C level API was modified. See thread.c (logic) and yarvcore.h (data structures). * vm.c, vm_macro.def: add hook points. * compile.c, insns.def: fix "trace" instruction. * iseq.c, vm_macro.h: add compile option "trace_instruction". * test/ruby/test_settracefunc.rb: hook "c-return" of set_trace_func. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- yarvcore.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'yarvcore.c') diff --git a/yarvcore.c b/yarvcore.c index d8d332f9e7..7d6869ad5b 100644 --- a/yarvcore.c +++ b/yarvcore.c @@ -167,6 +167,15 @@ vm_mark_each_thread_func(st_data_t key, st_data_t value, st_data_t dummy) return ST_CONTINUE; } +static void +mark_event_hooks(rb_event_hook_t *hook) +{ + while (hook) { + rb_gc_mark(hook->data); + hook = hook->next; + } +} + static void vm_mark(void *ptr) { @@ -181,6 +190,8 @@ vm_mark(void *ptr) MARK_UNLESS_NULL(vm->mark_object_ary); MARK_UNLESS_NULL(vm->last_status); MARK_UNLESS_NULL(vm->loaded_features); + + mark_event_hooks(vm->event_hooks); } MARK_REPORT_LEAVE("vm"); @@ -289,6 +300,8 @@ thread_mark(void *ptr) (VALUE *)(&th->machine_regs) + sizeof(th->machine_regs) / sizeof(VALUE)); } + + mark_event_hooks(th->event_hooks); } MARK_UNLESS_NULL(th->stat_insn_usage); -- cgit v1.2.3