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 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 MODULES="jdk.internal.vm.ci jdk.internal.vm.compiler" 30 31 TEST=InitGraal 32 33 for m in $MODULES; do 34 rm -f $JAVA_HOME/lib/lib$m*.$SO_TYPE 35 done 36 37 $JAVA_HOME/bin/javac --add-modules jdk.internal.vm.ci --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED $DIR/$TEST.java 38 39 # AOT compile non-tiered code version. 40 JAOTC_OPTS="-J-Xmx4g --info" 41 JAVA_OPTS="-Xmx4g -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseAOT -XX:+UnlockDiagnosticVMOptions -XX:+UseAOTStrictLoading --add-modules jdk.internal.vm.ci --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED" 42 43 # Compile with: +UseCompressedOops +UseG1GC 44 RT_OPTS="-J-XX:+UseCompressedOops -J-XX:+UseG1GC" 45 LIBRARIES="" 46 for m in $MODULES; do 47 if [ -f $DIR/$m-list.txt ]; then 48 LIST="--compile-commands $DIR/$m-list.txt" 49 else 50 LIST="" 51 fi 52 $JAVA_HOME/bin/jaotc $RT_OPTS $JAOTC_OPTS $LIST --output lib$m-coop.$SO_TYPE --module $m -J-XX:AOTLibrary=$LIBRARIES || exit 1 53 LIBRARIES="$LIBRARIES$PWD/lib$m-coop.$SO_TYPE:" 54 done 55 $JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT -XX:AOTLibrary=$LIBRARIES $TEST | grep "aot library" || exit 1 56 57 # Compile with: +UseCompressedOops +UseParallelGC 58 RT_OPTS="-J-XX:+UseCompressedOops -J-XX:+UseParallelGC" 59 LIBRARIES="" 60 for m in $MODULES; do 61 if [ -f $DIR/$m-list.txt ]; then 62 LIST="--compile-commands $DIR/$m-list.txt" 63 else 64 LIST="" 65 fi 66 $JAVA_HOME/bin/jaotc $RT_OPTS $JAOTC_OPTS $LIST --output lib$m-coop-nong1.$SO_TYPE --module $m -J-XX:AOTLibrary=$LIBRARIES || exit 1 67 LIBRARIES="$LIBRARIES$PWD/lib$m-coop-nong1.$SO_TYPE:" 68 done 69 $JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT -XX:AOTLibrary=$LIBRARIES $TEST | grep "aot library" || exit 1 70 71 # Compile with: -UseCompressedOops +UseG1GC 72 RT_OPTS="-J-XX:-UseCompressedOops -J-XX:+UseG1GC" 73 LIBRARIES="" 74 for m in $MODULES; do 75 if [ -f $DIR/$m-list.txt ]; then 76 LIST="--compile-commands $DIR/$m-list.txt" 77 else 78 LIST="" 79 fi 80 $JAVA_HOME/bin/jaotc $RT_OPTS $JAOTC_OPTS $LIST --output lib$m.$SO_TYPE --module $m -J-XX:AOTLibrary=$LIBRARIES || exit 1 81 LIBRARIES="$LIBRARIES$PWD/lib$m.$SO_TYPE:" 82 done 83 $JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT -XX:AOTLibrary=$LIBRARIES $TEST | grep "aot library" || exit 1 84 85 # Compile with: -UseCompressedOops +UseParallelGC 86 RT_OPTS="-J-XX:-UseCompressedOops -J-XX:+UseParallelGC" 87 LIBRARIES="" 88 for m in $MODULES; do 89 if [ -f $DIR/$m-list.txt ]; then 90 LIST="--compile-commands $DIR/$m-list.txt" 91 else 92 LIST="" 93 fi 94 $JAVA_HOME/bin/jaotc $RT_OPTS $JAOTC_OPTS $LIST --output lib$m-nong1.$SO_TYPE --module $m -J-XX:AOTLibrary=$LIBRARIES || exit 1 95 LIBRARIES="$LIBRARIES$PWD/lib$m-nong1.$SO_TYPE:" 96 done 97 $JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT -XX:AOTLibrary=$LIBRARIES $TEST | grep "aot library" || exit 1 98 99 echo "Installing shared libraries in: $JAVA_HOME/lib/" 100 for m in $MODULES; do 101 mv -f lib$m*.$SO_TYPE $JAVA_HOME/lib/ 102 done 103 104 # Test installed libraries. 105 $JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT $TEST | grep "aot library" || exit 1 106 $JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT $TEST | grep "aot library" || exit 1 107 $JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT $TEST | grep "aot library" || exit 1 108 $JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT $TEST | grep "aot library" || exit 1 109 110 rm -f $TEST.class