GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:12:58Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/15365Argument-less infix declarations printed without parentheses in -ddump-splices2019-07-07T18:12:58ZRyan ScottArgument-less infix declarations printed without parentheses in -ddump-splicesCompile this:
```hs
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where
$([d| type (|||) = Either
(&&&) :: Bool -> Bool -> Bool
(&&&) = (&&)
data (***)...Compile this:
```hs
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where
$([d| type (|||) = Either
(&&&) :: Bool -> Bool -> Bool
(&&&) = (&&)
data (***)
|])
```
And you'll get this:
```
$ /opt/ghc/8.4.3/bin/ghci Bug.hs
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:(6,3)-(12,6): Splicing declarations
[d| (&&&_a1xt) :: Bool -> Bool -> Bool
(&&&_a1xt) = (&&)
type |||_a1xs = Either
data ***_a1xr |]
======>
type |||_a5bW = Either
(&&&_a5bV) :: Bool -> Bool -> Bool
(&&&_a5bV) = (&&)
data ***_a5bX
Ok, one module loaded.
```
Notice the pretty-printed declarations of `type |||_a5bW` and `data ***_a5bX`, which are lacking some necessary parentheses.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Argument-less infix declarations printed without parentheses in -ddump-splices","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Compile this:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n{-# OPTIONS_GHC -ddump-splices #-}\r\nmodule Bug where\r\n\r\n$([d| type (|||) = Either\r\n\r\n (&&&) :: Bool -> Bool -> Bool\r\n (&&&) = (&&)\r\n\r\n data (***)\r\n |])\r\n}}}\r\n\r\nAnd you'll get this:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.3/bin/ghci Bug.hs\r\nGHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 1] Compiling Bug ( Bug.hs, interpreted )\r\nBug.hs:(6,3)-(12,6): Splicing declarations\r\n [d| (&&&_a1xt) :: Bool -> Bool -> Bool\r\n (&&&_a1xt) = (&&)\r\n \r\n type |||_a1xs = Either\r\n data ***_a1xr |]\r\n ======>\r\n type |||_a5bW = Either\r\n (&&&_a5bV) :: Bool -> Bool -> Bool\r\n (&&&_a5bV) = (&&)\r\n data ***_a5bX\r\nOk, one module loaded.\r\n}}}\r\n\r\nNotice the pretty-printed declarations of `type |||_a5bW` and `data ***_a5bX`, which are lacking some necessary parentheses.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1Krzysztof GogolewskiKrzysztof Gogolewskihttps://gitlab.haskell.org/ghc/ghc/-/issues/14875-ddump-splices pretty-printing oddities with case statements2019-07-07T18:15:14ZRyan Scott-ddump-splices pretty-printing oddities with case statementsThe latest installment in "Ryan finds minor bugs in `-ddump-splices`". Take this program:
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where
$([d| f :: Bool -...The latest installment in "Ryan finds minor bugs in `-ddump-splices`". Take this program:
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where
$([d| f :: Bool -> Bool
f x = case x of
(True :: Bool) -> True
(False :: Bool) -> False
g :: Bool -> Bool
g x = (case x of
True -> True
False -> False) :: Bool
|])
```
Compiling this gives:
```
$ /opt/ghc/8.2.2/bin/ghci Bug.hs
GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:(6,3)-(15,6): Splicing declarations
[d| f_a1sB :: Bool -> Bool
f_a1sB x_a1sD
= case x_a1sD of
(True :: Bool) -> True
(False :: Bool) -> False
g_a1sC :: Bool -> Bool
g_a1sC x_a1sE
= (case x_a1sE of
True -> True
False -> False) ::
Bool |]
======>
f_a49Z :: Bool -> Bool
f_a49Z x_a4a0
= case x_a4a0 of
True :: Bool -> True
False :: Bool -> False
g_a49Y :: Bool -> Bool
g_a49Y x_a4a1
= case x_a4a1 of
True -> True
False -> False ::
Bool
```
Neither the `-ddump-splices` output for `f` nor `g` parse are legal Haskell:
- In `f`, GHC fails to parenthesize the pattern signatures `True :: Bool` and `False :: Bool`.
- In `g`, GHC fails to parenthesize the `case` expression which has an explicit `Bool` signature.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"-ddump-splices pretty-printing oddities with case statements","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The latest installment in \"Ryan finds minor bugs in `-ddump-splices`\". Take this program:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# OPTIONS_GHC -ddump-splices #-}\r\nmodule Bug where\r\n\r\n$([d| f :: Bool -> Bool\r\n f x = case x of\r\n (True :: Bool) -> True\r\n (False :: Bool) -> False\r\n\r\n g :: Bool -> Bool\r\n g x = (case x of\r\n True -> True\r\n False -> False) :: Bool\r\n |])\r\n}}}\r\n\r\nCompiling this gives:\r\n\r\n{{{\r\n$ /opt/ghc/8.2.2/bin/ghci Bug.hs\r\nGHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 1] Compiling Bug ( Bug.hs, interpreted )\r\nBug.hs:(6,3)-(15,6): Splicing declarations\r\n [d| f_a1sB :: Bool -> Bool\r\n f_a1sB x_a1sD\r\n = case x_a1sD of\r\n (True :: Bool) -> True\r\n (False :: Bool) -> False\r\n g_a1sC :: Bool -> Bool\r\n g_a1sC x_a1sE\r\n = (case x_a1sE of\r\n True -> True\r\n False -> False) ::\r\n Bool |]\r\n ======>\r\n f_a49Z :: Bool -> Bool\r\n f_a49Z x_a4a0\r\n = case x_a4a0 of\r\n True :: Bool -> True\r\n False :: Bool -> False\r\n g_a49Y :: Bool -> Bool\r\n g_a49Y x_a4a1\r\n = case x_a4a1 of\r\n True -> True\r\n False -> False ::\r\n Bool\r\n}}}\r\n\r\nNeither the `-ddump-splices` output for `f` nor `g` parse are legal Haskell:\r\n\r\n* In `f`, GHC fails to parenthesize the pattern signatures `True :: Bool` and `False :: Bool`.\r\n* In `g`, GHC fails to parenthesize the `case` expression which has an explicit `Bool` signature.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/14006Heap profiling ghc gives hp2ps error2019-07-07T18:18:54ZDavid FeuerHeap profiling ghc gives hp2ps errorRunning GHC with heap profiling and then running `hp2ps` on the result gives
```
hp2ps: ghc-stage2.hp, line 17405, samples out of sequence
```
Reproduction (GHC commit 4700baaf8f9bf3c44a53a595d840c7c14cfd6f98)
```
cabal unpack skyligh...Running GHC with heap profiling and then running `hp2ps` on the result gives
```
hp2ps: ghc-stage2.hp, line 17405, samples out of sequence
```
Reproduction (GHC commit 4700baaf8f9bf3c44a53a595d840c7c14cfd6f98)
```
cabal unpack skylighting-0.1.1.5
cd skylighting-0.1.1.5
cabal install --enable-profiling --only-dependencies -fexecutable
cabal configure --with-ghc=$HOME/src/ghc-clean-july12/inplace/bin/ghc-stage2 \
--enable-profiling -fexecutable
cabal build
touch src/Skylighting/Syntax/Php.hs
/home/dfeuer/src/ghc-clean-july12/inplace/bin/ghc-stage2 --make -i \
-isrc -idist/build -O -prof -fprof-auto-exported -osuf p_o -hisuf \
p_hi -optPdist/build/autogen/cabal_macros.h -hide-all-packages \
-package-db dist/package.conf.inplace -package-id aeson-1.2.1.0 \
-package base-4.10.0.0 -package blaze-html-0.9.0.1 -package \
bytestring-0.10.8.2 -package case-insensitive-1.2.0.10 -package \
containers-0.5.10.2 -package directory-1.3.0.2 -package \
filepath-1.4.1.2 -package hxt-9.3.1.16 -package mtl-2.2.1 -package \
regex-pcre-builtin-0.94.4.8.8.35 -package safe-0.3.15 -package \
text-1.2.2.2 -package utf8-string-1.0.1.1 -XHaskell2010 \
Skylighting.Types Skylighting.Regex \
Skylighting.Tokenizer Skylighting.Syntax.Php -j1 +RTS \
-s -h -N1
hp2ps ghc-stage2.hp
```8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/10915Statistical profiling support in the RTS2023-11-25T22:03:34ZBen GamariStatistical profiling support in the RTSNow since GHC can produce useful debugging information (e.g. DWARF annotations and source notes) in compiled objects, it would great if we could leverage this for more efficient profiling.
While ideally we would be able to rely on exter...Now since GHC can produce useful debugging information (e.g. DWARF annotations and source notes) in compiled objects, it would great if we could leverage this for more efficient profiling.
While ideally we would be able to rely on external tools like `perf` for this task, this would require that the STG stack be walkable like a standard C stack.
A more feasible alternative is to incorporate a simple statistical profiler into the RTS.
Profiling is defined loosely here as the collection of information describing the current state of evaluation in response to certain triggers. In practice this will be the collection of the current symbol being evaluated triggered on a few events of interest,
- Memory allocation
- Periodic timers for time-based profiling
- Blackhole blocking for locating performance problems due to sharing in parallel programs8.6.1Ben GamariBen Gamari