[Git][ghc/ghc][wip/fendor/dep-json] 4 commits: Add `-dep-json` flag to `ghc -M`
by Hannes Siebenhandl (@fendor) 19 Oct '26
by Hannes Siebenhandl (@fendor) 19 Oct '26
19 Oct '26
Hannes Siebenhandl pushed to branch wip/fendor/dep-json at Glasgow Haskell Compiler / GHC
Commits:
b2645eb9 by fendor at 2026-10-19T13:35:48+02:00
Add `-dep-json` flag to `ghc -M`
Add an optional flag to `ghc -M` that allows to write the dependency
information in JSON Lines format.
The JSON Lines format enables us to stream the output of the dependency
generation to a consumer.
The output of `-dep-json` is streamed to a temporary file and then
copied to the final destination to avoid partial writes.
Each line contains one of two possible json objects:
1. A Home Unit Dependency
* Contains the name of the home module, its unit, where it is
located, whether a preprocessor is used, and all of its imports.
Importantly, the imports include `-XExplicitLevelImports`
information.
* If requested via `-include-pkg-deps`, includes imports of external
units, e.g. modules from `base`.
* If requested via `-include-cpp-deps`, files included via CPP.
2. External Unit Dependency
* Only if `-include-pkg-deps` is given
* Contains unit-id, its package name and package id.
- - - - -
2db6a4cf by fendor at 2026-10-19T13:35:48+02:00
Add multiple home unit support to `ghc -M`
Allows to process the module graph of multiple home units at once using
the same syntax as `--make` and `--interactive`:
ghc -M -unit @unitA -unit @unitB
The semantics are identical to `--make` and `--interactive`.
Each home unit can declare individually to use `-include-cpp-deps` and
`-include-pkg-deps`.
However, there can only be one output file, and `-dep-json` and
`-dep-makefile` can only be provided at the top of the cli invocation.
We introduce a new GHC API `doMkDepend` that allows to use multiple home
units conveniently.
The output of `-dep-json` and `-dep-makefile` does not change, since we
were careful to choose a format that supports multiple home units from
the start.
Single home units are still accepted like before with no changes.
- - - - -
1006abdf by fendor at 2026-10-19T13:35:48+02:00
Deprecate `doMkDependHS` in favour of `doMkDepend`
- - - - -
2e4f44de by fendor at 2026-10-19T13:35:48+02:00
Improve `ghc -M` test-suite
Adds a more extensive test-suite for `ghc -M` mode.
Introduce a dedicated test mode for running `ghc -M` tests more
conveniently.
Adds lots of normalizers that help to write `ghc -M` tests in a platform
independent manner.
Adds utility scripts that help format the output of `ghc -M`.
Add new perf regression tests for json and makefile generation.
Add perf regression test for multiple home unit support.
- - - - -
64 changed files:
- + changelog.d/make-depends-deprecate-doMkDependHS
- + changelog.d/make-depends-json
- + changelog.d/make-depends-multiple-home-units
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Driver/Session/Units.hs
- compiler/GHC/Utils/Json.hs
- + docs/users_guide/make-depends-json-schema-1_0.json
- docs/users_guide/separate_compilation.rst
- ghc/Main.hs
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/tests/driver/mkdepend/Makefile
- + testsuite/tests/driver/mkdepend/README.md
- testsuite/tests/driver/mkdepend/A.hs → testsuite/tests/driver/mkdepend/T24384/A.hs
- testsuite/tests/driver/mkdepend/C.hs → testsuite/tests/driver/mkdepend/T24384/C.hs
- testsuite/tests/driver/mkdepend/C.hs-boot → testsuite/tests/driver/mkdepend/T24384/C.hs-boot
- testsuite/tests/driver/mkdepend/D.hs → testsuite/tests/driver/mkdepend/T24384/D.hs
- testsuite/tests/driver/mkdepend/E.hs → testsuite/tests/driver/mkdepend/T24384/E.hs
- testsuite/tests/driver/mkdepend/dep-internal/DepInternal.hs → testsuite/tests/driver/mkdepend/T24384/dep-internal/DepInternal.hs
- testsuite/tests/driver/mkdepend/dep-internal/dep-internal.pkg → testsuite/tests/driver/mkdepend/T24384/dep-internal/dep-internal.pkg
- testsuite/tests/driver/mkdepend/dep-public/DepPublic.hs → testsuite/tests/driver/mkdepend/T24384/dep-public/DepPublic.hs
- testsuite/tests/driver/mkdepend/dep-public/dep-public.pkg → testsuite/tests/driver/mkdepend/T24384/dep-public/dep-public.pkg
- testsuite/tests/driver/mkdepend/dep/Dep.hs → testsuite/tests/driver/mkdepend/T24384/dep/Dep.hs
- testsuite/tests/driver/mkdepend/dep/dep.pkg → testsuite/tests/driver/mkdepend/T24384/dep/dep.pkg
- testsuite/tests/driver/mkdepend/foo.h → testsuite/tests/driver/mkdepend/T24384/foo.h
- testsuite/tests/driver/mkdepend/lib/B.hs → testsuite/tests/driver/mkdepend/T24384/lib/B.hs
- + testsuite/tests/driver/mkdepend/T24384/lib/B.hs-boot
- testsuite/tests/driver/mkdepend/preproc.sh → testsuite/tests/driver/mkdepend/T24384/preproc.sh
- testsuite/tests/driver/mkdepend/T24384a.stdout
- + testsuite/tests/driver/mkdepend/T24384b.stdout
- + testsuite/tests/driver/mkdepend/T24384c.stdout
- testsuite/tests/driver/mkdepend/all.T
- + testsuite/tests/driver/mkdepend/format_json.sh
- + testsuite/tests/driver/mkdepend/format_makefile.sh
- + testsuite/tests/driver/mkdepend/mhu01/a/A/Base.hs
- + testsuite/tests/driver/mkdepend/mhu01/a/A/Base.hs-boot
- + testsuite/tests/driver/mkdepend/mhu01/a/A/TH.hs
- + testsuite/tests/driver/mkdepend/mhu01/a/Util.hs
- + testsuite/tests/driver/mkdepend/mhu01/b/B/Normal.hs
- + testsuite/tests/driver/mkdepend/mhu01/b/B/Splice.hs
- + testsuite/tests/driver/mkdepend/mhu01/b/Util.hs
- + testsuite/tests/driver/mkdepend/mhu01/c/C.hs
- + testsuite/tests/driver/mkdepend/mhu01/unitA
- + testsuite/tests/driver/mkdepend/mhu01/unitB
- + testsuite/tests/driver/mkdepend/mhu01/unitC
- + testsuite/tests/driver/mkdepend/mhu02/A.hs
- + testsuite/tests/driver/mkdepend/mhu02/B.hs
- + testsuite/tests/driver/mkdepend/mhu02/pp.sh
- + testsuite/tests/driver/mkdepend/mhu02/unitA
- + testsuite/tests/driver/mkdepend/mhu02/unitB
- + testsuite/tests/driver/mkdepend/mhu03/pkg/A.hs
- + testsuite/tests/driver/mkdepend/mhu03/pkg/pp.sh
- + testsuite/tests/driver/mkdepend/mhu03/unitA
- + testsuite/tests/driver/mkdepend/mkdepend01.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend01.dep-makefile
- + testsuite/tests/driver/mkdepend/mkdepend01/A.hs
- + testsuite/tests/driver/mkdepend/mkdepend_mhu01.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu01.dep-makefile
- + testsuite/tests/driver/mkdepend/mkdepend_mhu02.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu03.dep-json
- testsuite/tests/perf/compiler/large-project/all.T
- + testsuite/tests/perf/compiler/large-project/large-project-mhu.sh
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/227f376d9b6db07250ed8b10b0a7d1…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/227f376d9b6db07250ed8b10b0a7d1…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/fendor/dep-json] 4 commits: Add `-dep-json` flag to `ghc -M`
by Hannes Siebenhandl (@fendor) 19 Oct '26
by Hannes Siebenhandl (@fendor) 19 Oct '26
19 Oct '26
Hannes Siebenhandl pushed to branch wip/fendor/dep-json at Glasgow Haskell Compiler / GHC
Commits:
33519257 by fendor at 2026-10-19T13:33:28+02:00
Add `-dep-json` flag to `ghc -M`
Add an optional flag to `ghc -M` that allows to write the dependency
information in JSON Lines format.
The JSON Lines format enables us to stream the output of the dependency
generation to a consumer.
The output of `-dep-json` is streamed to a temporary file and then
copied to the final destination to avoid partial writes.
Each line contains one of two possible json objects:
1. A Home Unit Dependency
* Contains the name of the home module, its unit, where it is
located, whether a preprocessor is used, and all of its imports.
Importantly, the imports include `-XExplicitLevelImports`
information.
* If requested via `-include-pkg-deps`, includes imports of external
units, e.g. modules from `base`.
* If requested via `-include-cpp-deps`, files included via CPP.
2. External Unit Dependency
* Only if `-include-pkg-deps` is given
* Contains unit-id, its package name and package id.
- - - - -
ce9b1abb by fendor at 2026-10-19T13:33:28+02:00
Add multiple home unit support to `ghc -M`
Allows to process the module graph of multiple home units at once using
the same syntax as `--make` and `--interactive`:
ghc -M -unit @unitA -unit @unitB
The semantics are identical to `--make` and `--interactive`.
Each home unit can declare individually to use `-include-cpp-deps` and
`-include-pkg-deps`.
However, there can only be one output file, and `-dep-json` and
`-dep-makefile` can only be provided at the top of the cli invocation.
We introduce a new GHC API `doMkDepend` that allows to use multiple home
units conveniently.
The output of `-dep-json` and `-dep-makefile` does not change, since we
were careful to choose a format that supports multiple home units from
the start.
Single home units are still accepted like before with no changes.
- - - - -
28b25350 by fendor at 2026-10-19T13:33:28+02:00
Deprecate `doMkDependHS` in favour of `doMkDepend`
- - - - -
227f376d by fendor at 2026-10-19T13:33:28+02:00
Improve `ghc -M` test-suite
Adds a more extensive test-suite for `ghc -M` mode.
Introduce a dedicated test mode for running `ghc -M` tests more
conveniently.
Adds lots of normalizers that help to write `ghc -M` tests in a platform
independent manner.
Adds utility scripts that help format the output of `ghc -M`.
Add new perf regression tests for json and makefile generation.
Add perf regression test for multiple home unit support.
- - - - -
64 changed files:
- + changelog.d/make-depends-deprecate-doMkDependHS
- + changelog.d/make-depends-json
- + changelog.d/make-depends-multiple-home-units
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Driver/Session/Units.hs
- compiler/GHC/Utils/Json.hs
- + docs/users_guide/make-depends-json-schema-1_0.json
- docs/users_guide/separate_compilation.rst
- ghc/Main.hs
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/tests/driver/mkdepend/Makefile
- + testsuite/tests/driver/mkdepend/README.md
- testsuite/tests/driver/mkdepend/A.hs → testsuite/tests/driver/mkdepend/T24384/A.hs
- testsuite/tests/driver/mkdepend/C.hs → testsuite/tests/driver/mkdepend/T24384/C.hs
- testsuite/tests/driver/mkdepend/C.hs-boot → testsuite/tests/driver/mkdepend/T24384/C.hs-boot
- testsuite/tests/driver/mkdepend/D.hs → testsuite/tests/driver/mkdepend/T24384/D.hs
- testsuite/tests/driver/mkdepend/E.hs → testsuite/tests/driver/mkdepend/T24384/E.hs
- testsuite/tests/driver/mkdepend/dep-internal/DepInternal.hs → testsuite/tests/driver/mkdepend/T24384/dep-internal/DepInternal.hs
- testsuite/tests/driver/mkdepend/dep-internal/dep-internal.pkg → testsuite/tests/driver/mkdepend/T24384/dep-internal/dep-internal.pkg
- testsuite/tests/driver/mkdepend/dep-public/DepPublic.hs → testsuite/tests/driver/mkdepend/T24384/dep-public/DepPublic.hs
- testsuite/tests/driver/mkdepend/dep-public/dep-public.pkg → testsuite/tests/driver/mkdepend/T24384/dep-public/dep-public.pkg
- testsuite/tests/driver/mkdepend/dep/Dep.hs → testsuite/tests/driver/mkdepend/T24384/dep/Dep.hs
- testsuite/tests/driver/mkdepend/dep/dep.pkg → testsuite/tests/driver/mkdepend/T24384/dep/dep.pkg
- testsuite/tests/driver/mkdepend/foo.h → testsuite/tests/driver/mkdepend/T24384/foo.h
- testsuite/tests/driver/mkdepend/lib/B.hs → testsuite/tests/driver/mkdepend/T24384/lib/B.hs
- + testsuite/tests/driver/mkdepend/T24384/lib/B.hs-boot
- testsuite/tests/driver/mkdepend/preproc.sh → testsuite/tests/driver/mkdepend/T24384/preproc.sh
- testsuite/tests/driver/mkdepend/T24384a.stdout
- + testsuite/tests/driver/mkdepend/T24384b.stdout
- + testsuite/tests/driver/mkdepend/T24384c.stdout
- testsuite/tests/driver/mkdepend/all.T
- + testsuite/tests/driver/mkdepend/format_json.sh
- + testsuite/tests/driver/mkdepend/format_makefile.sh
- + testsuite/tests/driver/mkdepend/mhu01/a/A/Base.hs
- + testsuite/tests/driver/mkdepend/mhu01/a/A/Base.hs-boot
- + testsuite/tests/driver/mkdepend/mhu01/a/A/TH.hs
- + testsuite/tests/driver/mkdepend/mhu01/a/Util.hs
- + testsuite/tests/driver/mkdepend/mhu01/b/B/Normal.hs
- + testsuite/tests/driver/mkdepend/mhu01/b/B/Splice.hs
- + testsuite/tests/driver/mkdepend/mhu01/b/Util.hs
- + testsuite/tests/driver/mkdepend/mhu01/c/C.hs
- + testsuite/tests/driver/mkdepend/mhu01/unitA
- + testsuite/tests/driver/mkdepend/mhu01/unitB
- + testsuite/tests/driver/mkdepend/mhu01/unitC
- + testsuite/tests/driver/mkdepend/mhu02/A.hs
- + testsuite/tests/driver/mkdepend/mhu02/B.hs
- + testsuite/tests/driver/mkdepend/mhu02/pp.sh
- + testsuite/tests/driver/mkdepend/mhu02/unitA
- + testsuite/tests/driver/mkdepend/mhu02/unitB
- + testsuite/tests/driver/mkdepend/mhu03/pkg/A.hs
- + testsuite/tests/driver/mkdepend/mhu03/pkg/pp.sh
- + testsuite/tests/driver/mkdepend/mhu03/unitA
- + testsuite/tests/driver/mkdepend/mkdepend01.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend01.dep-makefile
- + testsuite/tests/driver/mkdepend/mkdepend01/A.hs
- + testsuite/tests/driver/mkdepend/mkdepend_mhu01.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu01.dep-makefile
- + testsuite/tests/driver/mkdepend/mkdepend_mhu02.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu03.dep-json
- testsuite/tests/perf/compiler/large-project/all.T
- + testsuite/tests/perf/compiler/large-project/large-project-mhu.sh
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7308ae7cf722a9e34d03d71706b1d8…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7308ae7cf722a9e34d03d71706b1d8…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/fendor/dep-json] 4 commits: Add `-dep-json` flag to `ghc -M`
by Hannes Siebenhandl (@fendor) 19 Oct '26
by Hannes Siebenhandl (@fendor) 19 Oct '26
19 Oct '26
Hannes Siebenhandl pushed to branch wip/fendor/dep-json at Glasgow Haskell Compiler / GHC
Commits:
64ca10bc by fendor at 2026-10-19T11:55:37+02:00
Add `-dep-json` flag to `ghc -M`
Add an optional flag to `ghc -M` that allows to write the dependency
information in JSON Lines format.
The JSON Lines format enables us to stream the output of the dependency
generation to a consumer.
The output of `-dep-json` is streamed to a temporary file and then
copied to the final destination to avoid partial writes.
Each line contains one of two possible json objects:
1. A Home Unit Dependency
* Contains the name of the home module, its unit, where it is
located, whether a preprocessor is used, and all of its imports.
Importantly, the imports include `-XExplicitLevelImports`
information.
* If requested via `-include-pkg-deps`, includes imports of external
units, e.g. modules from `base`.
* If requested via `-include-cpp-deps`, files included via CPP.
2. External Unit Dependency
* Only if `-include-pkg-deps` is given
* Contains unit-id, its package name and package id.
- - - - -
610ea96c by fendor at 2026-10-19T11:55:37+02:00
Add multiple home unit support to `ghc -M`
Allows to process the module graph of multiple home units at once using
the same syntax as `--make` and `--interactive`:
ghc -M -unit @unitA -unit @unitB
The semantics are identical to `--make` and `--interactive`.
Each home unit can declare individually to use `-include-cpp-deps` and
`-include-pkg-deps`.
However, there can only be one output file, and `-dep-json` and
`-dep-makefile` can only be provided at the top of the cli invocation.
We introduce a new GHC API `doMkDepend` that allows to use multiple home
units conveniently.
The output of `-dep-json` and `-dep-makefile` does not change, since we
were careful to choose a format that supports multiple home units from
the start.
Single home units are still accepted like before with no changes.
- - - - -
92138bae by fendor at 2026-10-19T11:55:37+02:00
Deprecate `doMkDependHS` in favour of `doMkDepend`
- - - - -
7308ae7c by fendor at 2026-10-19T11:55:37+02:00
Improve `ghc -M` test-suite
Adds a more extensive test-suite for `ghc -M` mode.
Introduce a dedicated test mode for running `ghc -M` tests more
conveniently.
Adds lots of normalizers that help to write `ghc -M` tests in a platform
independent manner.
Adds utility scripts that help format the output of `ghc -M`.
Add new perf regression tests for json and makefile generation.
Add perf regression test for multiple home unit support.
- - - - -
62 changed files:
- + changelog.d/make-depends-json
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Driver/Session/Units.hs
- compiler/GHC/Utils/Json.hs
- + docs/users_guide/make-depends-json-schema-1_0.json
- docs/users_guide/separate_compilation.rst
- ghc/Main.hs
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/tests/driver/mkdepend/Makefile
- + testsuite/tests/driver/mkdepend/README.md
- testsuite/tests/driver/mkdepend/A.hs → testsuite/tests/driver/mkdepend/T24384/A.hs
- testsuite/tests/driver/mkdepend/C.hs → testsuite/tests/driver/mkdepend/T24384/C.hs
- testsuite/tests/driver/mkdepend/C.hs-boot → testsuite/tests/driver/mkdepend/T24384/C.hs-boot
- testsuite/tests/driver/mkdepend/D.hs → testsuite/tests/driver/mkdepend/T24384/D.hs
- testsuite/tests/driver/mkdepend/E.hs → testsuite/tests/driver/mkdepend/T24384/E.hs
- testsuite/tests/driver/mkdepend/dep-internal/DepInternal.hs → testsuite/tests/driver/mkdepend/T24384/dep-internal/DepInternal.hs
- testsuite/tests/driver/mkdepend/dep-internal/dep-internal.pkg → testsuite/tests/driver/mkdepend/T24384/dep-internal/dep-internal.pkg
- testsuite/tests/driver/mkdepend/dep-public/DepPublic.hs → testsuite/tests/driver/mkdepend/T24384/dep-public/DepPublic.hs
- testsuite/tests/driver/mkdepend/dep-public/dep-public.pkg → testsuite/tests/driver/mkdepend/T24384/dep-public/dep-public.pkg
- testsuite/tests/driver/mkdepend/dep/Dep.hs → testsuite/tests/driver/mkdepend/T24384/dep/Dep.hs
- testsuite/tests/driver/mkdepend/dep/dep.pkg → testsuite/tests/driver/mkdepend/T24384/dep/dep.pkg
- testsuite/tests/driver/mkdepend/foo.h → testsuite/tests/driver/mkdepend/T24384/foo.h
- testsuite/tests/driver/mkdepend/lib/B.hs → testsuite/tests/driver/mkdepend/T24384/lib/B.hs
- + testsuite/tests/driver/mkdepend/T24384/lib/B.hs-boot
- testsuite/tests/driver/mkdepend/preproc.sh → testsuite/tests/driver/mkdepend/T24384/preproc.sh
- testsuite/tests/driver/mkdepend/T24384a.stdout
- + testsuite/tests/driver/mkdepend/T24384b.stdout
- + testsuite/tests/driver/mkdepend/T24384c.stdout
- testsuite/tests/driver/mkdepend/all.T
- + testsuite/tests/driver/mkdepend/format_json.sh
- + testsuite/tests/driver/mkdepend/format_makefile.sh
- + testsuite/tests/driver/mkdepend/mhu01/a/A/Base.hs
- + testsuite/tests/driver/mkdepend/mhu01/a/A/Base.hs-boot
- + testsuite/tests/driver/mkdepend/mhu01/a/A/TH.hs
- + testsuite/tests/driver/mkdepend/mhu01/a/Util.hs
- + testsuite/tests/driver/mkdepend/mhu01/b/B/Normal.hs
- + testsuite/tests/driver/mkdepend/mhu01/b/B/Splice.hs
- + testsuite/tests/driver/mkdepend/mhu01/b/Util.hs
- + testsuite/tests/driver/mkdepend/mhu01/c/C.hs
- + testsuite/tests/driver/mkdepend/mhu01/unitA
- + testsuite/tests/driver/mkdepend/mhu01/unitB
- + testsuite/tests/driver/mkdepend/mhu01/unitC
- + testsuite/tests/driver/mkdepend/mhu02/A.hs
- + testsuite/tests/driver/mkdepend/mhu02/B.hs
- + testsuite/tests/driver/mkdepend/mhu02/pp.sh
- + testsuite/tests/driver/mkdepend/mhu02/unitA
- + testsuite/tests/driver/mkdepend/mhu02/unitB
- + testsuite/tests/driver/mkdepend/mhu03/pkg/A.hs
- + testsuite/tests/driver/mkdepend/mhu03/pkg/pp.sh
- + testsuite/tests/driver/mkdepend/mhu03/unitA
- + testsuite/tests/driver/mkdepend/mkdepend01.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend01.dep-makefile
- + testsuite/tests/driver/mkdepend/mkdepend01/A.hs
- + testsuite/tests/driver/mkdepend/mkdepend_mhu01.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu01.dep-makefile
- + testsuite/tests/driver/mkdepend/mkdepend_mhu02.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu03.dep-json
- testsuite/tests/perf/compiler/large-project/all.T
- + testsuite/tests/perf/compiler/large-project/large-project-mhu.sh
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cd063639067f822d448eb89cb77d65…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cd063639067f822d448eb89cb77d65…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/davide/windows-dlls_sysm-test_master] 2 commits: Add golden test for rts/RtsSymbols.c
by David Eichmann (@DavidEichmann) 19 Oct '26
by David Eichmann (@DavidEichmann) 19 Oct '26
19 Oct '26
David Eichmann pushed to branch wip/davide/windows-dlls_sysm-test_master at Glasgow Haskell Compiler / GHC
Commits:
af0f4087 by David Eichmann at 2026-10-19T10:43:57+01:00
Add golden test for rts/RtsSymbols.c
The test compares declared symbols against symbols observed
in the rts DSO (dll/so) by the llvm-readobj tool.
- - - - -
8539a27e by David Eichmann at 2026-10-19T10:43:57+01:00
RtsSymbols records redirect labels
The rts-check-symbols test uses redirect labels when available
- - - - -
11 changed files:
- rts/RtsSymbols.c
- rts/include/rts/RtsSymbols.h
- testsuite/driver/runtests.py
- testsuite/tests/ghci/linking/T25155_iserv_main.c
- + testsuite/tests/rts/symbols/Main.hs
- + testsuite/tests/rts/symbols/Makefile
- + testsuite/tests/rts/symbols/all.T
- + testsuite/tests/rts/symbols/dumpDeclaredSymbols.c
- + testsuite/tests/rts/symbols/rts-check-symbols.ignore
- + testsuite/tests/rts/symbols/rts-check-symbols.sh
- + testsuite/tests/rts/symbols/rts-check-symbols.stdout
Changes:
=====================================
rts/RtsSymbols.c
=====================================
@@ -1220,13 +1220,13 @@ RTS_SYMBOLS_PRIM
/* See Note [Naming Scheme for Symbol Macros] */
#define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
- (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE },
+ (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE, NULL },
#define SymI_HasDataProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
- (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_DATA },
+ (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_DATA, NULL },
#define SymE_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
- (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE },
+ (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE, NULL },
#define SymE_HasDataProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
- (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_DATA },
+ (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_DATA, NULL },
#define SymI_NeedsProto(vvv) SymI_HasProto(vvv)
#define SymI_NeedsDataProto(vvv) SymI_HasDataProto(vvv)
@@ -1237,7 +1237,7 @@ RTS_SYMBOLS_PRIM
// another symbol. See newCAF/newRetainedCAF/newGCdCAF for an example.
#define SymI_HasProto_redirect(vvv,xxx,strength,ty) \
{ MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
- (void*)(&(xxx)), strength, ty },
+ (void*)(&(xxx)), strength, ty, MAYBE_LEADING_UNDERSCORE_STR(#xxx) },
static RtsSymbolVal * rtsSyms = NULL;
@@ -1264,7 +1264,7 @@ RtsSymbolVal const * getRtsSymbols(void) {
RTS_ARM_OUTLINE_ATOMIC_SYMBOLS
RTS_SYMBOLS_PRIM
SymI_HasDataProto(nonmoving_write_barrier_enabled)
- { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE } /* sentinel */
+ { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE, NULL } /* sentinel */
};
uint32_t n = 1;
@@ -1362,7 +1362,7 @@ RtsSymbolVal const * getRtsSymbols(void) {
// CODE_SYM(getauxval)
// CODE_SYM(posix_spawn_file_actions_init)
// ...
-// { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE } /* sentinel */
+// { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE, NULL } /* sentinel */
// };
//
// RtsSymbolVal* rtsExtraSyms() {
@@ -1375,7 +1375,7 @@ RtsSymbolVal const * getRtsSymbols(void) {
//
static RtsSymbolVal default_extra_syms[] = {
- { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE } /* sentinel */
+ { 0, 0, STRENGTH_NORMAL, SYM_TYPE_CODE, NULL } /* sentinel */
};
/* Default empty extra RTS symbols. See Note[Extra RTS symbols] */
=====================================
rts/include/rts/RtsSymbols.h
=====================================
@@ -8,6 +8,7 @@
#pragma once
+#include <stdbool.h>
typedef void SymbolAddr;
typedef char SymbolName;
@@ -36,6 +37,9 @@ typedef struct _RtsSymbolVal {
SymbolAddr* addr;
SymStrength strength;
SymType type;
+ // If this is a redirection, then this is the lable of the
+ // target symbol. Otherwise NULL.
+ const SymbolName* lbl_redirect_target;
} RtsSymbolVal;
RtsSymbolVal const * getRtsSymbols(void);
=====================================
testsuite/driver/runtests.py
=====================================
@@ -284,32 +284,36 @@ def format_path(path):
# On Windows we need to set $PATH to include the paths to all the DLLs
# in order for the dynamic library tests to work.
if windows:
+ # Add mingw to PATH
+ topdir = config.libdir
+ mingw = os.path.abspath(os.path.join(topdir, '../mingw/bin'))
+ mingw = format_path(mingw)
+ ghc_env['PATH'] = os.pathsep.join([ghc_env.get("PATH", ""), mingw])
+
+ # Add ghc packages to PATH
try:
- pkginfo = getStdout([config.ghc_pkg, 'dump'])
+ pkgs = getStdout([config.ghc_pkg, '--simple-output', 'list'])
except FileNotFoundError as err:
# This can happen when we are only running tests which don't depend on ghc (ie linters)
# In that case we probably haven't built ghc-pkg yet so this query will fail.
print (err)
print ("Failed to call ghc-pkg for windows path modification... some tests might fail")
- pkginfo = ""
- topdir = config.libdir
- mingw = os.path.abspath(os.path.join(topdir, '../mingw/bin'))
- mingw = format_path(mingw)
- ghc_env['PATH'] = os.pathsep.join([ghc_env.get("PATH", ""), mingw])
- for line in pkginfo.split('\n'):
- if line.startswith('library-dirs:'):
- path = line.rstrip()
- path = str_removeprefix(path, 'library-dirs: ')
- # Use string.replace instead of re.sub, because re.sub
- # interprets backslashes in the replacement string as
- # escape sequences.
- path = path.replace('$topdir', topdir)
+ pkgs = ""
+
+ newPaths = set()
+ pkgs = pkgs.split(' ')
+ for pkg in pkgs:
+ for field in ['library-dirs', 'dynamic-library-dirs']:
+ path = getStdout([config.ghc_pkg, '--simple-output', 'field', pkg, field])
+ path = path.strip()
if path.startswith('"'):
path = re.sub('^"(.*)"$', '\\1', path)
path = re.sub('\\\\(.)', '\\1', path)
+ path = format_path(path)
+ newPaths.add(path)
- path = format_path(path)
- ghc_env['PATH'] = os.pathsep.join([path, ghc_env.get("PATH", "")])
+ for path in newPaths:
+ ghc_env['PATH'] = os.pathsep.join([path, ghc_env.get("PATH", "")])
testopts_ctx_var.set(TestOptions())
=====================================
testsuite/tests/ghci/linking/T25155_iserv_main.c
=====================================
@@ -23,7 +23,7 @@ int main (int argc, char *argv[])
// can use the FFI call to foobar in a TH splice.
#define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
- (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE },
+ (void*)(&(vvv)), STRENGTH_NORMAL, SYM_TYPE_CODE, NULL },
void foobar(int x) {
=====================================
testsuite/tests/rts/symbols/Main.hs
=====================================
@@ -0,0 +1,119 @@
+import qualified Data.Map.Lazy as M
+import qualified Data.Set as S
+import Data.List (isSuffixOf, stripPrefix)
+import Data.Maybe (mapMaybe)
+import System.Environment (getArgs)
+
+main :: IO ()
+main = do
+ args <- getArgs
+ case args of
+ ["dump"] -> dumpDeclaredSymbols
+ ["diff", ignoreSymbolsFile, declaredSymbolsFile, observedSymbolsFile] -> do
+
+ -- Symbols to be ignored. These are symbols that are gated on CPP not correctly
+ -- specified in RtsSymbols.c. This means the symbol will sometimes appear in the
+ -- test output and sometimes not (depending on CPP defines). That means we can't
+ -- simply put those symbols into the expected test output. It's already the
+ -- job of RtsSymbols.c to declare symbols correctly in accordance with CPP. We
+ -- want to avoid copying that logic again in the test. So we just ignore some
+ -- symbols so that CI can pass and in the future we aim to fix RtsSymbols.c and
+ -- reduce the size of ignoredSymbols.
+ ignoreSymbols <- S.fromList
+ . filter (not . null)
+ . lines
+ <$> readFile ignoreSymbolsFile
+
+ declaredSymbolsStr <- readFile declaredSymbolsFile
+ observedSymbolsStr <- readFile observedSymbolsFile
+
+ let declaredSymbols = readCodeOrData <$> linePairs declaredSymbolsStr
+ let observedSymbols = parseReadelf observedSymbolsStr
+
+ let diffStr = diff ignoreSymbols declaredSymbols observedSymbols
+ -- writeFile "<ghc root>/testsuite/tests/rts/symbols/rts-check-symbols.stdout"
+ putStrLn diffStr
+
+ _ -> fail ("Unexpected arguments: " ++ show args)
+
+foreign import ccall "dumpDeclaredSymbols"
+ dumpDeclaredSymbols :: IO ()
+
+data CodeOrData = Code | Data
+ deriving (Show, Eq)
+
+-- Compare observedSymbols (symbols observed in the DSO) to declaredSymbols
+-- (symbols declared in RtsSymbols.c)
+diff :: S.Set String -> M.Map String CodeOrData -> M.Map String CodeOrData -> String
+diff ignoreSymbols declaredSymbolsAll observedSymbolsAll = unlines $
+ [ "Symbols declared in RtsSymbols.c but not observed in the DSO:" ]
+ ++ [ "Declared> " ++ k ++ " " ++ show v | (k, v) <- M.toList diffInDeclaredSymbols ]
+ ++ [ "" ]
+ ++ [ "Symbols observed in the DSO but not declared in RtsSymbols.c:" ]
+ ++ [ "Observed> " ++ k ++ " " ++ show v | (k, v) <- M.toList diffInObservedSymbols ]
+ ++ [ "" ]
+ ++ [ "Symbols observed in the DSO and declared in RtsSymbols.c but with conflicting type:" ]
+ ++ [ "WrongType> " ++ k ++ " (declared, observed): (" ++ show declared ++ ", " ++ show observed ++ ")"
+ | (k, (declared, observed)) <- M.toList diffOnType ]
+ where
+ -- Ignore some symbols
+ declaredSymbols = declaredSymbolsAll `M.withoutKeys` ignoreSymbols
+ observedSymbols = observedSymbolsAll `M.withoutKeys` ignoreSymbols
+
+ -- Undeclared observed symbols
+ diffInObservedSymbols :: M.Map String CodeOrData
+ diffInObservedSymbols = observedSymbols M.\\ declaredSymbols
+
+ -- Declared unobserved symbols
+ diffInDeclaredSymbols :: M.Map String CodeOrData
+ diffInDeclaredSymbols = declaredSymbols M.\\ observedSymbols
+
+ -- Declared observed symbols with conflicting type
+ diffOnType :: M.Map String (CodeOrData, CodeOrData)
+ diffOnType = M.filter (\(a, b) -> a /= b) $ M.intersectionWith (,) declaredSymbols observedSymbols
+
+linePairs :: String -> M.Map String String
+linePairs = M.fromList . map (\str -> let [a,b] = words str in (a,b)) . filter (/= "") . lines
+
+readCodeOrData :: String -> CodeOrData
+readCodeOrData s = case s of
+ "code" -> Code
+ "data" -> Data
+ _ -> error ("Unknown symbol type: " ++ show s)
+
+-- | Parse the output of @readelf -W --dyn-syms@ of an ELF shared object.
+--
+-- Symbol lines look like:
+--
+-- > Num: Value Size Type Bind Vis Ndx Name
+-- > 2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND tcsetattr@GLIBC_2.2.5 (2)
+-- > 1149: 000000000006d020 190 OBJECT GLOBAL DEFAULT 12 stg_AP_info
+--
+-- Note that Vis may be followed by extra annotations on some platforms (e.g.
+-- @[<localentry>: 8]@ on ppc64le), so Ndx and Name are taken from the end of
+-- the line.
+parseReadelf :: String -> M.Map String CodeOrData
+parseReadelf = M.fromList . mapMaybe parseLine . lines
+ where
+ parseLine l = case words l of
+ (num : _value : _size : ty : bind : rest)
+ | ":" `isSuffixOf` num
+ , name : ndx : _ <- reverse (dropVersionIndex rest)
+ , bind == "GLOBAL"
+ , ndx /= "UND" -- Imports
+ -> (,) name <$> typeToCodeOrData ty
+ _ -> Nothing
+
+ -- Drop the trailing version index e.g. "(2)"
+ dropVersionIndex ws = case reverse ws of
+ ('(' : _) : ws' -> reverse ws'
+ _ -> ws
+
+ -- Returns Nothing if the symbol should be ignored
+ typeToCodeOrData :: String -> Maybe CodeOrData
+ typeToCodeOrData ty = case ty of
+ "FILE" -> Nothing
+ "NOTYPE" -> Nothing
+ "FUNC" -> Just Code
+ "OBJECT" -> Just Data
+ _ -> error ("Unknown symbol type: " ++ show ty)
\ No newline at end of file
=====================================
testsuite/tests/rts/symbols/Makefile
=====================================
@@ -0,0 +1,9 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# This makefile rule only exists because TEST_HC is set in boilerplate.mk
+# and otherwise the TEST_HC variable wouldn't be set in the context of the bash script
+rts-check-symbols:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -package containers -dynamic dumpDeclaredSymbols.c Main.hs -o Main > /dev/null
+ GHC_PKG="$(GHC_PKG)" GHC="$(TEST_HC)" ./rts-check-symbols.sh
=====================================
testsuite/tests/rts/symbols/all.T
=====================================
@@ -0,0 +1,12 @@
+test('rts-check-symbols', [
+ unless(have_dynamic(), skip),
+ windows_skip,
+ extra_files([
+ 'dumpDeclaredSymbols.c',
+ 'Main.hs',
+ 'rts-check-symbols.ignore',
+ 'rts-check-symbols.sh'
+ ])],
+ makefile_test,
+ []
+)
=====================================
testsuite/tests/rts/symbols/dumpDeclaredSymbols.c
=====================================
@@ -0,0 +1,34 @@
+
+#include "Rts.h"
+#include "rts/RtsSymbols.h"
+
+#include <stdio.h>
+
+void dumpDeclaredSymbols(void);
+
+void dumpDeclaredSymbols(void) {
+ const RtsSymbolVal * declaredSyms = getRtsSymbols();
+ for (const RtsSymbolVal * sym = &declaredSyms[0]; sym->lbl; sym++) {
+ // Ignore hidden
+ if (sym->type & SYM_TYPE_HIDDEN) continue;
+
+ char * type = NULL;
+ if (sym->type & SYM_TYPE_CODE) {
+ type = "code";
+ } else if (sym->type & (SYM_TYPE_DATA | SYM_TYPE_INDIRECT_DATA)) {
+ type = "data";
+ }
+
+ const char * lbl = NULL;
+ if (sym->lbl_redirect_target) {
+ // In the case of redirects, the true symbol name is lbl_redirect_target
+ lbl = sym->lbl_redirect_target;
+ } else {
+ lbl = sym->lbl;
+ }
+
+ if (type) {
+ printf("%s %s\n", lbl, type);
+ }
+ }
+}
=====================================
testsuite/tests/rts/symbols/rts-check-symbols.ignore
=====================================
@@ -0,0 +1,40 @@
+complex_ccall_adjustor_template
+decodeAddendAarch64
+encodeAddendAarch64
+findStub
+flushInstructionCache
+flushInstructionCacheAarch64
+freeStubs
+hs_quotInt16X8
+hs_quotInt32X4
+hs_quotInt64X2
+hs_quotInt8X16
+hs_quotWord16X8
+hs_quotWord32X4
+hs_quotWord64X2
+hs_quotWord8X16
+hs_remInt16X8
+hs_remInt32X4
+hs_remInt64X2
+hs_remInt8X16
+hs_remWord16X8
+hs_remWord32X4
+hs_remWord64X2
+hs_remWord8X16
+instSizeAarch64
+isAddSub
+isAdrp
+isBranch
+isBranchLink
+isLoadStore
+isVectorOp
+makeStub
+makeStubAarch64
+needStubForRelAarch64
+needStubForRelaAarch64
+numberOfStubsForSection
+relocateObjectCode
+relocateObjectCodeAarch64
+simple_ccall_adjustor_template
+StgReturn
+stubSizeAarch64
=====================================
testsuite/tests/rts/symbols/rts-check-symbols.sh
=====================================
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+#
+# Check the diff between symbols exported from the RTS and those listed in RtsSymbols.c
+#
+
+IGNORED_SYMBOLS=rts-check-symbols.ignore
+DECLARED_SYMBOLS=declared_symbols.txt
+OBSERVED_SYMBOLS=observed_symbols.txt
+
+# Get rts Symbols listed in RtsSymbols.c
+./Main dump | sort > $DECLARED_SYMBOLS
+
+# Find the path of the RTS shared object that ./Main is linked against
+if command -v ldd > /dev/null 2>&1; then
+ # Match e.g.:
+ # libHSrts-1.0.3-ghc9.15.20260710.so => /home/alice/s p a c e/myApp/lib/libHSrts-1.0.3-ghc9.15.20260710.so (0x7ffebc9a0000)
+ RTS_DYLIB_PATH=$(ldd ./Main | awk '/^[[:space:]]*libHSrts-.* => .+$/ {
+ sub(/^[[:space:]]*libHSrts-.* => /, "")
+ sub(/ \([^(]*\)$/, "")
+ print
+ }')
+elif command -v otool > /dev/null 2>&1; then
+ # macOS has no ldd. Use otool to find the RTS install name, e.g.:
+ # @rpath/libHSrts-1.0.3-ghc9.15.20260710.dylib (compatibility version 0.0.0, current version 0.0.0)
+ RTS_INSTALL_NAME=$(otool -L ./Main | awk '/^[[:space:]]*[^[:space:]].*\/libHSrts-[^\/]*\.dylib \(/ {
+ sub(/^[[:space:]]*/, "")
+ sub(/ \([^(]*\)$/, "")
+ print
+ exit
+ }')
+
+ case "$RTS_INSTALL_NAME" in
+ @rpath/*)
+ # Resolve @rpath against the LC_RPATH entries of ./Main e.g.:
+ # cmd LC_RPATH
+ # cmdsize 120
+ # path /Users/alice/s p a c e/lib/rts-1.0.3 (offset 12)
+ MAIN_DIR=$(cd "$(dirname ./Main)" && pwd)
+ RTS_DYLIB_PATH="not found"
+ while IFS= read -r RPATH; do
+ RPATH="${RPATH/#@loader_path/$MAIN_DIR}"
+ RPATH="${RPATH/#@executable_path/$MAIN_DIR}"
+ CANDIDATE="$RPATH/${RTS_INSTALL_NAME#@rpath/}"
+ if [ -f "$CANDIDATE" ]; then
+ RTS_DYLIB_PATH="$CANDIDATE"
+ break
+ fi
+ done < <(otool -l ./Main | awk '
+ $1 == "cmd" { in_rpath = ($2 == "LC_RPATH") }
+ in_rpath && $1 == "path" {
+ sub(/^[[:space:]]*path /, "")
+ sub(/ \(offset [0-9]+\)$/, "")
+ print
+ }')
+ ;;
+ *)
+ RTS_DYLIB_PATH="$RTS_INSTALL_NAME"
+ ;;
+ esac
+else
+ echo "Neither ldd nor otool is available to find the RTS DSO" 1>&2
+ exit 1
+fi
+
+if [ -z "$RTS_DYLIB_PATH" -o "$RTS_DYLIB_PATH" = "not found" ]; then
+ echo "Could not find path to RTS DSO: \"$RTS_DYLIB_PATH\"" 1>&2
+ exit 1
+fi
+
+# Dump the exported symbols. Main.hs is responsible for parsing the output.
+# The dynamic symbol table of the shared object. We use readelf rather
+# than nm as nm classifies symbols by section rather than by symbol
+# type, and with tables next to code info tables (objects) live in the
+# .text section.
+readelf -W --dyn-syms "$RTS_DYLIB_PATH" > $OBSERVED_SYMBOLS
+
+./Main diff $IGNORED_SYMBOLS $DECLARED_SYMBOLS $OBSERVED_SYMBOLS
=====================================
testsuite/tests/rts/symbols/rts-check-symbols.stdout
=====================================
@@ -0,0 +1,760 @@
+Symbols declared in RtsSymbols.c but not observed in the DSO:
+Declared> StgReturn Code
+Declared> __udivti3 Code
+Declared> __umodti3 Code
+Declared> atomic_dec Code
+Declared> dirty_TVAR Code
+Declared> ffi_call Code
+Declared> ffi_prep_cif Code
+Declared> ffi_type_double Data
+Declared> ffi_type_float Data
+Declared> ffi_type_pointer Data
+Declared> ffi_type_sint16 Data
+Declared> ffi_type_sint32 Data
+Declared> ffi_type_sint64 Data
+Declared> ffi_type_sint8 Data
+Declared> ffi_type_uint16 Data
+Declared> ffi_type_uint32 Data
+Declared> ffi_type_uint64 Data
+Declared> ffi_type_uint8 Data
+Declared> ffi_type_void Data
+Declared> signal_handlers Code
+Declared> updateRemembSetPushThunk Code
+
+Symbols observed in the DSO but not declared in RtsSymbols.c:
+Observed> AP_STACK_sizeW Code
+Observed> AP_sizeW Code
+Observed> BLACKHOLE_sizeW Code
+Observed> Bdescr Code
+Observed> CHARLIKE_CLOSURE Code
+Observed> CONSTR_sizeW Code
+Observed> CONTINUATION_sizeW Code
+Observed> CON_INFO_PTR_TO_STRUCT Code
+Observed> FUN_INFO_PTR_TO_STRUCT Code
+Observed> FileEventLogWriter Data
+Observed> GET_CLOSURE_TAG Code
+Observed> GET_INFO Code
+Observed> GET_TAG Code
+Observed> INFO_PTR_TO_STRUCT Code
+Observed> INTLIKE_CLOSURE Code
+Observed> LOOKS_LIKE_CLOSURE_PTR Code
+Observed> LOOKS_LIKE_INFO_PTR Code
+Observed> LOOKS_LIKE_INFO_PTR_NOT_NULL Code
+Observed> LOOKS_LIKE_PTR Code
+Observed> NullEventLogWriter Data
+Observed> OS_TRY_ACQUIRE_LOCK Code
+Observed> PAP_sizeW Code
+Observed> RET_INFO_PTR_TO_STRUCT Code
+Observed> SET_INFO Code
+Observed> SET_INFO_RELAXED Code
+Observed> SET_INFO_RELEASE Code
+Observed> STATIC_LINK Code
+Observed> TAG_CLOSURE Code
+Observed> THUNK_INFO_PTR_TO_STRUCT Code
+Observed> THUNK_SELECTOR_sizeW Code
+Observed> UNTAG_CLOSURE Code
+Observed> UNTAG_CONST_CLOSURE Code
+Observed> UPD_BH_UPDATABLE_ctr Data
+Observed> __rts_fopen Code
+Observed> _warnFail Code
+Observed> addInitFini Code
+Observed> addProddableBlock Code
+Observed> allocAlignedGroupOnNode Code
+Observed> allocBlock Code
+Observed> allocBlockOnNode Code
+Observed> allocBlockOnNode_lock Code
+Observed> allocBlock_lock Code
+Observed> allocGroup Code
+Observed> allocGroupOnNode Code
+Observed> allocGroupOnNode_lock Code
+Observed> allocGroup_lock Code
+Observed> allocLimitKill Data
+Observed> allocLimitRunHook Data
+Observed> allocMBlockAlignedGroupOnNode Code
+Observed> allocateMightFail Code
+Observed> allocatePinned Code
+Observed> allocated_bytes_at_heapoverflow Data
+Observed> ap_sizeW Code
+Observed> ap_stack_sizeW Code
+Observed> arr_words_sizeW Code
+Observed> arr_words_words Code
+Observed> bco_sizeW Code
+Observed> broadcastCondition Code
+Observed> cas_word8 Code
+Observed> checkProddableBlock Code
+Observed> checkVectorSupport Code
+Observed> clearImportSymbol Code
+Observed> closeCondition Code
+Observed> closeMutex Code
+Observed> closure_sizeW Code
+Observed> collect_pointers Code
+Observed> compact_nfdata_full_sizeW Code
+Observed> containsSpan Code
+Observed> continuation_sizeW Code
+Observed> createAttachedOSThread Code
+Observed> createGenThread Code
+Observed> createIOThread Code
+Observed> createOSThread Code
+Observed> createStrictIOThread Code
+Observed> createThread Code
+Observed> currentWorkerCount Data
+Observed> debugMsgFn Data
+Observed> dequeElements Code
+Observed> dirty_STACK Code
+Observed> dirty_TSO Code
+Observed> discardElements Code
+Observed> era Data
+Observed> errorMsgFn Data
+Observed> eventLogStatus Code
+Observed> eventTypes Data
+Observed> exitFn Data
+Observed> exitHeapOverflow Code
+Observed> exitHpc Code
+Observed> fatalInternalErrorFn Data
+Observed> fillGot Code
+Observed> findSymbol Code
+Observed> findSymbolTable Code
+Observed> flushExec Code
+Observed> formatClosureDescIpe Code
+Observed> freeAllMBlocks Code
+Observed> freeChain Code
+Observed> freeChain_lock Code
+Observed> freeGot Code
+Observed> freeGroup Code
+Observed> freeGroup_lock Code
+Observed> freeInitFiniList Code
+Observed> freeMBlocks Code
+Observed> freeProddableBlocks Code
+Observed> freeThreadingResources Code
+Observed> freeWSDeque Code
+Observed> full_prog_argc Data
+Observed> full_prog_argv Data
+Observed> generations Data
+Observed> getFirstMBlock Code
+Observed> getMBlock Code
+Observed> getMBlockOnNode Code
+Observed> getMBlocks Code
+Observed> getMBlocksOnNode Code
+Observed> getNextMBlock Code
+Observed> getObjectLoadStatus Code
+Observed> get_con_itbl Code
+Observed> get_fun_itbl Code
+Observed> get_itbl Code
+Observed> get_itbl_acquire Code
+Observed> get_ret_itbl Code
+Observed> get_thunk_itbl Code
+Observed> heap_view_closurePtrs Code
+Observed> heap_view_closureSize Code
+Observed> heap_view_closure_ptrs_in_pap_payload Code
+Observed> highMemDynamic Data
+Observed> hs_main Code
+Observed> initAdjustors Code
+Observed> initBlockAllocator Code
+Observed> initCondition Code
+Observed> initGenerationStats Code
+Observed> initMBlocks Code
+Observed> initMutex Code
+Observed> initProddableBlockSet Code
+Observed> interp_shutdown Code
+Observed> interp_startup Code
+Observed> interruptOSThread Code
+Observed> isSymbolImport Code
+Observed> isSymbolWeak Code
+Observed> itbl_to_con_itbl Code
+Observed> itbl_to_fun_itbl Code
+Observed> itbl_to_ret_itbl Code
+Observed> itbl_to_thunk_itbl Code
+Observed> joinOSThread Code
+Observed> kernelThreadId Code
+Observed> listAllBlocks Code
+Observed> listThreads Code
+Observed> looksEmptyWSDeque Code
+Observed> lookupIPEId Code
+Observed> m32_free_page_pool Data
+Observed> m32_free_page_pool_size Data
+Observed> makeGot Code
+Observed> mblock_address_space Data
+Observed> mblocks_allocated Data
+Observed> modules Data
+Observed> mpc_misses Data
+Observed> mutArrPtrsCard Code
+Observed> mutArrPtrsCardTableSize Code
+Observed> mutArrPtrsCards Code
+Observed> mut_arr_ptrs_sizeW Code
+Observed> n_alloc_blocks_by_node Data
+Observed> needGotSlot Code
+Observed> newCAF Code
+Observed> newGCdCAF Code
+Observed> newRetainedCAF Code
+Observed> newWSDeque Code
+Observed> next_nursery Data
+Observed> no_break_on_exception Data
+Observed> nonmovingAllocatorCensus Code
+Observed> nonmovingAllocatorCensusWithWords Code
+Observed> nonmovingPrintAllocatorCensus Code
+Observed> nonmovingSweep Code
+Observed> nonmovingSweepCompactObjects Code
+Observed> nonmovingSweepLargeObjects Code
+Observed> nonmovingSweepMutLists Code
+Observed> nonmovingSweepStableNameTable Code
+Observed> nonmovingTraceAllocatorCensus Code
+Observed> oldest_gen Data
+Observed> osThreadId Code
+Observed> osThreadIsAlive Code
+Observed> pap_sizeW Code
+Observed> pauseTokenCapability Code
+Observed> pbarf Code
+Observed> peak_mblocks_allocated Data
+Observed> poolFlush Code
+Observed> poolFree Code
+Observed> poolGetDesiredSize Code
+Observed> poolGetMaxSize Code
+Observed> poolInit Code
+Observed> poolRelease Code
+Observed> poolSetDesiredSize Code
+Observed> poolSetMaxSize Code
+Observed> poolTake Code
+Observed> poolTryTake Code
+Observed> popWSDeque Code
+Observed> printLoadedObjects Code
+Observed> prog_name Data
+Observed> pushWSDeque Code
+Observed> re_invalid Data
+Observed> re_realso Data
+Observed> releaseFreeMemory Code
+Observed> releaseThreadNode Code
+Observed> reportMemoryMap Code
+Observed> rtsDebugMsgFn Code
+Observed> rtsErrorMsgFn Code
+Observed> rtsFatalInternalErrorFn Code
+Observed> rtsSysErrorMsgFn Code
+Observed> rts_argc Data
+Observed> rts_argv Data
+Observed> rts_argv_size Data
+Observed> rts_done Code
+Observed> rts_evalLazyIO_ Code
+Observed> rts_getSchedStatus Code
+Observed> rts_isPaused Code
+Observed> rts_listMiscRoots Code
+Observed> rts_listThreads Code
+Observed> rts_pause Code
+Observed> rts_pinThreadToNumaNode Code
+Observed> rts_resume Code
+Observed> runFini Code
+Observed> runInit Code
+Observed> sbarf Code
+Observed> scheduleWaitThread Code
+Observed> setHighMemDynamic Code
+Observed> setImportSymbol Code
+Observed> setSymbolInfo Code
+Observed> setTSOLink Code
+Observed> setTSOPrev Code
+Observed> setThreadAffinity Code
+Observed> setThreadNode Code
+Observed> setVectorSupport Code
+Observed> setWeakSymbol Code
+Observed> shndx_table_uninit_label Data
+Observed> shouldCompact Code
+Observed> shutdownThread Code
+Observed> signalCondition Code
+Observed> sizeW_fromITBL Code
+Observed> small_mut_arr_ptrs_sizeW Code
+Observed> ssbarf Code
+Observed> stack_frame_sizeW Code
+Observed> stack_sizeW Code
+Observed> state_change_mutex Data
+Observed> stealWSDeque Code
+Observed> stealWSDeque_ Code
+Observed> stg_AP_NOUPD_info Data
+Observed> stg_AP_STACK_NOUPD_info Data
+Observed> stg_AP_STACK_info Data
+Observed> stg_AP_info Data
+Observed> stg_ASYNCIOOP_info Data
+Observed> stg_ASYNCIO_LIVE0_closure Data
+Observed> stg_ASYNCIO_LIVE0_info Data
+Observed> stg_BCO_info Data
+Observed> stg_CLOSURE_TABLE_NULL_closure Data
+Observed> stg_CLOSURE_TABLE_NULL_info Data
+Observed> stg_COMPACT_NFDATA_CLEAN_info Data
+Observed> stg_COMPACT_NFDATA_DIRTY_info Data
+Observed> stg_CONTINUATION_apply Code
+Observed> stg_CONTINUATION_info Data
+Observed> stg_C_FINALIZER_LIST_info Data
+Observed> stg_DEAD_SLOT_closure Data
+Observed> stg_DEAD_SLOT_info Data
+Observed> stg_DEAD_WEAK_info Data
+Observed> stg_END_STM_CHUNK_LIST_closure Data
+Observed> stg_END_STM_CHUNK_LIST_info Data
+Observed> stg_END_STM_WATCH_QUEUE_closure Data
+Observed> stg_END_STM_WATCH_QUEUE_info Data
+Observed> stg_END_TSO_QUEUE_closure Data
+Observed> stg_END_TSO_QUEUE_info Data
+Observed> stg_GCD_CAF_info Data
+Observed> stg_IND_info Data
+Observed> stg_MSG_BLACKHOLE_info Data
+Observed> stg_MSG_CLONE_STACK_info Data
+Observed> stg_MSG_NULL_info Data
+Observed> stg_MSG_THROWTO_info Data
+Observed> stg_MSG_TRY_WAKEUP_info Data
+Observed> stg_MSG_UPD_TSO_FLAG_info Data
+Observed> stg_MUT_ARR_PTRS_CLEAN_info Data
+Observed> stg_MVAR_TSO_QUEUE_info Data
+Observed> stg_NO_FINALIZER_closure Data
+Observed> stg_NO_FINALIZER_info Data
+Observed> stg_NO_TREC_closure Data
+Observed> stg_NO_TREC_info Data
+Observed> stg_PAP_apply Code
+Observed> stg_PAP_info Data
+Observed> stg_PROMPT_TAG_info Data
+Observed> stg_SMALL_MUT_ARR_PTRS_CLEAN_info Data
+Observed> stg_STABLE_NAME_info Data
+Observed> stg_STACK_info Data
+Observed> stg_TIMEOUT_QUEUE_EMPTY_closure Data
+Observed> stg_TIMEOUT_QUEUE_EMPTY_info Data
+Observed> stg_TIMEOUT_QUEUE_info Data
+Observed> stg_TREC_CHUNK_info Data
+Observed> stg_TREC_HEADER_info Data
+Observed> stg_TSO_info Data
+Observed> stg_TVAR_WATCH_QUEUE_info Data
+Observed> stg_WHITEHOLE_info Data
+Observed> stg_abort Code
+Observed> stg_ann_frame_info Data
+Observed> stg_ap_0_ret_str Data
+Observed> stg_ap_stack_entries Data
+Observed> stg_ap_stk_ Code
+Observed> stg_ap_stk_d Code
+Observed> stg_ap_stk_f Code
+Observed> stg_ap_stk_l Code
+Observed> stg_ap_stk_n Code
+Observed> stg_ap_stk_nn Code
+Observed> stg_ap_stk_nnn Code
+Observed> stg_ap_stk_nnp Code
+Observed> stg_ap_stk_np Code
+Observed> stg_ap_stk_npn Code
+Observed> stg_ap_stk_npp Code
+Observed> stg_ap_stk_p Code
+Observed> stg_ap_stk_pn Code
+Observed> stg_ap_stk_pnn Code
+Observed> stg_ap_stk_pnp Code
+Observed> stg_ap_stk_pp Code
+Observed> stg_ap_stk_ppn Code
+Observed> stg_ap_stk_ppp Code
+Observed> stg_ap_stk_pppp Code
+Observed> stg_ap_stk_ppppp Code
+Observed> stg_ap_stk_pppppp Code
+Observed> stg_ap_stk_ppppppp Code
+Observed> stg_ap_stk_pppppppp Code
+Observed> stg_ap_stk_v16 Code
+Observed> stg_ap_stk_v32 Code
+Observed> stg_ap_stk_v64 Code
+Observed> stg_apply_interp_info Data
+Observed> stg_atomically_frame_info Data
+Observed> stg_atomically_info Data
+Observed> stg_atomically_waiting_frame_info Data
+Observed> stg_block_blackhole Code
+Observed> stg_block_io_int Code
+Observed> stg_block_io_int_info Data
+Observed> stg_block_io_unit Code
+Observed> stg_block_io_unit_info Data
+Observed> stg_block_putmvar_finally Code
+Observed> stg_block_putmvar_info Data
+Observed> stg_block_readmvar_finally Code
+Observed> stg_block_readmvar_info Data
+Observed> stg_block_stmwait Code
+Observed> stg_block_takemvar_finally Code
+Observed> stg_block_takemvar_info Data
+Observed> stg_block_throwto Code
+Observed> stg_block_throwto_finally Code
+Observed> stg_block_throwto_info Data
+Observed> stg_catch_frame_info Data
+Observed> stg_catch_retry_frame_info Data
+Observed> stg_catch_stm_frame_info Data
+Observed> stg_compactAddWorkerzh Code
+Observed> stg_control0zh_ll Code
+Observed> stg_ctoi_D1_info Data
+Observed> stg_ctoi_F1_info Data
+Observed> stg_ctoi_L1_info Data
+Observed> stg_ctoi_R1n_info Data
+Observed> stg_ctoi_R1p_info Data
+Observed> stg_ctoi_V_info Data
+Observed> stg_dead_thread_info Data
+Observed> stg_do_unpack_cstring Code
+Observed> stg_do_unpack_cstring_utf8 Code
+Observed> stg_dummy_ret_closure Data
+Observed> stg_dummy_ret_info Data
+Observed> stg_forceIO_info Data
+Observed> stg_gc_prim Code
+Observed> stg_gc_prim_p_ll Code
+Observed> stg_gc_prim_p_ll_info Data
+Observed> stg_gc_prim_pp_ll Code
+Observed> stg_gc_prim_pp_ll_info Data
+Observed> stg_handleIOSubmitResult Code
+Observed> stg_keepAlive_frame_info Data
+Observed> stg_killMyself Code
+Observed> stg_marked_upd_frame_info Data
+Observed> stg_maskAsyncExceptionszh_ret_info Data
+Observed> stg_maskUninterruptiblezh_ret_info Data
+Observed> stg_noDuplicate_info Data
+Observed> stg_overwritingClosure Code
+Observed> stg_overwritingClosureSize Code
+Observed> stg_prompt_frame_info Data
+Observed> stg_raise_info Data
+Observed> stg_raise_ret_info Data
+Observed> stg_restore_cccs_d_info Data
+Observed> stg_restore_cccs_eval_info Data
+Observed> stg_restore_cccs_v16_info Data
+Observed> stg_restore_cccs_v32_info Data
+Observed> stg_restore_cccs_v64_info Data
+Observed> stg_returnToSched Code
+Observed> stg_returnToSchedButFirst Code
+Observed> stg_returnToSchedNotPaused Code
+Observed> stg_returnToStackTop Code
+Observed> stg_stack_save_entries Data
+Observed> stg_stack_underflow_frame_d_info Data
+Observed> stg_stack_underflow_frame_v16_info Data
+Observed> stg_stack_underflow_frame_v32_info Data
+Observed> stg_stack_underflow_frame_v64_info Data
+Observed> stg_stk_save_ Code
+Observed> stg_stk_save_d Code
+Observed> stg_stk_save_f Code
+Observed> stg_stk_save_l Code
+Observed> stg_stk_save_n Code
+Observed> stg_stk_save_nn Code
+Observed> stg_stk_save_nnn Code
+Observed> stg_stk_save_nnp Code
+Observed> stg_stk_save_np Code
+Observed> stg_stk_save_npn Code
+Observed> stg_stk_save_npp Code
+Observed> stg_stk_save_p Code
+Observed> stg_stk_save_pn Code
+Observed> stg_stk_save_pnn Code
+Observed> stg_stk_save_pnp Code
+Observed> stg_stk_save_pp Code
+Observed> stg_stk_save_ppn Code
+Observed> stg_stk_save_ppp Code
+Observed> stg_stk_save_pppp Code
+Observed> stg_stk_save_ppppp Code
+Observed> stg_stk_save_pppppp Code
+Observed> stg_stk_save_ppppppp Code
+Observed> stg_stk_save_pppppppp Code
+Observed> stg_stk_save_v16 Code
+Observed> stg_stk_save_v32 Code
+Observed> stg_stk_save_v64 Code
+Observed> stg_stop_thread_info Data
+Observed> stg_threadFinished Code
+Observed> stg_unmaskAsyncExceptionszh_ret_info Data
+Observed> stg_writeSlopMarker Code
+Observed> sync_phase_marking_budget Data
+Observed> sysErrorMsgFn Data
+Observed> tagConstr Code
+Observed> thunk_sizeW_fromITBL Code
+Observed> timedWaitCondition Code
+Observed> totalArgumentSize Code
+Observed> total_ticks Data
+Observed> unloadNativeObj Code
+Observed> user_era Data
+Observed> validate_trec_optimistic Code
+Observed> vbarf Code
+Observed> vdebugBelch Code
+Observed> vectorSupportGlobalVar Data
+Observed> verifyGot Code
+Observed> verrorBelch Code
+Observed> vsysErrorBelch Code
+Observed> waitCondition Code
+Observed> warnMissingKBLibraryPaths Code
+Observed> yieldThread Code
+
+Symbols observed in the DSO and declared in RtsSymbols.c but with conflicting type:
+WrongType> ALLOC_BH_adm (declared, observed): (Code, Data)
+WrongType> ALLOC_BH_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_BH_gds (declared, observed): (Code, Data)
+WrongType> ALLOC_BH_slp (declared, observed): (Code, Data)
+WrongType> ALLOC_CON_adm (declared, observed): (Code, Data)
+WrongType> ALLOC_CON_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_CON_gds (declared, observed): (Code, Data)
+WrongType> ALLOC_CON_slp (declared, observed): (Code, Data)
+WrongType> ALLOC_FUN_adm (declared, observed): (Code, Data)
+WrongType> ALLOC_FUN_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_FUN_gds (declared, observed): (Code, Data)
+WrongType> ALLOC_FUN_slp (declared, observed): (Code, Data)
+WrongType> ALLOC_HEAP_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_HEAP_tot (declared, observed): (Code, Data)
+WrongType> ALLOC_PAP_adm (declared, observed): (Code, Data)
+WrongType> ALLOC_PAP_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_PAP_gds (declared, observed): (Code, Data)
+WrongType> ALLOC_PAP_slp (declared, observed): (Code, Data)
+WrongType> ALLOC_PRIM_adm (declared, observed): (Code, Data)
+WrongType> ALLOC_PRIM_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_PRIM_gds (declared, observed): (Code, Data)
+WrongType> ALLOC_PRIM_slp (declared, observed): (Code, Data)
+WrongType> ALLOC_RTS_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_RTS_tot (declared, observed): (Code, Data)
+WrongType> ALLOC_SE_THK_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_STACK_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_STACK_tot (declared, observed): (Code, Data)
+WrongType> ALLOC_THK_adm (declared, observed): (Code, Data)
+WrongType> ALLOC_THK_gds (declared, observed): (Code, Data)
+WrongType> ALLOC_THK_slp (declared, observed): (Code, Data)
+WrongType> ALLOC_TSO_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_TSO_tot (declared, observed): (Code, Data)
+WrongType> ALLOC_TUP_adm (declared, observed): (Code, Data)
+WrongType> ALLOC_TUP_ctr (declared, observed): (Code, Data)
+WrongType> ALLOC_TUP_gds (declared, observed): (Code, Data)
+WrongType> ALLOC_TUP_slp (declared, observed): (Code, Data)
+WrongType> ALLOC_UP_THK_ctr (declared, observed): (Code, Data)
+WrongType> CATCHF_PUSHED_ctr (declared, observed): (Code, Data)
+WrongType> ENT_AP_STACK_ctr (declared, observed): (Code, Data)
+WrongType> ENT_AP_ctr (declared, observed): (Code, Data)
+WrongType> ENT_BH_ctr (declared, observed): (Code, Data)
+WrongType> ENT_CONTINUATION_ctr (declared, observed): (Code, Data)
+WrongType> ENT_DYN_CON_ctr (declared, observed): (Code, Data)
+WrongType> ENT_DYN_FUN_DIRECT_ctr (declared, observed): (Code, Data)
+WrongType> ENT_DYN_IND_ctr (declared, observed): (Code, Data)
+WrongType> ENT_DYN_THK_MANY_ctr (declared, observed): (Code, Data)
+WrongType> ENT_DYN_THK_SINGLE_ctr (declared, observed): (Code, Data)
+WrongType> ENT_LNE_ctr (declared, observed): (Code, Data)
+WrongType> ENT_PAP_ctr (declared, observed): (Code, Data)
+WrongType> ENT_PERM_IND_ctr (declared, observed): (Code, Data)
+WrongType> ENT_STATIC_CON_ctr (declared, observed): (Code, Data)
+WrongType> ENT_STATIC_FUN_DIRECT_ctr (declared, observed): (Code, Data)
+WrongType> ENT_STATIC_IND_ctr (declared, observed): (Code, Data)
+WrongType> ENT_STATIC_THK_MANY_ctr (declared, observed): (Code, Data)
+WrongType> ENT_STATIC_THK_SINGLE_ctr (declared, observed): (Code, Data)
+WrongType> ENT_VIA_NODE_ctr (declared, observed): (Code, Data)
+WrongType> GC_FAILED_PROMOTION_ctr (declared, observed): (Code, Data)
+WrongType> GC_SEL_ABANDONED_ctr (declared, observed): (Code, Data)
+WrongType> GC_SEL_MAJOR_ctr (declared, observed): (Code, Data)
+WrongType> GC_SEL_MINOR_ctr (declared, observed): (Code, Data)
+WrongType> HEAP_CHK_ctr (declared, observed): (Code, Data)
+WrongType> KNOWN_CALL_EXTRA_ARGS_ctr (declared, observed): (Code, Data)
+WrongType> KNOWN_CALL_TOO_FEW_ARGS_ctr (declared, observed): (Code, Data)
+WrongType> KNOWN_CALL_ctr (declared, observed): (Code, Data)
+WrongType> MULTI_CHUNK_SLOW_CALL_CHUNKS_ctr (declared, observed): (Code, Data)
+WrongType> MULTI_CHUNK_SLOW_CALL_ctr (declared, observed): (Code, Data)
+WrongType> MainCapability (declared, observed): (Code, Data)
+WrongType> RET_NEW_ctr (declared, observed): (Code, Data)
+WrongType> RET_NEW_hst (declared, observed): (Code, Data)
+WrongType> RET_OLD_ctr (declared, observed): (Code, Data)
+WrongType> RET_OLD_hst (declared, observed): (Code, Data)
+WrongType> RET_SEMI_loads_avoided (declared, observed): (Code, Data)
+WrongType> RET_UNBOXED_TUP_ctr (declared, observed): (Code, Data)
+WrongType> RET_UNBOXED_TUP_hst (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_FUN_CORRECT_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_FUN_TOO_FEW_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_FUN_TOO_MANY_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_PAP_CORRECT_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_PAP_TOO_FEW_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_PAP_TOO_MANY_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_UNEVALD_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_d_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_f_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_l_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_n_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_p_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_pp_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_ppp_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_pppp_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_ppppp_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_pppppp_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_pppv_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_ppv_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_pv_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_v16_ctr (declared, observed): (Code, Data)
+WrongType> SLOW_CALL_fast_v_ctr (declared, observed): (Code, Data)
+WrongType> STK_CHK_ctr (declared, observed): (Code, Data)
+WrongType> TAG_TAGGED_miss (declared, observed): (Code, Data)
+WrongType> TAG_TAGGED_pred (declared, observed): (Code, Data)
+WrongType> TAG_UNTAGGED_miss (declared, observed): (Code, Data)
+WrongType> TAG_UNTAGGED_pred (declared, observed): (Code, Data)
+WrongType> UNKNOWN_CALL_ctr (declared, observed): (Code, Data)
+WrongType> UPDF_OMITTED_ctr (declared, observed): (Code, Data)
+WrongType> UPDF_PUSHED_ctr (declared, observed): (Code, Data)
+WrongType> UPDF_RCC_OMITTED_ctr (declared, observed): (Code, Data)
+WrongType> UPDF_RCC_PUSHED_ctr (declared, observed): (Code, Data)
+WrongType> UPD_CAF_BH_SINGLE_ENTRY_ctr (declared, observed): (Code, Data)
+WrongType> UPD_CAF_BH_UPDATABLE_ctr (declared, observed): (Code, Data)
+WrongType> UPD_CON_IN_NEW_ctr (declared, observed): (Code, Data)
+WrongType> UPD_CON_IN_PLACE_ctr (declared, observed): (Code, Data)
+WrongType> UPD_NEW_IND_ctr (declared, observed): (Code, Data)
+WrongType> UPD_NEW_PERM_IND_ctr (declared, observed): (Code, Data)
+WrongType> UPD_OLD_IND_ctr (declared, observed): (Code, Data)
+WrongType> UPD_OLD_PERM_IND_ctr (declared, observed): (Code, Data)
+WrongType> UPD_PAP_IN_NEW_ctr (declared, observed): (Code, Data)
+WrongType> UPD_PAP_IN_PLACE_ctr (declared, observed): (Code, Data)
+WrongType> UPD_SQUEEZED_ctr (declared, observed): (Code, Data)
+WrongType> VERY_SLOW_CALL_ctr (declared, observed): (Code, Data)
+WrongType> __stg_gc_enter_1 (declared, observed): (Data, Code)
+WrongType> __stg_gc_fun (declared, observed): (Data, Code)
+WrongType> closure_flags (declared, observed): (Code, Data)
+WrongType> defaultRtsConfig (declared, observed): (Code, Data)
+WrongType> g0 (declared, observed): (Code, Data)
+WrongType> ghc_unique_counter64 (declared, observed): (Code, Data)
+WrongType> ghc_unique_inc (declared, observed): (Code, Data)
+WrongType> keepCAFs (declared, observed): (Code, Data)
+WrongType> large_alloc_lim (declared, observed): (Code, Data)
+WrongType> prog_argc (declared, observed): (Code, Data)
+WrongType> prog_argv (declared, observed): (Code, Data)
+WrongType> stable_name_table (declared, observed): (Code, Data)
+WrongType> stable_ptr_table (declared, observed): (Code, Data)
+WrongType> stg_CHARLIKE_closure (declared, observed): (Code, Data)
+WrongType> stg_INTLIKE_closure (declared, observed): (Code, Data)
+WrongType> stg_absentErrorzh (declared, observed): (Data, Code)
+WrongType> stg_annotateStackzh (declared, observed): (Data, Code)
+WrongType> stg_ap_0_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_d_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_f_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_l_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_n_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_p_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_pp_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_ppp_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_pppp_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_ppppp_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_pppppp_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_pppv_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_ppv_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_pv_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_v16_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_v32_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_v64_fast (declared, observed): (Data, Code)
+WrongType> stg_ap_v_fast (declared, observed): (Data, Code)
+WrongType> stg_atomicModifyMutVar2zh (declared, observed): (Data, Code)
+WrongType> stg_atomicModifyMutVarzuzh (declared, observed): (Data, Code)
+WrongType> stg_atomicallyzh (declared, observed): (Data, Code)
+WrongType> stg_block_noregs (declared, observed): (Data, Code)
+WrongType> stg_block_putmvar (declared, observed): (Data, Code)
+WrongType> stg_block_readmvar (declared, observed): (Data, Code)
+WrongType> stg_block_takemvar (declared, observed): (Data, Code)
+WrongType> stg_casArrayzh (declared, observed): (Data, Code)
+WrongType> stg_casInt16Arrayzh (declared, observed): (Data, Code)
+WrongType> stg_casInt32Arrayzh (declared, observed): (Data, Code)
+WrongType> stg_casInt64Arrayzh (declared, observed): (Data, Code)
+WrongType> stg_casInt8Arrayzh (declared, observed): (Data, Code)
+WrongType> stg_casIntArrayzh (declared, observed): (Data, Code)
+WrongType> stg_casMutVarzh (declared, observed): (Data, Code)
+WrongType> stg_casSmallArrayzh (declared, observed): (Data, Code)
+WrongType> stg_castDoubleToWord64zh (declared, observed): (Data, Code)
+WrongType> stg_castFloatToWord32zh (declared, observed): (Data, Code)
+WrongType> stg_castWord32ToFloatzh (declared, observed): (Data, Code)
+WrongType> stg_castWord64ToDoublezh (declared, observed): (Data, Code)
+WrongType> stg_catchRetryzh (declared, observed): (Data, Code)
+WrongType> stg_catchSTMzh (declared, observed): (Data, Code)
+WrongType> stg_catchzh (declared, observed): (Data, Code)
+WrongType> stg_clearCCSzh (declared, observed): (Data, Code)
+WrongType> stg_cloneArrayzh (declared, observed): (Data, Code)
+WrongType> stg_cloneMutableArrayzh (declared, observed): (Data, Code)
+WrongType> stg_cloneSmallArrayzh (declared, observed): (Data, Code)
+WrongType> stg_cloneSmallMutableArrayzh (declared, observed): (Data, Code)
+WrongType> stg_closureSizzezh (declared, observed): (Data, Code)
+WrongType> stg_compactAddWithSharingzh (declared, observed): (Data, Code)
+WrongType> stg_compactAddzh (declared, observed): (Data, Code)
+WrongType> stg_compactAllocateBlockzh (declared, observed): (Data, Code)
+WrongType> stg_compactContainsAnyzh (declared, observed): (Data, Code)
+WrongType> stg_compactContainszh (declared, observed): (Data, Code)
+WrongType> stg_compactFixupPointerszh (declared, observed): (Data, Code)
+WrongType> stg_compactGetFirstBlockzh (declared, observed): (Data, Code)
+WrongType> stg_compactGetNextBlockzh (declared, observed): (Data, Code)
+WrongType> stg_compactNewzh (declared, observed): (Data, Code)
+WrongType> stg_compactResizzezh (declared, observed): (Data, Code)
+WrongType> stg_compactSizzezh (declared, observed): (Data, Code)
+WrongType> stg_copyArray_barrier (declared, observed): (Data, Code)
+WrongType> stg_copyArrayzh (declared, observed): (Data, Code)
+WrongType> stg_copyMutableArrayzh (declared, observed): (Data, Code)
+WrongType> stg_copySmallArrayzh (declared, observed): (Data, Code)
+WrongType> stg_copySmallMutableArrayzh (declared, observed): (Data, Code)
+WrongType> stg_deRefStablePtrzh (declared, observed): (Data, Code)
+WrongType> stg_deRefWeakzh (declared, observed): (Data, Code)
+WrongType> stg_decodeDoublezu2Intzh (declared, observed): (Data, Code)
+WrongType> stg_decodeDoublezuInt64zh (declared, observed): (Data, Code)
+WrongType> stg_decodeFloatzuIntzh (declared, observed): (Data, Code)
+WrongType> stg_delayzh (declared, observed): (Data, Code)
+WrongType> stg_exit (declared, observed): (Data, Code)
+WrongType> stg_freezzeArrayzh (declared, observed): (Data, Code)
+WrongType> stg_freezzeSmallArrayzh (declared, observed): (Data, Code)
+WrongType> stg_gc_bpp (declared, observed): (Data, Code)
+WrongType> stg_gc_d1 (declared, observed): (Data, Code)
+WrongType> stg_gc_f1 (declared, observed): (Data, Code)
+WrongType> stg_gc_ii (declared, observed): (Data, Code)
+WrongType> stg_gc_ip (declared, observed): (Data, Code)
+WrongType> stg_gc_l1 (declared, observed): (Data, Code)
+WrongType> stg_gc_noregs (declared, observed): (Data, Code)
+WrongType> stg_gc_pi (declared, observed): (Data, Code)
+WrongType> stg_gc_pp (declared, observed): (Data, Code)
+WrongType> stg_gc_ppp (declared, observed): (Data, Code)
+WrongType> stg_gc_pppp (declared, observed): (Data, Code)
+WrongType> stg_gc_ppppp (declared, observed): (Data, Code)
+WrongType> stg_gc_prim_n (declared, observed): (Data, Code)
+WrongType> stg_gc_prim_p (declared, observed): (Data, Code)
+WrongType> stg_gc_prim_pp (declared, observed): (Data, Code)
+WrongType> stg_gc_unbx_r1 (declared, observed): (Data, Code)
+WrongType> stg_gc_unpt_r1 (declared, observed): (Data, Code)
+WrongType> stg_getApStackValzh (declared, observed): (Data, Code)
+WrongType> stg_getMaskingStatezh (declared, observed): (Data, Code)
+WrongType> stg_getOtherThreadAllocationCounterzh (declared, observed): (Data, Code)
+WrongType> stg_getSparkzh (declared, observed): (Data, Code)
+WrongType> stg_getThreadAllocationCounterzh (declared, observed): (Data, Code)
+WrongType> stg_isByteArrayPinnedzh (declared, observed): (Data, Code)
+WrongType> stg_isByteArrayWeaklyPinnedzh (declared, observed): (Data, Code)
+WrongType> stg_isCurrentThreadBoundzh (declared, observed): (Data, Code)
+WrongType> stg_isEmptyMVarzh (declared, observed): (Data, Code)
+WrongType> stg_isMutableByteArrayPinnedzh (declared, observed): (Data, Code)
+WrongType> stg_isMutableByteArrayWeaklyPinnedzh (declared, observed): (Data, Code)
+WrongType> stg_keepAlivezh (declared, observed): (Data, Code)
+WrongType> stg_killThreadzh (declared, observed): (Data, Code)
+WrongType> stg_labelThreadzh (declared, observed): (Data, Code)
+WrongType> stg_listThreadszh (declared, observed): (Data, Code)
+WrongType> stg_makeStablePtrzh (declared, observed): (Data, Code)
+WrongType> stg_maskAsyncExceptionszh (declared, observed): (Data, Code)
+WrongType> stg_maskUninterruptiblezh (declared, observed): (Data, Code)
+WrongType> stg_mkApUpd0zh (declared, observed): (Data, Code)
+WrongType> stg_newAlignedPinnedByteArrayzh (declared, observed): (Data, Code)
+WrongType> stg_newArrayzh (declared, observed): (Data, Code)
+WrongType> stg_newBCOzh (declared, observed): (Data, Code)
+WrongType> stg_newByteArrayzh (declared, observed): (Data, Code)
+WrongType> stg_newConAppObjzh (declared, observed): (Data, Code)
+WrongType> stg_newMVarzh (declared, observed): (Data, Code)
+WrongType> stg_newMutVarzh (declared, observed): (Data, Code)
+WrongType> stg_newPinnedByteArrayzh (declared, observed): (Data, Code)
+WrongType> stg_newSmallArrayzh (declared, observed): (Data, Code)
+WrongType> stg_newTVarzh (declared, observed): (Data, Code)
+WrongType> stg_noDuplicatezh (declared, observed): (Data, Code)
+WrongType> stg_numSparkszh (declared, observed): (Data, Code)
+WrongType> stg_paniczh (declared, observed): (Data, Code)
+WrongType> stg_putMVarzh (declared, observed): (Data, Code)
+WrongType> stg_raiseDivZZerozh (declared, observed): (Data, Code)
+WrongType> stg_raiseIOzh (declared, observed): (Data, Code)
+WrongType> stg_raiseOverflowzh (declared, observed): (Data, Code)
+WrongType> stg_raiseUnderflowzh (declared, observed): (Data, Code)
+WrongType> stg_raisezh (declared, observed): (Data, Code)
+WrongType> stg_readMVarzh (declared, observed): (Data, Code)
+WrongType> stg_readTVarIOzh (declared, observed): (Data, Code)
+WrongType> stg_readTVarzh (declared, observed): (Data, Code)
+WrongType> stg_resizzeMutableByteArrayzh (declared, observed): (Data, Code)
+WrongType> stg_retryzh (declared, observed): (Data, Code)
+WrongType> stg_setOtherThreadAllocationCounterzh (declared, observed): (Data, Code)
+WrongType> stg_setThreadAllocationCounterzh (declared, observed): (Data, Code)
+WrongType> stg_shrinkMutableByteArrayzh (declared, observed): (Data, Code)
+WrongType> stg_shrinkSmallMutableArrayzh (declared, observed): (Data, Code)
+WrongType> stg_takeMVarzh (declared, observed): (Data, Code)
+WrongType> stg_thawArrayzh (declared, observed): (Data, Code)
+WrongType> stg_thawSmallArrayzh (declared, observed): (Data, Code)
+WrongType> stg_threadLabelzh (declared, observed): (Data, Code)
+WrongType> stg_threadStatuszh (declared, observed): (Data, Code)
+WrongType> stg_traceBinaryEventzh (declared, observed): (Data, Code)
+WrongType> stg_traceEventzh (declared, observed): (Data, Code)
+WrongType> stg_traceMarkerzh (declared, observed): (Data, Code)
+WrongType> stg_tryReadMVarzh (declared, observed): (Data, Code)
+WrongType> stg_tryTakeMVarzh (declared, observed): (Data, Code)
+WrongType> stg_unmaskAsyncExceptionszh (declared, observed): (Data, Code)
+WrongType> stg_unpackClosurezh (declared, observed): (Data, Code)
+WrongType> stg_unsafeThawArrayzh (declared, observed): (Data, Code)
+WrongType> stg_unsafeThawSmallArrayzh (declared, observed): (Data, Code)
+WrongType> stg_waitReadzh (declared, observed): (Data, Code)
+WrongType> stg_waitWritezh (declared, observed): (Data, Code)
+WrongType> stg_whereFromzh (declared, observed): (Data, Code)
+WrongType> stg_writeTVarzh (declared, observed): (Data, Code)
+WrongType> stg_yield_noregs (declared, observed): (Data, Code)
+WrongType> stg_yield_to_interpreter (declared, observed): (Data, Code)
+WrongType> stg_yieldzh (declared, observed): (Data, Code)
+WrongType> ticky_slow_call_unevald (declared, observed): (Code, Data)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ae35f54211a6c26c1ef61fba994afa…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ae35f54211a6c26c1ef61fba994afa…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/andreask/cfg-fix] x86 ncg: Track the current block in NatM to keep the CFG in sync
by Sylvain Henry (@hsyl20) 19 Oct '26
by Sylvain Henry (@hsyl20) 19 Oct '26
19 Oct '26
Sylvain Henry pushed to branch wip/andreask/cfg-fix at Glasgow Haskell Compiler / GHC
Commits:
1f6876c6 by Andreas Klebinger at 2026-10-19T10:49:44+02:00
x86 ncg: Track the current block in NatM to keep the CFG in sync
The x86 NCG maintains a CFG that is used for code layout. Whenever
instruction selection introduces new basic blocks (for instance for
word-to-float conversions, cmpxchg based atomic operations, ctz on
i386 or 64-bit shifts on i386) it must update this CFG, and the code
that follows must use the new block as its origin.
Before this patch the current block was threaded explicitly through
some statement-level functions only. Block-introducing primops that
were dispatched as "simple" (word2Float#, #27915) and the 64-bit shifts
in iselExpr64 did not update the CFG at all. This resulted in an
out-of-sync CFG, bad code layout and the "Can't find weight for edge
that should have one" panic once the register allocator inserted
fixup blocks (#27694, #27915).
We now keep the current block in the NatM state and provide a few
combinators (continueInNewBlock, addCondBlock, addDiamondFlow,
addColdSelfLoop, increaseEdgeWeight) that update the CFG and the
current block at the same time. See Note [Updating the CFG during
CodeGen] in GHC.CmmToAsm.Monad.
The cfg sanity check (-dasm-lint) now also checks that all branches in
the generated code have a matching edge in the CFG, which catches this
class of bug early. It immediately found another desync: when the
register allocator needs more stack than preallocated, allocMoreStack
moves the body of every entry block into a new block and retargets the
local jumps to it, but the CFG only recorded the new block as the
immediate successor of the entry block. The new addPreentryBlock also
redirects the jump edges (and keeps the call edges, since returns still
go through the entry block).
Fixes #27694, #27915
Co-authored-by: Sylvain Henry <sylvain(a)haskus.fr>
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
14 changed files:
- + changelog.d/27694
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/BlockLayout.hs
- compiler/GHC/CmmToAsm/CFG.hs
- compiler/GHC/CmmToAsm/Monad.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- + testsuite/tests/codeGen/should_compile/T27694.hs
- testsuite/tests/codeGen/should_compile/all.T
- + testsuite/tests/codeGen/should_run/T27915.hs
- + testsuite/tests/codeGen/should_run/T27915.stdout-ws-32
- + testsuite/tests/codeGen/should_run/T27915.stdout-ws-64
- testsuite/tests/codeGen/should_run/all.T
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1f6876c6402e886fe21a2582df15425…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1f6876c6402e886fe21a2582df15425…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/T27724] 6 commits: Improve exprOkForSpeculation
by Simon Peyton Jones (@simonpj) 19 Oct '26
by Simon Peyton Jones (@simonpj) 19 Oct '26
19 Oct '26
Simon Peyton Jones pushed to branch wip/T27724 at Glasgow Haskell Compiler / GHC
Commits:
8c947573 by Simon Peyton Jones at 2026-10-16T13:11:53+01:00
Improve exprOkForSpeculation
Fixes #27910, which exposed an infelicity in exprOkForSpeculation
The new story is carefully described in new Note [exprOkForSpeculation],
esp (a-c) and (EOKS1).
- - - - -
7dedcf13 by Alan Zimmerman at 2026-10-16T19:03:17-04:00
EPA: Add TTG fields to FamilyInfo
This commit is a simple add, with unused extension fields.
It lays the groundwork for using them for exact print annotations
- - - - -
a4f7542c by Simon Peyton Jones at 2026-10-17T23:24:46+01:00
Redesign the noinline magic
Main idea:
* When simplifying `noinline (f e1 e2)`, switch off inlining when simplifying `f`
* Mechanism: see `simplOutId`, the `noinlineIdKey` case
* If we see `noinline (f e1) e2`, the simplifier moves the `e2` inside; see the `splitContArgs` call.
This is important so you can write `noinliine f e1 e2` and have it mean the same as `noinline (f e1 e2)`.
* Now `f` sees all its arguments, henc:
* Fixes #27724
* Fixes #23911
* Also fixes #27803 where we were not respecting `noinline` if the RHS
was trivial
See Note [noinlineId magic] for lots of specifics. It's surprisingly tricky!
For some reason a couple of perf tests allocate 1.2% less at compile time,n
namely T29872 and T8095. Geom mean decease of 0.1%
Metric Decrease:
T9872d
- - - - -
b9692706 by Simon Peyton Jones at 2026-10-17T23:24:56+01:00
Wibbles
Tiresome thing about ticks around `noinline` in Prep.hs
- - - - -
fe5855a5 by Simon Peyton Jones at 2026-10-17T23:24:56+01:00
Comments
- - - - -
a302e382 by Simon Peyton Jones at 2026-10-19T08:16:21+01:00
Occ-anal for noinline [skip ci]
- - - - -
66 changed files:
- + changelog.d/T27724
- compiler/GHC/Builtin/WiredIn/Ids.hs
- compiler/GHC/Builtin/WiredIn/Prim.hs
- compiler/GHC/Builtin/WiredIn/Types/Box.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/TyCo/Make.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/Config/Core/Opt/Simplify.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Pmc/Solver/Types.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/ThToHs.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Magic.hs
- testsuite/tests/corelint/LintEtaExpand.hs
- + testsuite/tests/dmdanal/should_compile/T23911.hs
- + testsuite/tests/dmdanal/should_compile/T23911.stderr
- testsuite/tests/dmdanal/should_compile/all.T
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/KindSigs.stderr
- testsuite/tests/simplCore/should_compile/T18995.stderr
- + testsuite/tests/simplCore/should_compile/T27724a.hs
- + testsuite/tests/simplCore/should_compile/T27724a.stderr
- + testsuite/tests/simplCore/should_compile/T27803.hs
- + testsuite/tests/simplCore/should_compile/T27803.stderr
- + testsuite/tests/simplCore/should_compile/T27910.hs
- + testsuite/tests/simplCore/should_compile/T27910.stderr
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T17940.stderr
- utils/check-exact/ExactPrint.hs
- utils/genprimopcode/Main.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6354a6f3eebaa27ad1a07ddc27dfdf…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6354a6f3eebaa27ad1a07ddc27dfdf…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/rafl/hpc-viewpatterns] 11 commits: Fix #27836, normalise unit database path in ExternalUnitDatabases
by Florian Ragwitz (@rafl) 19 Oct '26
by Florian Ragwitz (@rafl) 19 Oct '26
19 Oct '26
Florian Ragwitz pushed to branch wip/rafl/hpc-viewpatterns at Glasgow Haskell Compiler / GHC
Commits:
3a72b8a2 by Hannes Siebenhandl at 2026-10-14T13:48:32-04:00
Fix #27836, normalise unit database path in ExternalUnitDatabases
Add a regression test, proofing that all variations:
- local-unit-db/my-test.conf
- ./local-unit-db/my-test.conf
- ./local-unit-db/my-test.conf/
are parsed only once.
- - - - -
8ddbc6f9 by Florian Ragwitz at 2026-10-14T13:49:28-04:00
Remove obsolete HPC types
Fixes #27946.
- - - - -
f34c79ee by Alan Zimmerman at 2026-10-15T04:54:47-04:00
EPA: Start using vocurly as basis for AnnListLayout
For the existing cases that populate AnnList.
This uses AnnListBraces when braces are explicitly supplied, and
AnnListLayout when vocurly is used
The change also shows up AnnList usages that can never capture layout,
these are cleared up later.
- - - - -
033ba59c by sheaf at 2026-10-15T04:55:44-04:00
Make exprFreeVars deep
exprFreeVars used to be a shallow free-variable finder (it didn't look
into kinds), but most callers wanted it to be deep. In particular,
'exprFreeVars' is often used to seed an 'InScopeSet', and that must
contain the /deep/ free variables.
This commit makes it deep, which allows us to get rid of calls to
'closeOverKinds' or other workarounds for shallowness in:
- 'GHC.Core.Opt.Simplify.Utils.abstractFloats'
- 'GHC.HsToCore.Binds.dsSpec_help'
- 'GHC.Core.Opt.Arity.etaBodyForJoinPoint'
- 'GHC.Core.FVs.freeVars'
- 'GHC.Core.Lint.lintCoreRule'
We also remove 'deepExprsFreeVarsDSet' and 'closeOverKindsDSet'.
Other places needed a little bit more care, in particular to properly
handle coercion variables free in kinds:
- 'GHC.Core.Opt.Specialise.specHeader' quantifies over the binder of
an unspecialised argument directly, instead of computing the free Ids
of the argument.
- 'GHC.HsToCore.dsWarnRuleShadowing' filters out 'CoVar's.
- 'GHC.Core.Opt.SpecConstr.callToPat' had some ad-hoc logic to compute
argument pattern types and a workaround with 'expandTypeSynonyms'.
That logic is removed in favour of a new 'argsToPats' function which
directly computes the argument pattern types by instantiating the
type of the head of the call pattern.
Fixes #27936
- - - - -
f93d523c by Luite Stegeman at 2026-10-15T04:56:34-04:00
testsuite: Use mkWeakMVar in memo001/memo002
mkWeakPtr in the memo001/memo001 tests created weak pointers
with the MVar box as the key, which is fragile in the presence
of optimization. The fix is using mkWeakMVar, keying on the
primitive MVar# instead.
Fixes #27924 and #27396
- - - - -
8c947573 by Simon Peyton Jones at 2026-10-16T13:11:53+01:00
Improve exprOkForSpeculation
Fixes #27910, which exposed an infelicity in exprOkForSpeculation
The new story is carefully described in new Note [exprOkForSpeculation],
esp (a-c) and (EOKS1).
- - - - -
7dedcf13 by Alan Zimmerman at 2026-10-16T19:03:17-04:00
EPA: Add TTG fields to FamilyInfo
This commit is a simple add, with unused extension fields.
It lays the groundwork for using them for exact print annotations
- - - - -
26b9a8a0 by Arkissa at 2026-10-17T16:04:10+00:00
ghci: Prefer exact source spans in :type-at
Prefer expression types for identical source spans.
Fixes #27412.
- - - - -
70dc4e61 by sheaf at 2026-10-18T18:15:15-04:00
Carefully implement coercion zapping
This commit implements coercion zapping in the rewriter, controlled by
the -fzap-coercions flag (on by default). This significantly reduces
the size of coercions produced when rewriting type family applications,
resulting in much faster compilation. See Note [Coercion zapping]
in GHC.Tc.Solver.Rewrite for an explanation and further details.
The rewriter now keeps track of the `CoVar`s and `CoercionHole`s it uses
when rewriting, which allows computing the dependencies of a zapped
coercion without traversing the coercion the rewriter produced, as
explained in Note [Computing coercion dependencies] in GHC.Tc.Solver.Rewrite.
Accompanying changes:
- Rework how dependencies of 'UnivCo's are tracked, purely for
performance reasons.
We now use the 'UnivCoDeps' datatype instead of '[Coercion]', and
we now insist that 'uco_deps' also contains the CoVars that appear
in the LHS and RHS types of the UnivCo (as a caching mechanism).
- Several performance improvements to the rewriter (e.g. increased
strictness).
- Improvements to the family application cache, including:
- Better documentation.
- Only cache a whole chain of reduction steps.
- Don't put coercion holes in the cache, fixing #27518.
- Allow Core Lint to be called from within the typechecker (and from
within the coercion optimiser).
- Move out "annotation linting" from Core Lint into the general Core
pipeline, to avoid the dependency GHC.Core.Coercion.Opt->GHC.Core.Lint
causing a regression in CountDepsParser due to transitive
dependencies of GHC.Core.Opt.Monad and GHC.Unit.Module.ModGuts.
Fixes #8095 #27336 #27518
Summary of performance numbers
Compile-time byte allocated in GHC's testsuite (0 regressions)
CoOpt_Singletons(normal) ghc/alloc 634,040,332 595,448,728 -6.1% GOOD
FamAppCachePerf(normal) ghc/alloc 495,629,812 191,612,920 -61.3% GOOD
LargeRecord(normal) ghc/alloc 1,226,806,434 966,260,976 -21.2% GOOD
SimplCastPerf(normal) ghc/alloc 160,505,678 148,112,688 -7.7% GOOD
T12227(normal) ghc/alloc 244,668,982 233,037,216 -4.8% GOOD
T12545(normal) ghc/alloc 697,804,842 424,705,152 -39.1% GOOD
T13386(normal) ghc/alloc 422,871,076 35,213,656 -91.7% GOOD
T15703(normal) ghc/alloc 288,402,364 273,692,560 -5.1% GOOD
T26426(normal) ghc/alloc 86,002,052 78,152,104 -9.1% GOOD
T27336(normal) ghc/alloc 498,932,268 35,886,016 -92.8% GOOD
T5030(normal) ghc/alloc 117,057,706 88,785,648 -24.2% GOOD
T5321Fun(normal) ghc/alloc 252,552,628 243,820,176 -3.5% GOOD
T8095(normal) ghc/alloc 768,198,564 127,779,520 -83.4% GOOD
T9872a(normal) ghc/alloc 1,655,675,020 1,406,017,008 -15.1% GOOD
T9872b(normal) ghc/alloc 1,864,180,628 1,644,706,696 -11.8% GOOD
T9872b_defer(normal) ghc/alloc 2,834,585,468 1,657,729,760 -41.5% GOOD
T9872c(normal) ghc/alloc 1,572,573,116 1,354,055,424 -13.9% GOOD
T9872d(normal) ghc/alloc 351,516,004 331,071,424 -5.8% GOOD
TcPlugin_RewritePerf(normal) ghc/alloc 2,063,065,680 1,847,464,272 -10.5% GOOD
Chesskell (github.com/Proxymoron461/chesskell/issues)
Typechecking that the first N plies of kholmovVsBronsteinShort
are a valid chess game:
Plies | GHC 9.14 time/alloc | This commit time/alloc |
-----:|---------------------|------------------------|
2 | 41s/20GB | 0.2s/19MB |
4 | 95s/49GB | 0.3s/25MB |
6 | timed out | 0.6s/522MB |
8 | timed out | 7s/673MB |
10 | timed out | timed out |
Compilation of singletons-base: compile time -28%, allocations -25%
-------------------------
Metric Decrease:
CoOpt_Singletons
FamAppCachePerf
LargeRecord
SimplCastPerf
T12227
T12545
T13386
T15703
T24984
T26426
T27336
T5030
T5321Fun
T8095
T9872a
T9872b
T9872b_defer
T9872c
T9872d
TcPlugin_RewritePerf
-------------------------
Co-Authored-By: Sylvain Henry <sylvain(a)haskus.fr>
- - - - -
3d326d7d by Sylvain Henry at 2026-10-18T18:16:09-04:00
JS: fix stack corruption in h$ap_gen_fast's pushAllRegs (#27624)
The loop added in 9e46990976 ("JS: support more than 128 registers
(#26558)") pushed register N to stack[sp - N - 2] while the switch it
falls through into, and every reader of the h$ap_gen frame, uses
stack[sp - (N - 2)]. Registers >= R32 were therefore written 4 slots
too low: the slots the readers consult were left stale and the frame
below was silently corrupted.
Fix the loop to use the same slot formula as the switch, and add a
regression test: an unknown call to a thunk with 35 argument register
slots, which goes through the generic apply.
Co-Authored-By: Claude Fable 5 <noreply(a)anthropic.com>
- - - - -
a2ef8469 by Florian Ragwitz at 2026-10-18T23:21:37-07:00
hpc: Traverse patterns to tick contained HsExprs
So we can have coverage for view patterns.
Fixes #18590.
- - - - -
130 changed files:
- + changelog.d/27624
- + changelog.d/27936
- + changelog.d/T27412
- + changelog.d/hpc-cleanup
- + changelog.d/hpc-viewpats
- changelog.d/unit-index
- + changelog.d/zap-coercions
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion.hs-boot
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Lint.hs
- + compiler/GHC/Core/Lint.hs-boot
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Reduction.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Core/TyCo/FVs.hs
- compiler/GHC/Core/TyCo/FVs.hs-boot
- compiler/GHC/Core/TyCo/Make.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Rep.hs-boot
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/Data/OsPath.hs
- compiler/GHC/Driver/Config.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Rename.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Runtime/Eval/Types.hs
- compiler/GHC/StgToJS/Apply.hs
- compiler/GHC/StgToJS/ExprCtx.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Rewrite.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Unique/DSet.hs
- compiler/GHC/Types/Var/FV.hs
- compiler/GHC/Types/Var/Set.hs
- compiler/GHC/Unit/External/Database.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- docs/users_guide/extending_ghc.rst
- docs/users_guide/exts/type_families.rst
- ghc/GHCi/UI/Info.hs
- libraries/base/tests/Memo1.lhs
- libraries/base/tests/Memo2.lhs
- libraries/base/tests/all.T
- + testsuite/tests/codeGen/should_run/T27624.hs
- + testsuite/tests/codeGen/should_run/T27624.stdout
- testsuite/tests/codeGen/should_run/all.T
- testsuite/tests/corelint/T27374.hs
- testsuite/tests/count-deps/CountDepsParser.stdout
- testsuite/tests/dependent/should_compile/T14729.stderr
- + testsuite/tests/driver/T27836/A.hs
- + testsuite/tests/driver/T27836/B.hs
- + testsuite/tests/driver/T27836/C.hs
- + testsuite/tests/driver/T27836/Makefile
- + testsuite/tests/driver/T27836/T27836.stdout
- + testsuite/tests/driver/T27836/all.T
- + testsuite/tests/driver/T27836/unitA
- + testsuite/tests/driver/T27836/unitB
- + testsuite/tests/driver/T27836/unitC
- testsuite/tests/ghci/prog-mhu001/prog-mhu001c.stdout
- testsuite/tests/ghci/prog-mhu002/prog-mhu002d.stdout
- testsuite/tests/ghci/scripts/T16575.script
- testsuite/tests/ghci/scripts/T16575.stdout
- testsuite/tests/ghci/scripts/T16804.stdout
- testsuite/tests/ghci/scripts/T20150.stdout
- + testsuite/tests/ghci/scripts/T27412.hs
- + testsuite/tests/ghci/scripts/T27412.script
- + testsuite/tests/ghci/scripts/T27412.stdout
- testsuite/tests/ghci/scripts/all.T
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/hpc/all.T
- + testsuite/tests/hpc/viewpats.hs
- + testsuite/tests/hpc/viewpats.stdout
- + testsuite/tests/indexed-types/should_compile/ZapDeps.hs
- testsuite/tests/indexed-types/should_compile/all.T
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/KindSigs.stderr
- testsuite/tests/rep-poly/RepPolyRule3.stderr
- testsuite/tests/simplCore/should_compile/T26051.stderr
- + testsuite/tests/simplCore/should_compile/T27910.hs
- + testsuite/tests/simplCore/should_compile/T27910.stderr
- + testsuite/tests/simplCore/should_compile/T27936.hs
- testsuite/tests/simplCore/should_compile/all.T
- utils/check-exact/ExactPrint.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b19b9a473829cbec7491d6da0649e4…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b19b9a473829cbec7491d6da0649e4…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
19 Oct '26
Florian Ragwitz pushed to branch wip/rafl/hpc-tixdir at Glasgow Haskell Compiler / GHC
Commits:
e70c73eb by Florian Ragwitz at 2026-10-18T20:19:00-07:00
Try grouping tix data
This is more LLM slop.
- - - - -
2 changed files:
- .gitlab/ci.sh
- tix-rle-merge.c
Changes:
=====================================
.gitlab/ci.sh
=====================================
@@ -903,11 +903,11 @@ function save_hpc_coverage() {
# Keep whatever has been generated even if the build or tests failed.
$GHC -c -o tix-rle-merge.o tix-rle-merge.c
$GHC -no-hs-main -o tix-rle-merge tix-rle-merge.o
- ./tix-rle-merge _build/ghc-tix/ _build/ghc.tix
+ ./tix-rle-merge _build/ghc-tix/ _build/tix-merged
if [[ -d _build/ghc-hpc || -d _build/ghc-tix ]]; then
mkdir -p _build/ghc-hpc _build/ghc-tix
- du -sh _build/ghc-hpc _build/ghc-tix _build/ghc.tix
- tar -czf ghc-hpc-coverage.tar.gz _build/ghc-hpc _build/ghc.tix
+ du -sh _build/ghc-hpc _build/ghc-tix _build/tix-merged
+ tar -czf ghc-hpc-coverage.tar.gz _build/ghc-hpc _build/tix-merged
ls -lh ghc-hpc-coverage.tar.gz
else
warn "No HPC coverage directories found"
=====================================
tix-rle-merge.c
=====================================
@@ -1,27 +1,35 @@
-/* Merge HPC prototype run-length-encoded .tix files (NOT part of GHC).
+/* Group and merge HPC binary RLE .tix files without combining incompatible
+ * versions of the same module.
*
- * Build: cc -O3 -std=c11 -Wall -Wextra -o tix-rle-merge tix-rle-merge.c
- * Usage: ./tix-rle-merge RLE_DIRECTORY OUTPUT.tix
+ * Build: cc -O2 -std=c11 -Wall -Wextra -pedantic -o tix-rle-merge tix-rle-merge-grouped.c
+ * Usage: tix-rle-merge INPUT_DIRECTORY EMPTY_OUTPUT_DIRECTORY
*
- * Input and output format (HPCTIX\2):
- * 7 bytes "HPCTIX\2", ULEB128 module count;
- * for each module:
- * ULEB128 name length, name bytes, little-endian uint32 hash,
- * ULEB128 box count;
- * repeated (ULEB128 zero-run length, ULEB128 nonzero-run length,
- * that many positive ULEB128 Word64 counts)
- * until exactly 'box count' counters are described.
+ * Input format: "HPCTIX\0", ULEB128 number of modules; each module has
+ * ULEB128 name length, name bytes, little-endian uint32 HPC hash, ULEB128
+ * box count, then alternating (zero run, nonzero run, positive counter values)
+ * encoded in ULEB128 until all box positions are covered. Output is the same.
*
- * No terminator follows an RLE module. A trailing zero run is represented
- * by (zero-run length, 0). Modules with zero boxes contain no run records.
+ * Group assignment is greedy, deterministic (lexicographic filename order):
+ * - never group files with a shared module name but different hash/box count;
+ * - require at least one shared module to merge into an existing group;
+ * - prefer the compatible group sharing the most boxes, then most modules,
+ * then most existing files, then lowest group number;
+ * - otherwise create a new group.
*
- * The accumulator is a dense uint64_t array per distinct module, as in
- * tix-sparse-prototype.c. Checks counter overflow and malformed inputs.
+ * This is a conservative heuristic, not a unique/optimal partition.
+ * Results are in merged-0001.tix, ... ; assignments.tsv lists every input;
+ * groups.txt gives group sizes, contents and split explanations. The output
+ * directory must be empty (or nonexistent) to avoid stale results.
+ *
+ * Two passes: inspect all inputs and assign groups without retaining counters;
+ * then merge and write one group at a time. Thus memory is bounded by the
+ * metadata for the groups plus one dense set of counters.
*/
#define _POSIX_C_SOURCE 200809L
#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
+#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -29,16 +37,35 @@
#include <sys/stat.h>
#define MAGIC "HPCTIX\0"
+#define MAGIC_SIZE 7
#define BUCKETS 8192
typedef struct { unsigned char *data; size_t len, cap; } Buffer;
typedef struct { const unsigned char *p, *end; } Reader;
+typedef struct { char *name; uint32_t hash; size_t n; } InputMod;
+typedef struct { InputMod *mods; size_t len, cap; } Input;
+typedef struct Sig {
+ char *name;
+ uint32_t hash;
+ size_t n;
+ const char *first_path; /* borrowed from sorted input path list */
+ struct Sig *next;
+} Sig;
+typedef struct {
+ Sig *buckets[BUCKETS];
+ size_t *indices; /* indices into the sorted input path list */
+ size_t len, cap, modules;
+ char *reason;
+} Group;
+typedef struct {
+ size_t group, shared_modules;
+ uint64_t shared_boxes;
+} Assignment;
typedef struct Module {
char *name;
uint32_t hash;
size_t n;
- uint64_t *ticks;
- uint64_t seen_epoch;
+ uint64_t *ticks, seen_epoch;
struct Module *next;
} Module;
typedef struct {
@@ -58,11 +85,22 @@ static void *xmalloc(size_t n) {
if (!p) die("out of memory");
return p;
}
+static void *xcalloc(size_t n, size_t s) {
+ if (s && n > SIZE_MAX / s) die("allocation overflow");
+ void *p = calloc(n ? n : 1, s ? s : 1);
+ if (!p) die("out of memory");
+ return p;
+}
static void *xrealloc(void *p, size_t n) {
void *q = realloc(p, n ? n : 1);
if (!q) die("out of memory");
return q;
}
+static char *xstrdup(const char *s) {
+ char *p = strdup(s);
+ if (!p) die("out of memory");
+ return p;
+}
static void reserve(Buffer *b, size_t add) {
if (add > SIZE_MAX - b->len) die("buffer too large");
size_t need = b->len + add;
@@ -97,20 +135,20 @@ static void put32(Buffer *b, uint32_t x) {
static uint64_t getvar(Reader *r) {
uint64_t x = 0;
for (unsigned k = 0; k < 10; k++) {
- if (r->p == r->end) die("truncated variable-length integer");
+ if (r->p == r->end) die("truncated ULEB128");
unsigned c = *r->p++;
- if (k == 9 && (c & 0xfe)) die("variable-length integer overflow");
+ if (k == 9 && (c & 0xfe)) die("ULEB128 overflow");
x |= (uint64_t)(c & 127) << (7*k);
if (!(c & 128)) {
- if (k && c == 0) die("noncanonical variable-length integer");
+ if (k && c == 0) die("noncanonical ULEB128");
return x;
}
}
- die("unterminated variable-length integer");
+ die("unterminated ULEB128");
return 0;
}
static uint32_t get32(Reader *r) {
- if ((size_t)(r->end - r->p) < 4) die("truncated hash");
+ if ((size_t)(r->end - r->p) < 4) die("truncated module hash");
uint32_t x = 0;
for (unsigned k = 0; k < 4; k++) x |= (uint32_t)(*r->p++) << (8*k);
return x;
@@ -139,24 +177,194 @@ static uint64_t namehash(const char *s) {
for (; *s; s++) { h ^= (unsigned char)*s; h *= UINT64_C(1099511628211); }
return h;
}
-static Module *module(Acc *a, const char *name, uint32_t hash, size_t n) {
- size_t bucket = namehash(name) % BUCKETS;
- for (Module *m = a->buckets[bucket]; m; m = m->next) {
+static size_t bucket_of(const char *s) { return (size_t)(namehash(s) % BUCKETS); }
+static char *join(const char *dir, const char *file) {
+ size_t a = strlen(dir), b = strlen(file);
+ if (a > SIZE_MAX - b - 2) die("path too long");
+ char *p = xmalloc(a + b + 2);
+ snprintf(p, a + b + 2, "%s/%s", dir, file);
+ return p;
+}
+static int is_tix(const char *s) {
+ size_t n = strlen(s);
+ return n >= 4 && strcmp(s + n - 4, ".tix") == 0;
+}
+static int cmpstr(const void *a, const void *b) {
+ return strcmp(*(char *const *)a, *(char *const *)b);
+}
+static int cmp_input_mod(const void *a, const void *b) {
+ return strcmp(((const InputMod *)a)->name, ((const InputMod *)b)->name);
+}
+static void input_append(Input *in, const char *name, uint32_t hash, size_t n) {
+ if (in->len == in->cap) {
+ if (in->cap > SIZE_MAX / (2 * sizeof(*in->mods))) die("too many modules");
+ in->cap = in->cap ? in->cap * 2 : 64;
+ in->mods = xrealloc(in->mods, in->cap * sizeof(*in->mods));
+ }
+ in->mods[in->len++] = (InputMod){xstrdup(name), hash, n};
+}
+static void input_free(Input *in) {
+ for (size_t i = 0; i < in->len; i++) free(in->mods[i].name);
+ free(in->mods);
+}
+/* Validate the complete file and collect just its module signatures. */
+static Input inspect(const char *path) {
+ context = path;
+ size_t size;
+ unsigned char *data = readfile(path, &size);
+ Reader r = {data, data + size};
+ if (size < MAGIC_SIZE || memcmp(r.p, MAGIC, MAGIC_SIZE))
+ die("wrong magic/version (expected HPCTIX\\0)");
+ r.p += MAGIC_SIZE;
+ uint64_t nmods = getvar(&r);
+ if (nmods > (uint64_t)(r.end - r.p)) die("invalid module count");
+ Input in = {0};
+ for (uint64_t j = 0; j < nmods; j++) {
+ uint64_t length = getvar(&r);
+ if (length > SIZE_MAX - 1 || length > (uint64_t)(r.end - r.p))
+ die("invalid module name length");
+ char *name = xmalloc((size_t)length + 1);
+ memcpy(name, r.p, (size_t)length);
+ name[length] = 0;
+ if (memchr(name, 0, (size_t)length)) die("embedded NUL in module name");
+ r.p += (size_t)length;
+ uint32_t hash = get32(&r);
+ uint64_t boxes = getvar(&r);
+ if (boxes > SIZE_MAX / sizeof(uint64_t)) die("too many counters");
+ input_append(&in, name, hash, (size_t)boxes);
+ free(name);
+ size_t pos = 0;
+ while (pos < (size_t)boxes) {
+ uint64_t zeros = getvar(&r);
+ if (zeros > boxes - pos) die("zero run exceeds box count");
+ pos += (size_t)zeros;
+ uint64_t nonzeros = getvar(&r);
+ if (nonzeros > boxes - pos) die("nonzero run exceeds box count");
+ if (!zeros && !nonzeros) die("empty RLE record");
+ for (uint64_t k = 0; k < nonzeros; k++) {
+ if (!getvar(&r)) die("zero counter in nonzero run");
+ }
+ pos += (size_t)nonzeros;
+ }
+ }
+ if (r.p != r.end) die("unexpected trailing bytes");
+ free(data);
+ qsort(in.mods, in.len, sizeof(*in.mods), cmp_input_mod);
+ for (size_t i = 1; i < in.len; i++)
+ if (!strcmp(in.mods[i-1].name, in.mods[i].name)) die("duplicate module in input");
+ return in;
+}
+static Sig *lookup(const Group *g, const char *name) {
+ for (Sig *s = g->buckets[bucket_of(name)]; s; s = s->next)
+ if (!strcmp(s->name, name)) return s;
+ return NULL;
+}
+typedef struct {
+ size_t shared, conflicts;
+ uint64_t boxes;
+ const InputMod *bad_input;
+ const Sig *bad_group;
+} Comparison;
+static Comparison compare(const Group *g, const Input *in) {
+ Comparison c = {0};
+ for (size_t j = 0; j < in->len; j++) {
+ const InputMod *m = &in->mods[j];
+ const Sig *s = lookup(g, m->name);
+ if (!s) continue;
+ if (s->hash != m->hash || s->n != m->n) {
+ c.conflicts++;
+ if (!c.bad_input) { c.bad_input = m; c.bad_group = s; }
+ } else {
+ c.shared++;
+ if (UINT64_MAX - c.boxes < m->n) c.boxes = UINT64_MAX;
+ else c.boxes += m->n;
+ }
+ }
+ return c;
+}
+static void group_add(Group *g, const Input *in, size_t index, const char *path) {
+ for (size_t j = 0; j < in->len; j++) {
+ const InputMod *m = &in->mods[j];
+ if (lookup(g, m->name)) continue;
+ Sig *s = xmalloc(sizeof(*s));
+ *s = (Sig){xstrdup(m->name), m->hash, m->n, path, g->buckets[bucket_of(m->name)]};
+ g->buckets[bucket_of(m->name)] = s;
+ g->modules++;
+ }
+ if (g->len == g->cap) {
+ if (g->cap > SIZE_MAX / (2 * sizeof(*g->indices))) die("too many input files");
+ g->cap = g->cap ? 2 * g->cap : 16;
+ g->indices = xrealloc(g->indices, g->cap * sizeof(*g->indices));
+ }
+ g->indices[g->len++] = index;
+}
+static void group_free(Group *g) {
+ for (size_t i = 0; i < BUCKETS; i++) {
+ Sig *s = g->buckets[i];
+ while (s) { Sig *next = s->next; free(s->name); free(s); s = next; }
+ }
+ free(g->indices);
+ free(g->reason);
+ free(g);
+}
+static int better(const Comparison *a, const Group *ga,
+ const Comparison *b, const Group *gb) {
+ if (a->boxes != b->boxes) return a->boxes > b->boxes;
+ if (a->shared != b->shared) return a->shared > b->shared;
+ return ga->len > gb->len;
+}
+static char *reason_for_new_group(Group **groups, size_t ng, const Input *in) {
+ if (!ng) return xstrdup("first input");
+ size_t nearest = SIZE_MAX, rejected = 0, unrelated = 0;
+ Comparison closest = {0};
+ for (size_t i = 0; i < ng; i++) {
+ Comparison c = compare(groups[i], in);
+ if (c.conflicts) {
+ rejected++;
+ if (nearest == SIZE_MAX || c.boxes > closest.boxes ||
+ (c.boxes == closest.boxes && c.shared > closest.shared)) {
+ nearest = i;
+ closest = c;
+ }
+ } else if (!c.shared) unrelated++;
+ }
+ char msg[1024];
+ if (nearest != SIZE_MAX) {
+ const InputMod *m = closest.bad_input;
+ const Sig *s = closest.bad_group;
+ snprintf(msg, sizeof(msg),
+ "incompatible with %zu group(s); closest group %04zu shares "
+ "%zu modules (%" PRIu64 " boxes), but %zu conflict(s); "
+ "e.g. %s: existing hash=%08" PRIx32 " boxes=%zu (from %s); "
+ "incoming hash=%08" PRIx32 " boxes=%zu",
+ rejected, nearest + 1, closest.shared, closest.boxes,
+ closest.conflicts, m->name, s->hash, s->n, s->first_path,
+ m->hash, m->n);
+ } else {
+ snprintf(msg, sizeof(msg),
+ "no shared module signatures with %zu existing group(s) (%zu disjoint)",
+ ng, unrelated);
+ }
+ return xstrdup(msg);
+}
+
+/* The second pass is the original dense-counter merger, one group at a time. */
+static Module *acc_module(Acc *a, const char *name, uint32_t hash, size_t n) {
+ size_t b = bucket_of(name);
+ for (Module *m = a->buckets[b]; m; m = m->next) {
if (strcmp(m->name, name)) continue;
- if (m->hash != hash || m->n != n) die("incompatible module hash/number of boxes");
+ if (m->hash != hash || m->n != n) die("grouping error: incompatible module");
return m;
}
if (n > SIZE_MAX / sizeof(uint64_t)) die("module too large");
Module *m = xmalloc(sizeof(*m));
- m->name = strdup(name);
- if (!m->name) die("out of memory");
+ *m = (Module){0};
+ m->name = xstrdup(name);
m->hash = hash;
m->n = n;
- m->ticks = calloc(n ? n : 1, sizeof(uint64_t));
- if (!m->ticks) die("out of memory");
- m->seen_epoch = 0;
- m->next = a->buckets[bucket];
- a->buckets[bucket] = m;
+ m->ticks = xcalloc(n ? n : 1, sizeof(uint64_t));
+ m->next = a->buckets[b];
+ a->buckets[b] = m;
if (a->len == a->cap) {
if (a->cap > SIZE_MAX / (2 * sizeof(*a->mods))) die("too many modules");
a->cap = a->cap ? 2 * a->cap : 256;
@@ -170,47 +378,40 @@ static void mergeone(Acc *a, const char *path) {
size_t size;
unsigned char *data = readfile(path, &size);
Reader r = {data, data + size};
- if (size < 7 || memcmp(r.p, MAGIC, 7)) die("wrong magic/version (expected HPCTIX\\2)");
- r.p += 7;
+ if (size < MAGIC_SIZE || memcmp(r.p, MAGIC, MAGIC_SIZE)) die("wrong magic/version");
+ r.p += MAGIC_SIZE;
uint64_t nmods = getvar(&r);
- if (nmods > (uint64_t)(r.end - r.p)) die("invalid module count");
if (++a->epoch == 0) die("epoch overflow");
-
for (uint64_t j = 0; j < nmods; j++) {
- uint64_t name_len = getvar(&r);
- if (name_len > SIZE_MAX - 1 || name_len > (uint64_t)(r.end - r.p))
+ uint64_t length = getvar(&r);
+ if (length > SIZE_MAX - 1 || length > (uint64_t)(r.end - r.p))
die("invalid name length");
- char *name = xmalloc((size_t)name_len + 1);
- memcpy(name, r.p, (size_t)name_len);
- name[name_len] = 0;
- if (memchr(name, 0, (size_t)name_len)) die("embedded NUL in module name");
- r.p += (size_t)name_len;
+ char *name = xmalloc((size_t)length + 1);
+ memcpy(name, r.p, (size_t)length);
+ name[length] = 0;
+ r.p += (size_t)length;
uint32_t hash = get32(&r);
uint64_t boxes = getvar(&r);
if (boxes > SIZE_MAX / sizeof(uint64_t)) die("too many counters");
- Module *m = module(a, name, hash, (size_t)boxes);
+ Module *m = acc_module(a, name, hash, (size_t)boxes);
free(name);
- if (m->seen_epoch == a->epoch) die("duplicate module");
+ if (m->seen_epoch == a->epoch) die("duplicate module in input");
m->seen_epoch = a->epoch;
-
- /* RLE records account for exactly 'boxes' positions. */
size_t pos = 0;
while (pos < m->n) {
uint64_t zeros = getvar(&r);
- if (zeros > m->n - pos) die("zero run exceeds module box count");
+ if (zeros > m->n - pos) die("zero run exceeds box count");
pos += (size_t)zeros;
uint64_t nonzeros = getvar(&r);
- if (nonzeros > m->n - pos) die("nonzero run exceeds module box count");
+ if (nonzeros > m->n - pos) die("nonzero run exceeds box count");
if (!zeros && !nonzeros) die("empty RLE record");
-
- size_t stop = pos + (size_t)nonzeros;
- for (; pos < stop; pos++) {
- uint64_t value = getvar(&r);
- if (!value) die("zero value in nonzero run");
- if (UINT64_MAX - m->ticks[pos] < value) die("counter overflow");
- m->ticks[pos] += value;
+ for (uint64_t k = 0; k < nonzeros; k++, pos++) {
+ uint64_t v = getvar(&r);
+ if (!v) die("zero counter in nonzero run");
+ if (v > UINT64_MAX - m->ticks[pos]) die("counter overflow");
+ m->ticks[pos] += v;
}
- if (UINT64_MAX - a->input_entries < nonzeros) die("entry count overflow");
+ if (nonzeros > UINT64_MAX - a->input_entries) die("entry count overflow");
a->input_entries += nonzeros;
}
}
@@ -222,60 +423,78 @@ static int cmpmod(const void *a, const void *b) {
const Module *const *x = a, *const *y = b;
return strcmp((*x)->name, (*y)->name);
}
-static Buffer serialise(const Acc *a) {
+static Buffer serialise(Acc *a) {
Buffer b = {0};
- bytes(&b, MAGIC, 7);
+ qsort(a->mods, a->len, sizeof(*a->mods), cmpmod);
+ bytes(&b, MAGIC, MAGIC_SIZE);
putvar(&b, a->len);
for (size_t j = 0; j < a->len; j++) {
Module *m = a->mods[j];
- size_t name_len = strlen(m->name);
- putvar(&b, name_len);
- bytes(&b, m->name, name_len);
+ size_t length = strlen(m->name);
+ putvar(&b, length);
+ bytes(&b, m->name, length);
put32(&b, m->hash);
putvar(&b, m->n);
-
size_t i = 0;
while (i < m->n) {
size_t start = i;
- while (i < m->n && m->ticks[i] == 0) i++;
+ while (i < m->n && !m->ticks[i]) i++;
putvar(&b, i - start);
start = i;
- while (i < m->n && m->ticks[i] != 0) i++;
+ while (i < m->n && m->ticks[i]) i++;
putvar(&b, i - start);
for (size_t k = start; k < i; k++) putvar(&b, m->ticks[k]);
}
}
return b;
}
-static int is_tix(const char *s) {
- size_t n = strlen(s);
- return n >= 4 && strcmp(s + n - 4, ".tix") == 0;
+static void acc_free(Acc *a) {
+ for (size_t i = 0; i < a->len; i++) {
+ free(a->mods[i]->name);
+ free(a->mods[i]->ticks);
+ free(a->mods[i]);
+ }
+ free(a->mods);
}
-static int cmpstr(const void *a, const void *b) {
- return strcmp(*(char *const *)a, *(char *const *)b);
+static void output_name(char *buf, size_t cap, size_t group) {
+ if (snprintf(buf, cap, "merged-%04zu.tix", group + 1) >= (int)cap)
+ die("too many output groups");
+}
+static void ensure_empty_output_dir(const char *in, const char *out) {
+ if (mkdir(out, 0777) && errno != EEXIST) { perror(out); exit(1); }
+ struct stat a, b;
+ if (stat(in, &a) || stat(out, &b) || !S_ISDIR(b.st_mode))
+ die("invalid input/output directory");
+ if (a.st_dev == b.st_dev && a.st_ino == b.st_ino)
+ die("output directory must differ from input directory");
+ DIR *d = opendir(out);
+ if (!d) { perror(out); exit(1); }
+ struct dirent *e;
+ while ((e = readdir(d))) {
+ if (!strcmp(e->d_name, ".") || !strcmp(e->d_name, "..")) continue;
+ closedir(d);
+ die("output directory is not empty");
+ }
+ closedir(d);
}
-static void merge_dir(const char *dir, const char *output) {
+static void checked_close(FILE *f) {
+ if (fclose(f)) die("could not write report");
+}
+static void merge_dir(const char *dir, const char *dest) {
+ context = dir;
DIR *d = opendir(dir);
if (!d) { perror(dir); exit(1); }
char **paths = NULL;
size_t n = 0, cap = 0;
struct dirent *e;
- struct stat outstat;
- int output_exists = stat(output, &outstat) == 0;
while ((e = readdir(d))) {
if (!is_tix(e->d_name)) continue;
- size_t dlen = strlen(dir), flen = strlen(e->d_name);
- if (dlen > SIZE_MAX - flen - 2) die("path too long");
- char *path = xmalloc(dlen + flen + 2);
- snprintf(path, dlen + flen + 2, "%s/%s", dir, e->d_name);
+ char *path = join(dir, e->d_name);
struct stat st;
if (stat(path, &st) || !S_ISREG(st.st_mode)) { free(path); continue; }
- if (!strcmp(path, output) ||
- (output_exists && st.st_dev == outstat.st_dev && st.st_ino == outstat.st_ino))
- die("output file is among input files");
if (n == cap) {
if (cap > SIZE_MAX / (2 * sizeof(*paths))) die("too many input files");
- cap = cap ? 2 * cap : 256;
+ cap = cap ? cap * 2 : 256;
paths = xrealloc(paths, cap * sizeof(*paths));
}
paths[n++] = path;
@@ -283,32 +502,104 @@ static void merge_dir(const char *dir, const char *output) {
closedir(d);
if (!n) die("no input .tix files");
qsort(paths, n, sizeof(*paths), cmpstr);
- Acc a = {0};
+ ensure_empty_output_dir(dir, dest);
+
+ Group **groups = NULL;
+ size_t ng = 0, gcap = 0;
+ Assignment *assign = xcalloc(n, sizeof(*assign));
for (size_t i = 0; i < n; i++) {
- mergeone(&a, paths[i]);
- free(paths[i]);
- if (a.filecount % 1000 == 0)
- fprintf(stderr, "Merged %" PRIu64 " files\n", a.filecount);
+ Input in = inspect(paths[i]);
+ size_t best = SIZE_MAX;
+ Comparison bestc = {0};
+ for (size_t j = 0; j < ng; j++) {
+ Comparison c = compare(groups[j], &in);
+ if (c.conflicts || !c.shared) continue;
+ if (best == SIZE_MAX || better(&c, groups[j], &bestc, groups[best])) {
+ best = j;
+ bestc = c;
+ }
+ }
+ if (best == SIZE_MAX) {
+ if (ng == gcap) {
+ if (gcap > SIZE_MAX / (2 * sizeof(*groups))) die("too many groups");
+ gcap = gcap ? gcap * 2 : 8;
+ groups = xrealloc(groups, gcap * sizeof(*groups));
+ }
+ Group *g = xcalloc(1, sizeof(*g));
+ g->reason = reason_for_new_group(groups, ng, &in);
+ groups[ng] = g;
+ best = ng++;
+ fprintf(stderr, "New group %04zu from %s: %s\n",
+ best + 1, paths[i], g->reason);
+ }
+ group_add(groups[best], &in, i, paths[i]);
+ assign[i] = (Assignment){best, bestc.shared, bestc.boxes};
+ input_free(&in);
+ if ((i + 1) % 1000 == 0)
+ fprintf(stderr, "Classified %zu/%zu inputs into %zu groups\n", i + 1, n, ng);
}
- free(paths);
- qsort(a.mods, a.len, sizeof(*a.mods), cmpmod);
- Buffer out = serialise(&a);
- context = output;
- writefile(output, out.data, out.len);
- fprintf(stderr, "Merged %" PRIu64 " files, %zu modules, %" PRIu64
- " nonzero input counters; result %zu bytes\n",
- a.filecount, a.len, a.input_entries, out.len);
- free(out.data);
- for (size_t i = 0; i < a.len; i++) {
- free(a.mods[i]->ticks);
- free(a.mods[i]->name);
- free(a.mods[i]);
+
+ char *manifest_path = join(dest, "assignments.tsv");
+ FILE *manifest = fopen(manifest_path, "wb");
+ if (!manifest) { perror(manifest_path); exit(1); }
+ fprintf(manifest, "output\tinput\tshared_modules\tshared_boxes\n");
+ for (size_t i = 0; i < n; i++) {
+ char name[80];
+ output_name(name, sizeof(name), assign[i].group);
+ fprintf(manifest, "%s\t%s\t%zu\t%" PRIu64 "\n",
+ name, paths[i], assign[i].shared_modules, assign[i].shared_boxes);
}
- free(a.mods);
+ checked_close(manifest);
+ free(manifest_path);
+
+ char *report_path = join(dest, "groups.txt");
+ FILE *report = fopen(report_path, "wb");
+ if (!report) { perror(report_path); exit(1); }
+ fprintf(report, "%zu input files -> %zu output groups\n", n, ng);
+ fprintf(report, "Assignments: largest shared box count, then module count, "
+ "then existing file count; no incompatible modules permitted.\n\n");
+
+ for (size_t gi = 0; gi < ng; gi++) {
+ Group *g = groups[gi];
+ Acc *a = xcalloc(1, sizeof(*a));
+ for (size_t j = 0; j < g->len; j++) mergeone(a, paths[g->indices[j]]);
+ if (a->len != g->modules) die("grouping error: module count changed");
+ Buffer b = serialise(a);
+ char name[80];
+ output_name(name, sizeof(name), gi);
+ char *target = join(dest, name);
+ context = target;
+ writefile(target, b.data, b.len);
+ fprintf(stderr, "%s: %zu input files, %zu modules, %" PRIu64
+ " nonzero input counters, %zu output bytes\n",
+ target, g->len, a->len, a->input_entries, b.len);
+ fprintf(report, "%s: %zu files, %zu modules, %zu bytes\n",
+ name, g->len, a->len, b.len);
+ fprintf(report, " Started by: %s\n Reason: %s\n",
+ paths[g->indices[0]], g->reason);
+ for (size_t j = 0; j < g->len; j++) {
+ size_t index = g->indices[j];
+ fprintf(report, " %s [matched %zu modules, %" PRIu64 " boxes]\n",
+ paths[index], assign[index].shared_modules, assign[index].shared_boxes);
+ }
+ fputc('\n', report);
+ free(target);
+ free(b.data);
+ acc_free(a);
+ free(a);
+ }
+ checked_close(report);
+ fprintf(stderr, "Done: %zu files -> %zu output groups; diagnostics: %s\n", n, ng, report_path);
+ free(report_path);
+ for (size_t i = 0; i < ng; i++) group_free(groups[i]);
+ free(groups);
+ free(assign);
+ for (size_t i = 0; i < n; i++) free(paths[i]);
+ free(paths);
}
int main(int argc, char **argv) {
if (argc != 3) {
- fprintf(stderr, "Usage: %s RLE_DIRECTORY OUTPUT.tix\n", argv[0]);
+ fprintf(stderr, "Usage: %s INPUT_DIRECTORY EMPTY_OUTPUT_DIRECTORY\n", argv[0]);
return 2;
}
merge_dir(argv[1], argv[2]);
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e70c73eb65f1cb38c1b062346c6fe2d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e70c73eb65f1cb38c1b062346c6fe2d…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] JS: fix stack corruption in h$ap_gen_fast's pushAllRegs (#27624)
by Marge Bot (@marge-bot) 18 Oct '26
by Marge Bot (@marge-bot) 18 Oct '26
18 Oct '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
3d326d7d by Sylvain Henry at 2026-10-18T18:16:09-04:00
JS: fix stack corruption in h$ap_gen_fast's pushAllRegs (#27624)
The loop added in 9e46990976 ("JS: support more than 128 registers
(#26558)") pushed register N to stack[sp - N - 2] while the switch it
falls through into, and every reader of the h$ap_gen frame, uses
stack[sp - (N - 2)]. Registers >= R32 were therefore written 4 slots
too low: the slots the readers consult were left stale and the frame
below was silently corrupted.
Fix the loop to use the same slot formula as the switch, and add a
regression test: an unknown call to a thunk with 35 argument register
slots, which goes through the generic apply.
Co-Authored-By: Claude Fable 5 <noreply(a)anthropic.com>
- - - - -
5 changed files:
- + changelog.d/27624
- compiler/GHC/StgToJS/Apply.hs
- + testsuite/tests/codeGen/should_run/T27624.hs
- + testsuite/tests/codeGen/should_run/T27624.stdout
- testsuite/tests/codeGen/should_run/all.T
Changes:
=====================================
changelog.d/27624
=====================================
@@ -0,0 +1,8 @@
+section: js-backend
+synopsis: Fix stack corruption in the generic apply with 31 or more argument registers.
+ ``h$ap_gen_fast`` wrote registers above R31 to wrong stack slots (off by 4),
+ corrupting the stack frame below and reloading stale values for the
+ affected arguments. This affected unknown calls to thunks with 31 or more
+ argument register slots.
+issues: #27624
+mrs: !16614
=====================================
compiler/GHC/StgToJS/Apply.hs
=====================================
@@ -774,8 +774,9 @@ genericFastApply s =
, postIncrS regs
-- copy high registers with a loop
, WhileStat False (regs .>. toJExpr max_low_reg) $ mconcat
- -- rN stored in stack[sp - N - 2] so that r2 is stored in stack[sp], etc.
- [ stack .! (sp - regs - 2) |= highReg_expr regs
+ -- rN stored in stack[sp - (N - 2)] so that r2 is stored in stack[sp], etc.
+ -- (same layout as pushReg below and as the readers in h$ap_gen; see #27624)
+ [ stack .! (sp - (regs - 2)) |= highReg_expr regs
, postDecrS regs
]
, SwitchStat regs (map pushReg low_regs) mempty
=====================================
testsuite/tests/codeGen/should_run/T27624.hs
=====================================
@@ -0,0 +1,39 @@
+-- Regression test for #27624: the JS backend's h$ap_gen_fast wrote
+-- registers >= R32 to wrong stack slots (off by 4), corrupting the stack.
+--
+-- The call below is an unknown call with 35 argument register slots and a
+-- thunk callee, so it goes through the generic apply (h$ap_gen_fast on the
+-- JS backend). Compile with -O0 to keep `g` a thunk and the call unknown.
+module Main (main) where
+
+import System.Environment (getArgs)
+
+type F = Int -> Int -> Int -> Int -> Int -> Int -> Int
+ -> Int -> Int -> Int -> Int -> Int -> Int -> Int
+ -> Int -> Int -> Int -> Int -> Int -> Int -> Int
+ -> Int -> Int -> Int -> Int -> Int -> Int -> Int
+ -> Int -> Int -> Int -> Int -> Int -> Int -> Int
+ -> Int
+
+{-# NOINLINE add35 #-}
+add35 :: F
+add35 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18
+ a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29 a30 a31 a32 a33 a34 a35
+ = a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18
+ +a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35
+
+{-# NOINLINE sub35 #-}
+sub35 :: F
+sub35 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18
+ a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29 a30 a31 a32 a33 a34 a35
+ = a1-a2-a3-a4-a5-a6-a7-a8-a9-a10-a11-a12-a13-a14-a15-a16-a17-a18
+ -a19-a20-a21-a22-a23-a24-a25-a26-a27-a28-a29-a30-a31-a32-a33-a34-a35
+
+main :: IO ()
+main = do
+ args <- getArgs
+ -- g is a let-bound thunk of function type; the 35-argument application
+ -- below is an unknown call with no specialized apply function.
+ let g = if null args then add35 else sub35
+ print (g 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
+ 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35)
=====================================
testsuite/tests/codeGen/should_run/T27624.stdout
=====================================
@@ -0,0 +1 @@
+630
=====================================
testsuite/tests/codeGen/should_run/all.T
=====================================
@@ -259,6 +259,7 @@ test('CCallConv', [req_c], compile_and_run, ['CCallConv_c.c'])
test('T25364', normal, compile_and_run, [''])
test('T26061', normal, compile_and_run, [''])
test('T26537', compile_timeout_multiplier(1.5), compile_and_run, ['-O2 -fregs-graph'])
+test('T27624', normal, compile_and_run, ['-O0'])
test('T24016', normal, compile_and_run, ['-O1 -fPIC'])
test('T27046',
[ req_cmm
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3d326d7d28ee5d51c9ae42ae1baf1c5…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3d326d7d28ee5d51c9ae42ae1baf1c5…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
18 Oct '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
70dc4e61 by sheaf at 2026-10-18T18:15:15-04:00
Carefully implement coercion zapping
This commit implements coercion zapping in the rewriter, controlled by
the -fzap-coercions flag (on by default). This significantly reduces
the size of coercions produced when rewriting type family applications,
resulting in much faster compilation. See Note [Coercion zapping]
in GHC.Tc.Solver.Rewrite for an explanation and further details.
The rewriter now keeps track of the `CoVar`s and `CoercionHole`s it uses
when rewriting, which allows computing the dependencies of a zapped
coercion without traversing the coercion the rewriter produced, as
explained in Note [Computing coercion dependencies] in GHC.Tc.Solver.Rewrite.
Accompanying changes:
- Rework how dependencies of 'UnivCo's are tracked, purely for
performance reasons.
We now use the 'UnivCoDeps' datatype instead of '[Coercion]', and
we now insist that 'uco_deps' also contains the CoVars that appear
in the LHS and RHS types of the UnivCo (as a caching mechanism).
- Several performance improvements to the rewriter (e.g. increased
strictness).
- Improvements to the family application cache, including:
- Better documentation.
- Only cache a whole chain of reduction steps.
- Don't put coercion holes in the cache, fixing #27518.
- Allow Core Lint to be called from within the typechecker (and from
within the coercion optimiser).
- Move out "annotation linting" from Core Lint into the general Core
pipeline, to avoid the dependency GHC.Core.Coercion.Opt->GHC.Core.Lint
causing a regression in CountDepsParser due to transitive
dependencies of GHC.Core.Opt.Monad and GHC.Unit.Module.ModGuts.
Fixes #8095 #27336 #27518
Summary of performance numbers
Compile-time byte allocated in GHC's testsuite (0 regressions)
CoOpt_Singletons(normal) ghc/alloc 634,040,332 595,448,728 -6.1% GOOD
FamAppCachePerf(normal) ghc/alloc 495,629,812 191,612,920 -61.3% GOOD
LargeRecord(normal) ghc/alloc 1,226,806,434 966,260,976 -21.2% GOOD
SimplCastPerf(normal) ghc/alloc 160,505,678 148,112,688 -7.7% GOOD
T12227(normal) ghc/alloc 244,668,982 233,037,216 -4.8% GOOD
T12545(normal) ghc/alloc 697,804,842 424,705,152 -39.1% GOOD
T13386(normal) ghc/alloc 422,871,076 35,213,656 -91.7% GOOD
T15703(normal) ghc/alloc 288,402,364 273,692,560 -5.1% GOOD
T26426(normal) ghc/alloc 86,002,052 78,152,104 -9.1% GOOD
T27336(normal) ghc/alloc 498,932,268 35,886,016 -92.8% GOOD
T5030(normal) ghc/alloc 117,057,706 88,785,648 -24.2% GOOD
T5321Fun(normal) ghc/alloc 252,552,628 243,820,176 -3.5% GOOD
T8095(normal) ghc/alloc 768,198,564 127,779,520 -83.4% GOOD
T9872a(normal) ghc/alloc 1,655,675,020 1,406,017,008 -15.1% GOOD
T9872b(normal) ghc/alloc 1,864,180,628 1,644,706,696 -11.8% GOOD
T9872b_defer(normal) ghc/alloc 2,834,585,468 1,657,729,760 -41.5% GOOD
T9872c(normal) ghc/alloc 1,572,573,116 1,354,055,424 -13.9% GOOD
T9872d(normal) ghc/alloc 351,516,004 331,071,424 -5.8% GOOD
TcPlugin_RewritePerf(normal) ghc/alloc 2,063,065,680 1,847,464,272 -10.5% GOOD
Chesskell (github.com/Proxymoron461/chesskell/issues)
Typechecking that the first N plies of kholmovVsBronsteinShort
are a valid chess game:
Plies | GHC 9.14 time/alloc | This commit time/alloc |
-----:|---------------------|------------------------|
2 | 41s/20GB | 0.2s/19MB |
4 | 95s/49GB | 0.3s/25MB |
6 | timed out | 0.6s/522MB |
8 | timed out | 7s/673MB |
10 | timed out | timed out |
Compilation of singletons-base: compile time -28%, allocations -25%
-------------------------
Metric Decrease:
CoOpt_Singletons
FamAppCachePerf
LargeRecord
SimplCastPerf
T12227
T12545
T13386
T15703
T24984
T26426
T27336
T5030
T5321Fun
T8095
T9872a
T9872b
T9872b_defer
T9872c
T9872d
TcPlugin_RewritePerf
-------------------------
Co-Authored-By: Sylvain Henry <sylvain(a)haskus.fr>
- - - - -
49 changed files:
- + changelog.d/zap-coercions
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion.hs-boot
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Lint.hs
- + compiler/GHC/Core/Lint.hs-boot
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Reduction.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/TyCo/FVs.hs
- compiler/GHC/Core/TyCo/FVs.hs-boot
- compiler/GHC/Core/TyCo/Make.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Rep.hs-boot
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/Driver/Config.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Iface/Rename.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Runtime/Eval/Types.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Rewrite.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Types/Unique/DSet.hs
- compiler/GHC/Types/Var/Set.hs
- docs/users_guide/extending_ghc.rst
- docs/users_guide/exts/type_families.rst
- testsuite/tests/corelint/T27374.hs
- testsuite/tests/count-deps/CountDepsParser.stdout
- testsuite/tests/dependent/should_compile/T14729.stderr
- + testsuite/tests/indexed-types/should_compile/ZapDeps.hs
- testsuite/tests/indexed-types/should_compile/all.T
- testsuite/tests/rep-poly/RepPolyRule3.stderr
- testsuite/tests/simplCore/should_compile/T26051.stderr
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70dc4e611ba6ad79ec51e34363326ec…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70dc4e611ba6ad79ec51e34363326ec…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0