diff --git a/ChangeLog b/ChangeLog index cfc2d47647..90c543127d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon Nov 19 01:11:59 2012 Naohisa Goto + + * vm_core.h, probes_helper.h (RUBY_DTRACE_FUNC_ENTRY_HOOK, + RUBY_DTRACE_FUNC_RETURN_HOOK): move from vm_core.h to new file + probes_helper.h for narrowing dependency to probes.h. + * common.mk (VM_CORE_H_INCLUDES): remove dependency to probes.h. + * common.mk (vm.$(OBJEXT)): add dependency to probes_helper.h. + * vm.c, vm_insnhelper.c: include probes_helper.h. + Sun Nov 18 20:46:08 2012 Tadayoshi Funaba * bignum.c (rb_cstr_to_inum): should accept underscores of diff --git a/common.mk b/common.mk index 9d34d28a64..3bb98c972b 100644 --- a/common.mk +++ b/common.mk @@ -612,7 +612,7 @@ ID_H_INCLUDES = {$(VPATH)}id.h PROBES_H_INCLUDES = {$(VPATH)}probes.h VM_CORE_H_INCLUDES = {$(VPATH)}vm_core.h {$(VPATH)}thread_$(THREAD_MODEL).h \ {$(VPATH)}node.h {$(VPATH)}method.h {$(VPATH)}ruby_atomic.h \ - $(ID_H_INCLUDES) $(PROBES_H_INCLUDES) + $(ID_H_INCLUDES) addr2line.$(OBJEXT): {$(VPATH)}addr2line.c {$(VPATH)}addr2line.h {$(VPATH)}config.h array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \ @@ -768,7 +768,8 @@ vm.$(OBJEXT): {$(VPATH)}vm.c {$(VPATH)}gc.h {$(VPATH)}iseq.h \ {$(VPATH)}vm_insnhelper.c {$(VPATH)}vm_insnhelper.h {$(VPATH)}vm_exec.c \ {$(VPATH)}vm_exec.h {$(VPATH)}insns.def {$(VPATH)}vmtc.inc \ {$(VPATH)}vm.inc {$(VPATH)}insns.inc {$(VPATH)}debug.h \ - {$(VPATH)}internal.h {$(VPATH)}vm.h {$(VPATH)}constant.h $(PROBES_H_INCLUDES) + {$(VPATH)}internal.h {$(VPATH)}vm.h {$(VPATH)}constant.h \ + $(PROBES_H_INCLUDES) {$(VPATH)}probes_helper.h vm_dump.$(OBJEXT): {$(VPATH)}vm_dump.c $(RUBY_H_INCLUDES) \ $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h {$(VPATH)}addr2line.h \ {$(VPATH)}internal.h diff --git a/probes_helper.h b/probes_helper.h new file mode 100644 index 0000000000..9324cb8872 --- /dev/null +++ b/probes_helper.h @@ -0,0 +1,35 @@ +#ifndef RUBY_PROBES_HELPER_H +#define RUBY_PROBES_HELPER_H + +#include "ruby/ruby.h" +#include "probes.h" + +#define RUBY_DTRACE_FUNC_ENTRY_HOOK(klass, id) \ + if (RUBY_DTRACE_FUNCTION_ENTRY_ENABLED()) { \ + const char * classname = rb_class2name((klass)); \ + const char * methodname = rb_id2name((id)); \ + const char * filename = rb_sourcefile(); \ + if (classname && methodname && filename) { \ + RUBY_DTRACE_FUNCTION_ENTRY( \ + classname, \ + methodname, \ + filename, \ + rb_sourceline()); \ + } \ + } \ + +#define RUBY_DTRACE_FUNC_RETURN_HOOK(klass, id) \ + if (RUBY_DTRACE_FUNCTION_RETURN_ENABLED()) { \ + const char * classname = rb_class2name((klass)); \ + const char * methodname = rb_id2name((id)); \ + const char * filename = rb_sourcefile(); \ + if (classname && methodname && filename) { \ + RUBY_DTRACE_FUNCTION_RETURN( \ + classname, \ + methodname, \ + filename, \ + rb_sourceline()); \ + } \ + } \ + +#endif /* RUBY_PROBES_HELPER_H */ diff --git a/vm.c b/vm.c index f1dd008cd4..d1c1c4b621 100644 --- a/vm.c +++ b/vm.c @@ -19,6 +19,7 @@ #include "iseq.h" #include "eval_intern.h" #include "probes.h" +#include "probes_helper.h" static inline VALUE * VM_EP_LEP(VALUE *ep) diff --git a/vm_core.h b/vm_core.h index 757a3a5a15..dd9e3872e2 100644 --- a/vm_core.h +++ b/vm_core.h @@ -23,7 +23,6 @@ #include "id.h" #include "method.h" #include "ruby_atomic.h" -#include "probes.h" #if defined(_WIN32) #include "thread_win32.h" @@ -899,35 +898,6 @@ rb_threadptr_exec_event_hooks(rb_thread_t *th, rb_event_flag_t flag, VALUE self, } \ } while (0) -#define RUBY_DTRACE_FUNC_ENTRY_HOOK(klass, id) \ - if (RUBY_DTRACE_FUNCTION_ENTRY_ENABLED()) { \ - const char * classname = rb_class2name((klass)); \ - const char * methodname = rb_id2name((id)); \ - const char * filename = rb_sourcefile(); \ - if (classname && methodname && filename) { \ - RUBY_DTRACE_FUNCTION_ENTRY( \ - classname, \ - methodname, \ - filename, \ - rb_sourceline()); \ - } \ - } \ - -#define RUBY_DTRACE_FUNC_RETURN_HOOK(klass, id) \ - if (RUBY_DTRACE_FUNCTION_RETURN_ENABLED()) { \ - const char * classname = rb_class2name((klass)); \ - const char * methodname = rb_id2name((id)); \ - const char * filename = rb_sourcefile(); \ - if (classname && methodname && filename) { \ - RUBY_DTRACE_FUNCTION_RETURN( \ - classname, \ - methodname, \ - filename, \ - rb_sourceline()); \ - } \ - } \ - - #if defined __GNUC__ && __GNUC__ >= 4 #pragma GCC visibility push(default) #endif diff --git a/vm_insnhelper.c b/vm_insnhelper.c index bf524d6fb8..451283eb62 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -14,6 +14,7 @@ #include "constant.h" #include "internal.h" #include "probes.h" +#include "probes_helper.h" /* control stack frame */