[Git][ghc/ghc][wip/con-info] 4 commits: Turn on SourceNotes without -g

Matthew Pickering gitlab at gitlab.haskell.org
Thu Nov 26 15:24:59 UTC 2020



Matthew Pickering pushed to branch wip/con-info at Glasgow Haskell Compiler / GHC


Commits:
55da5b4d by Matthew Pickering at 2020-11-26T10:32:59+00:00
Turn on SourceNotes without -g

- - - - -
f57343e5 by Matthew Pickering at 2020-11-26T15:14:38+00:00
release notes

- - - - -
db0274b4 by Matthew Pickering at 2020-11-26T15:14:51+00:00
debug info docs

- - - - -
10d7be01 by Matthew Pickering at 2020-11-26T15:24:51+00:00
Some more comments

- - - - -


4 changed files:

- compiler/GHC/HsToCore/Coverage.hs
- compiler/GHC/Types/IPE.hs
- docs/users_guide/9.2.1-notes.rst
- docs/users_guide/debug-info.rst


Changes:

=====================================
compiler/GHC/HsToCore/Coverage.hs
=====================================
@@ -1044,13 +1044,17 @@ data TickTransEnv = TTE { fileName     :: FastString
 data TickishType = ProfNotes | HpcTicks | Breakpoints | SourceNotes
                  deriving (Eq)
 
+sourceNotesEnabled :: DynFlags -> Bool
+sourceNotesEnabled dflags =
+  (debugLevel dflags > 0) || (gopt Opt_InfoTableMap dflags)
+
 coveragePasses :: DynFlags -> [TickishType]
 coveragePasses dflags =
     ifa (breakpointsEnabled dflags)          Breakpoints $
     ifa (gopt Opt_Hpc dflags)                HpcTicks $
     ifa (sccProfilingEnabled dflags &&
          profAuto dflags /= NoProfAuto)      ProfNotes $
-    ifa (debugLevel dflags > 0)              SourceNotes []
+    ifa (sourceNotesEnabled dflags)          SourceNotes []
   where ifa f x xs | f         = x:xs
                    | otherwise = xs
 


=====================================
compiler/GHC/Types/IPE.hs
=====================================
@@ -11,12 +11,19 @@ import GHC.Types.Unique.Map
 
 -- | A map from a 'Name' to the best approximate source position that
 -- name arose from.
-type ClosureMap = UniqMap
-                                        Name  -- The binding
-                                        (String, RealSrcSpan, String) -- The best approximate source position.
+type ClosureMap = UniqMap Name  -- The binding
+                          (String, RealSrcSpan, String)
+                          -- The best approximate source position.
+                          -- (rendered type, source position, source note
+                          -- label)
 
 -- | A map storing all the different uses of a specific data constructor and the
 -- approximate source position that usage arose from.
+-- The `Int` is an incrementing identifier which distinguishes each usage
+-- of a constructor in a module. It is paired with the source position
+-- the constructor was used at, if possible and a string which names
+-- the source location. This is the same information as is the payload
+-- for the `GHC.Core.SourceNote` constructor.
 type DCMap = UniqMap DataCon [(Int, Maybe (RealSrcSpan, String))]
 
 data InfoTableProvMap = InfoTableProvMap


=====================================
docs/users_guide/9.2.1-notes.rst
=====================================
@@ -46,7 +46,7 @@ Compiler
   also useful with this flag to give each usage of a data constructor its own
   unique info table so they can be distinguished in gdb and heap profiles.
 
-- A new heap profiling mode, :ghc-flag:`-hi`, profile by info table allows for
+- A new heap profiling mode, :rts-flag:`-hi`, profile by info table allows for
   fine-grain banding by the info table address of a closure. The profiling
   mode is intended to be used with :ghc-flag:`-finfo-table-map` and can best
   be consumed with ``eventlog2html``. This profiling mode does not require a


=====================================
docs/users_guide/debug-info.rst
=====================================
@@ -356,8 +356,7 @@ to a source location. This lookup table is generated by using the ``-finfo-table
 
     This flag enables the generation of a table which maps the address of
     an info table to an approximate source position of where that
-    info table statically originated from. You almost certainly want to use this
-    with :ghc-flag:`-g` to improve the accuracy of the source positions. If you
+    info table statically originated from. If you
     also want more precise information about constructor info tables then you
     should also use :ghc-flag:`-fdistinct-constructor-tables`.
 
@@ -375,7 +374,7 @@ to a source location. This lookup table is generated by using the ``-finfo-table
 
     For every usage of a data constructor in the source program
     a new info table will be created. This is useful with
-    :ghc-flag:`-finfo-table-map` and the :ghc-flag:`-hi` profiling mode as
+    :ghc-flag:`-finfo-table-map` and the :rts-flag:`-hi` profiling mode as
     each info table will correspond to the usage of a data constructor rather
     than the data constructor itself.
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/364ceb537a5010bb4bf2c655dbc4f0cf1f00b95b...10d7be0129954b5e44e3d05552a4aa8f9da16fac

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/364ceb537a5010bb4bf2c655dbc4f0cf1f00b95b...10d7be0129954b5e44e3d05552a4aa8f9da16fac
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/20201126/b22a2edd/attachment-0001.html>


More information about the ghc-commits mailing list