1# Copyright (c) 2017, 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
22JAR="dacapo-9.12-bach.jar"
23
24if [ ! -f $JAR ]; then
25    echo "$JAR not found."
26    exit 1
27fi
28
29pushd `dirname $0` > /dev/null
30DIR=`pwd`
31popd > /dev/null
32
33APP="-jar $JAR -s small -n 5"
34
35JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:-TieredCompilation -Xmx4g -XX:+UseCompressedOops -XX:+UseG1GC"
36
37MODULE_OPTS="--add-modules jdk.internal.vm.ci --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED"
38
39$JAVA_HOME/bin/java $JAVA_OPTS -version || exit 1
40
41$JAVA_HOME/bin/javac $MODULE_OPTS InitGraal.java || exit 1
42
43PATTERN="(aot library|DONE:.*HotSpotVMConfig|DONE:.*HotSpotJVMCIRuntime|DONE:.*HotSpotGraalRuntime)"
44echo "----------"
45$JAVA_HOME/bin/java $JAVA_OPTS $MODULE_OPTS -XX:+TieredCompilation -XX:-UseAOT -XX:+PrintAOT -Djvmci.InitTimer=true InitGraal | grep -E "$PATTERN" || exit 1
46echo "----------"
47$JAVA_HOME/bin/java $JAVA_OPTS $MODULE_OPTS -XX:+TieredCompilation             -XX:+PrintAOT -Djvmci.InitTimer=true InitGraal | grep -E "$PATTERN" || exit 1
48echo "----------"
49$JAVA_HOME/bin/java $JAVA_OPTS $MODULE_OPTS                                    -XX:+PrintAOT -Djvmci.InitTimer=true InitGraal | grep -E "$PATTERN" || exit 1
50echo "----------"
51
52rm -f InitGraal.class
53
54# eclipse started to fail again with JDK 9.
55#BENCHMARKS="avrora batik eclipse fop jython h2 luindex lusearch pmd sunflow tradebeans tradesoap xalan"
56BENCHMARKS="avrora batik fop jython h2 luindex lusearch pmd sunflow xalan"
57
58for i in $BENCHMARKS; do
59    $JAVA_HOME/bin/java $JAVA_OPTS $APP $i || exit 1
60    rm -rf ./scratch
61done
62
63