- Mar 03, 2025
-
-
Rodrigo Mesquita authored
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 interpreter_steplocal test added, calling `:steplocal` after breaking on `main = fib 25` now takes 12 seconds rather than 49 seconds on my machine. ``` interpreter_steplocal(ghci) ghc/alloc 6,124,821,176 540,181,392 -91.2% GOOD ``` Fixes #25779 ------------------------- Metric Decrease: interpreter_steplocal -------------------------
-
- Feb 28, 2025
-
-
Rodrigo Mesquita authored
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)
-
Now we can use HasDebugCallStack instead to avoid cluttering the code with strings and to avoid maintaining those strings (e.g. renaming them when functions are renamed...).
-
Measures taken to make the test stable: - Use 'a' as variable prefix, because X86 32bit stumbled over the variable name 'i386' - Flush stdout to make test output deterministic - Use type annotations to support 32bit archs
-
Though the name is misleading, we consider them to be branching. For branch instructions we do not deallocate (parts of) the stack, but keep the stack pointer (sp) intact.
-
- Feb 27, 2025
-
-
This adds a simple test which exercises #25779
-
We currently have no way of keeping this up-to-date with the project version
-
- Feb 26, 2025
-
-
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
-
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
-
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.
-
GHCi.BreakArray.showBreakArray is not used anywhere, hence the housecleaning.
-
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.
-
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.
-
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.
-
- 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.
-
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
-
- Feb 25, 2025
-
-
ArgPatBuilder in Parser/PostProcess.hs became redundant with the introduction of InvisPat (36a75b80). This small refactoring removes it.
-
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
-
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
-
- Feb 23, 2025
-
-
Bumps libffi submodule.
-
This patch adds a note to explain how the magic variables like `__ghc_wasm_jsffi_dyld` are brought into scope of JSFFI code snippets, as follow up work of !13583.
-
- Feb 22, 2025
-
-
For the wasm target, the driver calls `wasm32-wasi-clang --print-search-dirs` and finds the sysroot directory that contains libc.so etc, then passes the directory path to dyld. However, when GHC is configured with -flto as a part of C/C++ compiler flags, the clang driver would insert a llvm-lto specific directory in the --print-search-dirs output and the driver didn't take that into account. This patch fixes it and always selects the non-lto sysroot directory to be passed to dyld. This is one small step towards supporting building all cbits with lto for wasm.
-
This patch fixes wasm dyld script for shared libraries created by llvm 20.x. The __wasm_apply_data_relocs function is now optional and may be omitted for shared libraries without any runtime relocatable data segments, so only call __wasm_apply_data_relocs when it's present.
-
This patch sets `--max-old-space-size=65536` as wasm dyld shebang arguments to lessen v8 heap pressure in certain workloads that load the full ghc package. It doesn't really commit 64G memory but it does help reduce v8 gc overhead.
-
There is no reason why these should have external linkage.
-
This patch uses fromAscList (with O(n) complexity) instead of fromList (with O(nlogn) complexity) in certain Binary instances. It's safe to do so since the corresponding serialization logic is based on toList (same as toAscList).
-
- Feb 20, 2025
-
-
-
The `InternalCounters` test case fails when ghc is built with `+debug_ghc`. This patch skips it in that case and allows the testsuite to pass for the `+debug_ghc` flavour transformer.
-
- Feb 19, 2025
-
-
These are otherwise very hard to test in isolation.
-
> DeprecationWarning: 'count' is passed as positional argument
-
- Feb 18, 2025
-
-
Matthew Farkas-Dyck authored
In some cases, where not readily feasible to modify code to use `NonEmpty`, merely use `expectNonEmpty` to make explicit we are panicking if we have an empty list.
-
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
-
In the previous commit I omitted to include the unique, which still makes it very difficult to trace back where the BCO came from.
-
Converting from `NonEmpty` to `[]` and back is totally needless.
-
-
This commit: 1. Refactors checkTyEqRhs to allow it be called in pure contexts, which means it skips doing any on-the-fly promotion. 2. Calls checkTyEqRhs in mightEqualLater to check whether it a MetaTv can unify with a RHS or whether that would cause e.g. skolem escape errors or concreteness errors. Fixes #25744
-
-
In the ParStmt constructor Language.Haskell.Syntax.Expr.StmtLR, the 2nd argument, the list of ParStmtBlocks, must be NonEmpty; make it so.
-