1 #!/bin/sh
   2 #
   3 # Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
   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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 #
  24 
  25 EXECUTE_CLASS=jit.escape.LockCoarsening.LockCoarsening
  26 JAVA="$TESTJAVA/bin/java"
  27 JAVA_OPTS="-cp $TESTCLASSPATH $TESTJAVAOPTS $TESTVMOPTS"
  28 
  29 #
  30 # Run the test in EA mode if -server and -Xcomp JVM options specified
  31 # Set EliminateLocks commandline option to enable -XX:+EliminateLocks
  32 #
  33 
  34 if [ "$1" = "EliminateLocks" ]; then
  35     EA_OPTS="-XX:+DoEscapeAnalysis -XX:+EliminateLocks"
  36     TEST_ARGS="$TEST_ARGS -eliminateLocks"
  37 else
  38     EA_OPTS="-XX:-DoEscapeAnalysis -XX:-EliminateLocks"
  39 fi
  40 
  41 # Additional VM options
  42 ADD_OPTS="-XX:-TieredCompilation -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeALot"
  43 
  44 echo "Check if EscapeAnalysis is supported"
  45 $JAVA $JAVA_OPTS $EA_OPTS -version
  46 
  47 if [ "$?" = 0 ]; then
  48         echo "EA options '$EA_OPTS' are supported"
  49 
  50         b1=0
  51         b2=0
  52 
  53         for param in $JAVA_OPTS; do
  54                 case "$param" in
  55                         -server )
  56                                 b1=1
  57                                 ;;
  58                         -Xcomp )
  59                                 b2=1
  60                                 ;;
  61                 esac
  62         done
  63 
  64         if [ "$b1$b2" = 11 ]; then
  65                 JAVA_OPTS="$JAVA_OPTS $ADD_OPTS $EA_OPTS"
  66                 echo "Java options: $JAVA_OPTS"
  67 
  68                 $JAVA $JAVA_OPTS $EXECUTE_CLASS $TEST_ARGS
  69 
  70                 exit $?
  71         else
  72                 echo "JVM options '-server -Xcomp' not specified"
  73 
  74                 exit 0
  75         fi
  76 fi
  77 
  78 echo "EA not supported, passing test"
  79 
  80 exit 0