diff --git a/ChangeLog b/ChangeLog index 5852e45fd393b4..ffa3c45bd88772 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Tue Nov 13 12:27:11 2012 NARUSE, Yui + + * configure.in: disable dtrace because it doesn't work on FreeBSD. + + * common.mk (clean-local): rm probes.h. + + * common.mk (parse.o): depend $(PROBES_H_INCLUDES). + + * common.mk (.d.h): moved from Makefile.in and use BASERUBY. + + * tool/gen_dummy_probes.rb: reimplemented with ruby because sed is not + available on Windows Microsoft VC++ environment. + +Tue Nov 13 06:50:02 2012 Aaron Patterson + Tue Nov 13 12:30:26 2012 NAKAMURA Usaku * win32/README.win32: added mention about build directory. currently @@ -28,10 +43,10 @@ Tue Nov 13 06:50:02 2012 Aaron Patterson * eval.c (setup_exception): add a probe for when an exception is raised. - + * gc.c: Add DTrace probes for mark begin and end, and sweep begin and end. - + * hash.c (empty_hash_alloc): Add a probe for hash allocation. * insns.def: Add probes for function entry and return. @@ -59,12 +74,12 @@ Tue Nov 13 06:50:02 2012 Aaron Patterson * vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on function entry and return. - + * vm_exec.c: expose instruction number to instruction name function. * vm_insnshelper.c: add function entry and exit probes for cfunc methods. - + * vm_insnhelper.h: vm usage information is always collected, so uncomment the functions. diff --git a/Makefile.in b/Makefile.in index 2c8e7d22527f64..de8b1328e69769 100644 --- a/Makefile.in +++ b/Makefile.in @@ -321,16 +321,6 @@ enc/unicode/name2ctype.h: enc/unicode/name2ctype.kwd @$(ECHO) preprocessing $< $(Q) $(CPP) $(warnflags) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -E $< > $@ -.d.h: - @$(ECHO) translating probes $< - $(Q)if test -n '$(DTRACE)'; then\ - $(DTRACE) -o $@.tmp -h -s $<; \ - sed -e 's/RUBY_/RUBY_DTRACE_/g' $@.tmp | sed -e 's/PROBES_H_TMP/PROBES_H/g' >$@; \ - rm $@.tmp; \ - else \ - sed -f $(srcdir)/tool/gen_dummy_probes.sed $< > $@; \ - fi - clean-local:: $(Q)$(RM) ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output \ enc/encinit.c enc/encinit.$(OBJEXT) diff --git a/common.mk b/common.mk index adf1c246aee5d8..fea9986a2d5dcf 100644 --- a/common.mk +++ b/common.mk @@ -435,7 +435,7 @@ clean: clean-ext clean-local clean-enc clean-golf clean-rdoc clean-capi clean-ex clean-local:: PHONY $(Q)$(RM) $(OBJS) $(MINIOBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES) $(Q)$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) $(ARCHFILE) .*.time - $(Q)$(RM) y.tab.c y.output encdb.h transdb.h prelude.c config.log rbconfig.rb $(ruby_pc) + $(Q)$(RM) y.tab.c y.output encdb.h transdb.h prelude.c config.log rbconfig.rb $(ruby_pc) probes.h clean-ext:: PHONY clean-golf: PHONY $(Q)$(RM) $(GORUBY)$(EXEEXT) $(GOLFOBJS) @@ -614,6 +614,16 @@ 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) +.d.h: + @$(ECHO) translating probes $< + $(Q)if test -n '$(DTRACE)'; then\ + $(DTRACE) -o $@.tmp -h -s $<; \ + sed -e 's/RUBY_/RUBY_DTRACE_/g' $@.tmp | sed -e 's/PROBES_H_TMP/PROBES_H/g' >$@; \ + $(RM) $@.tmp; \ + else \ + $(BASERUBY) $(srcdir)/tool/gen_dummy_probes.rb $< > $@; \ + fi + addr2line.$(OBJEXT): {$(VPATH)}addr2line.c {$(VPATH)}addr2line.h {$(VPATH)}config.h array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) @@ -688,7 +698,7 @@ parse.$(OBJEXT): {$(VPATH)}parse.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h \ {$(VPATH)}regex.h {$(VPATH)}util.h {$(VPATH)}lex.c \ {$(VPATH)}defs/keywords {$(VPATH)}id.c {$(VPATH)}parse.y \ {$(VPATH)}parse.h {$(VPATH)}vm_opts.h \ - {$(VPATH)}internal.h + {$(VPATH)}internal.h $(PROBES_H_INCLUDES) proc.$(OBJEXT): {$(VPATH)}proc.c {$(VPATH)}eval_intern.h \ $(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \ {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}iseq.h diff --git a/configure.in b/configure.in index d2ba707a7b33b5..375d204e4bb75b 100644 --- a/configure.in +++ b/configure.in @@ -374,6 +374,9 @@ if test x"${build}" != x"${host}"; then fi AC_CHECK_TOOL(DTRACE, dtrace) +AS_CASE(["$target_os"], +[freebsd*], [DTRACE=] +) AC_PROG_CC AC_PROG_CXX diff --git a/tool/gen_dummy_probes.rb b/tool/gen_dummy_probes.rb new file mode 100644 index 00000000000000..88ad2ca5bf2667 --- /dev/null +++ b/tool/gen_dummy_probes.rb @@ -0,0 +1,24 @@ +#!/usr/bin/ruby + +text = ARGF.read +text.upcase! + +# remove the pragma declarations +text.gsub!(/^#PRAGMA.*$/, '') + +# replace the provider section with the start of the header file +text.gsub!(/PROVIDER RUBY \{/, "#ifndef\t_PROBES_H\n#define\t_PROBES_H") + +# finish up the #ifndef sandwich +text.gsub!(/\};/, "#endif\t/* _PROBES_H */") + +text.gsub!(/__/, '_') + +text.gsub!(/\([^,)]+\)/, '(arg0)') +text.gsub!(/\([^,)]+,[^,)]+\)/, '(arg0, arg1)') +text.gsub!(/\([^,)]+,[^,)]+,[^,)]+\)/, '(arg0, arg1, arg2)') +text.gsub!(/\([^,)]+,[^,)]+,[^,)]+,[^,)]+\)/, '(arg0, arg1, arg2, arg3)') +text.gsub!(/\([^,)]+,[^,)]+,[^,)]+,[^,)]+,[^,)]+\)/, '(arg0, arg1, arg2, arg3, arg4)') + +text.gsub!(/ *PROBE ([^\(]*)(\([^\)]*\));/, "#define RUBY_DTRACE_\\1_ENABLED() 0\n#define RUBY_DTRACE_\\1\\2\ do \{ \} while\(0\)") +print text diff --git a/tool/gen_dummy_probes.sed b/tool/gen_dummy_probes.sed deleted file mode 100644 index 476f6f633bcce8..00000000000000 --- a/tool/gen_dummy_probes.sed +++ /dev/null @@ -1,24 +0,0 @@ - -# upper case everything -y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ - -# remove the pragma declarations -s/^#PRAGMA.*$// - -# replace the provider section with the start of the header file -s/PROVIDER RUBY {/#ifndef _PROBES_H\ -#define _PROBES_H/ - -# finish up the #ifndef sandwich -s/};/#endif \/* _PROBES_H *\// - -s/__/_/g - -s/([^,)]\{1,\})/(arg0)/ -s/([^,)]\{1,\},[^,)]\{1,\})/(arg0, arg1)/ -s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(arg0, arg1, arg2)/ -s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(arg0, arg1, arg2, arg3)/ -s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(arg0, arg1, arg2, arg3, arg4)/ - -s/[ ]*PROBE[ ]\([^\(]*\)\(([^\)]*)\);/#define RUBY_DTRACE_\1_ENABLED() 0\ -#define RUBY_DTRACE_\1\2\ do \{ \} while\(0\)/