make/scripts/compare.sh
changeset 51781 dd737bf6abde
parent 50928 0e7e4b28c0d9
child 52030 57862a02bf4b
--- a/make/scripts/compare.sh	Tue Sep 18 10:29:56 2018 +0200
+++ b/make/scripts/compare.sh	Tue Sep 18 10:35:42 2018 +0200
@@ -65,6 +65,59 @@
 . "$COMPARE_EXCEPTIONS_INCLUDE"
 
 ################################################################################
+#
+# Disassembly diff filters. These filters try to filter out ephemeral parts of the
+# disassembly, such as hard-coded addresses, to be able to catch "actual" differences.
+
+if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
+  if [ "$OPENJDK_TARGET_CPU" = "sparcv9" ]; then
+    DIS_DIFF_FILTER="$SED \
+        -e 's/^[0-9a-f]\{16\}/<ADDR>:/' \
+        -e 's/^ *[0-9a-f]\{3,12\}:/  <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>),/' \
+        "
+  elif [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
+    # Random strings looking like this differ: <.XAKoKoPIac2W0OA.
+    DIS_DIFF_FILTER="$SED \
+        -e 's/<\.[A-Za-z0-9]\{\15}\./<.SYM./' \
+        "
+  fi
+elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+  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
+elif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
+  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
+
+################################################################################
 # Compare text files and ignore specific differences:
 #
 #  * Timestamps in Java sources generated by idl2java