[Git][ghc/ghc][wip/T25560] 16 commits: Fix requirements on T25240

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Tue Dec 10 19:34:24 UTC 2024



Ben Gamari pushed to branch wip/T25560 at Glasgow Haskell Compiler / GHC


Commits:
090fc7c1 by Peter Trommler at 2024-12-07T03:41:21-05:00
Fix requirements on T25240

T25240 doesn't need RTS linker, GHCi is sufficient and GHCi can also be
dynamically linked.

- - - - -
3fb5d399 by Peter Trommler at 2024-12-07T03:41:21-05:00
Fix requirements for T25155

Loading C objects requires RTS linker.

- - - - -
4c58bdf6 by Leary at 2024-12-07T03:42:07-05:00
TH: Add typed variants of dataToExpQ and liftData

This commit introduces to template-haskell (via ghc-internal) two
functions `dataToCodeQ` and `liftDataTyped`, typed variants of
`dataToExpQ` and `liftData` respectively.

Tested in: `dataToCodeQUnit`.

- - - - -
63027593 by Serge S. Gulin at 2024-12-08T13:52:05+03:00
JS: Basic cleanup for unused stuff to simplify things.

1. Make `staticInitStat`, `staticDeclStat`, `allocUnboxedConStatic`, `allocateStaticList`, `jsStaticArg` local to modules.
2. Remove unused `hdRawStr`, `hdStrStr` from Haskell and JavaScript (`h$pstr`, `h$rstr`, `h$str`).
3. Introduce a special type `StaticAppKind` enumeration and `StaticApp` to represent boxed scalar static applications. Originally, StaticThunk supported to pass Maybe when it became Nothing for initializied thunks in an alternatie way but it is not used anymore.

- - - - -
a9f8f1fb by Serge S. Gulin at 2024-12-08T14:10:45+03:00
JS: Add trivial optimizations for `unpackCString` and `unpackCStringUtf8`.

It became possible due of introduction strings unfloating at Sinker pass (#13185). Earns few more bytes at optimizations.

- - - - -
b519c06b by Serge S. Gulin at 2024-12-08T15:50:26+03:00
JS: Specialize unpackCString# CAFs (fixes #24744)

Code analysis shown that such optimization would be possible out of the box if `cachedIdentForId` allowed to do that for Haskell `Id`s which are represented by few JavaScript `Ident`s. It is a usual for strings which are represented at JavaScript as a pair of 2 values: the string content and the offset where to start reading actual string from the full content. Usually offset is 0 but technically we need to allow such complex structures to be treated as "global".

Enabling it there shown that `genToplevelRhs` and `globalOccs` had inaccuracies in their implementations:
1. `globalOccs` operated over JavaScript's `Ident`s but for complex structures it didn't pay attention to the fact that different Idents actually could be pointed to same Id. Now the algo is changed to calculate occurencies for Ids.
2. `genToplevelRhs` didn't assume that different Idents pointed to same Id can have mixed order of occurence. But actually the order is important. Strings are encoded into 2 variables where first is content and second is offset and their order are not interchangeable. It is fixed by regeneration Idents from collected Ids which is fine because all Idents generation is passed through the Cache and they are quasi-stable.

- - - - -
a8ceccf3 by Brandon Chinn at 2024-12-09T16:25:43-05:00
Fix panic in multiline string with unterminated gap (#25530)

- - - - -
9e464ad0 by Brandon Chinn at 2024-12-09T16:25:43-05:00
Add test case for unterminated multiline string

- - - - -
ed1ed5c6 by Rodrigo Mesquita at 2024-12-09T16:26:19-05:00
Revert mapMG renaming

We had previously renamed this function for consistency, but that caused unnecessary breakage

- - - - -
158261f7 by Sylvain Henry at 2024-12-09T16:27:01-05:00
RTS: make Cabal flags manual

Cabal shouldn't automatically try to set them. We set them explicitly.

- - - - -
26764a68 by Ben Gamari at 2024-12-10T14:34:08-05:00
rts(setNumCapabilities): Assert that n_caps < MAX_N_CAPS

It was noticed in #25560 that this would previously be allowed,
resulting in a segfault.

I will add a proper exception in `base` in a future commit.

- - - - -
be52a457 by Ben Gamari at 2024-12-10T14:34:08-05:00
ghc-internal: Fix inconsistent FFI import types

The foreign imports of `enabled_capabilities` and
`getNumberOfProcessors` were declared as `CInt` whereas they are defined
as `uint32_t`.

- - - - -
207b1533 by Ben Gamari at 2024-12-10T14:34:08-05:00
rts: Mention maximum capability count in users guide

Addresses #25560.

- - - - -
b75f972d by Ben Gamari at 2024-12-10T14:34:08-05:00
rts/Capability: Move induction variable declaration into `for`s

Just a stylistic change.

- - - - -
3ff826f6 by Ben Gamari at 2024-12-10T14:34:09-05:00
rts: Determine max_n_capabilities at RTS startup

Previously the maximum number of capabilities supported by the RTS was
statically capped at 256. However, this bound is uncomfortably low given
the size of today's machine.

While supporting unbounded, fully-dynamic adjustment would be nice, it
is complex and so instead we do something simpler: Probe the logical
core count at RTS startup and use this as the static bound for the rest
of our execution.

This should avoid users running into the capability limit on large
machines while avoiding wasting memory on a large capabilities array for
most users and keeping complexity at bay.

Addresses #25560.

- - - - -
cd7bf129 by Ben Gamari at 2024-12-10T14:34:09-05:00
testsuite: Add test for #25560

- - - - -


30 changed files:

- compiler/GHC.hs
- compiler/GHC/Parser/Lexer.x
- compiler/GHC/StgToJS/Apply.hs
- compiler/GHC/StgToJS/Arg.hs
- compiler/GHC/StgToJS/CodeGen.hs
- compiler/GHC/StgToJS/Expr.hs
- compiler/GHC/StgToJS/Ids.hs
- compiler/GHC/StgToJS/Linker/Linker.hs
- compiler/GHC/StgToJS/Monad.hs
- compiler/GHC/StgToJS/Object.hs
- compiler/GHC/StgToJS/Symbols.hs
- compiler/GHC/StgToJS/Types.hs
- compiler/GHC/Unit/Module/Graph.hs
- docs/users_guide/using-concurrent.rst
- libraries/ghc-internal/CHANGELOG.md
- libraries/ghc-internal/src/GHC/Internal/Conc/Sync.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Lift.hs
- libraries/template-haskell/changelog.md
- libraries/template-haskell/tests/all.T
- + libraries/template-haskell/tests/dataToCodeQUnit.hs
- + libraries/template-haskell/tests/dataToCodeQUnit.stdout
- rts/Capability.c
- rts/Capability.h
- rts/RtsSymbols.c
- rts/Schedule.c
- rts/include/rts/Config.h
- rts/include/rts/Threads.h
- rts/js/string.js
- rts/rts.cabal
- testsuite/tests/ghci/linking/T25240/all.T


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ed2d745312f84bc25dcf2f05eee890adc1e1dcb5...cd7bf129c29fe919fb4214fdb9e1241bf569907b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ed2d745312f84bc25dcf2f05eee890adc1e1dcb5...cd7bf129c29fe919fb4214fdb9e1241bf569907b
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/20241210/7a728499/attachment.html>


More information about the ghc-commits mailing list