components/python/python27/patches/12-studio-profile.patch
author Shawn Walker <shawn.walker@oracle.com>
Tue, 20 Dec 2011 17:19:09 -0800
changeset 634 bd9c94f9f6e0
child 1914 00e8dbcb9b1e
child 3367 ed5024e47b53
permissions -rw-r--r--
6771457 explore compiler performance improvements for python
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
634
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     1
This changes Python's standard profile-guided build target to work with
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     2
Studio instead of gcc.  The unfortunate repetition of options seen below
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     3
is a workaround for build peculiarities and to meet Studio's requirement
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     4
that the profiling options be used at all steps of the build -- not just
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     5
compilation.
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     6
--- Python-2.6.4/Makefile.pre.in.orig	Thu Nov  3 15:14:03 2011
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     7
+++ Python-2.6.4/Makefile.pre.in	Thu Nov  3 15:14:11 2011
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     8
@@ -360,9 +360,9 @@
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
     9
 profile-opt:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    10
 	@echo "Building with support for profile generation:"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    11
 	$(MAKE) clean
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    12
+	$(MAKE) profile-removal
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    13
 	$(MAKE) build_all_generate_profile
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    14
 	@echo "Running benchmark to generate profile data:"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    15
-	$(MAKE) profile-removal
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    16
 	$(MAKE) run_profile_task
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    17
 	@echo "Rebuilding with profile guided optimizations:"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    18
 	$(MAKE) clean
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    19
@@ -369,18 +369,27 @@
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    20
 	$(MAKE) build_all_use_profile
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    21
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    22
 build_all_generate_profile:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    23
-	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    24
+	$(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    25
+	    CFLAGS="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    26
+	    LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    27
+	    BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    28
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    29
 run_profile_task:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    30
-	./$(BUILDPYTHON) $(PROFILE_TASK)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    31
+	LD_LIBRARY_PATH=. ./$(BUILDPYTHON) $(PROFILE_TASK)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    32
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    33
 build_all_use_profile:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    34
-	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    35
+	$(MAKE) all CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    36
+	    CFLAGS="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    37
+	    LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    38
+	    BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    39
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    40
 coverage:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    41
 	@echo "Building with support for coverage checking:"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    42
 	$(MAKE) clean
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    43
-	$(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    44
+	$(MAKE) all CC="$(CC) -xprofile=tcov" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    45
+	    CFLAGS="$(CFLAGS) -xO1 -xprofile=tcov" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    46
+	    LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    47
+	    BLDSHARED="$(BLDSHARED) -xprofile=tcov"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    48
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    49
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    50
 # Build the interpreter
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    51
@@ -395,10 +404,7 @@
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    52
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    53
 # Build the shared modules
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    54
 sharedmods: $(BUILDPYTHON)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    55
-	@case $$MAKEFLAGS in \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    56
-	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    57
-	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    58
-	esac
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    59
+	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    60
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    61
 # Build static library
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    62
 # avoid long command lines, same as LIBRARY_OBJS
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    63
@@ -1173,7 +1179,7 @@
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    64
 	-rm -f Lib/lib2to3/*Grammar*.pickle
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    65
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    66
 profile-removal:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    67
-	find . -name '*.gc??' -exec rm -f {} ';'
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    68
+	find . -name '.profile' -exec rm -rf {} ';'
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    69
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    70
 clobber: clean profile-removal
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    71
 	-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \