patches/Python-07-dtrace.diff
changeset 10191 2562bec71126
parent 9619 ec2d81c0a557
child 17065 71eeb9bbac92
--- a/patches/Python-07-dtrace.diff	Fri Jul 13 11:15:59 2007 +0000
+++ b/patches/Python-07-dtrace.diff	Fri Jul 13 11:50:25 2007 +0000
@@ -1,7 +1,7 @@
-diff -x '*.o' -x pyconfig.h -x tags -x python.h -Naur Python-2.4.4/Include/frameobject.h Python-new/Include/frameobject.h
+diff -prauN Python-2.4.4/Include/frameobject.h Python-new/Include/frameobject.h
 --- Python-2.4.4/Include/frameobject.h	2004-07-01 23:41:07.000000000 -0700
-+++ Python-new/Include/frameobject.h	2007-02-02 10:33:19.641865000 -0800
-@@ -32,6 +32,7 @@
++++ Python-new/Include/frameobject.h	2007-07-03 07:59:58.696193000 -0700
+@@ -32,6 +32,7 @@ typedef struct _frame {
      /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when
         f_trace is set) -- at other times use PyCode_Addr2Line instead. */
      int f_lineno;		/* Current line number */
@@ -9,19 +9,18 @@
      int f_restricted;		/* Flag set if restricted operations
  				   in this scope */
      int f_iblock;		/* index in f_blockstack */
-diff -x '*.o' -x pyconfig.h -x tags -x python.h -Naur Python-2.4.4/Makefile.pre.in Python-new/Makefile.pre.in
+diff -prauN Python-2.4.4/Makefile.pre.in Python-new/Makefile.pre.in
 --- Python-2.4.4/Makefile.pre.in	2006-10-08 10:41:25.000000000 -0700
-+++ Python-new/Makefile.pre.in	2007-02-02 10:33:19.653108000 -0800
-@@ -217,6 +217,8 @@
++++ Python-new/Makefile.pre.in	2007-07-12 11:34:02.483271000 -0700
+@@ -217,6 +217,7 @@ PGOBJS=		\
  
  PGENOBJS=	$(PGENMAIN) $(POBJS) $(PGOBJS)
  
-+# FIXME johnlev
 +DTRACE_OBJS=Python/dtrace.o Python/phelper.o
  
  ##########################################################################
  # Python
-@@ -253,6 +255,7 @@
+@@ -253,6 +254,7 @@ PYTHON_OBJS=	\
  		Python/getopt.o \
  		Python/pystrtod.o \
  		Python/$(DYNLOADFILE) \
@@ -29,11 +28,10 @@
  		$(MACHDEP_OBJS) \
  		$(THREADOBJ)
  
-@@ -479,6 +482,18 @@
+@@ -479,6 +481,17 @@ Python/importdl.o: $(srcdir)/Python/impo
  Objects/unicodectype.o:	$(srcdir)/Objects/unicodectype.c \
  				$(srcdir)/Objects/unicodetype_db.h
  
-+# FIXME johnlev
 +Python/phelper.o: $(srcdir)/Python/phelper.d
 +	dtrace -o $@ -DPHELPER $(DFLAGS) $(CPPFLAGS) -C -G -s $(srcdir)/Python/phelper.d
 +
@@ -48,10 +46,10 @@
  ############################################################################
  # Header files
  
-diff -x '*.o' -x pyconfig.h -x tags -x python.h -Naur Python-2.4.4/Objects/frameobject.c Python-new/Objects/frameobject.c
+diff -prauN Python-2.4.4/Objects/frameobject.c Python-new/Objects/frameobject.c
 --- Python-2.4.4/Objects/frameobject.c	2004-07-01 23:41:07.000000000 -0700
