
Zubin pushed to branch wip/9.12.3-backports at Glasgow Haskell Compiler / GHC
Commits:
14d75bd1 by Zubin Duggal at 2025-09-04T17:54:57+05:30
fetch_gitlab: Ensure we copy users_guide.pdf and Haddock.pdf to the release docs directory
Fixes #24093
(cherry picked from commit 9fa590a6e27545995cdcf419ed7a6504e6668b18)
- - - - -
0088037f by sheaf at 2025-09-04T17:54:57+05:30
Use mkTrAppChecked in ds_ev_typeable
This change avoids violating the invariant of mkTrApp according to which
the argument should not be a fully saturated function type.
This ensures we don't return false negatives for type equality
involving function types.
Fixes #25998
(cherry picked from commit 9c6d2b1bf54310b6d9755aa2ba67fbe38feeac51)
- - - - -
0b1f3bf6 by Ben Gamari at 2025-09-04T17:54:57+05:30
Reapply "Division by constants optimization"
This reverts commit eb2859af981415ed6bf08fcf4d8f19811bf95494.
(cherry picked from commit f0499c94071c11d31d5afc996431cf4b909dbd76)
- - - - -
632623d7 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/linker: Don't fail due to RTLD_NOW
In !12264 we started using the NativeObj machinery introduced some time
ago for loading of shared objects. One of the side-effects of this
change is shared objects are now loaded eagerly (i.e. with `RTLD_NOW`).
This is needed by NativeObj to ensure full visibility of the mappings of
the loaded object, which is in turn needed for safe shared object
unloading.
Unfortunately, this change subtly regressed, causing compilation
failures in some programs. Specifically, shared objects which refer to
undefined symbols (e.g. which may be usually provided by either the
executable image or libraries loaded via `dlopen`) will fail to load
with eager binding. This is problematic as GHC loads all package
dependencies while, e.g., evaluating TemplateHaskell splices. This
results in compilation failures in programs depending upon (but not
using at compile-time) packages with undefined symbol references.
To mitigate this NativeObj now first attempts to load an object via
eager binding, reverting to lazy binding (and disabling unloading) on
failure.
See Note [Don't fail due to RTLD_NOW].
Fixes #25943.
(cherry picked from commit 715d2a8550418d342bea767e1a4b0c7695966463)
(cherry picked from commit a9de3b73ebb6f29eeae7d170a0210f5bedeb8d85)
- - - - -
ce4c8735 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/linker: Factor out ProddableBlocks machinery
(cherry picked from commit 2921131cfa185c8e0ec48ddce2c994615493ca0a)
(cherry picked from commit 7d7e096504cd35272df9727b92dcbe7d94927ac8)
- - - - -
3ee32ef9 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/linker: Improve efficiency of proddable blocks structure
Previously the linker's "proddable blocks" check relied on a simple
linked list of spans. This resulted in extremely poor complexity while
linking objects with lots of small sections (e.g. objects built with
split sections).
Rework the mechanism to instead use a simple interval set implemented
via binary search.
Fixes #26009.
(cherry picked from commit e6e69dba996f47e21391f023010f5b138dc1df9c)
(cherry picked from commit b388ca86b5e56636a1862987ec1b1d3deefedc9e)
- - - - -
bf2d27b5 by Ben Gamari at 2025-09-04T17:54:57+05:30
testsuite: Add simple functional test for ProddableBlockSet
(cherry picked from commit 915902fc09ff4b00cf676c40d31dbbbf7d1cb7d7)
(cherry picked from commit dc4c540ddd39fb99b18630aebd2849ac29a4cd73)
- - - - -
553dcd51 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/linker/PEi386: Drop check for LOAD_LIBRARY_SEARCH_*_DIRS
The `LOAD_LIBRARY_SEARCH_USER_DIRS` and
`LOAD_LIBRARY_SEARCH_DEFAULT_DIRS` were introduced in Windows Vista and
have been available every since. As we no longer support Windows XP we
can drop this check.
Addresses #26009.
(cherry picked from commit 1f38e2739fbbae3cbe925320fa70965004aaaca5)
(cherry picked from commit 10cfa8946b76a914fb3ecd4df62d32160b64151a)
- - - - -
754f5c06 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/linker/PEi386: Clean up code style
(cherry picked from commit facf379b0f1c0d1cbc3c1896cce603c89e837481)
(cherry picked from commit 92793b3799525f46373d9696c7e91c0d14860fa8)
- - - - -
002ac0bf by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/Hash: Factor out hashBuffer
This is a useful helper which can be used for non-strings as well.
(cherry picked from commit 827961b9a724d8b2dd848222f980efc2de3996e3)
(cherry picked from commit a8c1ecb0d45050491496c0d04cc022a294a075b1)
- - - - -
338c6066 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/linker/PEi386: Fix incorrect use of break in nested for
Previously the happy path of PEi386 used `break` in a double-`for` loop
resulting in redundant calls to `LoadLibraryEx`.
Fixes #26052.
(cherry picked from commit 6fbb05cf8a999628476d0d7274f30ef45e4d3932)
(cherry picked from commit 36a8bd2b7ceb0622e0aca2bed9cee7162076379c)
- - - - -
c3471809 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts: Correctly mark const arguments
(cherry picked from commit 320d7dd3e8de62f970d23ac1d27c665093d22aaa)
(cherry picked from commit 3a389cacefaffb3293f6b5f2ed5b20f2dbb9b4e3)
- - - - -
b79b3668 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/linker/PEi386: Don't repeatedly load DLLs
Previously every DLL-imported symbol would result in a call to
`LoadLibraryEx`. This ended up constituting over 40% of the runtime of
`ghc --interactive -e 42` on Windows. Avoid this by maintaining a
hash-set of loaded DLL names, skipping the call if we have already
loaded the requested DLL.
Addresses #26009.
(cherry picked from commit e6b0067bfa49b42bf4599af8d6a3c97878302624)
(cherry picked from commit b24be9b90adcf3fb9ee0c6b7e120b4bf1e77f072)
- - - - -
3ebc4f8d by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/linker: Expand comment describing ProddableBlockSet
(cherry picked from commit 9631a12c0b89529c3d1147d0770ec6b9023cdb17)
(cherry picked from commit 6ad664de0a4ab3e1747d318aabb5035ce7c74fcd)
- - - - -
ca493586 by Cheng Shao at 2025-09-04T17:54:57+05:30
rts: fix rts_clearMemory logic when sanity checks are enabled
This commit fixes an RTS assertion failure when invoking
rts_clearMemory with +RTS -DS. -DS implies -DZ which asserts that free
blocks contain 0xaa as the designated garbage value. Also adds the
sanity way to rts_clearMemory test to prevent future regression.
Closes #26011.
ChatGPT Codex automatically diagnosed the issue and proposed the
initial patch in a single shot, given a GHC checkout and the following
prompt:
---
Someone is reporting the following error when attempting to use `rts_clearMemory` with the RTS option `-DS`:
```
test.wasm: internal error: ASSERTION FAILED: file rts/sm/Storage.c, line 1216
(GHC version 9.12.2.20250327 for wasm32_unknown_wasi)
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
What's the culprit? How do I look into this issue?
---
I manually reviewed & revised the patch, tested and submitted it.
(cherry picked from commit 86406f48659a5ab61ce1fd2a2d427faba2dcdb09)
- - - - -
280f87fe by kwxm at 2025-09-04T17:54:57+05:30
Fix bugs in `integerRecipMod` and `integerPowMod`
This fixes #26017.
* `integerRecipMod x 1` now returns `(# 1 | #)` for all x; previously it
incorrectly returned `(# | () #)`, indicating failure.
* `integerPowMod 0 e m` now returns `(# | () #)` for e<0 and m>1, indicating
failure; previously it incorrectly returned `(# 0 | #)`.
(cherry picked from commit 8ded23300367c6e032b3c5a635fd506b8915374b)
- - - - -
905715ad by Matthew Pickering at 2025-09-04T17:54:57+05:30
interpreter: Fix INTERP_STATS profiling code
The profiling code had slightly bitrotted since the last time it was
used. This just fixes things so that if you toggle the INTERP_STATS
macro then it just works and prints out the stats.
Fixes #25695
(cherry picked from commit 66c7f65676801367f440a6a644f87d71157d2f3f)
- - - - -
8033abd5 by Matthew Pickering at 2025-09-04T17:54:57+05:30
interpreter: Fix overflows and reentrancy in statistics calculation
1. Use unsigned long for counter, as they can easily overflow if you are
running a long benchmark.
2. Make interp_shutdown reentrant by copying the command frequency table
into an array.
Fixes #25756
(cherry picked from commit c4e112fccd10ca745771dd81d2c1eb340aa8dd86)
- - - - -
2759c597 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts: Tighten up invariants of PACK
(cherry picked from commit aa58fc5b9745a2201707de81a91960b213ea3258)
- - - - -
30cd1559 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts: Improve documentation of SLIDE bytecode instruction
(cherry picked from commit 0e084029def86e9e67b89317f44fd71c823e9bca)
- - - - -
f5ff86f2 by Ben Gamari at 2025-09-04T17:54:57+05:30
rts/Interpreter: Assert that TEST*_P discriminators are valid
(cherry picked from commit 9bf3663b9970851e7b5701d68147450272823197)
- - - - -
60906d43 by Ben Gamari at 2025-09-04T17:54:58+05:30
Revert "rts/Interpreter: Assert that TEST*_P discriminators are valid"
This assertion was based on the misconception that `GET_TAG` was
returning the pointer tag whereas it is actually returning the
constructor tag.
This reverts commit 9bf3663b9970851e7b5701d68147450272823197.
Fixes #25527.
(cherry picked from commit dd95940639fd198f97fb3f44e84494eaca721788)
- - - - -
d302744c by Matthew Pickering at 2025-09-04T17:54:58+05:30
interpreter: Fix underflow frame lookups
BCOs can be nested, resulting in nested BCO stack frames where the inner most
stack frame can refer to variables stored on earlier stack frames via the
PUSH_L instruction.
|---------|
| BCO_1 | -<-┐
|---------|
......... |
|---------| | PUSH_L <n>
| BCO_N | ->-┘
|---------|
Here BCO_N is syntactically nested within the code for BCO_1 and will result
in code that references the prior stack frame of BCO_1 for some of it's local
variables. If a stack overflow happens between the creation of the stack frame
for BCO_1 and BCO_N the RTS might move BCO_N to a new stack chunk while leaving
BCO_1 in place, invalidating a simple offset based reference to the outer stack
frames.
Therefore `ReadSpW` first performs a bounds check to ensure that accesses onto
the stack will succeed. If the target address would not be a valid location for
the current stack chunk then `slow_spw` function is called, which dereferences
the underflow frame to adjust the offset before performing the lookup.
┌->--x | CHK_1 |
| CHK_2 | | | |---------|
|---------| | └-> | BCO_1 |
| UD_FLOW | -- x |---------|
|---------| |
| ...... | |
|---------| | PUSH_L <n>
| BCO_ N | ->-┘
|---------|
Fixes #25750
(cherry picked from commit f4da90f11e3a3a634ec3edb6d70d96fe3515b726)
- - - - -
63480835 by Ben Gamari at 2025-09-04T17:54:58+05:30
base: Note strictness changes made in 4.16.0.0
Addresses #25886.
(cherry picked from commit 7722232c6f8f0b57db03d0439d77896d38191bf9)
- - - - -
aaff4d7c by Hécate Kleidukos at 2025-09-04T17:54:58+05:30
Expose all of Backtraces' internals for ghc-internal
Closes #26049
(cherry picked from commit 16014bf84afa0d009b6254b103033bceca42233a)
- - - - -
5e37fa3b by ARATA Mizuki at 2025-09-04T17:54:58+05:30
AArch64 NCG: Fix sub-word arithmetic right shift
As noted in Note [Signed arithmetic on AArch64], we should zero-extend sub-word values.
Fixes #26061
(cherry picked from commit 265d0024abc95be941f8e4769f24af128eedaa10)
- - - - -
76b9fcbd by ARATA Mizuki at 2025-09-04T17:54:58+05:30
x86 NCG: Fix code generation of bswap64 on i386
Co-authored-by: sheaf
naturalAndNot ((2 ^ 65) .|. (2 ^ 3)) (2 ^ 3) 0
In contrast, `naturalAndNot` does not truncate when both arguments are larger than a `Word`, so this appears to be a bug.
Luckily, the fix is pretty easy: we just need to call `bigNatAndNotWord#` instead of truncating.
Fixes #26230
(cherry picked from commit a766286fe759251eceb304c54ba52841c2a51f86)
- - - - -
d0629aa6 by Ben Gamari at 2025-09-04T17:54:58+05:30
llvmGen: Fix built-in variable predicate
Previously the predicate to identify LLVM builtin global variables was
checking for `$llvm` rather than `@llvm` as it should.
(cherry picked from commit 6e67fa083a50684e1cfae546e07cab4d4250e871)
- - - - -
88 changed files:
- .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/Cmm/Config.hs
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/Cmm/Pipeline.hs
- compiler/GHC/Cmm/Sink.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/Core/LateCC/OverloadedCalls.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Driver/Config/Cmm.hs
- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/SysTools/Ar.hs
- compiler/GHC/Tc/Solver/Equality.hs
- configure.ac
- docs/users_guide/profiling.rst
- libraries/base/changelog.md
- libraries/ghc-bignum/changelog.md
- libraries/ghc-bignum/src/GHC/Num/Integer.hs
- libraries/ghc-bignum/src/GHC/Num/Natural.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Backtrace.hs
- rts/Hash.c
- rts/Hash.h
- rts/Interpreter.c
- rts/Interpreter.h
- rts/Linker.c
- rts/LinkerInternals.h
- rts/Messages.c
- rts/PathUtils.c
- rts/PathUtils.h
- rts/RtsMain.c
- rts/StgMiscClosures.cmm
- rts/Updates.h
- rts/include/rts/storage/InfoTables.h
- rts/linker/Elf.c
- rts/linker/LoadNativeObjPosix.c
- rts/linker/MachO.c
- rts/linker/PEi386.c
- rts/linker/PEi386.h
- + rts/linker/ProddableBlocks.c
- + rts/linker/ProddableBlocks.h
- rts/rts.cabal
- rts/sm/NonMoving.c
- rts/sm/NonMoving.h
- rts/sm/NonMovingAllocate.c
- rts/sm/Sanity.c
- rts/sm/Storage.h
- + testsuite/tests/cmm/should_run/T25601.hs
- + testsuite/tests/cmm/should_run/T25601.stdout
- + testsuite/tests/cmm/should_run/T25601a.cmm
- testsuite/tests/cmm/should_run/all.T
- + testsuite/tests/codeGen/should_run/T26061.hs
- + testsuite/tests/codeGen/should_run/T26061.stdout
- testsuite/tests/codeGen/should_run/all.T
- + testsuite/tests/cpranal/sigs/T25944.hs
- + testsuite/tests/cpranal/sigs/T25944.stderr
- testsuite/tests/cpranal/sigs/all.T
- testsuite/tests/ffi/should_run/all.T
- + testsuite/tests/ghc-api/T26120.hs
- + testsuite/tests/ghc-api/T26120.stdout
- testsuite/tests/ghc-api/all.T
- + testsuite/tests/lib/integer/T26017.hs
- + testsuite/tests/lib/integer/T26017.stdout
- testsuite/tests/lib/integer/all.T
- testsuite/tests/lib/integer/integerRecipMod.hs
- testsuite/tests/lib/integer/integerRecipMod.stdout
- + testsuite/tests/numeric/should_run/T26230.hs
- + testsuite/tests/numeric/should_run/T26230.stdout
- testsuite/tests/numeric/should_run/all.T
- + testsuite/tests/partial-sigs/should_compile/T26256.hs
- + testsuite/tests/partial-sigs/should_compile/T26256.stderr
- testsuite/tests/partial-sigs/should_compile/all.T
- + testsuite/tests/rts/TestProddableBlockSet.c
- testsuite/tests/rts/all.T
- + testsuite/tests/typecheck/should_compile/T26256a.hs
- testsuite/tests/typecheck/should_compile/all.T
- + testsuite/tests/typecheck/should_run/T25998.hs
- + testsuite/tests/typecheck/should_run/T25998.stdout
- testsuite/tests/typecheck/should_run/all.T
- + utils/haddock/html-test/ref/Bug25739.html
- + utils/haddock/html-test/src/Bug25739.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9edb71d5f782b8860e674240b6de715ed69c025c...d0629aa6d14710c2fbbd4709d0c54e28af805fb1
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9edb71d5f782b8860e674240b6de715ed69c025c...d0629aa6d14710c2fbbd4709d0c54e28af805fb1
You're receiving this email because of your account on gitlab.haskell.org.