[Git][ghc/ghc][wip/romes/12935] 7 commits: Refactor ProfilingInfo to preserve Unique information before rendering it
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Mon Jul 29 11:03:45 UTC 2024
Rodrigo Mesquita pushed to branch wip/romes/12935 at Glasgow Haskell Compiler / GHC
Commits:
8aba0515 by Rodrigo Mesquita at 2024-07-26T14:26:05+01:00
Refactor ProfilingInfo to preserve Unique information before rendering it
- - - - -
2dd3da96 by Rodrigo Mesquita at 2024-07-26T14:26:05+01:00
Rename Profiling Info now that names are preserved
- - - - -
79275e2d by Rodrigo Mesquita at 2024-07-26T14:26:05+01:00
Update standalone check scripts
- - - - -
8140fd3b by Rodrigo Mesquita at 2024-07-26T14:26:19+01:00
Revert "Rename Profiling Info now that names are preserved"
This reverts commit 2dd3da96b7e771ae272791a00d7fb55313401c9e.
- - - - -
879ccfcb by Rodrigo Mesquita at 2024-07-26T14:26:28+01:00
Revert "Refactor ProfilingInfo to preserve Unique information before rendering it"
This reverts commit 8aba0515bb744ca5add6a4c3c9c7760e226e0b31.
- - - - -
eecf110c by Rodrigo Mesquita at 2024-07-26T14:36:34+01:00
Don't print unique in pprFullName
This unique was leaking as part of the profiling description in info tables when profiling was enabled
- - - - -
e6081ac2 by Rodrigo Mesquita at 2024-07-26T15:14:02+01:00
Update abi test with decrementing uniques
- - - - -
4 changed files:
- .gitlab/ci.sh
- compiler/GHC/Types/Name.hs
- testsuite/tests/determinism/object/check-standalone.sh
- testsuite/tests/determinism/object/check.sh
Changes:
=====================================
.gitlab/ci.sh
=====================================
@@ -701,6 +701,12 @@ function cabal_abi_test() {
if [ -z "$OUT" ]; then
fail "OUT not set"
fi
+ if [ -z "$REVERSE_UNIQUES" ]; then
+ EXTRA_OPTS=""
+ else
+ # Count uniques in reverse one of the runs to get more non-determinism exposed
+ EXTRA_OPTS="-dinitial-unique=16777215 -dunique-increment=-1"
+ fi
cp -r libraries/Cabal $DIR
pushd $DIR
@@ -711,6 +717,8 @@ function cabal_abi_test() {
run "$HC" \
-hidir tmp -odir tmp -fforce-recomp -haddock \
-iCabal/Cabal/src -XNoPolyKinds Distribution.Simple -j"$cores" \
+ -fobject-determinism \
+ $EXTRA_OPTS \
"$@" 2>&1 | tee $OUT/log
summarise_hi_files
summarise_o_files
@@ -784,6 +792,8 @@ function check_objects(){
fail "Mismatched object: $dump"
fi
done
+
+ fail "Some objects are mismatched, but theres no diff with --all-headers or --disassemble-all. Perhaps try objdump -s"
fi
}
@@ -798,7 +808,7 @@ function run_abi_test() {
fi
mkdir -p out
OUT="$PWD/out/run1" DIR=$(mktemp -d XXXX-looooooooong) cabal_abi_test -O0
- OUT="$PWD/out/run2" DIR=$(mktemp -d XXXX-short) cabal_abi_test -O0
+ OUT="$PWD/out/run2" DIR=$(mktemp -d XXXX-short) REVERSE_UNIQUES="yes" cabal_abi_test -O0
check_interfaces out/run1 out/run2 abis "Mismatched ABI hash"
check_interfaces out/run1 out/run2 interfaces "Mismatched interface hashes"
check_objects out/run1 out/run2
=====================================
compiler/GHC/Types/Name.hs
=====================================
@@ -716,7 +716,7 @@ pprName name@(Name {n_sort = sort, n_uniq = uniq, n_occ = occ})
{-# SPECIALISE pprName :: Name -> SDoc #-}
{-# SPECIALISE pprName :: Name -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable
--- | Print fully qualified name (with unit-id, module and unique)
+-- | Print fully qualified name (with unit-id, module but no unique)
pprFullName :: Module -> Name -> SDoc
pprFullName this_mod Name{n_sort = sort, n_uniq = uniq, n_occ = occ} =
let mod = case sort of
@@ -727,8 +727,6 @@ pprFullName this_mod Name{n_sort = sort, n_uniq = uniq, n_occ = occ} =
in ftext (unitIdFS (moduleUnitId mod))
<> colon <> ftext (moduleNameFS $ moduleName mod)
<> dot <> ftext (occNameFS occ)
- <> char '_' <> pprUniqueAlways uniq
-
-- | Print a ticky ticky styled name
--
=====================================
testsuite/tests/determinism/object/check-standalone.sh
=====================================
@@ -8,8 +8,8 @@ fi
rm -rf objs1 objs2
cabal get Cabal-3.12.0.0
-cabal build -w $1 --ghc-options="-fforce-recomp -j4 -ddump-to-file -fobject-determinism" --ghc-options=-odir=out1 Cabal
+cabal build --enable-profiling -w "$1" --ghc-options="-fforce-recomp -j12 -ddump-to-file -fobject-determinism -dumpdir=dumpout1 -ddump-simpl -ddump-stg-final -ddump-cmm" --ghc-options=-odir=out1 --ghc-options=-hidir=hiout1 Cabal
# cabal build -w $1 --ghc-options="-fforce-recomp -j4" --ghc-options=-odir=out1 Cabal
-cabal build -w $1 --ghc-options="-fforce-recomp -j4 -dinitial-unique=16777215 -dunique-increment=-1 -fobject-determinism" --ghc-options=-odir=out2 Cabal
+cabal build --enable-profiling -w "$1" --ghc-options="-fforce-recomp -j12 -ddump-to-file -dinitial-unique=16777215 -dunique-increment=-1 -fobject-determinism -dumpdir=dumpout2 -ddump-simpl -ddump-stg-final -ddump-cmm" --ghc-options=-odir=out2 --ghc-options=-hidir=hiout2 Cabal
# cabal build -w $1 --ghc-options="-fforce-recomp -j4" --ghc-options=-odir=out2 Cabal
-./check.sh linux
+./check.sh "$1"
=====================================
testsuite/tests/determinism/object/check.sh
=====================================
@@ -4,12 +4,15 @@
if test -z "$1"
then
- echo "Usage: ./check.sh <HostOS> # example ./check.sh darwin"
+ echo "Usage: ./check.sh <ghc>"
exit 1
fi
+UNAME=$(uname)
+COMPILER="$1"
+
# On darwin we need to pass -m to objdump on Mach-O files
-if test $1 == "darwin"
+if test $UNAME == "Darwin"
then
OBJDUMP="objdump -m"
else
@@ -67,7 +70,7 @@ else
OBJS=$(find . -type f)
popd >/dev/null
- compareHis "/home/matt/ghc-rodrigo/_build/stage1/bin/ghc" "$OBJS"
+ compareHis "$COMPILER" "$OBJS"
exit 1
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a1eaee52f5ef7229abcf136e5fd33189cadc82f6...e6081ac247b42abfc13497b06791bf5d8646de72
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a1eaee52f5ef7229abcf136e5fd33189cadc82f6...e6081ac247b42abfc13497b06791bf5d8646de72
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240729/99626a9c/attachment-0001.html>
More information about the ghc-commits
mailing list