-+++ Python-new/Objects/frameobject.c	2007-02-02 10:33:19.653643000 -0800
-@@ -633,6 +633,7 @@
++++ Python-new/Objects/frameobject.c	2007-07-03 07:59:58.720162000 -0700
+@@ -633,6 +633,7 @@ PyFrame_New(PyThreadState *tstate, PyCod
  
  	f->f_lasti = -1;
  	f->f_lineno = code->co_firstlineno;
@@ -59,14 +57,14 @@
  	f->f_restricted = (builtins != tstate->interp->builtins);
  	f->f_iblock = 0;
  	f->f_nlocals = code->co_nlocals;
-diff -x '*.o' -x pyconfig.h -x tags -x python.h -Naur Python-2.4.4/Python/ceval.c Python-new/Python/ceval.c
+diff -prauN Python-2.4.4/Python/ceval.c Python-new/Python/ceval.c
 --- Python-2.4.4/Python/ceval.c	2006-10-06 12:09:36.000000000 -0700
-+++ Python-new/Python/ceval.c	2007-02-02 10:33:19.655685000 -0800
++++ Python-new/Python/ceval.c	2007-07-12 12:39:29.067739000 -0700
 @@ -16,6 +16,11 @@
  
  #include <ctype.h>
  
-+#define HAVE_DTRACE // FIXME johnlev
++#define HAVE_DTRACE
 +#ifdef HAVE_DTRACE
 +#include "python.h"
 +#endif
@@ -74,7 +72,7 @@
  #ifndef WITH_TSC 
  #define rdtscll(var)
  #else /*WITH_TSC defined*/
-@@ -490,11 +495,115 @@
+@@ -490,11 +495,132 @@ PyEval_EvalCode(PyCodeObject *co, PyObje
  }
  
  
@@ -89,7 +87,16 @@
 +	filename = PyString_AsString(f->f_code->co_filename);
 +	fname = PyString_AsString(f->f_code->co_name);
 +	lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
++
 +	PYTHON_FUNCTION_ENTRY((char *)filename, (char *)fname, lineno);
++
++	/*
++	 * Currently a USDT tail-call will not receive the correct arguments.
++	 * Disable the tail call here.
++	 */
++#if defined(__sparc)
++	asm("nop");
++#endif
 +}
 +
 +static void
@@ -103,6 +110,14 @@
 +	fname = PyString_AsString(f->f_code->co_name);
 +	lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
 +	PYTHON_FUNCTION_RETURN((char *)filename, (char *)fname, lineno);
++
++	/*
++	 * Currently a USDT tail-call will not receive the correct arguments.
++	 * Disable the tail call here.
++	 */
++#if defined(__sparc)
++	asm("nop");
++#endif
 +}
 +#else
 +#define	PYTHON_FUNCTION_ENTRY_ENABLED 0
@@ -190,7 +205,7 @@
  #ifdef DXPAIRS
  	int lastopcode = 0;
  #endif
-@@ -710,6 +819,9 @@
+@@ -710,6 +836,9 @@ PyEval_EvalFrame(PyFrameObject *f)
  		}
  	}
  
@@ -200,7 +215,7 @@
  	co = f->f_code;
  	names = co->co_names;
  	consts = co->co_consts;
-@@ -2161,6 +2273,10 @@
+@@ -2161,6 +2290,10 @@ PyEval_EvalFrame(PyFrameObject *f)
  			PyObject **sp;
  			PCALL(PCALL_ALL);
  			sp = stack_pointer;
@@ -211,7 +226,7 @@
  #ifdef WITH_TSC
  			x = call_function(&sp, oparg, &intr0, &intr1);
  #else
-@@ -2203,6 +2319,10 @@
+@@ -2203,6 +2336,10 @@ PyEval_EvalFrame(PyFrameObject *f)
  		    } else
  			    Py_INCREF(func);
  		    sp = stack_pointer;
@@ -222,7 +237,7 @@
  		    rdtscll(intr0);
  		    x = ext_do_call(func, &sp, flags, na, nk);
  		    rdtscll(intr1);
-@@ -2501,6 +2621,8 @@
+@@ -2501,6 +2638,8 @@ fast_yield:
  
  	/* pop frame */
      exit_eval_frame:
@@ -231,9 +246,9 @@
  	Py_LeaveRecursiveCall();
  	tstate->frame = f->f_back;
  
-diff -x '*.o' -x pyconfig.h -x tags -x python.h -Naur Python-2.4.4/Python/phelper.d Python-new/Python/phelper.d
+diff -prauN Python-2.4.4/Python/phelper.d Python-new/Python/phelper.d
 --- Python-2.4.4/Python/phelper.d	1969-12-31 16:00:00.000000000 -0800
-+++ Python-new/Python/phelper.d	2007-02-02 10:33:19.656077000 -0800
++++ Python-new/Python/phelper.d	2007-07-03 07:59:58.727255000 -0700
 @@ -0,0 +1,137 @@
 +
 +/*
@@ -372,9 +387,9 @@
 +{
 +	NULL;
 +}
-diff -x '*.o' -x pyconfig.h -x tags -x python.h -Naur Python-2.4.4/Python/python.d Python-new/Python/python.d
+diff -prauN Python-2.4.4/Python/python.d Python-new/Python/python.d
 --- Python-2.4.4/Python/python.d	1969-12-31 16:00:00.000000000 -0800
-+++ Python-new/Python/python.d	2007-02-02 10:33:19.656250000 -0800
++++ Python-new/Python/python.d	2007-07-03 07:59:58.727981000 -0700
 @@ -0,0 +1,10 @@
 +provider python {
 +	probe function__entry(const char *, const char *, int);