annotate agent/test/jdi/sasanity.sh @ 3766:c3f1170908be

7045330: G1: Simplify/fix the HeapRegionSeq class 7042285: G1: native memory leak during humongous object allocation 6804436: G1: heap region indices should be size_t Summary: A series of fixes and improvements to the HeapRegionSeq class: a) replace the _regions growable array with a standard C array, b) avoid de-allocating / re-allocating HeapRegion instances when the heap shrinks / grows (fix for 7042285), c) introduce fast method to map address to HeapRegion via a "biased" array pointer, d) embed the _hrs object in G1CollectedHeap, instead of pointing to it via an indirection, e) assume that all the regions added to the HeapRegionSeq instance are contiguous, f) replace int's with size_t's for indexes (and expand that to HeapRegion as part of 6804436), g) remove unnecessary / unused methods, h) rename a couple of fields (_alloc_search_start and _seq_bottom), i) fix iterate_from() not to always start from index 0 irrespective of the region passed to it, j) add a verification method to check the HeapRegionSeq assumptions, k) always call the wrappers for _hrs.iterate(), _hrs_length(), and _hrs.at() from G1CollectedHeap, not those methods directly, and l) unify the code that expands the sequence (by either re-using or creating a new HeapRegion) and make it robust wrt to a HeapRegion allocation failing. Reviewed-by: stefank, johnc, brutisso
author tonyp
date Fri, 10 Jun 2011 13:16:40 -0400
parents c7f3d0b4570f
children e6b1331a51d2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 #!/bin/ksh
a61af66fc99e Initial load
duke
parents:
diff changeset
2 #
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
3 # Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
5 #
a61af66fc99e Initial load
duke
parents:
diff changeset
6 # This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
7 # under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
8 # published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
9 #
a61af66fc99e Initial load
duke
parents:
diff changeset
10 # This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
13 # version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
14 # accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
15 #
a61af66fc99e Initial load
duke
parents:
diff changeset
16 # You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
17 # 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
19 #
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 # or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
22 # questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
23 #
a61af66fc99e Initial load
duke
parents:
diff changeset
24 #
a61af66fc99e Initial load
duke
parents:
diff changeset
25
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # This script is used to run sanity check on vmStructs.
a61af66fc99e Initial load
duke
parents:
diff changeset
27 # Each SA class is checked against a given VM. "PASSED" is
a61af66fc99e Initial load
duke
parents:
diff changeset
28 # printed if vmStructs are consistent. Else, "FAILED" is
a61af66fc99e Initial load
duke
parents:
diff changeset
29 # printed and an exception stack trace follows.
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 usage() {
a61af66fc99e Initial load
duke
parents:
diff changeset
32 echo "usage: ./sasanity.sh <jdk>"
a61af66fc99e Initial load
duke
parents:
diff changeset
33 echo "<jdk> is the 1.5 j2se directory against which you want to run sanity check"
a61af66fc99e Initial load
duke
parents:
diff changeset
34 exit 1
a61af66fc99e Initial load
duke
parents:
diff changeset
35 }
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 if [ "$1" == "" ]; then
a61af66fc99e Initial load
duke
parents:
diff changeset
38 usage
a61af66fc99e Initial load
duke
parents:
diff changeset
39 fi
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 if [ "$1" == "-help" ]; then
a61af66fc99e Initial load
duke
parents:
diff changeset
42 usage
a61af66fc99e Initial load
duke
parents:
diff changeset
43 fi
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 jdk=$1
2376
c7f3d0b4570f 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 1552
diff changeset
46 shift
0
a61af66fc99e Initial load
duke
parents:
diff changeset
47 OS=`uname`
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 if [ "$OS" != "Linux" ]; then
a61af66fc99e Initial load
duke
parents:
diff changeset
50 OPTIONS="-Dsun.jvm.hotspot.debugger.useProcDebugger"
a61af66fc99e Initial load
duke
parents:
diff changeset
51 fi
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 javacp=$jdk/lib/sa-jdi.jar:./workdir
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 mkdir -p workdir
a61af66fc99e Initial load
duke
parents:
diff changeset
56 if [ SASanityChecker.java -nt ./workdir/SASanityChecker.class ] ; then
a61af66fc99e Initial load
duke
parents:
diff changeset
57 $jdk/bin/javac -d ./workdir -classpath $javacp SASanityChecker.java
a61af66fc99e Initial load
duke
parents:
diff changeset
58 if [ $? != 0 ] ; then
a61af66fc99e Initial load
duke
parents:
diff changeset
59 exit 1
a61af66fc99e Initial load
duke
parents:
diff changeset
60 fi
a61af66fc99e Initial load
duke
parents:
diff changeset
61 fi
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 if [ sagtarg.java -nt ./workdir/sagtarg.class ]; then
a61af66fc99e Initial load
duke
parents:
diff changeset
64 $jdk/bin/javac -g -classpath -d $workdir sagtarg.java
a61af66fc99e Initial load
duke
parents:
diff changeset
65 if [ $? != 0 ] ; then
a61af66fc99e Initial load
duke
parents:
diff changeset
66 exit 1
a61af66fc99e Initial load
duke
parents:
diff changeset
67 fi
a61af66fc99e Initial load
duke
parents:
diff changeset
68 fi
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 tmp=/tmp/sagsetup
a61af66fc99e Initial load
duke
parents:
diff changeset
71 rm -f $tmp
2376
c7f3d0b4570f 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 1552
diff changeset
72 $jdk/bin/java $* sagtarg > $tmp &
0
a61af66fc99e Initial load
duke
parents:
diff changeset
73 pid=$!
a61af66fc99e Initial load
duke
parents:
diff changeset
74 while [ ! -s $tmp ] ; do
a61af66fc99e Initial load
duke
parents:
diff changeset
75 # Kludge alert!
a61af66fc99e Initial load
duke
parents:
diff changeset
76 sleep 2
a61af66fc99e Initial load
duke
parents:
diff changeset
77 done
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 $jdk/bin/java -showversion ${OPTIONS} -classpath $javacp SASanityChecker $pid
a61af66fc99e Initial load
duke
parents:
diff changeset
80 kill -9 $pid