[Git][ghc/ghc][wip/ghc-9.10] 230 commits: Fix eta-expansion in Prep
Cheng Shao (@TerrorJack)
gitlab at gitlab.haskell.org
Tue Jan 14 00:09:06 UTC 2025
Cheng Shao pushed to branch wip/ghc-9.10 at Glasgow Haskell Compiler / GHC
Commits:
94e008c5 by Simon Peyton Jones at 2024-08-19T09:28:48+02:00
Fix eta-expansion in Prep
As #25033 showed, we were eta-expanding in a way that broke a join point,
which messed up Note [CorePrep invariants].
The fix is rather easy. See Wrinkle (EA1) of
Note [Eta expansion of arguments in CorePrep]
(cherry picked from commit 8bf6fd68001bc1dabdd974506fc735e22e8257a9)
- - - - -
13f3cc8f by Teo Camarasu at 2024-12-06T16:59:29+01:00
Add HasCallStack to T23221
This makes the test a bit easier to debug
(cherry picked from commit 18c495c1bf3e37daf0030c983ffdd7697eb4072b)
- - - - -
6986a1ef by Teo Camarasu at 2024-12-06T17:07:50+01:00
rts: use live words to estimate heap size
We use live words rather than live blocks to determine the size of the
heap for determining memory retention.
Most of the time these two metrics align, but they can come apart in
normal usage when using the nonmoving collector.
The nonmoving collector leads to a lot of partially occupied blocks. So,
using live words is more accurate.
They can also come apart when the heap is suffering from high levels
fragmentation caused by small pinned objects, but in this case, the
block size is the more accurate metric. Since this case is best avoided
anyway. It is ok to accept the trade-off that we might try (and
probably) fail to return more memory in this case.
See also the Note [Statistics for retaining memory]
Resolves #23397
(cherry picked from commit 2f71e8b0dc346d3b74cf1ea6da8c63f9c9fe2073)
- - - - -
9bcf1f1c by ur4t at 2024-12-06T17:10:53+01:00
GHCi: fix improper location of ghci_history file
Fixes #24266
(cherry picked from commit 6f0a62db5dc79640433c61e83ea1427665304869)
- - - - -
82616fb0 by Andreas Klebinger at 2024-12-06T17:14:58+01:00
Mention .ghci_history XGD changes in changelog.
- - - - -
25d72bab by Cheng Shao at 2024-12-06T17:18:03+01:00
rts: do not prefetch mark_closure bdescr in non-moving gc when ASSERTS_ENABLED
This commit fixes a small an oversight in !12148: the prefetch logic
in non-moving GC may trap in debug RTS because it calls Bdescr() for
mark_closure which may be a static one. It's fine in non-debug RTS
because even invalid bdescr addresses are prefetched, they will not
cause segfaults, so this commit implements the most straightforward
fix: don't prefetch mark_closure bdescr when assertions are enabled.
(cherry picked from commit 8f74b38148f0d8b9341099cb0edda6f7698a4369)
- - - - -
8958612c by Teo Camarasu at 2024-12-06T17:20:07+01:00
rts: Allocate non-moving segments with megablocks
Non-moving segments are 8 blocks long and need to be aligned.
Previously we serviced allocations by grabbing 15 blocks, finding
an aligned 8 block group in it and returning the rest.
This proved to lead to high levels of fragmentation as a de-allocating a segment
caused an 8 block gap to form, and this could not be reused for allocation.
This patch introduces a segment allocator based around using entire
megablocks to service segment allocations in bulk.
When there are no free segments, we grab an entire megablock and fill it
with aligned segments. As the megablock is free, we can easily guarantee
alignment. Any unused segments are placed on a free list.
It only makes sense to free segments in bulk when all of the segments in
a megablock are freeable. After sweeping, we grab the free list, sort it,
and find all groups of segments where they cover the megablock and free
them.
This introduces a period of time when free segments are not available to
the mutator, but the risk that this would lead to excessive allocation
is low. Right after sweep, we should have an abundance of partially full
segments, and this pruning step is relatively quick.
In implementing this we drop the logic that kept NONMOVING_MAX_FREE
segments on the free list.
We also introduce an eventlog event to log the amount of pruned/retained
free segments.
See Note [Segment allocation strategy]
Resolves #24150
-------------------------
Metric Decrease:
T13253
T19695
-------------------------
(cherry picked from commit 5e36e7ced6a8aa183762e1df97da20b460e19bcf)
- - - - -
8cb44392 by Matthew Craven at 2024-12-09T13:36:25+01:00
Remove unused ghc-internal module "GHC.Internal.Constants"
(cherry picked from commit c6c190718972330504c048b013e5c2596b3c0c1e)
- - - - -
c16c0dea by Matthew Craven at 2024-12-09T14:25:07+01:00
CorePrep: Rework lowering of BigNat# literals
Don't use bigNatFromWord#, because that's terrible:
* We shouldn't have to traverse a linked list at run-time
to build a BigNat# literal. That's just silly!
* The static List object we have to create is much larger
than the actual BigNat#'s contents, bloating code size.
* We have to read the corresponding interface file,
which causes un-tracked implicit dependencies. (#23942)
Instead, encode them into the appropriate platform-dependent
sequence of bytes, and generate code that copies these bytes
at run-time from an Addr# literal into a new ByteArray#.
A ByteArray# literal would be the correct thing to generate,
but these are not yet supported; see also #17747.
Somewhat surprisingly, this change results in a slight
reduction in compiler allocations, averaging around 0.5%
on ghc's compiler performance tests, including when compiling
programs that contain no bignum literals to begin with.
The specific cause of this has not been investigated.
Since this lowering no longer reads the interface file for
GHC.Num.BigNat, the reasoning in Note [Depend on GHC.Num.Integer]
is obsoleted. But the story of un-tracked built-in dependencies
remains complex, and Note [Tracking dependencies on primitives]
now exists to explain this complexity.
Additionally, many empty imports have been modified to refer to
this new note and comply with its guidance. Several empty imports
necessary for other reasons have also been given brief explanations.
Metric Decrease:
MultiLayerModulesTH_OneShot
(cherry picked from commit 6d8f274b8677fcf9519d569875145f9f5434d779)
- - - - -
0b3c9d24 by Andreas Klebinger at 2024-12-09T14:27:39+01:00
Add changelog entry for BigNat# lowering changes.
- - - - -
53d78e35 by Fendor at 2024-12-09T17:11:34+01:00
Replace `SizedSeq` with `FlatBag` for flattened structure
LinkedLists are notoriously memory ineffiecient when all we do is
traversing a structure.
As 'UnlinkedBCO' has been identified as a data structure that impacts
the overall memory usage of GHCi sessions, we avoid linked lists and
prefer flattened structure for storing.
We introduce a new memory efficient representation of sequential
elements that has special support for the cases:
* Empty
* Singleton
* Tuple Elements
This improves sharing in the 'Empty' case and avoids the overhead of
'Array' until its constant overhead is justified.
(cherry picked from commit 5f085d3af61e3f7a73652dfc1ae57e7ed7d691f2)
- - - - -
d4cf1dc7 by Fendor at 2024-12-09T17:11:34+01:00
Compact FlatBag array representation
`Array` contains three additional `Word`'s we do not need in `FlatBag`. Move
`FlatBag` to `SmallArray`.
Expand the API of SmallArray by `sizeofSmallArray` and add common
traversal functions, such as `mapSmallArray` and `foldMapSmallArray`.
Additionally, allow users to force the elements of a `SmallArray`
via `rnfSmallArray`.
(cherry picked from commit 82cfe10c8c3ec68e1b054e2d6b88e1a8830c60bf)
- - - - -
a90fac71 by Fendor at 2024-12-09T17:11:34+01:00
Avoid UArray when indexing is not required
`UnlinkedBCO`'s can occur many times in the heap. Each `UnlinkedBCO`
references two `UArray`'s but never indexes them. They are only needed
to encode the elements into a `ByteArray#`. The three words for
the lower bound, upper bound and number of elements are essentially
unused, thus we replace `UArray` with a wrapper around `ByteArray#`.
This saves us up to three words for each `UnlinkedBCO`.
Further, to avoid re-allocating these words for `ResolvedBCO`, we repeat
the procedure for `ResolvedBCO` and add custom `Binary` and `Show` instances.
For example, agda's repl session has around 360_000 UnlinkedBCO's,
so avoiding these three words is already saving us around 8MB residency.
(cherry picked from commit 88cb3e1079e88ba10065ce260a96095ae96d58e8)
- - - - -
68a1c9dd by Andreas Klebinger at 2024-12-09T17:11:34+01:00
Changelog for !12170 and !12142
- - - - -
73f25e46 by Rodrigo Mesquita at 2024-12-09T17:11:34+01:00
rts: free error message before returning
Fixes a memory leak in rts/linker/PEi386.c
(cherry picked from commit dd530bb7e22e953e4cec64a5fd6c39fddc152c6f)
- - - - -
c9979fed by Alexis King at 2024-12-09T17:11:34+01:00
linker: Avoid linear search when looking up Haskell symbols via dlsym
See the primary Note [Looking up symbols in the relevant objects] for a
more in-depth explanation.
When dynamically loading a Haskell symbol (typical when running a splice or
GHCi expression), before this commit we would search for the symbol in
all dynamic libraries that were loaded. However, this could be very
inefficient when too many packages are loaded (which can happen if there are
many package dependencies) because the time to lookup the would be
linear in the number of packages loaded.
This commit drastically improves symbol loading performance by
introducing a mapping from units to the handles of corresponding loaded
dlls. These handles are returned by dlopen when we load a dll, and can
then be used to look up in a specific dynamic library.
Looking up a given Name is now much more precise because we can get
lookup its unit in the mapping and lookup the symbol solely in the
handles of the dynamic libraries loaded for that unit.
In one measurement, the wait time before the expression was executed
went from +-38 seconds down to +-2s.
This commit also includes Note [Symbols may not be found in pkgs_loaded],
explaining the fallback to the old behaviour in case no dll can be found
in the unit mapping for a given Name.
Fixes #23415
Co-authored-by: Rodrigo Mesquita (@alt-romes)
(cherry picked from commit e008a19a7f9e8f22aada0b4e1049744f49d39aad)
- - - - -
b663c9e0 by Rodrigo Mesquita at 2024-12-09T17:11:34+01:00
rts: Make addDLL a wrapper around loadNativeObj
Rewrite the implementation of `addDLL` as a wrapper around the more
principled `loadNativeObj` rts linker function. The latter should be
preferred while the former is preserved for backwards compatibility.
`loadNativeObj` was previously only available on ELF platforms, so this
commit further refactors the rts linker to transform loadNativeObj_ELF
into loadNativeObj_POSIX, which is available in ELF and MachO platforms.
The refactor made it possible to remove the `dl_mutex` mutex in favour
of always using `linker_mutex` (rather than a combination of both).
Lastly, we implement `loadNativeObj` for Windows too.
(cherry picked from commit dcfaa190e1e1182a2efe4e2f601affbb832a49bb)
- - - - -
67890fdb by Rodrigo Mesquita at 2024-12-09T17:11:34+01:00
Use symbol cache in internal interpreter too
This commit makes the symbol cache that was used by the external
interpreter available for the internal interpreter too.
This follows from the analysis in #23415 that suggests the internal
interpreter could benefit from this cache too, and that there is no good
reason not to have the cache for it too. It also makes it a bit more
uniform to have the symbol cache range over both the internal and
external interpreter.
This commit also refactors the cache into a function which is used by
both `lookupSymbol` and also by `lookupSymbolInDLL`, extending the
caching logic to `lookupSymbolInDLL` too.
(cherry picked from commit 12931698261a1cee6a00b731d143270cd60e5f2d)
- - - - -
353b6ec1 by Ben Gamari at 2024-12-09T17:11:34+01:00
testsuite: Add test for lookupSymbolInNativeObj
(cherry picked from commit dccd3ea159b03cc1972cf47ee3cf8bda73ec0c5a)
- - - - -
920ccafc by Andreas Klebinger at 2024-12-09T17:11:34+01:00
Changelog for !12264 (Lookup symbols in relevant DLLs only)
- - - - -
99399b92 by Andreas Klebinger at 2024-12-09T17:12:58+01:00
NCG: Fix a bug where we errounously removed a required jump instruction.
Add a new method to the Instruction class to check if we can eliminate a
jump in favour of fallthrough control flow.
Fixes #24507
(cherry picked from commit 0fe2b410ac0d8951f07ffcc9f3c6c97bc312df48)
- - - - -
6ea0d4f7 by Andreas Klebinger at 2024-12-09T17:13:42+01:00
Add changelog for !12370 - Bug in jump shortcutting.
- - - - -
8692ced5 by Simon Peyton Jones at 2024-12-09T17:18:17+01:00
Don't generate wrappers for `type data` constructors with StrictData
Previously, the logic for checking if a data constructor needs a wrapper or not
would take into account whether the constructor's fields have explicit
strictness (e.g., `data T = MkT !Int`), but the logic would _not_ take into
account whether `StrictData` was enabled. This meant that something like `type
data T = MkT Int` would incorrectly generate a wrapper for `MkT` if
`StrictData` was enabled, leading to the horrible errors seen in #24620. To fix
this, we disable generating wrappers for `type data` constructors altogether.
Fixes #24620.
Co-authored-by: Ryan Scott <ryan.gl.scott at gmail.com>
(cherry picked from commit 5e4f4ba835fd24135759ee7a2d0d5c636a8a1505)
- - - - -
c52e8047 by Andreas Klebinger at 2024-12-09T17:19:50+01:00
Changelog for !12416
Entry for "Don't generate wrappers for `type data` constructors with StrictData."
- - - - -
8e13b22e by Matthew Pickering at 2024-12-09T17:21:24+01:00
Linearise ghc-internal and base build
This is achieved by requesting the final package database for
ghc-internal, which mandates it is fully built as a dependency of
configuring the `base` package. This is at the expense of cross-package
parrallelism between ghc-internal and the base package.
Fixes #24436
(cherry picked from commit 8a06ddf68bb5a9985e3a7b8464dd04b928c36b90)
- - - - -
220f15b2 by Andreas Klebinger at 2024-12-12T15:19:22+01:00
Accept backport metric changes.
The MLM test regresses slightly (+2.5% compiler bytes allocated).
That seems within reason.
-------------------------
Metric Increase:
MultiLayerModulesTH_OneShot
-------------------------
- - - - -
9cd1ae5b by Fendor at 2024-12-13T13:18:27+01:00
Escape multiple arguments in the settings file
Uses responseFile syntax.
The issue arises when GHC is installed on windows into a location that
has a space, for example the user name is 'Fake User'.
The $topdir will also contain a space, consequentially.
When we resolve the top dir in the string `-I$topdir/mingw/include`,
then `words` will turn this single argument into `-I/C/Users/Fake` and
`User/.../mingw/include` which trips up the flag argument parser of
various tools such as gcc or clang.
We avoid this by escaping the $topdir before replacing it in
`initSettngs`.
Additionally, we allow to escape spaces and quotation marks for
arguments in `settings` file.
Add regression test case to count the number of options after variable
expansion and argument escaping took place.
Additionally, we check that escaped spaces and double quotation marks are
correctly parsed.
(cherry picked from commit 31bf85ee49fe2ca0b17eaee0774e395f017a9373)
- - - - -
8d3b0c32 by Andreas Klebinger at 2024-12-13T13:29:03+01:00
Changelog for !11938 - Escape multiple arguments in the settings file.
- - - - -
156b8aa3 by Andreas Klebinger at 2024-12-13T19:46:22+01:00
RTS: Emit warning when -M < -H
Fixes #24487
(cherry picked from commit 9e91744a19dcd699896341baadf98f99b1250839)
- - - - -
4d5d4404 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: fix typos and namings (fixes #24602)
You may noted that I've also changed term of
```
, global "h$vt_double" ||= toJExpr IntV
```
See "IntV"
and
```
WaitReadOp -> \[] [fd] -> pure $ PRPrimCall $ returnS (app
"h$waidRead" [fd])
```
See "h$waidRead"
(cherry picked from commit c70b9ddb6dc232e22a49ddc757865bd3bc9c46a7)
- - - - -
fc56b471 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: trivial checks for variable presence (fixes #24602)
(cherry picked from commit 3db54f9bcdcd20a2497447bf76176470db900143)
- - - - -
1ed663cc by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: fs module imported twice (by emscripten and by ghc-internal). ghc-internal import wrapped
in a closure to prevent conflict with emscripten (fixes #24602)
Better solution is to use some JavaScript module system like AMD, CommonJS or even UMD. It will be investigated at other issues.
At first glance we should try UMD (See https://github.com/umdjs/umd)
(cherry picked from commit 777f108f74f0a81274775d504dffe46c5fdfc33f)
- - - - -
d3477264 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: thread.js requires h$fds and h$fdReady to be declared for static code analysis, minimal
code copied from GHCJS (fixes #24602)
I've just copied some old pieces of GHCJS from publicly available sources (See https://github.com/Taneb/shims/blob/a6dd0202dcdb86ad63201495b8b5d9763483eb35/src/io.js#L607).
Also I didn't put details to h$fds. I took minimal and left only its object initialization: `var h$fds = {};`
(cherry picked from commit a45a57127bb7eaceae92e0edf057c053eb4d5367)
- - - - -
549ce324 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: heap and stack overflows reporting defined as js hard failure (fixes #24602)
These errors were treated as a hard failure for browser application. The fix is trivial: just throw error.
(cherry picked from commit ad90bf1237e0c9d2013399bd8cd1315f2845d9e7)
- - - - -
8335f195 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: Stubs for code without actual implementation detected by Google Closure Compiler (fixes #24602)
These errors were fixed just by introducing stubbed functions with throw for further implementation.
(cherry picked from commit 5962fa526e071d77fd4970b57d957a622e13207c)
- - - - -
db00df21 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: Add externs to linker (fixes #24602)
After enabling jsdoc and built-in google closure compiler types I was needed to deal with the following:
1. Define NodeJS-environment types. I've just copied minimal set of externs from semi-official repo (see https://github.com/externs/nodejs/blob/6c6882c73efcdceecf42e7ba11f1e3e5c9c041f0/v8/nodejs.js#L8).
2. Define Emscripten-environment types: `HEAP8`. Emscripten already provides some externs in our code but it supposed to be run in some module system. And its definitions do not work well in plain bundle.
3. We have some functions which purpose is to add to functions some contextual information via function properties. These functions should be marked as `modifies` to let google closure compiler remove calls if these functions are not used actually by call graph. Such functions are: `h$o`, `h$sti`, `h$init_closure`, `h$setObjInfo`.
4. STG primitives such as registries and stuff from `GHC.StgToJS`. `dXX` properties were already present at externs generator function but they are started from `7`, not from `1`. This message is related: `// fixme does closure compiler bite us here?`
(cherry picked from commit a0694298aad5f2f428311d6e787484a250c9de43)
- - - - -
3a270b4d by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: added both tests: for size and for correctness (fixes #24602)
By some reason MacOS builds add to stderr messages like:
Ignoring unexpected archive entry:
__.SYMDEF
...
However I left stderr to `/dev/null` for compatibility with linux CI builds.
(cherry picked from commit e58bb29f8a4808fd4b74b653b1893f78121c7df4)
- - - - -
5348bbe9 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: Disable js linker warning for empty symbol table to make js tests running consistent across environments
(cherry picked from commit 909f3a9c8dac5d15c2492c008e370be60f50b50c)
- - - - -
68da8237 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: Add special preprocessor for js files due of needing to keep jsdoc comments (fixes #24602)
Our js files have defined google closure compiler types at jsdoc entries but these jsdoc entries are removed by cpp preprocessor. I considered that reusing them in javascript-backend would be a nice thing. Right now haskell processor uses `-traditional` option to deal with comments and `//` operators.
But now there are following compiler options: `-C` and `-CC`.
You can read about them at GCC (see https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#index-CC) and CLang (see https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-CC).
It seems that `-CC` works better for javascript jsdoc than `-traditional`.
At least it leaves `/* ... */` comments w/o changes.
(cherry picked from commit 83eb10da239e6bef0d06dbba174809f99c463d8d)
- - - - -
e234268d by Cheng Shao at 2024-12-18T16:28:16+01:00
Update autoconf scripts
Scripts taken from autoconf 948ae97ca5703224bd3eada06b7a69f40dd15a02
(cherry picked from commit 36f2c3422d7f3620078dba701f57275a3708aff5)
- - - - -
f1de8643 by Sylvain Henry at 2024-12-18T16:28:16+01:00
GHCi: support inlining breakpoints (#24712)
When a breakpoint is inlined, its context may change (e.g. tyvars in
scope). We must take this into account and not used the breakpoint tick
index as its sole identifier. Each instance of a breakpoint (even with
the same tick index) now gets a different "info" index.
We also need to distinguish modules:
- tick module: module with the break array (tick counters, status, etc.)
- info module: module having the CgBreakInfo (info at occurrence site)
(cherry picked from commit b85b11994e0130ff2401dd4bbdf52330e0bcf776)
- - - - -
cd9f53ba by Cheng Shao at 2024-12-18T16:28:16+01:00
wasm: use scheduler.postTask() for context switch when available
This patch makes use of scheduler.postTask() for JSFFI context switch
when it's available. It's a more principled approach than our
MessageChannel based setImmediate() implementation, and it's available
in latest version of Chromium based browsers.
(cherry picked from commit 43d48b449a46e805e3baeafbafa62b6cd6f761c9)
- - - - -
c01dc7f1 by Matthew Craven at 2024-12-18T16:28:16+01:00
Add test cases for #24664
...since none are present in the original MR !12463 fixing this issue.
(cherry picked from commit a19201d42cfd3aa54faeb1b5a95b715b9a67a01a)
- - - - -
5a8790db by Arsen Arsenović at 2024-12-18T16:28:16+01:00
Split out the C-- preprocessor, and make it pass -g0
Previously, C-- was processed with the C preprocessor program. This
means that it inherited flags passed via -optc. A flag that is somewhat
often passed through -optc is -g. At certain -g levels (>=2), GCC
starts emitting defines *after* preprocessing, for the purposes of
debug info generation. This is not useful for the C-- compiler, and, in
fact, causes lexer errors. We can suppress this effect (safely, if
supported) via -g0.
As a workaround, in older versions of GCC (<=10), GCC only emitted
defines if a certain set of -g*3 flags was passed. Newer versions check
the debug level. For the former, we filter out those -g*3 flags and,
for the latter, we specify -g0 on top of that.
As a compatible and effective solution, this change adds a C--
preprocessor distinct from the C compiler and preprocessor, but that
keeps its flags. The command line produced for C-- preprocessing now
looks like:
$pgmCmmP $optCs_without_g3 $g0_if_supported $optCmmP
Closes: https://gitlab.haskell.org/ghc/ghc/-/issues/24474
(cherry picked from commit 25b0b40467d0a12601497117c0ad14e1fcab0b74)
- - - - -
f2cc943d by Andreas Klebinger at 2024-12-18T16:28:16+01:00
Add release notes for some backported 9.10.2 patches.
Contains notes for:
!11938: Escape multiple arguments in the settings file
!12201: RTS: Emit warning when -M < -H
!12495: Update autoconf scripts
!12500: GHCi: support cross-module inlining of breakpoints
!12550: wasm: use scheduler.postTask() for context switch when available
!12569: Split out the C-- preprocessor, and make it pass -g0
- - - - -
1016a4b1 by Andreas Klebinger at 2024-12-18T16:28:17+01:00
-fprof-late: Only insert cost centres on functions/non-workfree cafs.
They are usually useless and doing so for data values comes with
a large compile time/code size overhead.
Fixes #24103
(cherry picked from commit 9b4129a580e6c1d18197ef2ed3a8b89d52a2b133)
- - - - -
0c850206 by Ben Gamari at 2024-12-18T16:28:17+01:00
IPE: Eliminate dependency on Read
Instead of encoding the closure type as decimal string we now simply
represent it as an integer, eliminating the need for `Read` in
`GHC.Internal.InfoProv.Types.peekInfoProv`.
Closes #24504.
-------------------------
Metric Decrease:
T24602_perf_size
size_hello_artifact
-------------------------
(cherry picked from commit ab840ce6f83a74f36dac939d087b69f97404399a)
- - - - -
c15c6a8d by Cheng Shao at 2024-12-18T16:28:17+01:00
testsuite: fix testwsdeque with recent clang
This patch fixes compilation of testwsdeque.c with recent versions of
clang, which will fail with the error below:
```
testwsdeque.c:95:33: error:
warning: format specifies type 'long' but the argument has type 'void *' [-Wformat]
95 | barf("FAIL: %ld %d %d", p, n, val);
| ~~~ ^
testwsdeque.c:95:39: error:
warning: format specifies type 'int' but the argument has type 'StgWord' (aka 'unsigned long') [-Wformat]
95 | barf("FAIL: %ld %d %d", p, n, val);
| ~~ ^~~
| %lu
testwsdeque.c:133:42: error:
error: incompatible function pointer types passing 'void (void *)' to parameter of type 'OSThreadProc *' (aka 'void *(*)(void *)') [-Wincompatible-function-pointer-types]
133 | createOSThread(&ids[n], "thief", thief, (void*)(StgWord)n);
| ^~~~~
/workspace/ghc/_build/stage1/lib/../lib/x86_64-linux-ghc-9.11.20240502/rts-1.0.2/include/rts/OSThreads.h:193:51: error:
note: passing argument to parameter 'startProc' here
193 | OSThreadProc *startProc, void *param);
| ^
2 warnings and 1 error generated.
```
(cherry picked from commit a9979f55d0f688fabd25ee318e44b9addd904988)
- - - - -
3329ca03 by Cheng Shao at 2024-12-18T16:28:17+01:00
ghc-heap: fix typo in ghc-heap cbits
(cherry picked from commit 2b1af08b94024c104b54eadd710855e9f8a90fb6)
- - - - -
a15b3383 by doyougnu at 2024-12-18T16:28:17+01:00
testsuite: expand size testing infrastructure
- closes #24191
- adds windows_skip, wasm_skip, wasm_arch, find_so, _find_so
- path_from_ghcPkg, collect_size_ghc_pkg, collect_object_size, find_non_inplace functions to testsuite
- adds on_windows and req_dynamic_ghc predicate to testsuite
The design is to not make the testsuite too smart and simply offload to
ghc-pkg for locations of object files and directories.
(cherry picked from commit 9bae34d87f6c978e03031c549920071857c9080c)
- - - - -
4b5b67a4 by Matthew Pickering at 2024-12-18T16:28:17+01:00
tests: Widen acceptance window for dir and so size tests
These are testing things which are sometimes out the control of a GHC
developer. Therefore we shouldn't fail CI if something about these
dependencies change because we can't do anything about it.
It is still useful to have these statistics for visualisation in grafana
though.
Ticket #24759
(cherry picked from commit c49493f242fc78fbf23ef3642df531a19c3b4b24)
- - - - -
216ad9f9 by Matthew Pickering at 2024-12-18T16:28:17+01:00
Disable rts_so test
It has already manifested large fluctuations and destabilising CI
Fixes #24762
(cherry picked from commit 9562808d02db67838844d874c632f18af904949c)
- - - - -
20552645 by Torsten Schmits at 2024-12-18T16:28:17+01:00
refactor quadratic search in warnMissingHomeModules
(cherry picked from commit bc672166acd8f2815d58b6d214e69373abec4486)
- - - - -
158c9dbf by Torsten Schmits at 2024-12-18T16:28:17+01:00
add test that runs MakeDepend on thousands of modules
(cherry picked from commit 7875e8cbe5d9b69a1a77354317b2bf9478172686)
- - - - -
ee3e6c79 by Matthew Pickering at 2024-12-18T16:28:17+01:00
driver: Fix -Wmissing-home-modules when multiple units have the same module name
It was assumed that module names were unique but that isn't true with
multiple units.
The fix is quite simple, maintain a set of `(ModuleName, UnitId)` and
query that to see whether the module has been specified.
Fixes #25122
(cherry picked from commit 951ce3d5904a1d34d49787d444f99e251e24d4e7)
- - - - -
1faf2c60 by Sylvain Henry at 2024-12-18T16:28:17+01:00
Reverse arguments to stgCallocBytes (fix #24828)
(cherry picked from commit 6838a7c32ca29b5d44adc9d6280d3a960f31be7c)
- - - - -
6d00956c by Ben Gamari at 2024-12-18T16:28:17+01:00
rts: Fix size of StgOrigThunkInfo frames
Previously the entry code of the `stg_orig_thunk` frame failed to
account for the size of the profiling header as it hard-coded the frame
size. Fix this.
Fixes #24809.
(cherry picked from commit 6d7e6ad803be11cb7a79dca727c37e4ef21cda4b)
- - - - -
0be2daaf by Fendor at 2024-12-18T16:28:17+01:00
Add regression test T24809 for stg_orig_thunk_info_frame size
(cherry picked from commit c645fe406cd4a3f4c152e51dfbcdeeb5e2930fb1)
- - - - -
80afd1a9 by Andreas Klebinger at 2024-12-18T16:28:17+01:00
bindists: Check for existence of share folder before trying to copy it.
This folder isn't distributed in windows bindists
A lack of doing so resulted us copying loads of files twice.
(cherry picked from commit 4181aa40fff5653a121cd2ece33ab0f7454d421d)
- - - - -
af123155 by Matthew Pickering at 2024-12-18T16:28:17+01:00
Remove ad-hoc installation of mingw toolchain in relocatable bindists
This reverts 616ac30026e8dd7d2ebb98d92dde071eedf5d951
The choice about whether to install mingw is taken in the installation
makefile.
This is also broken on non-windows systems.
The actual issue was the EnableDistroToolchain variable wasn't declared
in mk/config.mk and therefore the check to install mingw was failing.
(cherry picked from commit d216510e43deca5a9a221d2b799face293e38299)
- - - - -
50974a94 by Cheng Shao at 2024-12-18T16:28:17+01:00
testsuite: fix T17920 for wasm backend
T17920 was marked as fragile on wasm before; it can be trivially fixed
by avoiding calling variadic printf() in cmm.
(cherry picked from commit 7b4c19983bf6bc11b519b437a6204c38672721ea)
- - - - -
c8f98d01 by Simon Peyton Jones at 2024-12-18T16:28:17+01:00
Better skolemisation
As #24810 showed, it is (a little) better to skolemise en-bloc,
so that Note [Let-bound skolems] fires more often.
See Note [Skolemisation en bloc] in GHC.Tc.Utils.Instantiate.
(cherry picked from commit 3d9e4ce68a55f6bc5246d2d77729676010e85bbd)
- - - - -
e57d1433 by Ryan Scott at 2024-12-18T16:28:17+01:00
Add missing parenthesizePat in cvtp
We need to ensure that the output of `cvtp` is parenthesized (at precedence
`sigPrec`) so that any pattern signatures with a surrounding pattern signature
can parse correctly.
Fixes #24837.
(cherry picked from commit a3cd3a1d0d186f2aa4d0273c6b3e74a442de2ef0)
- - - - -
05338430 by crumbtoo at 2024-12-18T16:28:17+01:00
user_guide: Fix typo in MultiWayIf chapter
Close #24829
(cherry picked from commit c5e00c35927d574f71bf77449817b131d1749750)
- - - - -
53eeffd6 by Cheng Shao at 2024-12-18T16:28:17+01:00
rts: fix missing function prototypes in ClosureMacros.h
(cherry picked from commit 3ca72ad974169aa39f391774875a9cc2a77ee967)
- - - - -
bbe4accd by Cheng Shao at 2024-12-18T16:28:17+01:00
rts: use __builtin_offsetof to implement STG_FIELD_OFFSET
This patch fixes the STG_FIELD_OFFSET macro definition by using
__builtin_offsetof, which is what gcc/clang uses to implement offsetof
in standard C. The previous definition that uses NULL pointer involves
subtle undefined behavior in C and thus reported by
UndefinedBehaviorSanitizer as well:
```
rts/Capability.h:243:58: runtime error: member access within null pointer of type 'Capability' (aka 'struct Capability_')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Capability.h:243:58
```
(cherry picked from commit 05c4fafbc1693164d5f06ed062fc73bbf3f78deb)
- - - - -
4879286a by Cheng Shao at 2024-12-18T16:28:17+01:00
rts: fix an unaligned load in nonmoving gc
This patch fixes an unaligned load in nonmoving gc by ensuring the
closure address is properly untagged first before attempting to
prefetch its header. The unaligned load is reported by
UndefinedBehaviorSanitizer:
```
rts/sm/NonMovingMark.c:921:9: runtime error: member access within misaligned address 0x0042005f3a71 for type 'StgClosure' (aka 'struct StgClosure_'), which requires 8 byte alignment
0x0042005f3a71: note: pointer points here
00 00 00 98 43 13 8e 12 7f 00 00 50 3c 5f 00 42 00 00 00 58 17 b7 92 12 7f 00 00 89 cb 5e 00 42
^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/NonMovingMark.c:921:9
```
This issue had previously gone unnoticed since it didn't really harm
runtime correctness, the invalid header address directly loaded from a
tagged pointer is only used as prefetch address and will not cause
segfaults. However, it still should be corrected because the prefetch
would be rendered useless by this issue, and untagging only involves a
single bitwise operation without memory access so it's cheap enough to
add.
(cherry picked from commit c77a48af6e1f38337b305fec794e8c999f1c7f3a)
- - - - -
59b84e0f by Cheng Shao at 2024-12-18T16:28:17+01:00
rts: ensure gc_thread/gen_workspace is allocated with proper alignment
gc_thread/gen_workspace are required to be aligned by 64 bytes.
However, this property has not been properly enforced before, and
numerous alignment violations at runtime has been caught by
UndefinedBehaviorSanitizer that look like:
```
rts/sm/GC.c:1167:8: runtime error: member access within misaligned address 0x0000027a3390 for type 'gc_thread' (aka 'struct gc_thread_'), which requires 64 byte alignment
0x0000027a3390: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/GC.c:1167:8
rts/sm/GC.c:1184:13: runtime error: member access within misaligned address 0x0000027a3450 for type 'gen_workspace' (aka 'struct gen_workspace_'), which requires 64 byte alignment
0x0000027a3450: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/GC.c:1184:13
```
This patch fixes the gc_thread/gen_workspace misalignment issue by
explicitly allocating them with alignment constraint.
(cherry picked from commit 7a660042395614e4b19534baf5b779f65059861e)
- - - - -
c4507307 by Cheng Shao at 2024-12-18T16:28:17+01:00
hadrian: disable PIC for in-tree GMP on wasm32
This patch disables PIC for in-tree GMP on wasm32 target. Enabling PIC
unconditionally adds undesired code size and runtime overhead for
wasm32.
(cherry picked from commit f9c1ae122ec642c0d9236dffc971bc2d1ca38fba)
- - - - -
794e71e1 by Cheng Shao at 2024-12-18T16:28:17+01:00
hadrian: disable in-tree gmp fft code path for wasm32
This patch disables in-tree GMP FFT code paths for wasm32 target in
order to give up some performance of multiplying very large operands
in exchange for reduced code size.
(cherry picked from commit 1a32f82807ae01813f14bdf12fed75eb32799e18)
- - - - -
d08b9b83 by Cheng Shao at 2024-12-18T16:28:18+01:00
hadrian: build in-tree GMP with malloc-notreentrant on wasm32
This patch makes hadrian build in-tree GMP with the
--enable-alloca=malloc-notreentrant configure option. We will only
need malloc-reentrant when we have threaded RTS and SMP support on
wasm32, which will take some time to happen, before which we should
use malloc-notreentrant to avoid undesired runtime overhead.
(cherry picked from commit 06277d56de91c8d21cbf71e8bc4096925b863acc)
- - - - -
ece0a0db by Andreas Klebinger at 2024-12-18T16:28:18+01:00
Add release notes for some backported patches.
Add entries for the following backported MRs:
!12498: -fprof-late: Don't add cost centres to static data.
!12565: IPE: Eliminate dependency on Read
!12591: ghc-heap: fix typo in ghc-heap cbits
!12607: refactor quadratic search in warnMissingHomeModules
!12621: rts: Fix size of StgOrigThunkInfo frames
!12649 # bindists: Check for existence of shared folder before trying to copy it.
!12653: Better skolemisation
!12734: Various rts fixes for issues spotted by UndefinedBehaviorSanitizer
!12592: hadrian: adjust in-tree GMP configure options for wasm32
- - - - -
1b847dec by Cheng Shao at 2024-12-18T16:28:18+01:00
hadrian: fix hadrian building with ghc-9.10.1
(cherry picked from commit be514bb48629747258416e602c8b00810b3863b0)
- - - - -
7dd1423d by Cheng Shao at 2024-12-18T16:28:18+01:00
linters: fix lint-whitespace compilation with ghc-9.10.1
(cherry picked from commit ad38e954bf088b43fa1cecfeaf474b6b9c11e2ed)
- - - - -
86723eed by Zubin Duggal at 2024-12-18T16:28:18+01:00
testsuite: Handle exceptions in framework_fail when testdir is not initialised
When `framework_fail` is called before initialising testdir, it would fail with
an exception reporting the testdir not being initialised instead of the actual failure.
Ensure we report the actual reason for the failure instead of failing in this way.
One way this can manifest is when trying to run a test that doesn't exist using `--only`
(cherry picked from commit c56d728e1f8702db02cf7e7e3cdc567b3df47ac3)
- - - - -
1d787538 by Arsen Arsenović at 2024-12-18T16:28:18+01:00
Add the cmm_cpp_is_gcc predicate to the testsuite
A future C-- test called T24474-cmm-override-g0 relies on the
GCC-specific behaviour of -g3 implying -dD, which, in turn, leads to it
emitting #defines past the preprocessing stage. Clang, at least, does
not do this, so the test would fail if ran on Clang.
As the behaviour here being tested is ``-optCmmP-g3'' undoing effects of
the workaround we apply as a fix for bug #24474, and the workaround was
for GCC-specific behaviour, the test needs to be marked as fragile on
other compilers.
(cherry picked from commit 4d59abf295cd371448f22c1724b955dce4974302)
- - - - -
a73ffe72 by Ben Gamari at 2024-12-18T16:35:45+01:00
rts: Fix TSAN_ENABLED CPP guard
This should be `#if defined(TSAN_ENABLED)`, not `#if TSAN_ENABLED`,
lest we suffer warnings.
(cherry picked from commit c8a4c050626f451461a3667589d40004b2547a1c)
- - - - -
a235a078 by Cheng Shao at 2024-12-18T16:35:56+01:00
rts: fix errors when compiling with TSAN
This commit fixes rts compilation errors when compiling with TSAN:
- xxx_FENCE macros are redefined and trigger CPP warnings.
- Use SIZEOF_W. WORD_SIZE_IN_BITS is provided by MachDeps.h which
Cmm.h doesn't include by default.
(cherry picked from commit e91dad93ff50b429d5717c81fbd5fe20ff2defd9)
- - - - -
6c30c754 by Cheng Shao at 2024-12-18T16:36:11+01:00
rts: fix clang-specific errors when compiling with TSAN
This commit fixes clang-specific rts compilation errors when compiling
with TSAN:
- clang doesn't have -Wtsan flag
- Fix prototype of ghc_tsan_* helper functions
- __tsan_atomic_* functions aren't clang built-ins and
sanitizer/tsan_interface_atomic.h needs to be included
- On macOS, TSAN runtime library is
libclang_rt.tsan_osx_dynamic.dylib, not libtsan. -fsanitize-thread
as a link-time flag will take care of linking the TSAN runtime
library anyway so remove tsan as an rts extra library
(cherry picked from commit a9ab9455b0159c955ea8c38ac113e4cbe47d410f)
- - - - -
c05d1181 by Cheng Shao at 2024-12-18T16:36:58+01:00
compiler: fix github link to __tsan_memory_order in a comment
(cherry picked from commit 865bd717cc4c63d6926138c5b8c71addcf70a1e7)
- - - - -
f39baa8c by Cheng Shao at 2024-12-18T16:38:32+01:00
ci: improve TSAN CI jobs
- Run TSAN jobs with +thread_sanitizer_cmm which enables Cmm
instrumentation as well.
- Run TSAN jobs in deb12 which ships gcc-12, a reasonably recent gcc
that @bgamari confirms he's using in #GHC:matrix.org. Ideally we
should be using latest clang release for latest improvements in
sanitizers, though that's left as future work.
- Mark TSAN jobs as manual+allow_failure in validate pipelines. The
purpose is to demonstrate that we have indeed at least fixed
building of TSAN mode in CI without blocking the patch to land, and
once merged other people can begin playing with TSAN using their own
dev setups and feature branches.
(cherry picked from commit 07cb627c8232f573bd6a8ea1b7c110ff3c1b5d22)
- - - - -
51d3b2d0 by Andrei Borzenkov at 2024-12-19T15:44:28+01:00
Improve pattern to type pattern transformation (23739)
`pat_to_type_pat` function now can handle more patterns:
- TuplePat
- ListPat
- LitPat
- NPat
- ConPat
Allowing these new constructors in type patterns significantly
increases possible shapes of type patterns without `type` keyword.
This patch also changes how lookups in `lookupOccRnConstr` are
performed, because we need to fall back into
types when we didn't find a constructor on data level to perform
`ConPat` to type transformation properly.
(cherry picked from commit 2c0f8ddbdf351ed84395afa04a2654a7cbe2ad35)
- - - - -
164133ec by Andreas Klebinger at 2024-12-19T15:50:05+01:00
Removed a test whose change was not backported (T23764).
- - - - -
4e89c144 by Sylvain Henry at 2024-12-19T15:51:07+01:00
Type-check default declarations before deriving clauses (#24566)
See added Note and #24566. Default declarations must be type-checked
before deriving clauses.
(cherry picked from commit 52072f8e2121fe49a8367027efa3d8db32325f84)
- - - - -
6601403b by Simon Peyton Jones at 2024-12-19T18:36:54+01:00
Print more info about kinds in error messages
This fixes #24553, where GHC unhelpfully said
error: [GHC-83865]
• Expected kind ‘* -> * -> *’, but ‘Foo’ has kind ‘* -> * -> *’
See Note [Showing invisible bits of types in error messages]
(cherry picked from commit b72705e9b2ae5575aef92ede6ff975bbbe43004d)
- - - - -
1a7a0500 by Matthew Pickering at 2024-12-19T20:05:43+01:00
testsuite: workaround bug in python-3.12
There is some unexplained change to binding behaviour in python-3.12
which requires moving this import from the top-level into the scope of
the function.
I didn't feel any particular desire to do a deep investigation as to why
this changed as the code works when modified like this. No one in the
python IRC channel seemed to know what the problem was.
(cherry picked from commit 43aa99b8169fc6d8552844cd6fa0ce3cd4308185)
- - - - -
6c1bf036 by Max Ulidtko at 2024-12-20T13:28:23+01:00
GHCi: Support local Prelude
Fixes #10920, an issue where GHCi bails out when started alongside a
file named Prelude.hs or Prelude.lhs (even empty file suffices).
The in-source Note [GHCi and local Preludes] documents core reasoning.
Supplementary changes:
* add debug traces for module lookups under -ddump-if-trace;
* drop stale comment in GHC.Iface.Load;
* reduce noise in -v3 traces from GHC.Utils.TmpFs;
* new test, which also exercizes HomeModError.
(cherry picked from commit 977b6b64e184795f3f12ac5b2637707f0696457c)
- - - - -
03727a8e by Cheng Shao at 2024-12-20T13:30:00+01:00
compiler: emit NaturallyAligned when element type & index type are the same width
This commit fixes a subtle mistake in alignmentFromTypes that used to
generate Unaligned when element type & index type are the same width.
Fixes #24930.
(cherry picked from commit 0cff083abb24701530974872b21cf897c9955a9a)
- - - - -
487c8c8d by qqwy at 2024-12-20T13:32:00+01:00
Replace '?callStack' implicit param with HasCallStack in GHC.Internal.Exception.throw
(cherry picked from commit edfe6140be64f0d9365f7e954d3db534d63bb04f)
- - - - -
33ee13b5 by Cheng Shao at 2024-12-20T13:32:54+01:00
rts: use page sized mblocks on wasm
This patch changes mblock size to page size on wasm. It allows us to
simplify our wasi-libc fork, makes it much easier to test third party
libc allocators like emmalloc/mimalloc, as well as experimenting with
threaded RTS in wasm.
(cherry picked from commit 558353f4e22643b94b9710a45c3364c518d57b46)
- - - - -
71115f23 by Simon Peyton Jones at 2024-12-20T13:40:27+01:00
Localise a case-binder in SpecConstr.mkSeqs
This small change fixes #24944
See (SCF1) in Note [SpecConstr and strict fields]
(cherry picked from commit 246bc3a43a57b7c9ea907bd9ef15b7ef7c490681)
- - - - -
e417441e by Andreas Klebinger at 2024-12-20T13:43:40+01:00
Expand the `inline` rule to look through casts/ticks.
Fixes #24808
(cherry picked from commit a593f28426ca508a72b49d0112ef934ce9f453fd)
- - - - -
113e76d3 by Simon Peyton Jones at 2024-12-20T13:51:19+01:00
Fix a float-out error
Ticket #24768 showed that the Simplifier was accidentally destroying
a join point. It turned out to be that we were sending a bottoming
join point to the top, accidentally abstracting over /other/ join
points.
Easily fixed.
(cherry picked from commit 03c5dfbf52969504ca3473cb2eb7b3f7cf96d4b3)
- - - - -
d39bdab8 by Peter Trommler at 2024-12-20T13:58:28+01:00
PPC NCG: Fix sign hints in C calls
Sign hints for parameters are in the second component of the pair.
Fixes #23034
(cherry picked from commit 7fe85b1354a13749f14d588e3cc742b8ae2d8da9)
- - - - -
a92613c2 by Andreas Klebinger at 2024-12-20T16:00:28+01:00
More 9.10.2 Changelog notes.
- - - - -
ba97aa2d by Alex Mason at 2025-01-13T15:01:42+01:00
Implements MO_S_Mul2 and MO_U_Mul2 using the UMULH, UMULL and SMULH instructions for AArch64
Also adds a test for MO_S_Mul2
(cherry picked from commit dbdf1995956a7457c34b6895c67ef48f6c8384f2)
- - - - -
52812e1c by Matthew Pickering at 2025-01-13T15:04:41+01:00
Bump os-string submodule to 2.0.2.2
Closes #24786
(cherry picked from commit 0528509028ef6c4d80d47aad9fd80de6c662c8a2)
- - - - -
a085f505 by Alex Mason at 2025-01-13T15:05:55+01:00
Add AArch64 CLZ, CTZ, RBIT primop implementations.
Adds support for emitting the clz and rbit instructions, which are
used by GHC.Prim.clz*#, GHC.Prim.ctz*# and GHC.Prim.bitReverse*#.
(cherry picked from commit 71010381f4270966de334193ab2bfc67f8524212)
- - - - -
6faa8336 by Andreas Klebinger at 2025-01-13T15:06:40+01:00
GHCi interpreter: Tag constructor closures when possible.
When evaluating PUSH_G try to tag the reference we are pushing if it's a
constructor. This is potentially helpful for performance and required to
fix #24870.
(cherry picked from commit 1bfa91115b8320ed99a5e946147528e21ca4f3e1)
- - - - -
3928048e by Peter Trommler at 2025-01-13T17:24:23+01:00
X86 NCG: Fix argument promotion in foreign C calls
Promote 8 bit and 16 bit signed arguments by sign extension.
Fixes #25018
(cherry picked from commit a82121b3b6fdc2ac47211f71871b3ab21e5f6276)
- - - - -
5bc9d132 by Matthew Pickering at 2025-01-13T17:31:09+01:00
configure: Set LD_STAGE0 appropiately when 9.10.1 is used as a boot compiler
In 9.10.1 the "ld command" has been removed, so we fall back to using
the more precise "merge objects command" when it's available as
LD_STAGE0 is only used to set the object merging command in hadrian.
Fixes #24949
(cherry picked from commit 564981bda9a6a309ff0f524610af0f908432442f)
- - - - -
8746a86c by Matthew Pickering at 2025-01-13T17:31:18+01:00
hadrian: Don't build ghci object files for ./hadrian/ghci target
There is some convoluted logic which determines whether we build ghci
object files are not. In any case, if you set `ghcDynPrograms = pure
False` then it forces them to be built.
Given we aren't ever building executables with this flavour it's fine
to leave `ghcDynPrograms` as the default and it should be a bit faster
to build less.
Also fixes #24949
(cherry picked from commit a949c792388b5662dd199497541f9ad51c78d1a8)
- - - - -
01d6b09b by Matthew Pickering at 2025-01-13T17:34:34+01:00
ci: Unset ALEX/HAPPY variables when testing bootstrap jobs
Ticket #24826 reports a regression in 9.10.1 when building from a source
distribution. This patch is an attempt to reproduce the issue on CI by
more aggressively removing `alex` and `happy` from the environment.
(cherry picked from commit 3f9548fe97c728ed60ba26811e4fe248fc28d2a7)
- - - - -
bc0fc221 by Andrea Bedini at 2025-01-13T17:34:44+01:00
hadrian: Ignore build-tool-depends fields in cabal files
hadrian does not utilise the build-tool-depends fields in cabal files
and their presence can cause issues when building source distribution
(see #24826)
Ideally Cabal would support building "full" source distributions which
would remove the need for workarounds in hadrian but for now we can
patch the build-tool-depends out of the cabal files.
Fixes #24826
(cherry picked from commit aba2c9d4728262cd9a2d711eded9050ac131c6c1)
- - - - -
d6d2abe2 by Zubin Duggal at 2025-01-13T17:34:59+01:00
compiler: Fingerprint -fwrite-if-simplified-core
We need to recompile if this flag is changed because later modules might depend on the
simplified core for this module if -fprefer-bytecode is enabled.
Fixes #24656
(cherry picked from commit dddc9dff0547733a10e7f505612ab9df3a7c21b6)
- - - - -
b3322a3a by Alex Mason at 2025-01-13T17:35:10+01:00
ncg(aarch64): Add fsqrt instruction, byteSwap primitives [#24956]
Implements the FSQRT machop using native assembly rather than a C call.
Implements MO_BSwap by producing assembly to do the byte swapping
instead of producing a foreign call a C function.
In `tar`, the hot loop for `deserialise` got almost 4x faster by
avoiding the foreign call which caused spilling live variables to the
stack -- this means the loop did 4x more memory read/writing than
necessary in that particular case!
(cherry picked from commit dee035bf618d75a18fe72dd3977434c0749a2156)
- - - - -
0183e434 by Sylvain Henry at 2025-01-13T17:35:20+01:00
Linker: use m32 allocator for sections when NEED_PLT (#24432)
Use M32 allocator to avoid fragmentation when allocating ELF sections.
We already did this when NEED_PLT was undefined. Failing to do this led
to relocations impossible to fulfil (#24432).
(cherry picked from commit 5104ee615503617a1c124fe1d92f6aa2d263b7d0)
- - - - -
9c5cf8f8 by Sylvain Henry at 2025-01-13T17:35:25+01:00
RTS: allow M32 allocation outside of 4GB range when assuming -fPIC
(cherry picked from commit 52d6698479f951e07def237b0474ee22d27e621a)
- - - - -
2822e96b by Sylvain Henry at 2025-01-13T17:35:31+01:00
Linker: fix stub offset
Remove unjustified +8 offset that leads to memory corruption (cf
discussion in #24432).
(cherry picked from commit c34fef56367142fa55e9861092f64cc7b9946fa1)
- - - - -
ecd99e0b by Simon Peyton Jones at 2025-01-13T17:35:45+01:00
Address #25055, by disabling case-of-runRW# in Gentle phase
See Note [Case-of-case and full laziness]
in GHC.Driver.Config.Core.Opt.Simplify
(cherry picked from commit de5d9852dbdd367611bf9e45e69c723d26351992)
- - - - -
670a8cbc by Andreas Klebinger at 2025-01-13T17:40:11+01:00
Fix -freg-graphs for FP and AARch64 NCG (#24941).
It seems we reserve 8 registers instead of four for global regs
based on the layout in Note [AArch64 Register assignments].
I'm not sure it's neccesary, but for now we just accept this state of
affairs and simple update -fregs-graph to account for this.
(cherry picked from commit 3f89ab92da74c4ed45da68fe92ff81e7b9caa53d)
- - - - -
823fec13 by Simon Peyton Jones at 2025-01-13T17:46:45+01:00
Fix nasty bug in occurrence analyser
As #25096 showed, the occurrence analyser was getting one-shot info
flat out wrong.
This commit does two things:
* It fixes the bug and actually makes the code a bit tidier too.
The work is done in the new function
GHC.Core.Opt.OccurAnal.mkRhsOccEnv,
especially the bit that prepares the `occ_one_shots` for the RHS.
See Note [The OccEnv for a right hand side]
* When floating out a binding we must be conservative about one-shot
info. But we were zapping the entire demand info, whereas we only
really need zap the /top level/ cardinality.
See Note [Floatifying demand info when floating]
in GHC.Core.Opt.SetLevels
For some reason there is a 2.2% improvement in compile-time allocation
for CoOpt_Read. Otherwise nickels and dimes.
Metric Decrease:
CoOpt_Read
(cherry picked from commit f6b4c1c9be71fc6fe4688337752ffa4ad84180d9)
- - - - -
7c82602d by Arnaud Spiwack at 2025-01-13T17:47:24+01:00
Add tests for 25081
(cherry picked from commit e2f2a56e42d25bae178ae1692390bbbd6275176c)
- - - - -
84ff3c72 by Arnaud Spiwack at 2025-01-13T17:47:32+01:00
Scale multiplicity in list comprehension
Fixes #25081
(cherry picked from commit 23f50640e705c132f1a0689d4850866d0f0d76a6)
- - - - -
544f2ba7 by doyougnu at 2025-01-13T17:47:42+01:00
Rts linker: add case for pc-rel 64 relocation
part of the upstream haskell.nix patches
(cherry picked from commit bfe4b3d3bbb98b39169fad063c6c32f06d167756)
- - - - -
278b7f18 by Sylvain Henry at 2025-01-13T17:47:57+01:00
Only lookup ghcversion.h file in the RTS include-dirs by default.
The code was introduced in 3549c952b535803270872adaf87262f2df0295a4.
It used `getPackageIncludePath` which name doesn't convey that it looks
into all include paths of the preload units too. So this behavior is
probably unintentional and it should be ok to change it.
Fix #25106
(cherry picked from commit f954f42823f6ca3588425a0d543d93ace86d89e4)
- - - - -
c1d30b65 by Andreas Klebinger at 2025-01-13T17:48:11+01:00
Add since annotation for -fkeep-auto-rules.
This partially addresses #25082.
- - - - -
219d34f9 by Andreas Klebinger at 2025-01-13T17:57:21+01:00
Mention `-fkeep-auto-rules` in release notes.
It was added earlier but hadn't appeared in any release notes yet.
Partially addresses #25082.
- - - - -
df444de5 by Sylvain Henry at 2025-01-13T18:01:33+01:00
Cmm: don't perform unsound optimizations on 32-bit compiler hosts
- beef61351b240967b49169d27a9a19565cf3c4af enabled the use of
MO_Add/MO_Sub for 64-bit operations in the C and LLVM backends
- 6755d833af8c21bbad6585144b10e20ac4a0a1ab did the same for the x86 NCG
backend
However we store some literal values as `Int` in the compiler. As a
result, some Cmm optimizations transformed target 64-bit literals into
compiler `Int`. If the compiler is 32-bit, this leads to computing with
wrong literals (see #24893 and #24700).
This patch disables these Cmm optimizations for 32-bit compilers. This
is unsatisfying (optimizations shouldn't be compiler-word-size
dependent) but it fixes the bug and it makes the patch easy to backport.
A proper fix would be much more invasive but it shall be implemented in
the future.
Co-authored-by: amesgen <amesgen at amesgen.de>
(cherry picked from commit 7446a09a2d5b04b95cd43c03659b5647853124ce)
- - - - -
bc68b829 by Sylvain Henry at 2025-01-13T18:01:45+01:00
AARCH64 linker: skip NONE relocations
This patch is part of the patches upstreamed from haskell.nix.
See https://github.com/input-output-hk/haskell.nix/pull/1960 for the
original report/patch.
(cherry picked from commit c749bdfd3e21d712dc2b966482eb010165bdeebe)
- - - - -
0d853dcc by sheaf at 2025-01-13T18:02:24+01:00
GHCi debugger: drop record name spaces for Ids
When binding new local variables at a breakpoint, we should create
Ids with variable namespace, and not record field namespace. Otherwise
the rest of the compiler falls over because the IdDetails are wrong.
Fixes #25109
(cherry picked from commit c29b2b5a77611b2bd6c3089765079bc43aec3e22)
- - - - -
7241f7bf by Sylvain Henry at 2025-01-13T18:03:39+01:00
JS: support rubbish static literals (#25177)
Support for rubbish dynamic literals was added in #24664. This patch
does the same for static literals.
Fix #25177
(cherry picked from commit 5092dbff750ee5b6fd082b7eed8574922a2b0bf4)
- - - - -
784028b6 by Arsen Arsenović at 2025-01-13T18:04:06+01:00
ghc-toolchain: Don't leave stranded a.outs when testing for -g0
This happened because, when ghc-toolchain tests for -g0, it does so by
compiling an empty program. This compilation creates an a.out.
Since we create a temporary directory, lets place the test program
compilation in it also, so that it gets cleaned up.
Fixes: 25b0b40467d0a12601497117c0ad14e1fcab0b74
Closes: https://gitlab.haskell.org/ghc/ghc/-/issues/25203
(cherry picked from commit b16605e7c135f8cfd357a60c7f358132faec6a84)
- - - - -
e9403d89 by Cheng Shao at 2025-01-13T18:04:16+01:00
rts: fix checkClosure error message
This patch fixes an error message in checkClosure() when the closure
has already been evacuated. The previous logic was meant to print the
evacuated closure's type in the error message, but it was completely
wrong, given info was not really an info table, but a tagged pointer
that points to the closure's new address.
(cherry picked from commit 0d3bc2fa3a9a8c342ec34bb9d32e493655a4ec69)
- - - - -
d55abf10 by Simon Peyton Jones at 2025-01-13T18:06:05+01:00
Add ZonkAny and document it
This MR fixed #24817 by adding ZonkAny, which takes a Nat
argument.
See Note [Any types] in GHC.Builtin.Types, especially
wrinkle (Any4).
(cherry picked from commit cfbff65a8bde902b4510cdaead847bf7a52b4018)
- - - - -
8fefeeb3 by Cheng Shao at 2025-01-14T00:01:28+00:00
autoconf: set RELEASE=NO
- - - - -
5c38b62c by Cheng Shao at 2025-01-14T00:01:28+00:00
Revert "hadrian: Refactor treatment of extra dependencies"
This reverts commit 3a18d9e7aff51dae78df8866e12f36649d379a58.
- - - - -
89b41713 by Teo Camarasu at 2025-01-14T00:01:28+00:00
Make template-haskell a stage1 package
Promoting template-haskell from a stage0 to a stage1 package means that
we can much more easily refactor template-haskell.
We implement this by duplicating the in-tree `template-haskell`.
A new `template-haskell-next` library is autogenerated to mirror `template-haskell`
`stage1:ghc` to depend on the new interface of the library including the
`Binary` instances without adding an explicit dependency on `template-haskell`.
This is controlled by the `bootstrap-th` cabal flag
When building `template-haskell` modules as part of this vendoring we do
not have access to quote syntax, so we cannot use variable quote
notation (`'Just`). So we either replace these with hand-written `Name`s
or hide the code behind CPP.
We can remove the `th_hack` from hadrian, which was required when
building stage0 packages using the in-tree `template-haskell` library.
For more details see Note [Bootstrapping Template Haskell].
Resolves #23536
Co-Authored-By: Sebastian Graf <sgraf1337 at gmail.com>
Co-Authored-By: Matthew Craven <5086-clyring at users.noreply.gitlab.haskell.org>
(cherry picked from commit 42bd040702d9a1c620354e7de05aaff6ee849f38)
- - - - -
99c2d16e by Teo Camarasu at 2025-01-14T00:01:28+00:00
Remove unecessary stage0 packages
Historically quite a few packages had to be stage0 as they depended on
`template-haskell` and that was stage0. In #23536 we made it so that was
no longer the case. This allows us to remove a bunch of packages from
this list.
A few still remain. A new version of `Win32` is required by
`semaphore-compat`. Including `Win32` in the stage0 set requires also
including `filepath` because otherwise Hadrian's dependency logic gets
confused. Once our boot compiler has a newer version of `Win32` all of
these will be able to be dropped.
Resolves #24652
(cherry picked from commit dd339c7acaf842ab275ee153be3521314ab4b85d)
- - - - -
bc687037 by Sylvain Henry at 2025-01-14T00:01:28+00:00
Fix TH dependencies (#22229)
Add a dependency between Syntax and Internal (via module reexport).
(cherry picked from commit 4d78c53c527af05bc1b4944219fa88306449bae0)
- - - - -
2c9509f4 by Ben Gamari at 2025-01-14T00:01:28+00:00
Bump time submodule to 1.14
As requested in #24528.
-------------------------
Metric Decrease:
ghc_bignum_so
rts_so
Metric Increase:
cabal_syntax_dir
rts_so
time_dir
time_so
-------------------------
(cherry picked from commit 1dacb506f55b8ab0aacf84dcfbf9742ad68f47c6)
- - - - -
761fa9a9 by Cheng Shao at 2025-01-14T00:01:28+00:00
testsuite: fix req_target_smp predicate
(cherry picked from commit a580722ecb716b917a16521d5185c1dbc24d0ab9)
- - - - -
2af93fc6 by Cheng Shao at 2025-01-14T00:01:28+00:00
testsuite: bump PartialDownSweep timeout to 5x on wasm32
(cherry picked from commit b1e0c313e6f0ef4a98ff37e2dc443ea452c58f7e)
- - - - -
5b3600d4 by Cheng Shao at 2025-01-14T00:01:28+00:00
rts: fix I/O manager compilation errors for win32 target
This patch fixes I/O manager compilation errors for win32 target
discovered when cross-compiling to win32 using recent clang:
```
rts/win32/ThrIOManager.c:117:7: error:
error: call to undeclared function 'is_io_mng_native_p'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
117 | if (is_io_mng_native_p ()) {
| ^
|
117 | if (is_io_mng_native_p ()) {
| ^
1 error generated.
`x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
rts/fs.c:143:28: error:
error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
143 | int setErrNoFromWin32Error () {
| ^
| void
|
143 | int setErrNoFromWin32Error () {
| ^
1 error generated.
`x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
rts/win32/ConsoleHandler.c:227:9: error:
error: call to undeclared function 'interruptIOManagerEvent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
227 | interruptIOManagerEvent ();
| ^
|
227 | interruptIOManagerEvent ();
| ^
rts/win32/ConsoleHandler.c:227:9: error:
note: did you mean 'getIOManagerEvent'?
|
227 | interruptIOManagerEvent ();
| ^
rts/include/rts/IOInterface.h:27:10: error:
note: 'getIOManagerEvent' declared here
27 | void * getIOManagerEvent (void);
| ^
|
27 | void * getIOManagerEvent (void);
| ^
1 error generated.
`x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
rts/win32/ConsoleHandler.c:196:9: error:
error: call to undeclared function 'setThreadLabel'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
196 | setThreadLabel(cap, t, "signal handler thread");
| ^
|
196 | setThreadLabel(cap, t, "signal handler thread");
| ^
rts/win32/ConsoleHandler.c:196:9: error:
note: did you mean 'postThreadLabel'?
|
196 | setThreadLabel(cap, t, "signal handler thread");
| ^
rts/eventlog/EventLog.h:118:6: error:
note: 'postThreadLabel' declared here
118 | void postThreadLabel(Capability *cap,
| ^
|
118 | void postThreadLabel(Capability *cap,
| ^
1 error generated.
`x86_64-w64-mingw32-clang' failed in phase `C Compiler'. (Exit code: 1)
```
(cherry picked from commit 710665bdd48b055d763c30b88d690fadd46a03af)
- - - - -
cacf04e9 by Cheng Shao at 2025-01-14T00:01:28+00:00
autoconf: remove unused context diff check
This patch removes redundant autoconf check for the context diff
program given it isn't actually been used anywhere, especially since
make removal.
(cherry picked from commit b7bcf72990c20bf88c57d7d2b4478d8f2ad18ac3)
- - - - -
72e758b1 by Cheng Shao at 2025-01-14T00:01:28+00:00
testsuite: bump T22744 timeout to 5x
(cherry picked from commit c739383b9de12acde0e16f444b1563ef102d5e07)
- - - - -
b68820e7 by Cheng Shao at 2025-01-14T00:01:28+00:00
testsuite: don't attempt to detect host cpu features when testing cross ghc
The testsuite driver CPU feature detection logic only detects host CPU
and only makes sense when we are not testing a cross GHC.
(cherry picked from commit c4c6d714b93e65052c872df0c3b700302adaba97)
- - - - -
482418ac by Cheng Shao at 2025-01-14T00:01:28+00:00
compiler: avoid saving foreign call target to local when there are no caller-save GlobalRegs
This patch makes the STG->Cmm backend avoid saving foreign call target
to local when there are no caller-save GlobalRegs.
Since 321941a8ebe25192cdeece723e1058f2f47809ea, when we lower a
foreign call, we unconditionally save the foreign call target to a
temporary local first, then rely on cmmSink to clean it up later,
which only happens with -fcmm-sink (implied by -O) and not in
unoptimized code.
And this is troublesome for the wasm backend NCG, which needs to infer
a foreign call target symbol's type signature from the Cmm call site.
Previously, the NCG has been emitting incorrect type signatures for
unoptimized code, which happens to work with `wasm-ld` most of the
time, but this is never future-proof against upstream toolchain
updates, and it causes horrible breakages when LTO objects are
included in linker input. Hence this patch.
(cherry picked from commit 8dd8a076058baca45ac52ace25b9c2797d61ef84)
- - - - -
934777ce by Cheng Shao at 2025-01-14T00:08:12+00:00
testsuite: add callee-no-local regression test
(cherry picked from commit 986df1abe23aaad4142721fbdb7dd3791cf153ad)
- - - - -
b7292e6f by Cheng Shao at 2025-01-14T00:08:17+00:00
testsuite: bump MultiLayerModulesDefsGhciReload timeout to 10x
(cherry picked from commit e17f2df9906e2edd5ded932c8dcac4818e6ce0e4)
- - - - -
8133cf64 by Cheng Shao at 2025-01-14T00:08:17+00:00
hadrian: build C/C++ with split sections when enabled
When split sections is enabled, ensure -fsplit-sections is passed to
GHC as well when invoking GHC to compile C/C++; and pass
-ffunction-sections -fdata-sections to gcc/clang when compiling C/C++
with the hadrian Cc builder. Fixes #23381.
(cherry picked from commit 0958937e79efcbe9f1ff25c1d697d62b8796d910)
- - - - -
f920cdf0 by Cheng Shao at 2025-01-14T00:08:18+00:00
driver: build C/C++ with -ffunction-sections -fdata-sections when split sections is enabled
When -fsplit-sections is passed to GHC, pass -ffunction-sections
-fdata-sections to gcc/clang when building C/C++. Previously,
-fsplit-sections was only respected by the NCG/LLVM backends, but not
the unregisterised backend; the GHC driver did not pass
-fdata-sections and -ffunction-sections to the C compiler, which
resulted in excessive executable sizes.
Fixes #23381.
-------------------------
Metric Decrease:
size_hello_artifact
size_hello_unicode
-------------------------
(cherry picked from commit 02b1f91e93b4e26c8fc227f48878a66f342cb68f)
- - - - -
dbe05f41 by Cheng Shao at 2025-01-14T00:08:18+00:00
testsuite: mark process005 as fragile on JS
(cherry picked from commit fd47e2e38dd10d6f39cc7ee2c512cb3e6b56a44e)
- - - - -
3238226f by Cheng Shao at 2025-01-14T00:08:18+00:00
compiler: remove ArchWasm32 special case in cmmDoCmmSwitchPlans
This patch removes special consideration for ArchWasm32 in
cmmDoCmmSwitchPlans, which means the compiler will now disable
cmmImplementSwitchPlans for wasm unreg backend, just like unreg
backend of other targets. We enabled it in the past to workaround some
compile-time panic in older versions of LLVM, but those panics are no
longer present, hence no need to keep this workaround.
(cherry picked from commit bf0737c0b86a36ccc5523582dea6979e020fb547)
- - - - -
74294494 by Cheng Shao at 2025-01-14T00:08:18+00:00
utils: add hie.yaml config file for ghc-config
Add hie.yaml to ghc-config project directory so it can be edited using
HLS.
(cherry picked from commit 7eda4bd229452b5d998398a12c45c62ad3c61777)
- - - - -
70ebf663 by Cheng Shao at 2025-01-14T00:08:18+00:00
hadrian: handle findExecutable "" gracefully
hadrian may invoke findExecutable "" at run-time due to a certain
program is not found by configure script. Which is fine and
findExecutable is supposed to return Nothing in this case. However, on
Windows there's a directory bug that throws an exception (see
https://github.com/haskell/directory/issues/180), so we might as well
use a wrapper for findExecutable and handle exceptions gracefully.
(cherry picked from commit 1e5752f64a522c4025365856d92f78073a7b3bba)
- - - - -
34b924ab by Cheng Shao at 2025-01-14T00:08:18+00:00
configure: do not set LLC/OPT/LLVMAS fallback values when FIND_LLVM_PROG fails
When configure fails to find LLC/OPT/LLVMAS within supported version
range, it used to set "llc"/"opt"/"clang" as fallback values. This
behavior is particularly troublesome when the user has llc/opt/clang
with other versions in their PATH and run the testsuite, since hadrian
will incorrectly assume have_llvm=True and pass that to the testsuite
driver, resulting in annoying optllvm test failures (#23186). If
configure determines llc/opt/clang wouldn't work, then we shouldn't
pretend it'll work at all, and the bindist configure will invoke
FIND_LLVM_PROG check again at install time anyway.
(cherry picked from commit 4eb5ad09cf93caa5791a735baa0e7ba86b916f2a)
- - - - -
13c0ad4a by Cheng Shao at 2025-01-14T00:08:18+00:00
compiler: fix -ddump-cmm-raw when compiling .cmm
This patch fixes missing -ddump-cmm-raw output when compiling .cmm,
which is useful for debugging cmm related codegen issues.
(cherry picked from commit 6346c669215c797abb977cf875da4e4238f5d064)
- - - - -
54e43687 by Cheng Shao at 2025-01-14T00:08:18+00:00
testsuite: mark T7773 as fragile on wasm
(cherry picked from commit ae50a8eb73a21decf3f6aa6cd9e4f236d11bdc3f)
- - - - -
be2b8b76 by Cheng Shao at 2025-01-14T00:08:18+00:00
compiler: remove unused CompilerInfo/LinkerInfo types
This patch removes CompilerInfo/LinkerInfo types from the compiler
since they aren't actually used anywhere.
(cherry picked from commit 98ad1ea5ea9f113335df591cab362d841ee7b96b)
- - - - -
51aeafb2 by Cheng Shao at 2025-01-14T00:08:18+00:00
testsuite: bump T7653 timeout for wasm
(cherry picked from commit 2eee65e1a4f441e99b79f3dc6e7d60492e4cad78)
- - - - -
195d8b9b by Cheng Shao at 2025-01-14T00:08:18+00:00
testsuite: skip objc-hi/objcxx-hi when cross compiling
objc-hi/objcxx-hi should be skipped when cross compiling. The existing
opsys('darwin') predicate only asserts the host system is darwin but
tells us nothing about the target, hence the oversight.
(cherry picked from commit 595c0894f630f4fc377c6bf14a5fb88ca0f1398c)
- - - - -
a410aff5 by Cheng Shao at 2025-01-14T00:08:18+00:00
rts: cleanup inlining logic
This patch removes pre-C11 legacy code paths related to
INLINE_HEADER/STATIC_INLINE/EXTERN_INLINE macros, ensure EXTERN_INLINE
is treated as static inline in most cases (fixes #24945), and also
corrects the comments accordingly.
(cherry picked from commit 35a64220c9e47d64635ae732f33795c611eb1fc8)
- - - - -
0a0abc53 by Cheng Shao at 2025-01-14T00:08:18+00:00
rts: replace ad-hoc MYTASK_USE_TLV with proper CC_SUPPORTS_TLS
This patch replaces the ad-hoc `MYTASK_USE_TLV` with the
`CC_SUPPORTS_TLS` macro. If TLS support is detected by autoconf, then
we should use that for managing `myTask` in the threaded RTS.
(cherry picked from commit f3017dd3a7e3a2bd8a4f0b9f86268ff403f8f7c6)
- - - - -
120ed44b by Cheng Shao at 2025-01-14T00:08:18+00:00
testsuite: bump T17572 timeout on wasm32
(cherry picked from commit 64fba310c2d23a41c88514aed0a482fbe5a3b184)
- - - - -
dd8bfc12 by Cheng Shao at 2025-01-14T00:08:18+00:00
testsuite: remove undesired -fasm flag from test ways
This patch removes the -fasm flag from test ways, except ways like
optasm that explicitly state they are meant to be compiled with NCG
backend. Most test ways should use the default codegen backend, and
the precense of -fasm can cause stderr mismatches like this when GHC
is configured with the unregisterised backend:
```
--- /dev/null
+++ /tmp/ghctest-3hydwldj/test spaces/testsuite/tests/profiling/should_compile/prof-late-cc.run/prof-late-cc.comp.stderr.normalised
@@ -0,0 +1,2 @@
+when making flags consistent: warning: [GHC-74335] [-Winconsistent-flags (in -Wdefault)]
+ Target platform uses unregisterised ABI, so compiling via C
*** unexpected failure for prof-late-cc(prof_no_auto)
```
This has been breaking the wasm unreg nightly job since !12595 landed.
(cherry picked from commit 8848884718044dbcc08be134d768040ffa18d336)
- - - - -
79b43c0f by Cheng Shao at 2025-01-14T00:08:18+00:00
ghci: fix isMinTTY.h casing for Windows targets
This commit fixes isMinTTY.h casing in isMinTTY.c that's compiled for
Windows targets. While this looks harmless given Windows filesystems
are case-insensitive by default, it does cause a compilation warning
with recent versions of clang, so we might as well fix the casing:
```
driver\ghci\isMinTTY.c:10:10: error:
warning: non-portable path to file '"isMinTTY.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
|
10 | #include "isMINTTY.h"
| ^
#include "isMINTTY.h"
^~~~~~~~~~~~
"isMinTTY.h"
1 warning generated.
```
(cherry picked from commit 3a145315052d6f66f9682ecff87b522011165d59)
- - - - -
a0942c45 by Cheng Shao at 2025-01-14T00:08:18+00:00
git: remove a.out and include it in .gitignore
a.out is a configure script byproduct. It was mistakenly checked into
the tree in !13118. This patch removes it, and include it in
.gitignore to prevent a similar error in the future.
(cherry picked from commit f0408eeb41286561d76d206a1f07cfe6b7c53d37)
- - - - -
f8369edc by Cheng Shao at 2025-01-14T00:08:18+00:00
driver: fix runWorkerLimit on wasm
This commit fixes link-time unresolved symbol errors for sem_open etc
on wasm, by making runWorkerLimit always behave single-threaded. This
avoids introducing the jobserver logic into the final wasm module and
thus avoids referencing the posix semaphore symbols.
(cherry picked from commit ceca9efb3d437fb74263877d98d4fb4a45ee96b8)
- - - - -
c29a5fa5 by Cheng Shao at 2025-01-14T00:08:18+00:00
hadrian: remove unused ghciWithDebugger field from flavour config
This patch removes the ghciWithDebugger field from flavour config
since it's actually not used anywhere.
(cherry picked from commit c6e5fd3d29219f69935eb117648e4eeab16bba13)
- - - - -
362f384c by Cheng Shao at 2025-01-14T00:08:18+00:00
Drop obsolete libffi Makefile
This patch drops obsolete libffi Makefile from the tree, given it's
completely unused since removal of make build system in !7094.
(cherry picked from commit 3fe843c730a2d882af98dac53958731624dfe0a3)
- - - - -
34c2b36e by Cheng Shao at 2025-01-14T00:08:18+00:00
ghci: mitigate host/target word size mismatch in BCOByteArray serialization
This patch mitigates a severe host/target word size mismatch issue in
BCOByteArray serialization logic introduced since !12142, see added
note for detailed explanation.
(cherry picked from commit 90891962ad4d2c781e68062de01e25eea999ae1b)
(cherry picked from commit 860596329a85295277aa21854f4aeae2b755c36f)
(cherry picked from commit 30d12c468cd19940fecad1d6c89c51e5fe3f4050)
- - - - -
11011b65 by Cheng Shao at 2025-01-14T00:08:18+00:00
ghci: use plain malloc for mkConInfoTable on non-TNTC platforms
This patch avoids using mmap() to allocate executable memory for
mkConInfoTable on platforms without tables-next-to-code, see added
comment for explanation.
(cherry picked from commit 839ac52e94f8ecf878e522dba0575466af248267)
- - - - -
7692890c by Cheng Shao at 2025-01-14T00:08:18+00:00
ghc-internal: add missing CPPs for wasm
This patch adds some missing CPP guards to ghc-internal, given those
functions are non existent on wasm and would cause linking issues.
(cherry picked from commit a998f69d2de062b7290e78221d55e8c49bf95bbc)
- - - - -
57435136 by Cheng Shao at 2025-01-14T00:08:18+00:00
rts: rename prelude.js to prelude.mjs
This commit renames prelude.js to prelude.mjs for wasm backend rts
jsbits, and slightly adjusts the jsbits contents. This is for
preparing the implementation of dyld.mjs that contains wasm dynamic
linker logic, which needs to import prelude.mjs as a proper ESM
module.
(cherry picked from commit 71a471e7495f1fbf6b44cfbe4e930c99131c583e)
- - - - -
e0c2e46c by Cheng Shao at 2025-01-14T00:08:18+00:00
rts: add __wrapped_freeJSVal
This commit wraps imported freeJSVal in a __wrapped_freeJSVal C
function for wasm backend RTS. In general, wasm imports are only
supposed to be directly called by C; they shouldn't be used as
function pointers, which confuses wasm-ld at link-time when generating
shared libraries.
(cherry picked from commit 33d9db17f31f59ef72d6d8dac033a84c45d3c216)
- - - - -
d1df0400 by Cheng Shao at 2025-01-14T00:08:18+00:00
rts: correct stale link in comment
(cherry picked from commit 0d0a16a81b3875c0e21c0bbe9659edc6312c4846)
- - - - -
f723c989 by Cheng Shao at 2025-01-14T00:08:18+00:00
rts: drop interpretBCO support from non-dyn ways on wasm
This commit drops interpretBCO support from non dynamic rts ways on
wasm. The bytecode interpreter is only useful when the RTS linker also
works, and on wasm it only works for dynamic ways anyway. An
additional benefit of dropping interpretBCO is reduction in code size
of linked wasm modules, especially since interpretBCO references
ffi_call which is an auto-generated large function in libffi-wasm and
unused by most user applications.
(cherry picked from commit 90a35c41bb676b5e68212f63b187d2c50439714c)
- - - - -
cb2e4186 by Cheng Shao at 2025-01-14T00:08:18+00:00
rts: don't build predefined GloblRegs for wasm PIC mode
This commit wraps the predefined GlobalRegs in Wasm.S under a CPP
guard to prevent building for PIC mode. When building dynamic ways of
RTS, the wasm globals that represent STG GlobalRegs will be created
and supplied by dyld.mjs. The current wasm dylink convention doesn't
properly support exporting relocatable wasm globals at all, any wasm
global exported by a .so is assumed to be a GOT.mem entry.
(cherry picked from commit 98a32ec551dd95534c1a8eaccb0f67dbe5f19648)
- - - - -
62c74f50 by Cheng Shao at 2025-01-14T00:08:18+00:00
rts: fix conflicting StgRun definitions on wasm
This commit fixes conflicting StgRun definition when building dynamic
ways of RTS for wasm in unregisterised mode.
(cherry picked from commit bef94bde53f07a1b0d7eb16d3d0eb1bd62f5f992)
- - - - -
370668dd by Cheng Shao at 2025-01-14T00:08:18+00:00
hadrian: use targetSupportsRPaths predicate
This commit changes the hostSupportsRPaths predicate to
targetSupportsRPaths and use that to decide whether to pass
RPATH-related link-time options. It's not applied to stage0, we should
just use the default link-time options of stageBoot ghc.
(cherry picked from commit a6a82cdb7162f32a1b73a2a6224d6d9cd208962c)
- - - - -
595520c3 by Cheng Shao at 2025-01-14T00:08:19+00:00
hadrian: disable internal-interpreter of ghc library when cross compiling
This commit disable the internal-interpreter flag of ghc library when
cross compiling, only external interpreter works in such cases.
(cherry picked from commit f232c872c6adf4472b5a1c88812c57aa2aa76cbe)
- - - - -
667ac259 by Cheng Shao at 2025-01-14T00:08:19+00:00
hadrian: enable internal-interpreter for ghc-bin stage0
This commit enables internal-interpreter flag for ghc-bin even when
compiling stage0, as long as target supports ghci. It enables ghci
functionality for cross targets that support ghci, since cross ghc-bin
is really stage0.
(cherry picked from commit 577c1819ab4eb3369cafdaf24114b74da21ce4b4)
- - - - -
a12248a5 by Cheng Shao at 2025-01-14T00:08:19+00:00
hadrian: fix CFLAGS for gmp shared objs on wasm
This commit adds -fvisibility=default to CFLAGS of gmp when building
for wasm. This is required to generate the ghc-bignum shared library
without linking errors. Clang defaults to -fvisibility=hidden for wasm
targets, which will cause issues when a symbol is expected to be
exported in a shared library but without explicit visibility attribute
annotation.
(cherry picked from commit c247f2eef9e8450837cbaad1668c6178d094a8fb)
- - - - -
ac3c4797 by Cheng Shao at 2025-01-14T00:08:19+00:00
hadrian: re-enable PIC for gmp on wasm
This commit re-enables --with-pic=yes configuration option of gmp when
building for wasm, given we're about to include support for shared
libraries, TH and ghci.
(cherry picked from commit 775410fdfc5d6faf287eecdaae170af9f8a59bb9)
- - - - -
477b90df by Cheng Shao at 2025-01-14T00:08:19+00:00
hadrian: add the host_fully_static flavour transformer
This commit adds the host_fully_static flavour transformer to hadrian,
which ensures stage0 is fully statically linked while still permitting
stage1 libdir to contain shared libraries. This is intended to be used
by the wasm backend to build portable linux bindists that contain wasm
shared libraries.
(cherry picked from commit b45080a3e34200767b76faca495f5aea95bb94f5)
- - - - -
58fbc8c8 by Matthew Pickering at 2025-01-14T00:08:19+00:00
Update alpine release job to 3.20
alpine 3.20 was recently released and uses a new python and sphinx
toolchain which could be useful to test.
(cherry picked from commit 7bcda869abe650c60dac1bb5d64a2a0aeff71d6b)
- - - - -
91d0f3ba by Cheng Shao at 2025-01-14T00:08:19+00:00
ci: update wasm jobs configuration
This commit bumps ci-image revision to use updated wasm toolchain, and
use host_fully_static instead of fully_static for wasm jobs so to
ensure wasm shared libraries can be properly built.
(cherry picked from commit 5043507ca32e31d14869a0a11dd317529f616fc2)
- - - - -
4f8f12b3 by Cheng Shao at 2025-01-14T00:08:19+00:00
hadrian/testsuite: implement config.cross logic
This commit implements the config.cross field in the testsuite driver.
It comes from the "cross compiling" ghc info field for both
in-tree/out-of-tree GHC, and is an accurate predicate of whether we're
cross-compiling or not (compared to the precense of target emulator),
and is useful to implement predicates to assert the precense of
internal interpreter (only available on non-cross GHC) for tests that
do require it (e.g. plugins).
(cherry picked from commit 2956a3f7ecd58a6fda81447100404941c0ed837d)
- - - - -
567c8eac by Cheng Shao at 2025-01-14T00:08:19+00:00
hadrian/compiler: implement targetRTSLinkerOnlySupportsSharedLibs
This patch implements the targetRTSLinkerOnlySupportsSharedLibs
predicate in hadrian. Its definition in hadrian is the single source
of truth, and the information propagates to ghc settings file, ghc
driver and testsuite driver. It is used in various places to ensure
dynamic dependency is selected when the target RTS linker only
supports loading dynamic code.
(cherry picked from commit 8c74a0eda41255ead134f05598f5da70992a7054)
- - - - -
ad3375a7 by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: implement & use req_plugins predicate
This commit implements req_plugins predicate to indicate that the test
requires plugin functionality. Currently this means cross GHC is
disabled since internal-interpreter doesn't work in cross GHC yet.
(cherry picked from commit 3c21b696abc9acf375307eb91ccc678965487843)
- - - - -
2841d111 by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: make use of config.interp_force_dyn
This commit takes config.interp_force_dyn into consideration when
setting up TH/ghci way flags.
(cherry picked from commit 93b8af8009a6e174b8d75f766dba2dc4d9aa9119)
- - - - -
bace91fd by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: bump T17572 timeout
(cherry picked from commit 94673d419a8cdf71d722c93da9860ad8807657e7)
- - - - -
20e46828 by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: skip ghc api tests that attempt to spawn processes inside wasm
This commit skips a few ghc api tests on wasm, since they would
attempt to spawn processes inside wasm, which is not supported at all.
(cherry picked from commit fa68f83355ecca1f72f4593a1ed0422fa8fcb6a6)
- - - - -
4083c3f8 by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: skip T22840 due to broken -dtag-inference-checks on wasm
(cherry picked from commit 1241c04e72107e1648f9aba5e857b48ec3bac96f)
- - - - -
1d6b31bb by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: ensure $(ghciWayFlags) can be overridden
This commit revises boilerplate.mk in testsuite as well as a few other
places, to ensure the tests that do make use of $(ghciWayFlags) can
receive the right $(ghciWayFlags) from testsuite driver config.
(cherry picked from commit 78c8b90006ac4d0a4de4e72295f8a57de4b9beca)
- - - - -
87045713 by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: skip rdynamic on wasm
(cherry picked from commit 47989ecc6ddfbe68ba2213c6c2b0d29ed958c330)
- - - - -
c1dc80eb by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: skip T2615 on wasm
This commit marks T2615 as skip on wasm, given LD_* environment
variables aren't supported on wasm anyway.
(cherry picked from commit fefb4ea1dee945ace173b63c808c593fc167803f)
- - - - -
ece36085 by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: mark MultiLayerModulesTH_Make/MultiLayerModulesTH_OneShot as fragile on wasm
(cherry picked from commit 77c797625483be968bb51c1518020895ca5ecb11)
- - - - -
7c50301f by Cheng Shao at 2025-01-14T00:08:19+00:00
testsuite: fix T16180 on wasm
This commit fixes T16180 on wasm once TH support is flipped on. The
fix is simply adding right asm code for wasm.
(cherry picked from commit 69bb4745218d2d54c82e33fa529ccf9ba3819fac)
- - - - -
0651d666 by Cheng Shao at 2025-01-14T00:08:19+00:00
driver: fix -fexternal-interpreter flag for JS backend
Previously, -fexternal-interpreter is broken for JS backend, since GHC
would attempt to launch a non-existent ghc-iserv* executable. This
commit fixes it by adjusting pattern matching order in
setTopSessionDynFlags.
(cherry picked from commit 621c753dee540be65208d1fdcd1728ba9f2b4320)
- - - - -
b4bba2ca by Cheng Shao at 2025-01-14T00:08:19+00:00
driver: use interpreterDynamic predicate in preloadLib
This commit use the interpreterDynamic predicate in preloadLib to
decide if we should do dynLoadObjs instead of loadObj. Previously we
used hostIsDynamic which was only written with non-cross internal
interpreter in mind.
The testsuite is also adjusted to remove hard-wired -fPIC flag for
cbits (doesn't work in i386 RTS linker in vanilla way, #25260) and
properly pass ghc_th_way_flags to ghc.
(cherry picked from commit 80aa89831c18162ce5591400c41b4cd8f77db0e4)
- - - - -
1e6e182f by Cheng Shao at 2025-01-14T00:08:19+00:00
compiler: fix Cmm dynamic CLabels for wasm
This commit fixes the handling of dynamic CLabels for the wasm
backend. Just do the simplest handling: preserve the original CLabel,
both unreg/NCG backends can handle them properly without issue.
(cherry picked from commit 744114618678ed1eac7a699c738ffa3223d1b41a)
- - - - -
ef977e6d by Cheng Shao at 2025-01-14T00:08:19+00:00
driver: add necessary compile-time flags for wasm PIC mode
This commit adds necessary compile-time flags when compiling for wasm
PIC mode, see added comment for detailed explanation.
(cherry picked from commit f6abaf13c527e372edea2d70f9c012da8624e27c)
- - - - -
e81ba786 by Cheng Shao at 2025-01-14T00:08:19+00:00
driver: add necessary link-time flags for wasm shared libs
This commit adds necessary link-time flags for wasm shared libs, see
added comments for detailed explanation.
(cherry picked from commit 9745fcfbffb6434bacdec69082739c9e0229c6f2)
- - - - -
f5fafa0a by Cheng Shao at 2025-01-14T00:08:19+00:00
driver: enforce -fno-use-rpaths for wasm
This commit ensures the GHC driver never passes any RPATH-related
link-time flags on wasm, which is not supported at all.
(cherry picked from commit 649aae00c34014fcb64244de59961635563bf06a)
- - - - -
2172b20b by Cheng Shao at 2025-01-14T00:08:19+00:00
driver: ensure static archives are picked when linking static .wasm modules
This commit ensures static archives are picked when linking .wasm
modules which are supposed to be fully static, even when ghc may be
invoked with -dynamic, see added comment for explanation.
(cherry picked from commit 47baa9044a786ab04b6b68cf008f1254471c3cc1)
- - - - -
edffbcfc by Cheng Shao at 2025-01-14T00:08:19+00:00
compiler: fix dynamic_too_enable for targets that require dynamic libraries
This commit fixes dynamic_too_enable for targets whose RTS linker can
only load dynamic code.
(cherry picked from commit fc3a55917e9c6c64765f11e0703853b9eed230fe)
- - - - -
08650af4 by Cheng Shao at 2025-01-14T00:08:20+00:00
compiler: fix checkNonStdWay for targets that require dynamic libraries
This commit fixes checkNonStdWay to ensure that for targets whose RTS
linker can only load dynamic code, the dynamic way of object is
selected.
(cherry picked from commit 94ef949ef8b52cebaf8d4a81d7a169e100da2a73)
- - - - -
eddc109b by Cheng Shao at 2025-01-14T00:08:20+00:00
ghc-bin: enforce dynamic way when the target requires so
This commit makes ghc-bin use dynamic way when it is doing interactive
stuff on certain targets whose RTS linker can only handle dynamic
code.
(cherry picked from commit 88e992489e1574b471a55ff9ddace2c81a09ba63)
- - - - -
709bec66 by Cheng Shao at 2025-01-14T00:08:20+00:00
hadrian/ghci: add wasm dyld
This commit adds the wasm dynamic linker implementation, as well as
ghci logic to call it and hadrian logic to install it to the correct
location. See the top-level note in utils/jsffi/dyld.mjs for more
details.
(cherry picked from commit 549582eff80da6a8c5b7449755eaa726c208c324)
- - - - -
86ea726a by Cheng Shao at 2025-01-14T00:08:20+00:00
driver: fix getGccSearchDirectory for wasm target
This commit fixes getGccSearchDirectory logic for wasm target, ensures
the correct search directory containing libc.so etc can be found by
GHC. getGccSearchDirectory is also exported so it can be used
elsewhere to obtain the wasi-sdk libdir and pass to the dyld script.
(cherry picked from commit b562e3a6fab87422f40997f84b11a05505df2fcb)
- - - - -
928b42d9 by Cheng Shao at 2025-01-14T00:08:20+00:00
driver: add wasm backend iserv logic
This commit adds wasm backend iserv logic to the driver, see added
comments for explanation.
(cherry picked from commit 2d6107dc0e461f6d339ea14712b6f0cb9a619680)
- - - - -
9362667a by Cheng Shao at 2025-01-14T00:08:20+00:00
compiler: add PIC support to wasm backend NCG
This commit adds support for generating PIC to the wasm backend NCG.
(cherry picked from commit 61f5baa5bd6e8d0daa20af4dc7c3213a48f99019)
- - - - -
0a1d2e8b by Cheng Shao at 2025-01-14T00:08:20+00:00
hadrian/compiler: flip on support for shared libs & ghci for wasm
This commit flips on the support for shared libs and ghci for the wasm
target, given all required support logic has been added in previous
commits.
(cherry picked from commit 652e72394b715abc931b1104a4b683bb16909695)
- - - - -
c92ce1e8 by Cheng Shao at 2025-01-14T00:08:20+00:00
testsuite: flip on support for shared libs, TH & ghci for wasm
This commit flips on support for shared libs, TH & ghci for wasm in
the testsuite, given support has been landed in previous commits.
(cherry picked from commit 74a1f6818d1592ebceab8e0fbb6be1973f38fe78)
- - - - -
489e3370 by Cheng Shao at 2025-01-14T00:08:20+00:00
Revert "compiler: start deprecating cmmToRawCmmHook"
This reverts commit 1c064ef1f3e1aa2afc996e962ad53effa99ec5f4. Turns
out the GHC-WPC project does use it to observe Cmm in the pipeline,
see #25363.
(cherry picked from commit 525d451e175c7d6acfa968ce99d8d3fc7a8af0c7)
- - - - -
9abb751b by Cheng Shao at 2025-01-14T00:08:20+00:00
rts: fix pointer overflow undefined behavior in bytecode interpreter
This patch fixes an unnoticed undefined behavior in the bytecode
interpreter. It can be caught by building `rts/Interpreter.c` with
`-fsanitize=pointer-overflow`, the warning message is something like:
```
rts/Interpreter.c:1369:13: runtime error: addition of unsigned offset to 0x004200197660 overflowed to 0x004200197658
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Interpreter.c:1369:13
rts/Interpreter.c:1265:13: runtime error: addition of unsigned offset to 0x004200197660 overflowed to 0x004200197658
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Interpreter.c:1265:13
rts/Interpreter.c:1645:13: runtime error: addition of unsigned offset to 0x0042000b22f8 overflowed to 0x0042000b22f0
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Interpreter.c:1645:13
```
Whenever we do something like `SpW(-1)`, the negative argument is
implicitly converted to an unsigned integer type and causes pointer
arithmetic overflow. It happens to be harmless for most targets since
overflowing would wrap the result to desired value, but it's still
coincidental and undefined behavior. Furthermore, it causes real
damage to the wasm backend, given clang-20 will emit invalid wasm code
that crashes at run-time for this kind of C code! (see
https://github.com/llvm/llvm-project/issues/108770)
The fix here is adding some explicit casts to ensure we always use the
signed `ptrdiff_t` type as right hand operand of pointer arithmetic.
(cherry picked from commit 5bcfefd5bb73c18a9bad63d1813968832b696f9a)
- - - - -
3364b4d3 by Luite Stegeman at 2025-01-14T00:08:20+00:00
Interpreter: Add locking for communication with external interpreter
This adds locking to communication with the external interpreter
to prevent concurrent tasks interfering with each other. This
fixes Template Haskell with the external interpreter in parallel (-j)
builds.
Fixes #25083
- - - - -
0c373ab6 by Cheng Shao at 2025-01-14T00:08:20+00:00
wasm: bump dyld v8 heap size limit
This patch adds `--max-old-space-size=8192` to wasm dyld shebang
arguments to bump V8 heap size limit. The default limit
(`heap_size_limit` returned by `v8.getHeapStatistics()`) is
dynamically determined and a bit too low under certain workloads, and
V8 would waste too much CPU time to garbage collect old generation
heap more aggressively. Bumping the limit to 8G doesn't imply dyld
would really take that much memory at run-time, but it lessens V8 heap
stress significantly.
(cherry picked from commit 14c5143899d164c7ac1213d918b4819684538c4b)
- - - - -
718884fc by Cheng Shao at 2025-01-14T00:08:20+00:00
hadrian: make sure ghc-bin internal-interpreter is disabled for stage0 when not cross compiling
This patch disables internal-interpreter flag for stage0 ghc-bin when
not cross compiling, see added comment for explanation. Fixes #25406.
(cherry picked from commit fde12aba9bb2d3ba607548dfba648f2a5ee00b59)
- - - - -
0dad6161 by Cheng Shao at 2025-01-14T00:08:20+00:00
ghcid: use multi repl for ghcid
(cherry picked from commit 589fea7f1035970f515d422e6956d7d09d363f8f)
- - - - -
c92da25a by Cheng Shao at 2025-01-14T00:08:20+00:00
wasm: fix safari console error message related to import("node:timers")
This patch fixes the wasm backend JSFFI prelude script to avoid
calling `import("node:timers")` on non-deno hosts. Safari doesn't like
it and would print an error message to the console. Fixes
https://gitlab.haskell.org/ghc/ghc-wasm-meta/-/issues/13.
(cherry picked from commit 301c3b541de825b76cff59c739a8797b64321d1a)
- - - - -
1ee6f2e4 by Cheng Shao at 2025-01-14T00:08:20+00:00
compiler: remove unused hscDecls/hscDeclsWithLocation
This patch removes unused `hscDecls`/`hscDeclsWithLocation` functions
from the compiler, to reduce maintenance burden when doing
refactorings related to ghci.
(cherry picked from commit e3496ef6c6f4cdb8bbef8b0e9dfa61219c32a575)
- - - - -
4bf63e82 by Cheng Shao at 2025-01-14T00:08:20+00:00
testsuite: add T25414 test case marked as broken
This commit adds T25414 test case to demonstrate #25414. It is marked
as broken and will be fixed by the next commit.
(cherry picked from commit 82213395dc2fbdc8b452336da0909896b4300218)
- - - - -
b6cd6d22 by Cheng Shao at 2025-01-14T00:08:20+00:00
driver: fix foreign stub handling logic in hscParsedDecls
This patch fixes foreign stub handling logic in `hscParsedDecls`.
Previously foreign stubs were simply ignored here, so any feature that
involve foreign stubs would not work in ghci (e.g. CApiFFI). The patch
reuses `generateByteCode` logic and eliminates a large chunk of
duplicate logic that implements Core to bytecode generation pipeline
here. Fixes #25414.
(cherry picked from commit 677e3aa56e905524071fc9717a88ad2cd1bc2951)
- - - - -
998eff67 by Cheng Shao at 2025-01-14T00:08:20+00:00
Remove unused USE_REPORT_PRELUDE code paths from the tree
This patch removes unused `USE_REPORT_PRELUDE` code paths from the
tree. They have been present since the first git revision
4fb94ae5e5d632748fa2e6c35e259eccc5a1a3f4, and might have been useful
for debugging purposes many years ago, but these code paths are never
actually built. Removing these ease maintenance of relevant modules in
the future, and also allows us to get rid of `CPP` extension in those
modules as a nice byproduct.
(cherry picked from commit 573cad4bd9e7fc146581d9711d36c4e3bacbb6e9)
- - - - -
e00fdae1 by Cheng Shao at 2025-01-14T00:08:20+00:00
Remove obsolete executable wrappers from the tree
The executable wrappers are handled by hadrian and bindist Makefile.
The various .wrapper scripts in the tree are unused since removal of
Make build system, so this patch removes them all.
(cherry picked from commit 9ede97f3431cba9394904751762b9ab1a59dde0e)
(cherry picked from commit 737e9e0bbf09475df92fe93cbe5bb76b299cbdfc)
- - - - -
1269e36e by Cheng Shao at 2025-01-14T00:08:20+00:00
wasm: fix setImmediate() implementation for Cloudflare Workers
This patch fixes setImmediate() implementation for Cloudflare Workers
in the wasm backend's js prelude script. Cloudflare Workers doesn't
support the MessageChannel API, and we use a setTimeout() based
fallback implementation in this case.
(cherry picked from commit c37b96fa267cc0419172ee5da6d969def5a8135b)
(cherry picked from commit 6bd2d9ad7e5e3f444cba1fba062df50708848893)
- - - - -
a1978778 by Cheng Shao at 2025-01-14T00:08:20+00:00
wasm: fix FinalizationRegistry logic for Cloudflare Workers
This patch fixes FinalizationRegistry related logic for Cloudflare
Workers in wasm backend js post linker. Cloudflare Workers doesn't
support FinalizationRegistry, in this case we use a dummy
implementation that doesn't do anything.
(cherry picked from commit bea8ea4cabcd51d098a361bd27d78884effa5d00)
(cherry picked from commit 0346e7b71d4b48f91f2374e6864b15f8d8530fad)
- - - - -
df3aa970 by Cheng Shao at 2025-01-14T00:08:20+00:00
Remove obsolete cross-port script
This patch removes the obsolete cross-port script in the tree. The
script was based on the legacy Make build system which has been pruned
from the tree long ago. For hadrian, proper support for two-stage
bootstrapping onto a new unsupported platform is a work in progress in
!11444.
(cherry picked from commit 00d551bfac82d2974b09cf1c235dc56de49d257e)
(cherry picked from commit 329a26da48ce812078ba5a6dc3dac11c872a1b9f)
- - - - -
dc15dd6d by Cheng Shao at 2025-01-14T00:08:20+00:00
hadrian: fix bindist makefile for wasm32-wasi target
This patch fixes one incoherent place between bindist makefile and
hadrian logic: I forgot to include wasi/wasm32 in
OsSupportsGHCi/ArchSupportsGHCi as well. And this results in incorrect
settings file generated after installing the bindist, and "Use
interpreter"/"Have interpreter" fields incorrectly have "NO" values
where they should be "YES" like --info output of in-tree version.
(cherry picked from commit 75a2eae4cab9ba94f7ba331f64a65fe3519f26dd)
(cherry picked from commit 735f3f9acd6c4346132157a9bd87448ed332a5f3)
- - - - -
5ab7fc05 by Cheng Shao at 2025-01-14T00:08:20+00:00
misc: improve clangd compile_flags.txt flags
This patch improves the compile_flags.txt config used to power clangd
for the rts C codebase. The flags in the file are sampled & deduped
from a real stage1 build with clang-19 and vastly improves the IDE
accuracy when hacking the rts.
For maximum code coverage under the default settings,
compile_flags.txt defaults to threaded+profiled+dynamic+debug way.
This does not mean profdyn needs to be actually built in _build/stage1
for IDE to work. To activate IDE for other RTS ways, simply remove one
of the -D flags at the end of compile_flags.txt and restart clangd.
(cherry picked from commit 59e0a77021e26c550fde39bf3b67a03dda497633)
(cherry picked from commit 222a08aec5da56862c176202dc5d5f2d20e7cae2)
- - - - -
e0cc03f5 by Cheng Shao at 2025-01-14T00:08:20+00:00
testsuite: add regression test T25473
This commit adds regression test T25473 marked as broken due to #25473.
It will be fixed in the subsequent commit.
(cherry picked from commit ed2ed6c52e4b93b1afec5e5584aff4dc654bab04)
(cherry picked from commit fb470cb623bc5dcd04a6ffda093be1400267b3d8)
- - - - -
a282de49 by Cheng Shao at 2025-01-14T00:08:20+00:00
wasm: fix foreign import javascript "wrapper" in TH/ghci
This patch fixes foreign import javascript "wrapper" in wasm backend's
TH/ghci by fixing the handling of dyld/finalization_registry magic
variables. Fixes T25473 and closes #25473.
(cherry picked from commit bd0a8b7e7537499f7dc703f78ac96f34e4c40554)
(cherry picked from commit 610b0f773f67ffef8383e2a680245d11dcfa38d2)
- - - - -
d3404e42 by Cheng Shao at 2025-01-14T00:08:20+00:00
ci: avoid depending on stack job for test-bootstrap jobs
This patch makes test-bootstrap related ci jobs only depend on
hadrian-ghc-in-ghci job to finish, consistent with other jobs in the
full-build stage generated by gen_ci.hs. This allows the jobs to be
spawned earlier and improve overall pipeline parallelism.
(cherry picked from commit e684c40693577f47b1e6984f4c7994859edef6ad)
(cherry picked from commit 4884eb08e2fdf422312cde0381dcabbc7208ec3c)
- - - - -
2f4b8f39 by Cheng Shao at 2025-01-14T00:08:21+00:00
rts: remove -Wl,-U,___darwin_check_fd_set_overflow hack
This patch bumps macOS minimum SDK version to 11.0 for x86_64-darwin
to align it with aarch64-darwin. This allows us to get rid of the
horrible -Wl,-U,___darwin_check_fd_set_overflow hack, which is causing
linker warnings and testsuite failures on macOS 15. Fixes #25504.
(cherry picked from commit 88c4fe1d8a3bdbedf3972fde12f663a974cc2191)
(cherry picked from commit 5c7e7695698a664b671777f4c81470ecd7738ccf)
- - - - -
0771892b by Cheng Shao at 2025-01-14T00:08:21+00:00
xxhash: bump to v0.8.3
(cherry picked from commit 42826a8941ecedd329844b675e26d30bdb6cd46b)
(cherry picked from commit 3ea15740398fdb2c32234086be2c84172b1493f9)
- - - - -
93298d42 by amesgen at 2025-01-14T00:08:21+00:00
wasm: prevent bundlers from resolving import("node:timers")
(cherry picked from commit 7202a02c0a5238682de6a3a06a9b5137f02ad70c)
(cherry picked from commit 5e60fd646823aa77b3401e5bd7f56cf369e77308)
- - - - -
99166817 by Cheng Shao at 2025-01-14T00:08:21+00:00
ci: multi-project pipeline for wasm
(cherry picked from commit 3655c3fd295cde9a78c15aa0ac002cf94bb813be)
- - - - -
30 changed files:
- .ghcid
- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- CODEOWNERS
- compile_flags.txt
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/PrimOps.hs-boot
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm/Dominators.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/Cmm/ThreadSanitizer.hs
- compiler/GHC/CmmToAsm/AArch64.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/AArch64/Regs.hs
- compiler/GHC/CmmToAsm/BlockLayout.hs
- compiler/GHC/CmmToAsm/Instr.hs
- compiler/GHC/CmmToAsm/Monad.hs
- compiler/GHC/CmmToAsm/PIC.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/934a8bb930390d5db1e5613ddfeafc8c80dd9b96...991668174d89b2eeda918302baa09bfcb98d7ff1
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/934a8bb930390d5db1e5613ddfeafc8c80dd9b96...991668174d89b2eeda918302baa09bfcb98d7ff1
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/20250113/8738eeac/attachment-0001.html>
More information about the ghc-commits
mailing list