components/python/python27/patches/12-studio-profile.patch
author John Beck <John.Beck@Oracle.COM>
Wed, 17 Dec 2014 09:46:51 -0800
changeset 3555 76f4672c5e4b
parent 2028 6fa8f5812e20
child 5183 3a048793fc91
permissions -rw-r--r--
20230129 update Python 2.7 line to version 2.7.9 20207552 problem in UTILITY/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
1954
32663e59626d 19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents: 1914
diff changeset
     5
compilation.  As it is Solaris-specific, it is not suitable for upstream.
32663e59626d 19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents: 1914
diff changeset
     6
3555
76f4672c5e4b 20230129 update Python 2.7 line to version 2.7.9
John Beck <John.Beck@Oracle.COM>
parents: 2028
diff changeset
     7
--- Python-2.7.9/Makefile.pre.in.~2~	2014-12-11 09:26:43.160400840 -0800
76f4672c5e4b 20230129 update Python 2.7 line to version 2.7.9
John Beck <John.Beck@Oracle.COM>
parents: 2028
diff changeset
     8
+++ Python-2.7.9/Makefile.pre.in	2014-12-11 09:26:43.287536256 -0800
76f4672c5e4b 20230129 update Python 2.7 line to version 2.7.9
John Beck <John.Beck@Oracle.COM>
parents: 2028
diff changeset
     9
@@ -416,28 +416,37 @@
634
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    10
 profile-opt:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    11
 	@echo "Building with support for profile generation:"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    12
 	$(MAKE) clean
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    13
+	$(MAKE) profile-removal
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    14
 	$(MAKE) build_all_generate_profile
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    15
 	@echo "Running benchmark to generate profile data:"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    16
-	$(MAKE) profile-removal
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    17
 	$(MAKE) run_profile_task
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    18
 	@echo "Rebuilding with profile guided optimizations:"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    19
 	$(MAKE) clean
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:
1914
00e8dbcb9b1e PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents: 634
diff changeset
    30
 	: # FIXME: can't run for a cross build
634
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    31
-	./$(BUILDPYTHON) $(PROFILE_TASK)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    32
+	LD_LIBRARY_PATH=. ./$(BUILDPYTHON) $(PROFILE_TASK)
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    33
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    34
 build_all_use_profile:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    35
-	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    36
+	$(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
    37
+	    CFLAGS="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    38
+	    LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    39
+	    BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    40
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    41
 coverage:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    42
 	@echo "Building with support for coverage checking:"
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    43
 	$(MAKE) clean
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    44
-	$(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
    45
+	$(MAKE) all CC="$(CC) -xprofile=tcov" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    46
+	    CFLAGS="$(CFLAGS) -xO1 -xprofile=tcov" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    47
+	    LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    48
+	    BLDSHARED="$(BLDSHARED) -xprofile=tcov"
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
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    51
 # Build the interpreter
3555
76f4672c5e4b 20230129 update Python 2.7 line to version 2.7.9
John Beck <John.Beck@Oracle.COM>
parents: 2028
diff changeset
    52
@@ -1331,7 +1340,7 @@
634
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    53
 	-rm -f Lib/lib2to3/*Grammar*.pickle
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    54
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    55
 profile-removal:
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    56
-	find . -name '*.gc??' -exec rm -f {} ';'
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    57
+	find . -name '.profile' -exec rm -rf {} ';'
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    58
 
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    59
 clobber: clean profile-removal
bd9c94f9f6e0 6771457 explore compiler performance improvements for python
Shawn Walker <shawn.walker@oracle.com>
parents:
diff changeset
    60
 	-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \