[Git][ghc/ghc][wip/romes/ghci-debugger-2] 17 commits: LLVM: account for register type in funPrologue
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Thu Feb 27 11:17:06 UTC 2025
Rodrigo Mesquita pushed to branch wip/romes/ghci-debugger-2 at Glasgow Haskell Compiler / GHC
Commits:
33aca30f by sheaf at 2025-02-25T08:58:46-05:00
LLVM: account for register type in funPrologue
We were not properly accounting for the live register type of
global registers in GHC.CmmToLlvm.CodeGen.funPrologue. This meant that
we could allocated a register at type <4 x i32> but try to write to it
at type <8 x i16>, which LLVM doesn't much like.
This patch fixes that by inserting intermerdiate casts when necessary.
Fixes #25730
- - - - -
0eb58b0e by sheaf at 2025-02-25T08:59:29-05:00
base: make Data.List.NonEmpty.unzip match Data.List
This commit makes Data.List.NonEmpty.unzip match the implementation
of Data.List, as was suggested in approved CLC proposal #107.
- - - - -
f4da90f1 by Matthew Pickering at 2025-02-25T14:11:21-05:00
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
- - - - -
c3f2d284 by Vladislav Zavialov at 2025-02-25T14:11:58-05:00
Remove ArgPatBuilder
ArgPatBuilder in Parser/PostProcess.hs became redundant with the
introduction of InvisPat (36a75b80eb).
This small refactoring removes it.
- - - - -
0f2241e9 by sheaf at 2025-02-25T19:23:21-05:00
Propagate long distance info to guarded let binds
This commit ensures that we propagate the enclosing long distance
information to let bindings inside guards, in order to get accurate
pattern-match checking warnings, in particular incomplete record
selector warnings.
Example:
data D = K0 | K1 { fld :: Int }
f :: D -> Int
f d@(K1 {})
| let i = fld d
= i
f _ = 3
We now correctly recognise that the field selector 'fld' cannot fail,
due to the outer pattern match which guarantees that the value 'd' has
the field 'fld'.
Fixes #25749
- - - - -
64b0d4d0 by Fangyi Zhou at 2025-02-25T19:24:07-05:00
wasm: use primitive opcodes for fabs and sqrt
- Add new `WasmInstr` constructor `WasmSqrt` for sqrt, corresponding to
primitivie operations in wasm.
- When lowering CallishMachOp, use `WasmAbs` and `WasmSqrt` for F32 and
F64 fabs and sqrt.
- - - - -
272eaef0 by Cheng Shao at 2025-02-25T19:24:43-05:00
hadrian: enable building stage1 haddock for cross ghc
This commit enables building stage1 haddock for cross ghc. Without
this change, hadrian would panic with "Unknown program" error when
building the _build/stage1/bin/cross-prefix-haddock program needed by
the docs-haddock target, even if it only needs to copy from
_build/stage0/bin/cross-prefix-haddock.
- - - - -
a794e733 by Cheng Shao at 2025-02-25T19:24:43-05:00
hadrian: enable building docs for cross targets
Hadrian used to omit the docs target as a part of binary-dist-dir for
cross targets. This commit enables docs to be built as a part of cross
bindists and it works just fine in CI.
- - - - -
6dba56e1 by Cheng Shao at 2025-02-25T19:24:43-05:00
ci: build haddock/sphinx-html for wasm jobs
This commit enables building haddock & sphinx-html documentation for
wasm targets. The docs are useful for end users and should be tested
in CI.
I've omitted pdf & manpage generation for the wasm target; I've never
found the pdf version of docs to be useful, and the manpage only
contains `ghc.1` where we really want `wasm32-wasi-ghc.1` but that
should be a separate issue to fix.
- - - - -
2d6a63ab by Cheng Shao at 2025-02-25T19:25:20-05:00
ghci: remove unused showBreakArray function
GHCi.BreakArray.showBreakArray is not used anywhere, hence the
housecleaning.
- - - - -
b228fcb5 by Cheng Shao at 2025-02-25T19:25:57-05:00
ghc-heap: fix HalfWord incompatible Binary instances for cross GHC
ghc-heap defines HalfWord as Word32/Word16 depending on host word
size. For cross GHC with different host/target word sizes, the Binary
instances are incompatible and breaks iserv serialization of any
message type that involves HalfWord, breaking the ghci debugger. This
patch fixes the issue and has been tested to fix ghci debugger
functionality of the wasm backend. Fixes #25420 #25781.
- - - - -
ec02f8c2 by Rodrigo Mesquita at 2025-02-26T11:03:38-05:00
ghci-debugger: display thunks provenance if avail
Improves reporting on ghci breakpoints when IPE information is available
by printing, next to the thunk, the source file and src span where the
thunk originated.
Closes #25746
- - - - -
6acaff2b by Vladislav Zavialov at 2025-02-26T11:04:15-05:00
Tidy up error messages for TypeAbstractions
1. Print the '@' symbol before invisible patterns and improve phrasing:
T24557c.hs:8:4: error: [GHC-11983]
- Invisible type pattern pat is not allowed here
+ Illegal invisible type pattern: @pat
+ An invisible type pattern must occur in an argument position.
2. Use a single error code for all type abstractions deemed illegal
due to the TypeAbstractions extension being disabled.
Before this change:
* [GHC-78249] was used in function equations, lambdas
* [GHC-17916] was used in constructor patterns
After this change:
* [GHC-78249] is used to report all illegal type abstractions
* [GHC-17916] is no longer used
There was no reason for both error codes to exist and this distinction
was a source of complexity in GHC/Tc/Errors/* and GHC/Rename/Pat.hs
3. Group the different "invisible type pattern" error constructors
under a single parent constructor, TcRnIllegalInvisibleTypePattern
containing BadInvisPatReason
- - - - -
1ce9502e by Ben Gamari at 2025-02-27T04:48:29-05:00
haddock/doc: Drop version and release
We currently have no way of keeping this up-to-date with the project version
- - - - -
7f358f25 by Matthew Pickering at 2025-02-27T04:49:06-05:00
testsuite: Add test for :steplocal performance
This adds a simple test which exercises #25779
- - - - -
a44430b8 by Rodrigo Mesquita at 2025-02-27T11:16:09+00:00
ghci: Don't set virtualCWD on every iteration
The calls to withVirtualCWD were introduced to fix #2973, but this bug
is no longer reproducible, even when `withVirtualCWD` is dropped.
This cleanup was originally motivated by the performance of :steplocal,
but the performance problem has now been fixed at its root in the next
commit.
Even then, `withVirtualCWD` seems to now be an unnecessary artifact, and
removing it simplifies the interpreter with no apparent drawbacks (testsuite is
also happy with this change)
- - - - -
0b05528d by Rodrigo Mesquita at 2025-02-27T11:16:09+00:00
ghci debugger: improve break/resume control flow
After interpreting bytecode (`evalStmt`), we may want to hand off
control to "GHCi.UI" in order to display an interactive break prompt:
1. When an /active/ breakpoint (one set with :break ...) is hit
2. At any breakpoint, when using :step from a breakpoint
3. At any breakpoint in the same function f, when :steplocal is called
from a breakpoint in f
4. At any breakpoint in the same module, when :stepmodule is used
Whether to pass control to the UI is now fully determined by
`handleRunStatus` which transforms an `EvalStatus_` into an
`ExecResult`. When `ExecBreak` is returned from `handleRunStatus` to
GHCi, it always means GHCi breaks.
`handleRunStatus` determines whether to loop and resume evaluation right away, or
when to return to GHCi (by returning `ExecBreak` or `ExecComplete`).
- (1) is queried using the `BreakpointStatus` message (the
`breakpointStatus` call)
- (2,3,4) are determined by the predicate `breakHere step span`, which
inspects the improved `SingleStep` type to determine whether we care
about this breakpoint even if it is not active.
This refactor solves two big performance problems with the previous control flow:
- We no longer call `withArgs/withProgram` repeatedly in the
break/resume loop, but rather just once "at the top".
- We now avoid computing the expensive `bindLocalsAtBreakpoint` for
breakpoints we'd never inspect.
In the test added, calling `:steplocal` after breaking on `main = fib 25`
now takes 12 seconds rather than 49 seconds on my machine.
Fixes #25779
- - - - -
58 changed files:
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/Cmm/Reg.hs
- compiler/GHC/CmmToAsm/Wasm/Asm.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/Wasm/Types.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/HsToCore/GuardedRHSs.hs
- compiler/GHC/Llvm/Types.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Runtime/Debugger.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/Runtime/Eval/Types.hs
- compiler/GHC/Runtime/Heap/Inspect.hs
- compiler/GHC/Runtime/Interpreter.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Types/Error/Codes.hs
- ghc/GHCi/UI.hs
- ghc/GHCi/UI/Monad.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Settings/Default.hs
- libraries/base/src/Data/List/NonEmpty.hs
- libraries/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc
- libraries/ghci/GHCi/BreakArray.hs
- libraries/ghci/GHCi/Message.hs
- libraries/ghci/GHCi/Run.hs
- rts/Interpreter.c
- + testsuite/tests/llvm/should_run/T25730.hs
- + testsuite/tests/llvm/should_run/T25730.stdout
- + testsuite/tests/llvm/should_run/T25730C.c
- testsuite/tests/llvm/should_run/all.T
- testsuite/tests/perf/compiler/all.T
- + testsuite/tests/perf/compiler/interpreter_steplocal.hs
- + testsuite/tests/perf/compiler/interpreter_steplocal.script
- + testsuite/tests/perf/compiler/interpreter_steplocal.stdout
- + testsuite/tests/pmcheck/should_compile/T25749.hs
- testsuite/tests/pmcheck/should_compile/all.T
- testsuite/tests/rename/should_fail/T17594b.hs
- testsuite/tests/rename/should_fail/T17594b.stderr
- + testsuite/tests/rename/should_fail/T17594b_th.hs
- + testsuite/tests/rename/should_fail/T17594b_th.stderr
- testsuite/tests/rename/should_fail/T22478e.stderr
- testsuite/tests/rename/should_fail/all.T
- testsuite/tests/th/T24557a.stderr
- testsuite/tests/th/T24557b.stderr
- testsuite/tests/th/T24557c.stderr
- testsuite/tests/th/T24557d.stderr
- testsuite/tests/typecheck/should_fail/T17594c.stderr
- testsuite/tests/typecheck/should_fail/T17594d.stderr
- testsuite/tests/typecheck/should_fail/T17594g.stderr
- testsuite/tests/typecheck/should_fail/T19109.stderr
- testsuite/tests/typecheck/should_fail/T23776.stderr
- utils/haddock/doc/conf.py
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d5b1d01156cdc5ecb1b89c2631bc08f86a5728f6...0b05528d20def1ed6ab0e48b3f16629d30edf6ae
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d5b1d01156cdc5ecb1b89c2631bc08f86a5728f6...0b05528d20def1ed6ab0e48b3f16629d30edf6ae
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250227/bc1feeee/attachment-0001.html>
More information about the ghc-commits
mailing list