1 # Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
   2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   3 #
   4 # This code is free software; you can redistribute it and/or modify it
   5 # under the terms of the GNU General Public License version 2 only, as
   6 # published by the Free Software Foundation.
   7 #
   8 # This code is distributed in the hope that it will be useful, but WITHOUT
   9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11 # version 2 for more details (a copy is included in the LICENSE file that
  12 # accompanied this code).
  13 #
  14 # You should have received a copy of the GNU General Public License version
  15 # 2 along with this work; if not, write to the Free Software Foundation,
  16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17 #
  18 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19 # or visit www.oracle.com if you need additional information or have any
  20 # questions.
  21 
  22 pushd `dirname $0` > /dev/null
  23 DIR=`pwd`
  24 popd > /dev/null
  25 
  26 # set env variables
  27 . $DIR/test-env.sh
  28 
  29 $JAVA_HOME/bin/java -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseAOTStrictLoading -XX:+PrintAOT -version | grep "aot library" || exit 1
  30 
  31 # Dump CDS archive.
  32 $JAVA_HOME/bin/java -Xshare:dump || exit 1
  33 
  34 FILE="empty.js"
  35 
  36 TIMEFORMAT="%3R"
  37 N=5
  38 
  39 rm -f libjdk.nashorn.$SO_TYPE
  40 $JAVA_HOME/bin/jaotc --info --compile-commands jdk.scripting.nashorn-list.txt --module jdk.scripting.nashorn --output libjdk.nashorn.$SO_TYPE || exit 1
  41 
  42 echo "Tiered C1:"
  43 for i in `seq 1 $N`; do
  44     time $JAVA_HOME/bin/jjs $JAVA_OPTS -J-XX:+UnlockExperimentalVMOptions -J-XX:-UseAOT -J-XX:TieredStopAtLevel=1 $FILE
  45     if [ $? -ne 0 ]; then
  46         exit 1
  47     fi
  48 done
  49 
  50 echo "Tiered C1/C2:"
  51 for i in `seq 1 $N`; do
  52     time $JAVA_HOME/bin/jjs $JAVA_OPTS -J-XX:+UnlockExperimentalVMOptions -J-XX:-UseAOT $FILE
  53     if [ $? -ne 0 ]; then
  54         exit 1
  55     fi
  56 done
  57 
  58 echo "Tiered AOT:"
  59 for i in `seq 1 $N`; do
  60     time $JAVA_HOME/bin/jjs $JAVA_OPTS -J-XX:+UnlockDiagnosticVMOptions -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseAOTStrictLoading -J-XX:AOTLibrary=./libjdk.nashorn.$SO_TYPE $FILE
  61     if [ $? -ne 0 ]; then
  62         exit 1
  63     fi
  64 done
  65 
  66 echo "Tiered AOT -Xshare:on:"
  67 for i in `seq 1 $N`; do
  68     time $JAVA_HOME/bin/jjs $JAVA_OPTS -J-Xshare:on -J-XX:+UnlockDiagnosticVMOptions -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseAOTStrictLoading -J-XX:AOTLibrary=./libjdk.nashorn.$SO_TYPE $FILE
  69     if [ $? -ne 0 ]; then
  70         exit 1
  71     fi
  72 done
  73 
  74 rm -f libjdk.nashorn.$SO_TYPE