Mercurial > hg > truffle
annotate make/solaris/reorder.sh @ 453:c96030fff130
6684579: SoftReference processing can be made more efficient
Summary: For current soft-ref clearing policies, we can decide at marking time if a soft-reference will definitely not be cleared, postponing the decision of whether it will definitely be cleared to the final reference processing phase. This can be especially beneficial in the case of concurrent collectors where the marking is usually concurrent but reference processing is usually not.
Reviewed-by: jmasa
author | ysr |
---|---|
date | Thu, 20 Nov 2008 16:56:09 -0800 |
parents | d1605aabd0a1 |
children | c18cbe5936b8 |
rev | line source |
---|---|
0 | 1 #!/bin/sh -x |
2 # | |
196 | 3 # Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. |
0 | 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 # | |
6 # This code is free software; you can redistribute it and/or modify it | |
7 # under the terms of the GNU General Public License version 2 only, as | |
8 # published by the Free Software Foundation. | |
9 # | |
10 # This code is distributed in the hope that it will be useful, but WITHOUT | |
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 # version 2 for more details (a copy is included in the LICENSE file that | |
14 # accompanied this code). | |
15 # | |
16 # You should have received a copy of the GNU General Public License version | |
17 # 2 along with this work; if not, write to the Free Software Foundation, | |
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 # | |
20 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
21 # CA 95054 USA or visit www.sun.com if you need additional information or | |
22 # have any questions. | |
23 # | |
24 # | |
25 | |
26 # Generate the reorder data for hotspot. | |
27 # | |
28 # Usage: | |
29 # | |
30 # sh reorder.sh <test_sdk_workspace> <test_sdk> <jbb_dir> | |
31 # | |
32 # <test_sdk_workspace> is a *built* SDK workspace which contains the | |
33 # reordering tools for the SDK. This script relies on lib_mcount.so | |
34 # from this workspace. | |
35 # | |
36 # <test_sdk> is a working SDK which you can use to run the profiled | |
37 # JVMs in to collect data. You must be able to write to this SDK. | |
38 # | |
39 # <jbb_dir> is a directory containing JBB test jar files and properties | |
40 # which will be used to run the JBB test to provide reordering data | |
41 # for the server VM. | |
42 # | |
43 # Profiled builds of the VM are needed (before running this script), | |
44 # build with PROFILE_PRODUCT=1: | |
45 # | |
46 # gnumake profiled1 profiled PROFILE_PRODUCT=1 | |
47 # | |
48 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
49 | |
50 test_setup() { | |
51 | |
52 # $1 = "client" or "server" | |
53 # $2 = name of reorder file to be generated. | |
54 | |
55 echo "" | |
56 echo "TEST_SETUP $1 $2" | |
57 echo "" | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
0
diff
changeset
|
58 libreldir=${ALT_OUTPUTDIR:-../../../make/solaris-$arch5}/reorder |
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
0
diff
changeset
|
59 libabsdir=${ALT_OUTPUTDIR:-$sdk_ws/make/solaris-$arch5}/reorder |
0 | 60 ( cd $sdk_ws/make/tools/reorder ; gnumake $libreldir/$arch5/libmcount.so ) |
61 if [ "${arch3}" = "i386" ] ; then | |
62 # On Solaris/x86 we need to remove the symbol _mcount from the command | |
63 ( cd $sdk_ws/make/tools/reorder ; \ | |
64 gnumake $libreldir/$arch5/remove_mcount ) | |
65 echo Remove _mcount from java command. | |
66 $libabsdir/$arch5/remove_mcount $jre/bin/java | |
67 fi | |
68 ( cd $sdk_ws/make/tools/reorder ; gnumake tool_classes ) | |
69 ( cd $sdk_ws/make/tools/reorder ; gnumake test_classes ) | |
70 | |
71 tests="Null Exit Hello Sleep IntToString \ | |
72 LoadToolkit LoadFrame LoadJFrame JHello" | |
73 swingset=$sdk/demo/jfc/SwingSet2/SwingSet2.jar | |
74 java=$jre/bin/java | |
75 if [ "X$LP64" != "X" ] ; then | |
76 testjava="$jre/bin/${arch3}/java" | |
77 else | |
78 testjava="$jre/bin/java" | |
79 fi | |
80 mcount=$libabsdir/$arch5/libmcount.so | |
81 | |
82 if [ ! -x $mcount ] ; then | |
83 echo $mcount is missing! | |
84 exit 1 | |
85 fi | |
86 | |
87 if [ "X$1" = "client" ] ; then | |
88 if [ "X$NO_SHARING" = "X" ] ; then | |
89 echo "Dumping shared file." | |
90 LD_PRELOAD=$mcount \ | |
91 JDK_ALTERNATE_VM=jvm_profiled \ | |
92 $testjava -Xshare:dump -Xint -XX:PermSize=16m -version 2> /dev/null | |
93 shared_client="-Xshare:on" | |
94 echo "Shared file dump completed." | |
95 else | |
96 shared_client="-Xshare:off" | |
97 echo "NO_SHARING defined, not using sharing." | |
98 fi | |
99 else | |
100 echo "Server: no sharing" | |
101 shared_server="-Xshare:off" | |
102 fi | |
103 | |
104 testpath=$libabsdir/classes | |
105 | |
106 reorder_file=$2 | |
107 | |
108 rm -f ${reorder_file} | |
109 rm -f ${reorder_file}_tmp2 | |
110 rm -f ${reorder_file}_tmp1 | |
111 | |
112 echo "data = R0x2000;" > ${reorder_file} | |
113 echo "text = LOAD ?RXO;" >> ${reorder_file} | |
114 echo "" >> ${reorder_file} | |
115 echo "" >> ${reorder_file} | |
116 } | |
117 | |
118 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
119 | |
120 test_client() { | |
121 | |
122 # Run each of a set of tests, extract the methods called, | |
123 # append the new functions to the reorder list. | |
124 # $1 = "client" or "server" | |
125 # $2 = name of reorder file to be generated. | |
126 | |
127 echo "TEST_CLIENT $1 $2." | |
128 test_setup $1 $2 | |
129 echo "TEST_CLIENT $1 $2." | |
130 | |
131 for f in $tests ; do | |
132 echo Running test $f. | |
133 rm -f ${reorder_file}_tmp1 | |
134 echo "# Test $f" >> ${reorder_file} | |
135 | |
136 echo "Using LD_PRELOAD=$mcount" | |
137 echo $testjava ${shared_client} -classpath $testpath $f | |
138 | |
139 LD_PRELOAD=$mcount \ | |
140 JDK_ALTERNATE_VM=jvm_profiled \ | |
141 $testjava ${shared_client} -classpath $testpath $f 2> ${reorder_file}_tmp1 | |
142 | |
143 echo "Done." | |
144 sed -n -e '/^text:/p' ${reorder_file}_tmp1 > ${reorder_file}_tmp2 | |
145 sed -e '/^text:/d' ${reorder_file}_tmp1 | |
146 LD_LIBRARY_PATH=$lib/server \ | |
147 $java -classpath $testpath Combine ${reorder_file} \ | |
148 ${reorder_file}_tmp2 \ | |
149 > ${reorder_file}_tmp3 | |
150 mv ${reorder_file}_tmp3 ${reorder_file} | |
151 rm -f ${reorder_file}_tmp2 | |
152 rm -f ${reorder_file}_tmp1 | |
153 done | |
154 | |
155 # Run SwingSet, extract the methods called, | |
156 # append the new functions to the reorder list. | |
157 | |
158 echo "# SwingSet" >> ${reorder_file} | |
159 | |
160 echo "" | |
161 echo "" | |
162 echo "When SwingSet has finished drawing, " \ | |
163 "you may terminate it (with your mouse)." | |
164 echo "Otherwise, it should be automatically terminated in 3 minutes." | |
165 echo "" | |
166 echo "" | |
167 | |
168 echo "Using LD_PRELOAD=$mcount, JDK_ALTERNATE=jvm_profiled." | |
169 echo $testjava ${shared_client} -classpath $testpath MaxTime $swingset 60 | |
170 LD_PRELOAD=$mcount \ | |
171 JDK_ALTERNATE_VM=jvm_profiled \ | |
172 $testjava ${shared_client} -classpath $testpath MaxTime \ | |
173 $swingset 60 2> ${reorder_file}_tmp1 | |
174 | |
175 sed -n -e '/^text:/p' ${reorder_file}_tmp1 > ${reorder_file}_tmp2 | |
176 | |
177 LD_LIBRARY_PATH=$lib/server \ | |
178 $java -server -classpath $testpath Combine ${reorder_file} ${reorder_file}_tmp2 \ | |
179 > ${reorder_file}_tmp3 | |
180 echo mv ${reorder_file}_tmp3 ${reorder_file} | |
181 mv ${reorder_file}_tmp3 ${reorder_file} | |
182 echo rm -f ${reorder_file}_tmp2 | |
183 rm -f ${reorder_file}_tmp2 | |
184 echo rm -f ${reorder_file}_tmp1 | |
185 rm -f ${reorder_file}_tmp1 | |
186 } | |
187 | |
188 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
189 | |
190 test_server() { | |
191 | |
192 # Run the JBB script, collecting data on the way. | |
193 # $1 = "client" or "server" | |
194 # $2 = name of reorder file to be generated. | |
195 | |
196 echo "TEST_SERVER $1 $2." | |
197 test_setup $1 $2 | |
198 echo "TEST_SERVER $1 $2." | |
199 | |
200 echo Running JBB. | |
201 | |
202 rm -f ${reorder_file}_tmp1 | |
203 rm -f ${reorder_file}_tmp2 | |
204 heap=200m | |
205 | |
206 CLASSPATH=jbb.jar:jbb_no_precompile.jar:check.jar:reporter.jar | |
207 | |
208 ( cd $jbb_dir; LD_PRELOAD=$mcount MCOUNT_ORDER_BY_COUNT=1 \ | |
209 JDK_ALTERNATE_VM=jvm_profiled \ | |
210 $testjava ${shared_server} -classpath $CLASSPATH -Xms${heap} -Xmx${heap} \ | |
211 spec.jbb.JBBmain -propfile SPECjbb.props ) 2> ${reorder_file}_tmp1 | |
212 | |
213 sed -n -e '/^text:/p' ${reorder_file}_tmp1 > ${reorder_file}_tmp2 | |
214 sed -e '/^text:/d' ${reorder_file}_tmp1 | |
215 cat ${reorder_file}_tmp2 >> ${reorder_file} | |
216 rm -f ${reorder_file}_tmp2 | |
217 rm -f ${reorder_file}_tmp1 | |
218 } | |
219 | |
220 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
221 | |
222 # Rename the old VMs, copy the new in, run the test, and put the | |
223 # old one back. | |
224 | |
225 copy_and_test() { | |
226 | |
227 # $1 = "client" or "server" | |
228 # $2 = name of reorder file to be generated. | |
229 # $3 = profiled jvm to copy in | |
230 | |
231 echo "COPY_AND_TEST ($1, $2, $3)." | |
232 # $2 = name of reorder file to be generated. | |
233 # $3 = profiled jvm to copy in | |
234 | |
235 rm -rf $lib/jvm_profiled | |
236 mkdir $lib/jvm_profiled | |
237 cp $3 $lib/jvm_profiled | |
238 test_$1 $1 $2 | |
239 rm -rf $lib/jvm_profiled | |
240 } | |
241 | |
242 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
243 | |
244 | |
245 # Check arguments: | |
246 | |
247 if [ $# != 3 ] ; then | |
248 echo "" | |
249 echo "Usage:" | |
250 echo " sh reorder.sh <test_sdk_workspace> <test_sdk> <jbb_dir>" | |
251 echo "" | |
252 exit 1 | |
253 fi | |
254 | |
255 sdk_ws=$1 | |
256 if [ ! -r $sdk_ws/make/tools/reorder/Makefile ] ; then | |
257 echo "" | |
258 echo "test workspace "$sdk_ws" does not contain the reordering tools." | |
259 echo "" | |
260 exit 1 | |
261 fi | |
262 | |
263 sdk=$2 | |
264 jre=$sdk/jre | |
265 | |
266 # Set up architecture names as needed by various components. | |
267 # Why couldn't we just use x86 for everything? | |
268 | |
269 # Arch name as used in JRE runtime (eg. i386): | |
270 # .../jre/lib/${arch3}/server | |
271 arch3=`uname -p` | |
272 | |
273 # Arch name as used in Hotspot build: (eg. i486) | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
0
diff
changeset
|
274 # /export/hotspot/make/solaris/solaris_${arch4}_compiler1 |
0 | 275 arch4=$arch3 |
276 | |
277 # Arch name as used in SDK build (eg. i586): | |
91
a294fd0c4b38
6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents:
0
diff
changeset
|
278 # /export/tiger/make/solaris-${arch3} |
0 | 279 arch5=$arch3 |
280 | |
281 # Tweak for 64-bit sparc builds. At least they all agree. | |
282 if [ $arch3 = sparc -a "X$LP64" != "X" ] ; then | |
283 arch3=sparcv9 | |
284 arch4=sparcv9 | |
285 arch5=sparcv9 | |
286 fi | |
287 | |
288 # Tweak for 64-bit i386 == amd64 builds. At least they all agree. | |
289 if [ $arch3 = i386 -a "X$LP64" != "X" ] ; then | |
290 arch3=amd64 | |
291 arch4=amd64 | |
292 arch5=amd64 | |
293 fi | |
294 | |
295 # Tweak for x86 builds. All different. | |
296 if [ $arch3 = i386 ] ; then | |
297 arch4=i486 | |
298 arch5=i586 | |
299 fi | |
300 | |
301 lib=$jre/lib/$arch3 | |
302 if [ ! -r $jre/lib/rt.jar ] ; then | |
303 echo "" | |
304 echo "test SDK "$sdk" is not a suitable SDK." | |
305 echo "" | |
306 exit 1 | |
307 fi | |
308 | |
309 jbb_dir=$3 | |
310 if [ ! -r $jbb_dir/jbb.jar ] ; then | |
311 echo "" | |
312 echo "jbb.jar not present in $jbb_dir" | |
313 echo "" | |
314 exit 1 | |
315 fi | |
316 | |
317 | |
318 # Were profiled VMs built? | |
319 | |
320 if [ "X$LP64" != "X" ] ; then | |
321 if [ ! -r solaris_${arch4}_compiler2/profiled/libjvm.so ] ; then | |
322 echo "" | |
323 echo "Profiled builds of compiler2 are needed first." | |
324 echo ' -- build with "make profiled PROFILE_PRODUCT=1" -- ' | |
325 echo "<solaris_${arch4}_compiler2/profiled/libjvm.so>" | |
326 exit 1 | |
327 fi | |
328 else | |
329 if [ ! -r solaris_${arch4}_compiler1/profiled/libjvm.so \ | |
330 -o ! -r solaris_${arch4}_compiler2/profiled/libjvm.so ] ; then | |
331 echo "" | |
332 echo "Profiled builds of compiler1 and compiler2 are needed first." | |
333 echo ' -- build with "make profiled{,1} PROFILE_PRODUCT=1" -- ' | |
334 exit 1 | |
335 fi | |
336 fi | |
337 | |
338 | |
339 # Compiler1 - not supported in 64-bit (b69 java launcher rejects it). | |
340 | |
341 if [ "X$LP64" = "X" ] ; then | |
342 #gnumake profiled1 | |
343 echo Using profiled client VM. | |
344 echo | |
345 copy_and_test client \ | |
346 reorder_COMPILER1_$arch4 \ | |
347 solaris_${arch4}_compiler1/profiled/libjvm.so | |
348 fi | |
349 | |
350 #gnumake profiled | |
351 echo Using profiled server VM. | |
352 echo | |
353 copy_and_test server \ | |
354 reorder_COMPILER2_$arch4 \ | |
355 solaris_${arch4}_compiler2/profiled/libjvm.so |