diff --git a/tools/ci/bench-base.sh b/tools/ci/bench-base.sh index 9679e41d9..e5b95af78 100755 --- a/tools/ci/bench-base.sh +++ b/tools/ci/bench-base.sh @@ -6,5 +6,5 @@ java -jar "$RENAISSANCE_JAR" --raw-list > list.txt for BENCH in $(cat list.txt); do echo "====> $BENCH" - java -Xms2500M -Xmx2500M -jar "$RENAISSANCE_JAR" -c test -r 1 --csv output.csv --json output.json "$BENCH" || exit 1 + java -Xms2500M -Xmx2500M $( get_jvm_workaround_args ) -jar "$RENAISSANCE_JAR" -c test -r 1 --csv output.csv --json output.json "$BENCH" || exit 1 done diff --git a/tools/ci/bench-jmh.sh b/tools/ci/bench-jmh.sh index 136fc5956..9d376a0b4 100755 --- a/tools/ci/bench-jmh.sh +++ b/tools/ci/bench-jmh.sh @@ -6,6 +6,7 @@ source "$(dirname "$0")/common.sh" java -jar "$RENAISSANCE_JMH_JAR" \ -jvmArgs -Xms2500M -jvmArgs -Xmx2500m \ + $( for arg in $( get_jvm_workaround_args ); do echo "-jvmArgs" "$arg"; done ) \ -jvmArgs -Dorg.renaissance.jmh.configuration=test \ -jvmArgs -Dorg.renaissance.jmh.fakeIncompatible=true \ -wi 0 -i 1 -f 1 -foe true diff --git a/tools/ci/common.sh b/tools/ci/common.sh index 6093c66f5..6cfa2d791 100644 --- a/tools/ci/common.sh +++ b/tools/ci/common.sh @@ -21,6 +21,12 @@ RENAISSANCE_GIT_VERSION=$(git describe --tags --always --dirty=-SNAPSHOT || echo # Strip leading 'v' from the git-produced version RENAISSANCE_VERSION=${RENAISSANCE_GIT_VERSION#v} +# Try to guess JVM version +RENAISSANCE_JVM_MAJOR_VERSION="$( java -XshowSettings:properties -version 2>&1 \ + | sed -n -e 's#^[ \t]*java.version[ ]*=[ ]\(.*\)#\1#p' \ + | sed -e 's#1\.8#8#' -e 's#\([^.]*\).*#\1#' \ + || echo 8 )" + # The base bundle RENAISSANCE_DIR="target" RENAISSANCE_JAR_NAME="renaissance-gpl-${RENAISSANCE_VERSION}.jar" @@ -43,6 +49,15 @@ cp_reflink() { cp $REFLINK "$@" } +get_jvm_workaround_args() { + if [ "$RENAISSANCE_JVM_MAJOR_VERSION" = "16" ]; then + echo "--add-opens=java.base/java.lang.invoke=ALL-UNNAMED" + echo "--add-opens=java.base/java.util=ALL-UNNAME" + echo "--add-opens=java.base/java.nio=ALL-UNNAMED" + echo "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED" + fi +} + # Make sure we are in the top-level directory so that we can use # relative paths when referring to files within the project.