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