#!/bin/bash
#
# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This script is not to be run as stand-alone, it should be included from
# compare.sh.
##########################################################################################
# Check that we are run via inclusion from compare.sh and not as stand-alone.
if [ -z "$COMPARE_EXCEPTIONS_INCLUDE" ]; then
echo "Error: This script should not be run as stand-alone. It is included by compare.sh"
exit 1
fi
##########################################################################################
# Diff exceptions
if [ "$OPENJDK_TARGET_OS" = "linux" ]; then
STRIP_BEFORE_COMPARE="
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
"
ACCEPTED_BIN_DIFF="
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
./lib/client/libjsig.so
./lib/client/libjvm.so
./lib/libattach.so
./lib/libdt_socket.so
./lib/libinstrument.so
./lib/libjsdt.so
./lib/libjsig.so
./lib/libmanagement.so
./lib/libnet.so
./lib/libnpt.so
./lib/libverify.so
./lib/minimal/libjsig.so
./lib/minimal/libjvm.so
./lib/server/libjsig.so
./lib/server/libjvm.so
./bin/appletviewer
./bin/idlj
./bin/jar
./bin/jarsigner
./bin/java
./bin/javac
./bin/javadoc
./bin/javah
./bin/javap
./bin/jdeps
./bin/jcmd
./bin/jconsole
./bin/jdb
./bin/jhsdb
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jlink
./bin/jmap
./bin/jmod
./bin/jps
./bin/jrunscript
./bin/jsadebugd
./bin/jshell
./bin/jstack
./bin/jstat
./bin/jstatd
./bin/keytool
./bin/orbd
./bin/pack200
./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
./bin/schemagen
./bin/serialver
./bin/servertool
./bin/tnameserv
./bin/wsgen
./bin/wsimport
./bin/xjc
"
if [ "$OPENJDK_TARGET_CPU" = "arm" ]; then
# NOTE: When comparing the old and new hotspot builds, the link time
# optimization makes good comparisons impossible. Fulldump compare always
# fails and disassembly can end up with some functions in different order.
# So for now, accept the difference but put a limit on the size. The
# different order of functions shouldn't result in a very big diff.
KNOWN_FULLDUMP_DIFF="
./lib/minimal/libjvm.so
"
# Link time optimization adds random numbers to symbol names
NEED_DIS_DIFF_FILTER="
./lib/minimal/libjvm.so
"
DIS_DIFF_FILTER="$SED -r \
-e 's/\.[0-9]+/.X/g' \
-e 's/\t[0-9a-f]{4} [0-9a-f]{4} /\tXXXX XXXX /' \
-e 's/\t[0-9a-f]{5,} /\t<HEX> /' \
"
KNOWN_DIS_DIFF="
./lib/minimal/libjvm.so
"
MAX_KNOWN_DIS_DIFF_SIZE="3000"
NEED_SYMBOLS_DIFF_FILTER="
./lib/minimal/libjvm.so
"
SYMBOLS_DIFF_FILTER="$SED -r \
-e 's/\.[0-9]+/.X/g'
"
fi
fi
if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
STRIP_BEFORE_COMPARE="
./demo/jni/Poller/lib/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
"
SORT_SYMBOLS="
./lib/server/libjvm.so
./lib/libfontmanager.so
./lib/libjimage.so
./lib/libsaproc.so
./lib/libunpack.so
./bin/unpack200
"
SKIP_BIN_DIFF="true"
ACCEPTED_SMALL_SIZE_DIFF="
./demo/jni/Poller/lib/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
./lib/jli/libjli.so
./lib/jspawnhelper
./lib/libJdbcOdbc.so
./lib/libattach.so
./lib/libawt.so
./lib/libawt_headless.so
./lib/libawt_xawt.so
./lib/libdcpr.so
./lib/libdt_socket.so
./lib/libfontmanager.so
./lib/libinstrument.so
./lib/libj2gss.so
./lib/libj2pcsc.so
./lib/libj2pkcs11.so
./lib/libj2ucrypto.so
./lib/libjaas_unix.so
./lib/libjava.so
./lib/libjawt.so
./lib/libjdwp.so
./lib/libjpeg.so
./lib/libjsdt.so
./lib/libjsound.so
./lib/libkcms.so
./lib/liblcms.so
./lib/libmanagement.so
./lib/libmlib_image.so
./lib/libnet.so
./lib/libnio.so
./lib/libnpt.so
./lib/libsctp.so
./lib/libsplashscreen.so
./lib/libsunec.so
./lib/libsunwjdga.so
./lib/libt2k.so
./lib/libunpack.so
./lib/libverify.so
./lib/libzip.so
./lib/server/64/libjvm_db.so
./lib/server/64/libjvm_dtrace.so
./lib/server/libjvm.so
./lib/server/libjvm_db.so
./lib/server/libjvm_dtrace.so
./bin/appletviewer
./bin/idlj
./bin/jar
./bin/jarsigner
./bin/java
./bin/javac
./bin/javadoc
./bin/javah
./bin/javap
./bin/jdeps
./bin/jcmd
./bin/jconsole
./bin/jdb
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jlink
./bin/jmap
./bin/jmod
./bin/jps
./bin/jrunscript
./bin/jsadebugd
./bin/jstack
./bin/jstat
./bin/jstatd
./bin/keytool
./bin/orbd
./bin/pack200
./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
./bin/schemagen
./bin/serialver
./bin/servertool
./bin/tnameserv
./bin/unpack200
./bin/wsgen
./bin/wsimport
./bin/xjc
"
SKIP_FULLDUMP_DIFF="true"
# Random strings looking like this differ: <.XAKoKoPIac2W0OA.
DIS_DIFF_FILTER="$SED \
-e 's/<\.[A-Za-z0-9]\{\15}\./<.SYM./' \
"
fi
if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "sparcv9" ]; then
STRIP_BEFORE_COMPARE="
./demo/jni/Poller/lib/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
"
SORT_SYMBOLS="
./demo/jvmti/waiters/lib/libwaiters.so
./lib/libjsig.so
./lib/libfontmanager.so
./lib/libjimage.so
./lib/libsaproc.so
./lib/libunpack.so
./lib/server/libjvm.so
./lib/server/libjvm_dtrace.so
./bin/unpack200
"
SKIP_BIN_DIFF="true"
ACCEPTED_SMALL_SIZE_DIFF="
./demo/jni/Poller/lib/libPoller.so
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
./demo/jvmti/gctest/lib/libgctest.so
./demo/jvmti/heapTracker/lib/libheapTracker.so
./demo/jvmti/heapViewer/lib/libheapViewer.so
./demo/jvmti/minst/lib/libminst.so
./demo/jvmti/mtrace/lib/libmtrace.so
./demo/jvmti/versionCheck/lib/libversionCheck.so
./demo/jvmti/waiters/lib/libwaiters.so
./lib/client/libjvm.so
./lib/jli/libjli.so
./lib/jspawnhelper
./lib/libJdbcOdbc.so
./lib/libattach.so
./lib/libawt.so
./lib/libawt_headless.so
./lib/libawt_xawt.so
./lib/libdcpr.so
./lib/libdt_socket.so
./lib/libfontmanager.so
./lib/libinstrument.so
./lib/libj2gss.so
./lib/libj2pcsc.so
./lib/libj2pkcs11.so
./lib/libj2ucrypto.so
./lib/libjaas_unix.so
./lib/libjava.so
./lib/libjawt.so
./lib/libjdwp.so
./lib/libjpeg.so
./lib/libjsdt.so
./lib/libjsound.so
./lib/libkcms.so
./lib/liblcms.so
./lib/libmanagement.so
./lib/libmlib_image.so
./lib/libmlib_image_v.so
./lib/libnet.so
./lib/libnio.so
./lib/libnpt.so
./lib/libsctp.so
./lib/libsplashscreen.so
./lib/libsunec.so
./lib/libsunwjdga.so
./lib/libt2k.so
./lib/libunpack.so
./lib/libverify.so
./lib/libzip.so
./lib/server/libjvm.so
./bin/appletviewer
./bin/idlj
./bin/jar
./bin/jarsigner
./bin/java
./bin/javac
./bin/javadoc
./bin/javah
./bin/javap
./bin/jdeps
./bin/jcmd
./bin/jconsole
./bin/jdb
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jlink
./bin/jmap
./bin/jmod
./bin/jps
./bin/jrunscript
./bin/jsadebugd
./bin/jstack
./bin/jstat
./bin/jstatd
./bin/keytool
./bin/orbd
./bin/pack200
./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
./bin/schemagen
./bin/serialver
./bin/servertool
./bin/tnameserv
./bin/unpack200
./bin/wsgen
./bin/wsimport
./bin/xjc
"
DIS_DIFF_FILTER="$SED \
-e 's/^[0-9a-f]\{16\}/<ADDR>:/' \
-e 's/^ *[0-9a-f]\{3,8\}:/ <ADDR>:/' \
-e 's/: [0-9a-f][0-9a-f]\( [0-9a-f][0-9a-f]\)\{2,10\}/: <NUMS>/' \
-e 's/\$[a-zA-Z0-9_\$]\{15\}\./<SYM>./' \
-e 's/, [0-9a-fx\-]\{1,8\}/, <ADDR>/g' \
-e 's/0x[0-9a-f]\{1,8\}/<HEX>/g' \
-e 's/\! [0-9a-f]\{1,8\} /! <ADDR> /' \
-e 's/call [0-9a-f]\{4,7\}/call <ADDR>/' \
-e 's/%hi(0),/%hi(<HEX>),/' \
"
KNOWN_DIS_DIFF="
./lib/libsaproc.so
"
MAX_KNOWN_DIS_DIFF_SIZE="3000"
# On slowdebug the disassembly can differ randomly.
if [ "$DEBUG_LEVEL" = "slowdebug" ]; then
ACCEPTED_DIS_DIFF="
./lib/libfontmanager.so
./lib/server/libjvm.so
"
fi
SKIP_FULLDUMP_DIFF="true"
fi
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
ACCEPTED_JARZIP_CONTENTS="
/modules_libs/java.security.jgss/w2k_lsa_auth.diz
/modules_libs/java.security.jgss/w2k_lsa_auth.pdb
/modules_libs/java.security.jgss/w2k_lsa_auth.map
/modules_libs/java.security.jgss/w2k_lsa_auth.dll
"
# Probably should add all libs here
ACCEPTED_SMALL_SIZE_DIFF="
./demo/jvmti/gctest/lib/gctest.dll
./demo/jvmti/heapTracker/lib/heapTracker.dll
./demo/jvmti/minst/lib/minst.dll
./bin/attach.dll
./bin/jsoundds.dll
./bin/client/jvm.dll
./bin/server/jvm.dll
./bin/appletviewer.exe
./bin/idlj.exe
./bin/jar.exe
./bin/jarsigner.exe
./bin/java-rmi.exe
./bin/java.exe
./bin/javac.exe
./bin/javadoc.exe
./bin/javah.exe
./bin/javap.exe
./bin/jdeps.exe
./bin/javaw.exe
./bin/jcmd.exe
./bin/jconsole.exe
./bin/jdb.exe
./bin/jimage.exe
./bin/jinfo.exe
./bin/jjs.exe
./bin/jlink.exe
./bin/jmap.exe
./bin/jmod.exe
./bin/jps.exe
./bin/jrunscript.exe
./bin/jsadebugd.exe
./bin/jstack.exe
./bin/jstat.exe
./bin/jstatd.exe
./bin/keytool.exe
./bin/kinit.exe
./bin/klist.exe
./bin/ktab.exe
./bin/orbd.exe
./bin/pack200.exe
./bin/policytool.exe
./bin/rmic.exe
./bin/rmid.exe
./bin/rmiregistry.exe
./bin/schemagen.exe
./bin/serialver.exe
./bin/servertool.exe
./bin/tnameserv.exe
./bin/unpack200.exe
./bin/wsgen.exe
./bin/wsimport.exe
./bin/xjc.exe
"
ACCEPTED_DIS_DIFF="
./bin/jabswitch.exe
"
if [ "$OPENJDK_TARGET_CPU" = "x86" ]; then
DIS_DIFF_FILTER="$SED -r \
-e 's/^ [0-9A-F]{16}: //' \
-e 's/^ [0-9A-F]{8}: / <ADDR>: /' \
-e 's/(offset \?\?)_C@_.*/\1<SYM>/' \
-e 's/[@?][A-Za-z0-9_]{1,25}/<SYM>/' \
-e 's/([-,+])[0-9A-F]{2,16}/\1<HEXSTR>/g' \
-e 's/\[[0-9A-F]{4,16}h\]/[<HEXSTR>]/' \
-e 's/: ([a-z]{2}[a-z ]{2}) [0-9A-F]{2,16}h?$/: \1 <HEXSTR>/' \
-e 's/_20[0-9]{2}_[0-1][0-9]_[0-9]{2}/_<DATE>/' \
"
elif [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
DIS_DIFF_FILTER="$SED -r \
-e 's/^ [0-9A-F]{16}: //' \
-e 's/\[[0-9A-F]{4,16}h\]/[<HEXSTR>]/' \
-e 's/([,+])[0-9A-F]{2,16}h/\1<HEXSTR>/' \
-e 's/([a-z]{2}[a-z ]{2}) [0-9A-F]{4,16}$/\1 <HEXSTR>/' \
-e 's/\[\?\?_C@_.*/[<SYM>]/' \
"
fi
SKIP_BIN_DIFF="true"
SKIP_FULLDUMP_DIFF="true"
# NOTE: When comparing the old and new hotspot builds, the server jvm.dll
# cannot be made equal in disassembly. Some functions just always end up
# in different order. So for now, accept the difference but put a limit
# on the size. The different order of functions shouldn't result in a very
# big diff.
KNOWN_DIS_DIFF="
./bin/server/jvm.dll
"
MAX_KNOWN_DIS_DIFF_SIZE="2000000"
fi
if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
ACCEPTED_JARZIP_CONTENTS="
/META-INF/INDEX.LIST
"
ACCEPTED_BIN_DIFF="
./bin/appletviewer
./bin/idlj
./bin/jar
./bin/jarsigner
./bin/java
./bin/javac
./bin/javadoc
./bin/javah
./bin/javap
./bin/javaws
./bin/jdeps
./bin/jcmd
./bin/jconsole
./bin/jdb
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jlink
./bin/jmap
./bin/jmod
./bin/jps
./bin/jrunscript
./bin/jsadebugd
./bin/jstack
./bin/jstat
./bin/jstatd
./bin/keytool
./bin/orbd
./bin/pack200
./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
./bin/schemagen
./bin/serialver
./bin/servertool
./bin/tnameserv
./bin/wsgen
./bin/wsimport
./bin/xjc
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.dylib
./demo/jvmti/gctest/lib/libgctest.dylib
./demo/jvmti/heapTracker/lib/libheapTracker.dylib
./demo/jvmti/heapViewer/lib/libheapViewer.dylib
./demo/jvmti/minst/lib/libminst.dylib
./demo/jvmti/mtrace/lib/libmtrace.dylib
./demo/jvmti/versionCheck/lib/libversionCheck.dylib
./demo/jvmti/waiters/lib/libwaiters.dylib
./Contents/Home/bin/_javaws
./Contents/Home/bin/javaws
./Contents/Home/bin/idlj
./Contents/Home/bin/servertool
./Contents/Home/lib/shortcuts/JavaWSApplicationStub
./Contents/Home/lib/jli/libjli.dylib
./Contents/Home/lib/jspawnhelper
./Contents/Home/lib/libAppleScriptEngine.dylib
./Contents/Home/lib/libattach.dylib
./Contents/Home/lib/libawt_lwawt.dylib
./Contents/Home/lib/libdeploy.dylib
./Contents/Home/lib/libdt_socket.dylib
./Contents/Home/lib/libinstrument.dylib
./Contents/Home/lib/libjdwp.dylib
./Contents/Home/lib/libjsdt.dylib
./Contents/Home/lib/libjsig.dylib
./Contents/Home/lib/libmanagement.dylib
./Contents/Home/lib/libnpjp2.dylib
./Contents/Home/lib/libosx.dylib
./Contents/Home/lib/libosxapp.dylib
./Contents/Home/lib/libosxui.dylib
./Contents/Home/lib/libverify.dylib
./Contents/Home/lib/libsaproc.dylib
./Contents/Home/lib/libsplashscreen.dylib
./Contents/Home/lib/server/libjsig.dylib
./Contents/Home/lib/server/libjvm.dylib
./Contents/Home/lib/deploy/JavaControlPanel.prefPane/Contents/MacOS/JavaControlPanel
./Contents/Resources/JavaControlPanelHelper
./Contents/Resources/JavaUpdater.app/Contents/MacOS/JavaUpdater
./Contents/Resources/JavawsLauncher.app/Contents/MacOS/JavawsLauncher
./lib/shortcuts/JavaWSApplicationStub
./lib/jli/libjli.dylib
./lib/jspawnhelper
./lib/libAppleScriptEngine.dylib
./lib/libattach.dylib
./lib/libawt_lwawt.dylib
./lib/libdeploy.dylib
./lib/libdt_socket.dylib
./lib/libinstrument.dylib
./lib/libjdwp.dylib
./lib/libjsdt.dylib
./lib/libjsig.dylib
./lib/libmanagement.dylib
./lib/libnpjp2.dylib
./lib/libosx.dylib
./lib/libosxapp.dylib
./lib/libosxui.dylib
./lib/libverify.dylib
./lib/libsaproc.dylib
./lib/libsplashscreen.dylib
./lib/server/libjsig.dylib
./lib/server/libjvm.dylib
./lib/deploy/JavaControlPanel.prefPane/Contents/MacOS/JavaControlPanel
./Versions/A/Resources/finish_installation.app/Contents/MacOS/finish_installation
./Versions/A/Sparkle
"
SORT_SYMBOLS="
./Contents/Home/lib/libsaproc.dylib
./lib/libsaproc.dylib
./lib/libjsig.dylib
"
ACCEPTED_SMALL_SIZE_DIFF="$ACCEPTED_BIN_DIFF"
DIS_DIFF_FILTER="LANG=C $SED \
-e 's/0x[0-9a-f]\{3,16\}/<HEXSTR>/g' -e 's/^[0-9a-f]\{12,20\}/<ADDR>/' \
-e 's/-20[0-9][0-9]-[0-1][0-9]-[0-3][0-9]-[0-2][0-9]\{5\}/<DATE>/g' \
-e 's/), built on .*/), <DATE>/' \
"
fi