From 295bc2fe2577336807db6e2c30bd642bdb6482bc Mon Sep 17 00:00:00 2001 From: yugui Date: Tue, 5 Jan 2010 05:59:23 +0000 Subject: [PATCH] removes the dtrace support. reverts r26239, r26238 and r26235. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- Makefile.in | 41 ++--------------- NEWS | 14 ------ common.mk | 17 +++---- compile.c | 1 - configure.in | 96 --------------------------------------- defs/dtrace.d | 41 ----------------- eval.c | 9 +--- ext/probe/extconf.rb | 3 -- ext/probe/probe.c | 47 ------------------- gc.c | 8 ---- include/ruby/ruby.h | 21 ++------- include/ruby/trace.h | 105 ------------------------------------------- insns.def | 24 ---------- iseq.c | 21 --------- lib/mkmf.rb | 21 +++------ thread.c | 12 ----- thread_pthread.c | 2 - tool/rbinstall.rb | 2 +- variable.c | 21 --------- vm.c | 1 - vm_core.h | 9 ++++ vm_exec.h | 35 +-------------- win32/Makefile.sub | 1 - 23 files changed, 31 insertions(+), 521 deletions(-) delete mode 100644 defs/dtrace.d delete mode 100644 ext/probe/extconf.rb delete mode 100644 ext/probe/probe.c delete mode 100644 include/ruby/trace.h diff --git a/Makefile.in b/Makefile.in index 58609f63fe..f328d2ad34 100644 --- a/Makefile.in +++ b/Makefile.in @@ -52,7 +52,6 @@ debugflags = @debugflags@ warnflags = @warnflags@ XCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) @XCFLAGS@ CPPFLAGS = @CPPFLAGS@ -CPPOUTFILE = @CPPOUTFILE@ LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@ EXTLDFLAGS = XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS) @@ -67,10 +66,6 @@ ARCHMINIOBJS = @MINIOBJS@ BUILTIN_ENCOBJS = @BUILTIN_ENCOBJS@ BUILTIN_TRANSSRCS = @BUILTIN_TRANSSRCS@ BUILTIN_TRANSOBJS = @BUILTIN_TRANSOBJS@ -DTRACE_OBJ = @DTRACE_OBJ@ -MINIDTRACE_OBJ = @MINIDTRACE_OBJ@ -GOLFDTRACE_OBJ = @GOLFDTRACE_OBJ@ -LIBRUBY_DTRACE_OBJ = @LIBRUBY_DTRACE_OBJ@ RUBY_BASE_NAME=@RUBY_BASE_NAME@ RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@ @@ -97,7 +92,6 @@ LIBRUBYARG_STATIC = @LIBRUBYARG_STATIC@ LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@ THREAD_MODEL = @THREAD_MODEL@ -TRACING_MODEL = @TRACING_MODEL@ PREP = @PREP@ ARCHFILE = @ARCHFILE@ @@ -121,10 +115,8 @@ IFCHANGE = $(srcdir)/tool/ifchange SET_LC_MESSAGES = env LC_MESSAGES=C OBJDUMP = @OBJDUMP@ OBJCOPY = @OBJCOPY@ -DTRACE = @DTRACE@ VCS = @VCS@ VCSUP = @VCSUP@ -DOXYGEN = @DOXYGEN@ OBJEXT = @OBJEXT@ ASMEXT = S @@ -147,37 +139,28 @@ all: miniruby$(EXEEXT): @-if test -f $@; then $(MV) -f $@ $@.old; $(RM) $@.old; fi - $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(MINIDTRACE_OBJ) $(LIBS) $(OUTFLAG)$@ -$(MINIDTRACE_OBJ): $(arch_hdrdir)/ruby/dtrace.d $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) - $(DTRACE) -G -o $@ -s $(arch_hdrdir)/ruby/dtrace.d $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) + $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(LIBS) $(OUTFLAG)$@ $(PROGRAM): @$(RM) $@ - $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(DTRACE_OBJ) $(LIBRUBYARG) $(LIBS) $(OUTFLAG)$@ -$(DTRACE_OBJ): $(arch_hdrdir)/ruby/dtrace.d $(MAINOBJ) $(EXTOBJS) - $(DTRACE) -G -o $@ -s $(arch_hdrdir)/ruby/dtrace.d $(MAINOBJ) $(EXTOBJS) -$(GOLFDTRACE_OBJ): $(arch_hdrdir)/ruby/dtrace.d $(GOLFOBJS) $(EXTOBJS) - $(DTRACE) -G -o $@ -s $(arch_hdrdir)/ruby/dtrace.d $(GOLFOBJS) $(EXTOBJS) + $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) $(OUTFLAG)$@ # We must `rm' the library each time this rule is invoked because "updating" a # MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not # supported. $(LIBRUBY_A): @$(RM) $@ - $(AR) $(ARFLAGS) $@ $(OBJS) $(DMYEXT) $(LIBRUBY_DTRACE_OBJ) + $(AR) $(ARFLAGS) $@ $(OBJS) $(DMYEXT) @-$(RANLIB) $@ 2> /dev/null || true $(LIBRUBY_SO): @-$(PRE_LIBRUBY_UPDATE) - $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(LIBRUBY_DTRACE_OBJ) $(SOLIBS) $(OUTFLAG)$@ + $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(OUTFLAG)$@ -$(OBJCOPY) -w -L '@EXPORT_PREFIX@Init_*' -L '@EXPORT_PREFIX@*_threadptr_*' $@ @-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \ File.symlink "$(LIBRUBY_SO)", link}' \ $(LIBRUBY_ALIASES) || true -$(LIBRUBY_DTRACE_OBJ): $(arch_hdrdir)/ruby/dtrace.d $(OBJS) $(DMYEXT) - $(DTRACE) -G -o $@ -s $(arch_hdrdir)/ruby/dtrace.d $(OBJS) $(DMYEXT) - fake: $(arch)-fake.rb $(arch)-fake.rb: config.status @./config.status --file=$@:$(srcdir)/template/fake.rb.in @@ -205,22 +188,6 @@ $(srcdir)/configure: $(srcdir)/configure.in incs: id.h -$(arch_hdrdir)/ruby/trace_dtrace.h: $(arch_hdrdir)/ruby/dtrace.d - $(DTRACE) -h -o $@ -s $(arch_hdrdir)/ruby/dtrace.d - -# NOTE: dtrace is not used on cross compiling -$(arch_hdrdir)/ruby/dtrace.d: $(srcdir)/defs/dtrace.d - @echo '#include ' > conftest.c - @echo '#define RUBY_TRACE_H' >> conftest.c - @echo '#include "ruby/ruby.h"' >> conftest.c - @echo 'int main(){ printf("%d", SIZEOF_VALUE * CHAR_BIT); return 0; }' >> conftest.c - @$(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -c $(COUTFLAG)conftest.o conftest.c - $(CC) $(LDFLAGS) $(XLDFLAGS) conftest.o $(LIBS) $(OUTFLAG)conftest - @$(CP) $(srcdir)/defs/dtrace.d dtrace.c - $(CPP) $(CPPFLAGS) -DBITSIZE_OF_VALUE=`./conftest` dtrace.c $(CPPOUTFILE) - $(MV) conftest.i $@ - @$(RM) conftest conftest.[co] dtrace.c - # Things which should be considered: # * with gperf v.s. without gperf # * committers may have various versions of gperf diff --git a/NEWS b/NEWS index 55289d9bdc..d94b43ecbc 100644 --- a/NEWS +++ b/NEWS @@ -222,10 +222,6 @@ with all sufficient information, see the ChangeLog file. * Pathname#realdirpath * Pathname#each_child -* probe - new library. - * Kernel#fire_probe - * Readline * new methods: * Readline.set_screen_size @@ -270,14 +266,6 @@ with all sufficient information, see the ChangeLog file. Unicode semantics * $: no longer includes the current directory, use require_relative -=== Tracing (experimental) - -* Runtime tracing is supported. Currently implemented on top of dtrace. - You can trace a ruby program without any modification if your platform - supports dtrace USDT. - - This feature is experimental. The semantics of probes will possibly change. - === Compilation options * --program-prefix and --program-suffix no longer act on the shared object @@ -289,8 +277,6 @@ with all sufficient information, see the ChangeLog file. * --with-arch is added for universal binary, instead of --enable-fat-binary option. -* --with-tracing-model is added for choosing a particular tracing mechanism. - === Compatibility issues (excluding feature bug fixes) * Enumerator#rewind diff --git a/common.mk b/common.mk index 1b86aedb9f..45d03c8f7d 100644 --- a/common.mk +++ b/common.mk @@ -142,11 +142,11 @@ loadpath: $(PREP) PHONY $(PREP): $(MKFILES) -miniruby$(EXEEXT): config.status $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(ARCHFILE) $(MINIDTRACE_OBJ) +miniruby$(EXEEXT): config.status $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(ARCHFILE) GORUBY = go$(RUBY_INSTALL_NAME) -golf: $(LIBRUBY) $(GOLFOBJS) $(GOLFDTRACE_OBJ) PHONY - $(MAKE) $(MFLAGS) MAINOBJ="$(GOLFOBJS)" DTRACE_OBJ="$(GOLFDTRACE_OBJ)" PROGRAM=$(GORUBY)$(EXEEXT) program +golf: $(LIBRUBY) $(GOLFOBJS) PHONY + $(MAKE) $(MFLAGS) MAINOBJ="$(GOLFOBJS)" PROGRAM=$(GORUBY)$(EXEEXT) program capi: Doxyfile PHONY $(PREP) @$(MAKEDIRS) doc/capi @$(DOXYGEN) @@ -157,9 +157,9 @@ Doxyfile: $(srcdir)/template/Doxyfile.tmpl $(PREP) $(srcdir)/tool/generic_erb.rb program: $(PROGRAM) -$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(DTRACE_OBJ) $(SETUP) $(PREP) +$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP) -$(LIBRUBY_A): $(OBJS) $(DMYEXT) $(LIBRUBY_DTRACE_OBJ) $(ARCHFILE) +$(LIBRUBY_A): $(OBJS) $(DMYEXT) $(ARCHFILE) $(LIBRUBY_SO): $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP) $(LIBRUBY_SO_UPDATE) $(BUILTIN_ENCOBJS) @@ -385,7 +385,6 @@ distclean: distclean-ext distclean-local distclean-enc distclean-golf distclean- distclean-local:: clean-local @$(RM) $(MKFILES) rbconfig.rb yasmdata.rb encdb.h @$(RM) config.cache config.log config.status config.status.lineno $(PRELUDES) - @$(RM) $(arch_hdrdir)/ruby/dtrace.d @$(RM) *~ *.bak *.stackdump core *.core gmon.out $(PREP) distclean-ext:: PHONY distclean-golf: clean-golf @@ -512,8 +511,7 @@ win32.$(OBJEXT): {$(VPATH)}win32.c $(RUBY_H_INCLUDES) ### RUBY_H_INCLUDES = {$(VPATH)}ruby.h {$(VPATH)}config.h {$(VPATH)}defines.h \ - {$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h \ - {$(VPATH)}trace.h {$(VPATH)}trace_$(TRACING_MODEL).h + {$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h ENCODING_H_INCLUDES= {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h ID_H_INCLUDES = {$(VPATH)}id.h VM_CORE_H_INCLUDES = {$(VPATH)}vm_core.h {$(VPATH)}vm_opts.h \ @@ -680,9 +678,6 @@ newline.$(OBJEXT): {$(VPATH)}newline.c {$(VPATH)}defines.h \ {$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h \ {$(VPATH)}transcode_data.h {$(VPATH)}ruby.h {$(VPATH)}config.h -trace_none.h: - echo > $@ - INSNS2VMOPT = --srcdir="$(srcdir)" {$(VPATH)}minsns.inc: $(srcdir)/template/minsns.inc.tmpl diff --git a/compile.c b/compile.c index ea4268aee2..54b513c4c8 100644 --- a/compile.c +++ b/compile.c @@ -3569,7 +3569,6 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } ADD_INSNL(ret, nd_line(node), jump, label_miss); ADD_LABEL(ret, label_hit); - ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RESCUE); COMPILE(ret, "resbody body", resq->nd_body); if (iseq->compile_data->option->tailcall_optimization) { ADD_INSN(ret, nd_line(node), nop); diff --git a/configure.in b/configure.in index c18f95da5d..d2a8228265 100644 --- a/configure.in +++ b/configure.in @@ -357,52 +357,6 @@ fi MAKEDIRS="$MKDIR_P" AC_SUBST(MAKEDIRS) -AC_DEFUN([RUBY_DTRACE_POSTPROCESS], -[AC_CACHE_CHECK(whether $DTRACE needs post processing, rb_cv_prog_dtrace_g, -[ - echo "int main(void){ return 0; }" > conftest.c - echo "provider conftest{};" > conftest_provider.d - $CC $CFLAGS -c -o conftest.o conftest.c - if $DTRACE -G -s conftest_provider.d conftest.o 2>/dev/null; then - rb_cv_prog_dtrace_g=yes - $1 - else - rb_cv_prog_dtrace_g=no - $2 - fi - rm -f conftest.o conftest.c conftest_provider.d conftest_provider.o -]) -]) - -AC_DEFUN([RUBY_DTRACE_BSD_BROKEN], -[AC_CACHE_CHECK(whether dtrace USDT is broken, rb_cv_dtrace_bsd_broken, -[ - cat < conftest.c -#define _DTRACE_VERSION 1 -#include "conftest_provider.h" -int main(void) -{ - if (CONFTEST_FIRE_ENABLED()) CONFTEST_FIRE(); - return 0; -} -EOF - echo "provider conftest{ probe fire(); };" > conftest_provider.d - $DTRACE -h -o conftest_provider.h -s conftest_provider.d - $CC $CFLAGS -c -o conftest.o conftest.c - if $DTRACE -G -o conftest_provider.o -s conftest_provider.d conftest.o >/dev/null 2>/dev/null; then - rb_cv_dtrace_bsd_broken=no - $2 - else - rb_cv_dtrace_bsd_broken=yes - $1 - fi - rm -f conftest.[co] conftest_provider.[dho] -]) -]) - -AC_CHECK_TOOL(DTRACE, dtrace) -$DTRACE -l 1>/dev/null 2>/dev/null || DTRACE="" - AC_CHECK_TOOL(DOT, dot) AC_CHECK_TOOL(DOXYGEN, doxygen) if test x"$DOXYGEN" = x; then @@ -1069,7 +1023,6 @@ AC_CHECK_HEADERS(limits.h sys/file.h sys/ioctl.h sys/syscall.h\ ucontext.h intrinsics.h langinfo.h locale.h sys/sendfile.h time.h \ net/socket.h sys/socket.h) - dnl Check additional types. RUBY_CHECK_SIZEOF(rlim_t, [int long "long long"], [], [ #ifdef HAVE_SYS_TYPES_H @@ -2112,54 +2065,6 @@ case "$target_os" in ;; esac -AC_ARG_WITH(tracing-model, - AS_HELP_STRING([--with-tracing-model=MODEL], [use MODEL for tracing ruby's internal. [[auto]] (none|dtrace|auto)]), - [TRACING_MODEL=$withval], [TRACING_MODEL=auto]) - -if test "${TRACING_MODEL}" = "auto"; then - if test x"$DTRACE" != x -a x"$cross_compiling" != xyes; then - RUBY_DTRACE_POSTPROCESS() - if test "$rb_cv_prog_dtrace_g" = 'yes'; then - RUBY_DTRACE_BSD_BROKEN([TRACING_MODEL=none], [TRACING_MODEL=dtrace]) - else - TRACING_MODEL=dtrace - fi - else - TRACING_MODEL=none - fi -fi - -case "${TRACING_MODEL}" in - when(none) - AC_DEFINE(RUBY_TRACING_MODEL, RUBY_TRACING_MODEL_NONE, [none]) - ;; - when(dtrace) - if test -z "$DTRACE"; then - AC_MSG_ERROR([dtrace(1) is missing]) - elif test "$cross_compiling" = yes; then - AC_MSG_ERROR([--with-tracing-model=dtrace, however, cross compiling]) - else - RUBY_DTRACE_POSTPROCESS() - if test "$rb_cv_prog_dtrace_g" = 'yes'; then - RUBY_DTRACE_BSD_BROKEN([AC_MSG_ERROR([--with-tracing-model=dtrace, however, USDT is broken])], []) - DTRACE_OBJ='dtrace.$(OBJEXT)' - MINIDTRACE_OBJ='minidtrace.$(OBJEXT)' - GOLFDTRACE_OBJ='golfdtrace.$(OBJEXT)' - LIBRUBY_DTRACE_OBJ='libruby_dtrace.$(OBJEXT)' - fi - fi - AC_DEFINE(RUBY_TRACING_MODEL, RUBY_TRACING_MODEL_DTRACE, [dtrace]) - AC_SUBST(DTRACE_OBJ) - AC_SUBST(MINIDTRACE_OBJ) - AC_SUBST(GOLFDTRACE_OBJ) - AC_SUBST(LIBRUBY_DTRACE_OBJ) - ;; - when(*) - AC_MSG_ERROR([unknown tracing model: ${TRACING_MODEL}]) - ;; -esac -AC_SUBST(TRACING_MODEL) - AC_ARG_WITH(soname, AS_HELP_STRING([--with-soname=SONAME], [base name of shared library]), [RUBY_SO_NAME=$withval], [RUBY_SO_NAME='$(RUBY_BASE_NAME)']) @@ -2807,5 +2712,4 @@ AC_CONFIG_FILES(Makefile, [{ [EXEEXT=$EXEEXT gnumake=$gnumake]) AC_OUTPUT dnl } - dnl } diff --git a/defs/dtrace.d b/defs/dtrace.d deleted file mode 100644 index 2983423d0b..0000000000 --- a/defs/dtrace.d +++ /dev/null @@ -1,41 +0,0 @@ -#ifdef BITSIZE_OF_VALUE -#define DO_DEFINE_VALUE(sz) typedef uint ## sz ## _t VALUE -#define DEFINE_VALUE(sz) DO_DEFINE_VALUE(sz) -DEFINE_VALUE(BITSIZE_OF_VALUE); -#else -# error BITSIZE_OF_VALUE is not defined. -#endif -provider ruby { - probe method__entry(VALUE receiver, char *classname, char *methodname, char *sourcefile, int sourceline); - probe method__return(VALUE receiver, char *classname, char *methodname, char *sourcefile, int sourceline); - probe raise(VALUE exception, char *classname, char *sourcefile, int sourceline); - probe rescue(VALUE exception, char *classname, char *sourcefile, int sourceline); - probe line(char* sourcefile, int sourceline); - - /* gc probes */ - probe gc__begin(); - probe gc__end(); - - /* threads and fibers */ - probe thread__init(VALUE thread, char *sourcefile, int sourceline); - probe thread__term(VALUE thread, char *sourcefile, int sourceline); - probe thread__enter(VALUE thread, char *sourcefile, int sourceline); - probe thread__leave(VALUE thread, char *sourcefile, int sourceline); - - /* Some initial memory type probes */ - probe object__create(VALUE obj, char *classname, char *sourcefile, int sourceline); - probe object__free(VALUE obj); - - /* VM proves */ - probe insn__entry(char *insnname, VALUE *operands, char *sourcefile, int sourceline); - probe insn__return(char *insnname, VALUE *operands, char *sourcefile, int sourceline); - - probe ruby__probe(char *name, char *data); -}; - -#pragma D attributes Evolving/Evolving/Common provider ruby provider -#pragma D attributes Private/Private/Unknown provider ruby module -#pragma D attributes Private/Private/Unknown provider ruby function -#pragma D attributes Evolving/Evolving/Unknown provider ruby name -#pragma D attributes Evolving/Evolving/Unknown provider ruby args - diff --git a/eval.c b/eval.c index 63f6a06901..c5a72dc609 100644 --- a/eval.c +++ b/eval.c @@ -424,13 +424,9 @@ rb_longjmp(int tag, volatile VALUE mesg) rb_trap_restore_mask(); - if (tag == TAG_FATAL) { - if (UNLIKELY(TRACE_RAISE_ENABLED())) FIRE_RAISE(0, (char*)"fatal", (char*)file, line); - } - else { + if (tag != TAG_FATAL) { EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0 /* TODO: id */, 0 /* TODO: klass */); - if (UNLIKELY(TRACE_RAISE_ENABLED())) FIRE_RAISE(mesg, (char*)rb_class2name(CLASS_OF(mesg)), (char*)file, line); } rb_thread_raised_clear(th); @@ -637,9 +633,6 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1, va_end(args); if (handle) { - if (UNLIKELY(TRACE_RESCUE_ENABLED())) { - FIRE_RESCUE(th->errinfo, (char*)rb_class2name(CLASS_OF(th->errinfo)), (char*)"", 0); - } if (r_proc) { PUSH_TAG(); if ((state = EXEC_TAG()) == 0) { diff --git a/ext/probe/extconf.rb b/ext/probe/extconf.rb deleted file mode 100644 index 41b4bc3dd3..0000000000 --- a/ext/probe/extconf.rb +++ /dev/null @@ -1,3 +0,0 @@ -require 'mkmf' -create_makefile('probe') - diff --git a/ext/probe/probe.c b/ext/probe/probe.c deleted file mode 100644 index e252b767b9..0000000000 --- a/ext/probe/probe.c +++ /dev/null @@ -1,47 +0,0 @@ -/** - * probe.c - - * - * $Author$ - * - * Based on the patch for Ruby 1.8.6 by Joyent Inc. - * - * Copyright 2007 Joyent Inc. - * Copyright 2009 Yuki Sonoda (Yugui). - */ -#include "ruby/ruby.h" - -#define FIRE_WITH_SUFFIXED_MSG(probe_name, probe_data, suffix) \ - if (TRACE_RUBY_PROBE_ENABLED()) { \ - char *msg = ALLOCA_N(char, strlen(probe_name) + strlen("-" #suffix) ); \ - sprintf(msg, "%s%s", probe_name, "-" #suffix); \ - FIRE_RUBY_PROBE(msg, (char*)probe_data); \ - } - -static VALUE -probe_fire(int argc, VALUE *argv, VALUE klass) -{ - int args; - VALUE name, data, ret; - const char *probe_data; - char *probe_name; - - args = rb_scan_args(argc, argv, "11", &name, &data); - probe_data = args == 2 ? StringValuePtr(data) : ""; - probe_name = StringValuePtr(name); - - if (rb_block_given_p()) { - FIRE_WITH_SUFFIXED_MSG(probe_name, probe_data, start); - ret = rb_yield(Qnil); - FIRE_WITH_SUFFIXED_MSG(probe_name, probe_data, end); - } else { - if (TRACE_RUBY_PROBE_ENABLED()) - FIRE_RUBY_PROBE(probe_name, (char*)probe_data); - ret = Qnil; - } - return ret; -} - -void Init_probe() -{ - rb_define_global_function("fire_probe", probe_fire, -1); -} diff --git a/gc.c b/gc.c index 3ccf10271a..40212204a3 100644 --- a/gc.c +++ b/gc.c @@ -460,7 +460,6 @@ ruby_memerror(void) else { /* no ruby thread */ fprintf(stderr, "[FATAL] failed to allocate memory\n"); - if (UNLIKELY(TRACE_RAISE_ENABLED())) FIRE_RAISE_FATAL(); exit(EXIT_FAILURE); } } @@ -473,7 +472,6 @@ rb_memerror(void) if (!nomem_error || (rb_thread_raised_p(th, RAISED_NOMEMORY) && rb_safe_level() < 4)) { fprintf(stderr, "[FATAL] failed to allocate memory\n"); - if (UNLIKELY(TRACE_RAISE_ENABLED())) FIRE_RAISE_FATAL(); exit(EXIT_FAILURE); } if (rb_thread_raised_p(th, RAISED_NOMEMORY)) { @@ -606,7 +604,6 @@ negative_size_allocation_error(const char *msg) } else { fprintf(stderr, "[FATAL] %s\n", msg); - if (UNLIKELY(TRACE_RAISE_ENABLED())) FIRE_RAISE_FATAL(); exit(EXIT_FAILURE); } } @@ -632,7 +629,6 @@ garbage_collect_with_gvl(rb_objspace_t *objspace) else { /* no ruby thread */ fprintf(stderr, "[FATAL] failed to allocate memory\n"); - if (UNLIKELY(TRACE_RAISE_ENABLED())) FIRE_RAISE_FATAL(); exit(EXIT_FAILURE); } } @@ -1977,8 +1973,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) break; } - if (UNLIKELY(TRACE_OBJECT_FREE_ENABLED())) FIRE_OBJECT_FREE(rb_obj_id(obj)); - if (FL_TEST(obj, FL_EXIVAR)) { rb_free_generic_ivar((VALUE)obj); FL_UNSET(obj, FL_EXIVAR); @@ -2159,7 +2153,6 @@ garbage_collect(rb_objspace_t *objspace) during_gc++; objspace->count++; - if (UNLIKELY(TRACE_GC_BEGIN_ENABLED())) FIRE_GC_BEGIN(); GC_PROF_TIMER_START; GC_PROF_MARK_TIMER_START; SET_STACK_END; @@ -2208,7 +2201,6 @@ garbage_collect(rb_objspace_t *objspace) GC_PROF_SWEEP_TIMER_STOP; GC_PROF_TIMER_STOP; - if (UNLIKELY(TRACE_GC_END_ENABLED())) FIRE_GC_END(); if (GC_NOTIFY) printf("end garbage_collect()\n"); return TRUE; } diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index ebef0e9605..5318772b35 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -40,19 +40,10 @@ extern "C" { #endif #ifdef __GNUC__ -# define PRINTF_ARGS(decl, string_index, first_to_check) \ - decl __attribute__((format(printf, string_index, first_to_check))) -# if __GNUC__ >= 3 -# define LIKELY(x) (__builtin_expect((x), 1)) -# define UNLIKELY(x) (__builtin_expect((x), 0)) -# else -# define LIKELY(x) (x) -# define UNLIKELY(x) (x) -# endif +#define PRINTF_ARGS(decl, string_index, first_to_check) \ + decl __attribute__((format(printf, string_index, first_to_check))) #else -# define PRINTF_ARGS(decl, string_index, first_to_check) decl -# define LIKELY(x) (x) -# define UNLIKELY(x) (x) +#define PRINTF_ARGS(decl, string_index, first_to_check) decl #endif #ifdef HAVE_STDLIB_H @@ -525,17 +516,12 @@ double rb_num2dbl(VALUE); VALUE rb_uint2big(VALUE); VALUE rb_int2big(SIGNED_VALUE); -#include "ruby/trace.h" - VALUE rb_newobj(void); #define NEWOBJ(obj,type) type *obj = (type*)rb_newobj() #define OBJSETUP(obj,c,t) do {\ RBASIC(obj)->flags = (t);\ RBASIC(obj)->klass = (c);\ if (rb_safe_level() >= 3) FL_SET(obj, FL_TAINT | FL_UNTRUSTED);\ - if (UNLIKELY(TRACE_OBJECT_CREATE_ENABLED())) { \ - FIRE_OBJECT_CREATE((VALUE)(obj), rb_class2name((c)), rb_sourcefile(), rb_sourceline()); \ - } \ } while (0) #define CLONESETUP(clone,obj) do {\ OBJSETUP(clone,rb_singleton_class_clone((VALUE)obj),RBASIC(obj)->flags);\ @@ -1339,7 +1325,6 @@ int ruby_native_thread_p(void); #define RUBY_EVENT_C_CALL 0x0020 #define RUBY_EVENT_C_RETURN 0x0040 #define RUBY_EVENT_RAISE 0x0080 -#define RUBY_EVENT_RESCUE 0x0100 #define RUBY_EVENT_ALL 0xffff #define RUBY_EVENT_VM 0x10000 #define RUBY_EVENT_SWITCH 0x20000 diff --git a/include/ruby/trace.h b/include/ruby/trace.h deleted file mode 100644 index f45e9d5396..0000000000 --- a/include/ruby/trace.h +++ /dev/null @@ -1,105 +0,0 @@ -/********************************************************************** - - trace.h - - - $Author$ - - Copyright (C) 2009 Yuki Sonoda (Yugui) - -**********************************************************************/ - -#ifndef RUBY_TRACE_H -#define RUBY_TRACE_H - -#define RUBY_TRACING_MODEL_NONE 0 -#define RUBY_TRACING_MODEL_DTRACE 1 - -#if RUBY_TRACING_MODEL == RUBY_TRACING_MODEL_NONE -# define TRACE_METHOD_ENTRY_ENABLED() 0 -# define TRACE_METHOD_RETURN_ENABLED() 0 -# define TRACE_RAISE_ENABLED() 0 -# define TRACE_RESCUE_ENABLED() 0 -# define TRACE_LINE_ENABLED() 0 -# define TRACE_GC_BEGIN_ENABLED() 0 -# define TRACE_GC_END_ENABLED() 0 -# define TRACE_THREAD_INIT_ENABLED() 0 -# define TRACE_THREAD_TERM_ENABLED() 0 -# define TRACE_THREAD_LEAVE_ENABLED() 0 -# define TRACE_THREAD_ENTER_ENABLED() 0 -# define TRACE_OBJECT_CREATE_ENABLED() 0 -# define TRACE_OBJECT_FREE_ENABLED() 0 -# define TRACE_INSN_ENTRY_ENABLED() 0 -# define TRACE_INSN_RETURN_ENABLED() 0 -# define TRACE_RUBY_PROBE_ENABLED() 0 - -# define FIRE_METHOD_ENTRY(receiver, classname, methodname, sourcefile, sourceline) ((void)0) -# define FIRE_METHOD_RETURN(receiver, classname, methodname, sourcefile, sourceline) ((void)0) -# define FIRE_RAISE(exception, classname, sourcename, sourceline) ((void)0) -# define FIRE_RESCUE(exception, classname, sourcename, sourceline) ((void)0) -# define FIRE_LINE(sourcename, sourceline) ((void)0) -# define FIRE_GC_BEGIN() ((void)0) -# define FIRE_GC_END() ((void)0) -# define FIRE_THREAD_INIT(th, sourcefile, sourceline) ((void)0) -# define FIRE_THREAD_TERM(th, sourcefile, sourceline) ((void)0) -# define FIRE_THREAD_LEAVE(th, sourcefile, sourceline) ((void)0) -# define FIRE_THREAD_ENTER(th, sourcefile, sourceline) ((void)0) -# define FIRE_OBJECT_CREATE(obj, classname, sourcefile, sourceline) ((void)0) -# define FIRE_OBJECT_FREE(obj) ((void)0) -# define FIRE_INSN_ENTRY(insnname, operands, sourcename, sourceline) ((void)0) -# define FIRE_INSN_RETURN(insnname, operands, sourcename, sourceline) ((void)0) -# define FIRE_RUBY_PROBE(name, data) ((void)0) - -#elif RUBY_TRACING_MODEL == RUBY_TRACING_MODEL_DTRACE -# include "ruby/trace_dtrace.h" -# define TRACE_METHOD_ENTRY_ENABLED() RUBY_METHOD_ENTRY_ENABLED() -# define TRACE_METHOD_RETURN_ENABLED() RUBY_METHOD_RETURN_ENABLED() -# define TRACE_RAISE_ENABLED() RUBY_RAISE_ENABLED() -# define TRACE_RESCUE_ENABLED() RUBY_RESCUE_ENABLED() -# define TRACE_LINE_ENABLED() RUBY_LINE_ENABLED() -# define TRACE_GC_BEGIN_ENABLED() RUBY_GC_BEGIN_ENABLED() -# define TRACE_GC_END_ENABLED() RUBY_GC_END_ENABLED() -# define TRACE_THREAD_INIT_ENABLED() RUBY_THREAD_INIT_ENABLED() -# define TRACE_THREAD_TERM_ENABLED() RUBY_THREAD_TERM_ENABLED() -# define TRACE_THREAD_LEAVE_ENABLED() RUBY_THREAD_LEAVE_ENABLED() -# define TRACE_THREAD_ENTER_ENABLED() RUBY_THREAD_ENTER_ENABLED() -# define TRACE_OBJECT_CREATE_ENABLED() RUBY_OBJECT_CREATE_ENABLED() -# define TRACE_OBJECT_FREE_ENABLED() RUBY_OBJECT_FREE_ENABLED() -# define TRACE_INSN_ENTRY_ENABLED() RUBY_INSN_ENTRY_ENABLED() -# define TRACE_INSN_RETURN_ENABLED() RUBY_INSN_RETURN_ENABLED() -# define TRACE_RUBY_PROBE_ENABLED() RUBY_RUBY_PROBE_ENABLED() - -# define FIRE_METHOD_ENTRY(receiver, classname, methodname, sourcefile, sourceline) \ - RUBY_METHOD_ENTRY(receiver, classname, methodname, sourcefile, sourceline) -# define FIRE_METHOD_RETURN(receiver, classname, methodname, sourcefile, sourceline) \ - RUBY_METHOD_RETURN(receiver, classname, methodname, sourcefile, sourceline) -# define FIRE_RAISE(exception, classname, sourcename, sourceline) \ - RUBY_RAISE(exception, classname, sourcename, sourceline) -# define FIRE_RESCUE(exception, classname, sourcename, sourceline) \ - RUBY_RESCUE(exception, classname, sourcename, sourceline) -# define FIRE_LINE(sourcename, sourceline) \ - RUBY_LINE(sourcename, sourceline) -# define FIRE_GC_BEGIN() RUBY_GC_BEGIN() -# define FIRE_GC_END() RUBY_GC_END() -# define FIRE_THREAD_INIT(th, sourcefile, sourceline) \ - RUBY_THREAD_INIT(th, (char*)sourcefile, sourceline) -# define FIRE_THREAD_TERM(th, sourcefile, sourceline) \ - RUBY_THREAD_TERM(th, (char*)sourcefile, sourceline) -# define FIRE_THREAD_LEAVE(th, sourcefile, sourceline) \ - RUBY_THREAD_LEAVE(th, (char*)sourcefile, sourceline) -# define FIRE_THREAD_ENTER(th, sourcefile, sourceline) \ - RUBY_THREAD_ENTER(th, (char*)sourcefile, sourceline) -# define FIRE_OBJECT_CREATE(obj, classname, sourcefile, sourceline) \ - RUBY_OBJECT_CREATE(obj, (char*)classname, (char*)sourcefile, sourceline) -# define FIRE_OBJECT_FREE(obj) \ - RUBY_OBJECT_FREE(obj) -# define FIRE_INSN_ENTRY(insnname, operands, sourcename, sourceline) \ - RUBY_INSN_ENTRY(insnname, operands, sourcename, sourceline) -# define FIRE_INSN_RETURN(insnname, operands, sourcename, sourceline) \ - RUBY_INSN_RETURN(insnname, operands, sourcename, sourceline) -# define FIRE_RUBY_PROBE(name, data) \ - RUBY_RUBY_PROBE(name, data) -#endif - -#define FIRE_RAISE_FATAL() FIRE_RAISE(0, (char*)"fatal", (char*)"", 0) - -#endif diff --git a/insns.def b/insns.def index 869d7564d8..5f789bd441 100644 --- a/insns.def +++ b/insns.def @@ -859,30 +859,6 @@ trace rb_event_flag_t flag = (rb_event_flag_t)nf; EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */); - if (UNLIKELY(TRACE_METHOD_ENTRY_ENABLED() - | TRACE_METHOD_RETURN_ENABLED() - | TRACE_LINE_ENABLED() - | TRACE_RESCUE_ENABLED())) { - if (UNLIKELY(TRACE_METHOD_ENTRY_ENABLED()) && (flag & RUBY_EVENT_CALL) ) { - VALUE self = GET_SELF(), klass; - ID id; - rb_thread_method_id_and_class(GET_THREAD(), &id, &klass); - FIRE_METHOD_ENTRY(self, (char*)rb_class2name(klass), (char*)rb_id2name(id), (char*)rb_sourcefile(), rb_sourceline()); - } - if (UNLIKELY(TRACE_METHOD_RETURN_ENABLED()) && (flag & RUBY_EVENT_RETURN) ) { - VALUE self = GET_SELF(), klass; - ID id; - rb_thread_method_id_and_class(GET_THREAD(), &id, &klass); - FIRE_METHOD_RETURN(self, (char*)rb_class2name(klass), (char*)rb_id2name(id), (char*)rb_sourcefile(), rb_sourceline()); - } - if (UNLIKELY(TRACE_RESCUE_ENABLED()) && (flag & RUBY_EVENT_RESCUE) ) { - VALUE ex = GET_DFP()[-2]; - FIRE_RESCUE(ex, (char*)rb_class2name(CLASS_OF(ex)), (char*)rb_sourcefile(), rb_sourceline()); - } - if (UNLIKELY(TRACE_LINE_ENABLED()) && (flag & RUBY_EVENT_LINE) ) { - FIRE_LINE((char*)rb_sourcefile(), rb_sourceline()); - } - } } /**********************************************************/ diff --git a/iseq.c b/iseq.c index c247b8c90d..7a59fce049 100644 --- a/iseq.c +++ b/iseq.c @@ -1473,27 +1473,6 @@ rb_iseq_build_for_ruby2cext( return iseqval; } -const char * -rb_vm_insn_name(int insn) -{ - if (insn < VM_INSTRUCTION_SIZE) { - return insn_name(insn); - } else { - return 0; - } -} - -int -rb_vm_insn_len(int insn) -{ - if (insn < VM_INSTRUCTION_SIZE) { - return insn_len(insn); - } else { - return 0; - } -} - - void Init_ISeq(void) { diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 0ad63d61e3..895bca0bee 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -69,8 +69,6 @@ $solaris = /solaris/ =~ RUBY_PLATFORM $universal = /universal/ =~ RUBY_PLATFORM $dest_prefix_pattern = (File::PATH_SEPARATOR == ';' ? /\A([[:alpha:]]:)?/ : /\A/) -$dtrace_postprocess = (CONFIG['DTRACE_OBJ'] and /^\s*$/ !~ CONFIG['DTRACE_OBJ']) - # :stopdoc: def config_string(key, config = CONFIG) @@ -1452,7 +1450,6 @@ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])} mk << %{ CC = #{CONFIG['CC']} CXX = #{CONFIG['CXX']} -DTRACE = #{CONFIG['DTRACE']} LIBRUBY = #{CONFIG['LIBRUBY']} LIBRUBY_A = #{CONFIG['LIBRUBY_A']} LIBRUBYARG_SHARED = #$LIBRUBYARG_SHARED @@ -1722,7 +1719,6 @@ LOCAL_LIBS = #{$LOCAL_LIBS} LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS} SRCS = #{srcs.collect(&File.method(:basename)).join(' ')} OBJS = #{$objs.join(" ")} -DTRACE_OBJ = #{$dtrace_postprocess ? "$(TARGET)_dtrace.#{$OBJEXT}" : ''} TARGET = #{target} DLLIB = #{dllib} EXTSTATIC = #{$static || ""} @@ -1743,12 +1739,6 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""} .PHONY: clean clean-so clean-rb " mfile.print CLEANINGS - - if $dtrace_postprocess - mfile.print "$(DTRACE_OBJ): $(OBJS)\n" - mfile.print "\t$(DTRACE) -G -o $@ -s $(arch_hdrdir)/ruby/dtrace.d $(OBJS)\n" - end - fsep = config_string('BUILD_FILE_SEPARATOR') {|s| s unless s == "/"} if fsep sep = ":/=#{fsep}" @@ -1851,7 +1841,7 @@ site-install-rb: install-rb mfile.print "$(RUBYARCHDIR)/" if $extout mfile.print "$(DLLIB): " mfile.print "$(DEFFILE) " if makedef - mfile.print "$(OBJS) $(DTRACE_OBJ) Makefile\n" + mfile.print "$(OBJS) Makefile\n" mfile.print "\t@-$(RM) $(@#{sep})\n" mfile.print "\t@-$(MAKEDIRS) $(@D)\n" if $extout link_so = LINK_SO.gsub(/^/, "\t") @@ -1860,8 +1850,8 @@ site-install-rb: install-rb end mfile.print link_so, "\n\n" unless $static.nil? - mfile.print "$(STATIC_LIB): $(OBJS) $(DTRACE_OBJ)\n\t@-$(RM) $(@#{sep})\n\t" - mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS) $(DTRACE_OBJ)" + mfile.print "$(STATIC_LIB): $(OBJS)\n\t@-$(RM) $(@#{sep})\n\t" + mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)" config_string('RANLIB') do |ranlib| mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true" end @@ -1882,7 +1872,6 @@ site-install-rb: install-rb end headers << $config_h headers << '$(RUBY_EXTCONF_H)' if $extconf_h - headers << '$(arch_hdrdir)/ruby/dtrace.d' if $dtrace_postprocess mfile.print "$(OBJS): ", headers.join(' '), "\n" end @@ -2015,9 +2004,9 @@ TRY_LINK = config_string('TRY_LINK') || "$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)" LINK_SO = config_string('LINK_SO') || if CONFIG["DLEXT"] == $OBJEXT - "ld $(DLDFLAGS) -r -o $@ $(OBJS) $(DTRACE_OBJ)\n" + "ld $(DLDFLAGS) -r -o $@ $(OBJS)\n" else - "$(LDSHARED) #{OUTFLAG}$@ $(OBJS) $(DTRACE_OBJ) " \ + "$(LDSHARED) #{OUTFLAG}$@ $(OBJS) " \ "$(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)" end LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"' diff --git a/thread.c b/thread.c index bcb7be5214..0ba41c7679 100644 --- a/thread.c +++ b/thread.c @@ -376,8 +376,6 @@ thread_cleanup_func(void *th_ptr) { rb_thread_t *th = th_ptr; - if (UNLIKELY(TRACE_THREAD_TERM_ENABLED())) FIRE_THREAD_TERM(th->self, rb_sourcefile(), rb_sourceline()); - /* unlock all locking mutexes */ if (th->keeping_mutexes) { rb_mutex_unlock_all(th->keeping_mutexes, th); @@ -429,16 +427,10 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s th->errinfo = Qnil; th->local_lfp = proc->block.lfp; th->local_svar = Qnil; - if (UNLIKELY(TRACE_THREAD_ENTER_ENABLED())) { - VALUE filename = proc->block.iseq->filename; - int lineno = proc->block.iseq->line_no; - FIRE_THREAD_ENTER(th->self, (TYPE(filename) == T_STRING ? RSTRING_PTR(filename) : 0), lineno); - } th->value = rb_vm_invoke_proc(th, proc, proc->block.self, (int)RARRAY_LEN(args), RARRAY_PTR(args), 0); } else { - if (UNLIKELY(TRACE_THREAD_ENTER_ENABLED())) FIRE_THREAD_ENTER(th->self, 0, 0); th->value = (*th->first_func)((void *)args); } }); @@ -469,7 +461,6 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s th->status = THREAD_KILLED; thread_debug("thread end: %p\n", (void *)th); - if (UNLIKELY(TRACE_THREAD_LEAVE_ENABLED())) FIRE_THREAD_LEAVE(th->self, 0, 0); main_th = th->vm->main_thread; if (th != main_th) { @@ -542,7 +533,6 @@ thread_create_core(VALUE thval, VALUE args, VALUE (*fn)(ANYARGS)) native_mutex_initialize(&th->interrupt_lock); /* kick thread */ st_insert(th->vm->living_threads, thval, (st_data_t) th->thread_id); - if (UNLIKELY(TRACE_THREAD_INIT_ENABLED())) FIRE_THREAD_INIT(th->self, rb_sourcefile(), rb_sourceline()); err = native_thread_create(th); if (err) { st_delete_wrap(th->vm->living_threads, th->self); @@ -992,7 +982,6 @@ rb_thread_schedule_rec(int sched_depth) rb_thread_t *th = GET_THREAD(); thread_debug("rb_thread_schedule/switch start\n"); - if (UNLIKELY(TRACE_THREAD_LEAVE_ENABLED())) FIRE_THREAD_LEAVE(th->self, rb_sourcefile(), rb_sourceline()); RB_GC_SAVE_MACHINE_CONTEXT(th); native_mutex_unlock(&th->vm->global_vm_lock); @@ -1003,7 +992,6 @@ rb_thread_schedule_rec(int sched_depth) rb_thread_set_current(th); thread_debug("rb_thread_schedule/switch done\n"); - if (UNLIKELY(TRACE_THREAD_ENTER_ENABLED())) FIRE_THREAD_ENTER(th->self, rb_sourcefile(), rb_sourceline()); if (!sched_depth && UNLIKELY(GET_THREAD()->interrupt_flag)) { rb_threadptr_execute_interrupts_rec(GET_THREAD(), sched_depth+1); diff --git a/thread_pthread.c b/thread_pthread.c index 3335a45839..af0b28644a 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -694,7 +694,6 @@ add_signal_thread_list(rb_thread_t *th) if (list == 0) { fprintf(stderr, "[FATAL] failed to allocate memory\n"); - if (UNLIKELY(TRACE_RAISE_ENABLED())) FIRE_RAISE_FATAL(); exit(1); } @@ -806,7 +805,6 @@ rb_thread_create_timer_thread(void) if (err != 0) { native_mutex_unlock(&timer_thread_lock); fprintf(stderr, "[FATAL] Failed to create timer thread (errno: %d)\n", err); - if (UNLIKELY(TRACE_RAISE_ENABLED())) FIRE_RAISE_FATAL(); exit(EXIT_FAILURE); } native_cond_wait(&timer_thread_cond, &timer_thread_lock); diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 55920a6d17..cf5827e6e2 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -346,7 +346,7 @@ install?(:ext, :arch, :'ext-arch') do end install?(:ext, :arch, :'ext-arch') do prepare "extension headers", archhdrdir - install_recursive("#{$extout}/include/#{CONFIG['arch']}", archhdrdir, :glob => "*.[dh]", :mode => $data_mode) + install_recursive("#{$extout}/include/#{CONFIG['arch']}", archhdrdir, :glob => "*.h", :mode => $data_mode) end install?(:ext, :comm, :'ext-comm') do prepare "extension scripts", rubylibdir diff --git a/variable.c b/variable.c index 722c021c59..62256a049e 100644 --- a/variable.c +++ b/variable.c @@ -313,27 +313,6 @@ rb_class2name(VALUE klass) return RSTRING_PTR(rb_class_name(klass)); } -/*! - * \internal - * Same as rb_class2name but safe if during GC - * - * \post the returned pointer points a string. not NULL. - */ -const char * -rb_class2name_without_alloc(VALUE klass) -{ - if (RCLASS_IV_TBL(klass)) { - st_data_t n; - if (st_lookup(RCLASS_IV_TBL(klass), (st_data_t)classpath, &n) || - st_lookup(RCLASS_IV_TBL(klass), (st_data_t)classid, &n) || - st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) { - if (TYPE(n) != T_STRING) rb_bug("class path is not set properly"); - return RSTRING_PTR(n); - } - } - return "(anonymous)"; -} - const char * rb_obj_classname(VALUE obj) { diff --git a/vm.c b/vm.c index 9f6fc124b9..e522c9f300 100644 --- a/vm.c +++ b/vm.c @@ -2072,7 +2072,6 @@ Init_BareVM(void) rb_thread_t * th = malloc(sizeof(*th)); if (!vm || !th) { fprintf(stderr, "[FATAL] failed to allocate memory\n"); - if (UNLIKELY(TRACE_RAISE_ENABLED())) FIRE_RAISE_FATAL(); exit(EXIT_FAILURE); } MEMZERO(th, rb_thread_t, 1); diff --git a/vm_core.h b/vm_core.h index 0dd93f3332..b9b584ad69 100644 --- a/vm_core.h +++ b/vm_core.h @@ -97,6 +97,15 @@ #endif /* OPT_STACK_CACHING */ #endif /* OPT_CALL_THREADED_CODE */ +/* likely */ +#if __GNUC__ >= 3 +#define LIKELY(x) (__builtin_expect((x), 1)) +#define UNLIKELY(x) (__builtin_expect((x), 0)) +#else /* __GNUC__ >= 3 */ +#define LIKELY(x) (x) +#define UNLIKELY(x) (x) +#endif /* __GNUC__ >= 3 */ + typedef unsigned long rb_num_t; /* iseq data type */ diff --git a/vm_exec.h b/vm_exec.h index 0a72f17854..9ae81794bd 100644 --- a/vm_exec.h +++ b/vm_exec.h @@ -52,39 +52,8 @@ typedef rb_iseq_t *ISEQ; #else #define debugs -extern const char *rb_vm_insn_name(int); -#define DEBUG_ENTER_INSN(insn) \ - do { \ - if (UNLIKELY(TRACE_INSN_ENTRY_ENABLED())) { \ - rb_control_frame_t *cfp = GET_CFP(); \ - rb_iseq_t *iseq = cfp->iseq; \ - if (iseq != NULL && VM_FRAME_TYPE(cfp) != VM_FRAME_MAGIC_FINISH) { \ - VALUE *seq = iseq->iseq; \ - int pc = cfp->pc - iseq->iseq_encoded; \ - FIRE_INSN_ENTRY((char *)rb_vm_insn_name(seq[pc]), \ - seq+1, \ - (char *)rb_sourcefile(), \ - rb_sourceline()); \ - } \ - } \ - } \ - while (0) -#define DEBUG_END_INSN() \ - do { \ - if (UNLIKELY(TRACE_INSN_RETURN_ENABLED())) { \ - rb_control_frame_t *cfp = GET_CFP(); \ - rb_iseq_t *iseq = cfp->iseq; \ - if (iseq != NULL && VM_FRAME_TYPE(cfp) != VM_FRAME_MAGIC_FINISH) { \ - VALUE *seq = iseq->iseq; \ - int pc = cfp->pc - iseq->iseq_encoded; \ - FIRE_INSN_RETURN((char *)rb_vm_insn_name(seq[pc]), \ - seq+1, \ - (char *)rb_sourcefile(), \ - rb_sourceline()); \ - } \ - } \ - } \ - while (0) +#define DEBUG_ENTER_INSN(insn) +#define DEBUG_END_INSN() #endif #define throwdebug if(0)printf diff --git a/win32/Makefile.sub b/win32/Makefile.sub index fe7f5fae52..a27cfba707 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -288,7 +288,6 @@ LIBRUBY_SO = $(RUBY_SO_NAME).dll LIBRUBY = $(RUBY_SO_NAME).lib LIBRUBYARG = $(LIBRUBY) THREAD_MODEL = win32 -TRACING_MODEL = none !if $(CROSS_COMPILING) PREP = fake.rb