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