Skip to content

Commit b98acdf

Browse files
author
doyougnu
committed
sphinx: fix warnings
In particular: - warning about extlinks in sphinx 6.0 - warning about duplicate targets for weigh, and wiki - warning about glossary not included in toctree - underline warning in ordering constructors
1 parent f21166d commit b98acdf

File tree

9 files changed

+48
-43
lines changed

9 files changed

+48
-43
lines changed

conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@
5454
todo_link_only = False
5555
autosectionlabel_prefix_document = True
5656

57-
extlinks = {'userGuide': ('https://downloads.haskell.org/~ghc/9.2.4/docs/html/users_guide/%s', '')}
57+
## global links in the book that share a prefix that we've named.
58+
extlinks = {'userGuide': ('https://downloads.haskell.org/~ghc/9.2.4/docs/html/users_guide/%s', '%s'),
59+
'ghcWiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', '#%s'),
60+
}
5861

5962
# prolog for colored text
6063
rst_prolog = """

contents.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ Haskell Optimization Handbook
2121
Indices and tables
2222
==================
2323

24+
.. toctree::
25+
:hidden:
26+
27+
src/glossary
28+
2429
* :ref:`genindex`
2530
* :ref:`search`
2631
* :ref:`glossary`

src/Measurement_Observation/Heap_Ghc/eventlog.rst

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@
88
Eventlog
99
========
1010

11-
`Eventlog
12-
<https://downloads.haskell.org/ghc/latest/docs/users_guide/runtime_control.html#rts-eventlog>`_
13-
is a GHC runtime system feature that logs events at runtime of a compiled
14-
program. It provides runtime information on the heap, the garbage collector, the
15-
scheduler, and arbitrary events that a user inserts into their own code.
16-
Eventlog is a versatile profiling tool, and should be one of the first tools in
17-
the profiling toolbox you reach for. Use eventlog when you are just beginning to
18-
diagnose the problem and are gathering data. Specifically when you want to
19-
inspect the heap or some other subsystem, such as the garbage collector. This
20-
chapter walks through using eventlog to inspect a small program that suffers
21-
from :ref:`Excessive Pointer Chasing`. By the end of the chapter you should
11+
:userGuide:`Eventlog <runtime_control.html#rts-eventlog>` is a GHC runtime
12+
system feature that logs events at runtime of a compiled program. It provides
13+
runtime information on the heap, the garbage collector, the scheduler, and
14+
arbitrary events that a user inserts into their own code. Eventlog is a
15+
versatile profiling tool, and should be one of the first tools in the profiling
16+
toolbox you reach for. Use eventlog when you are just beginning to diagnose the
17+
problem and are gathering data. Specifically when you want to inspect the heap
18+
or some other subsystem, such as the garbage collector. This chapter walks
19+
through using eventlog to inspect a small program that suffers from
20+
:ref:`Excessive Pointer Chasing <canonical-pointer-chasing>`. By the end of the chapter you should
2221
understand:
2322

2423
#. What information can you retrieve by using eventlog.
@@ -56,15 +55,15 @@ define and track their own events using the base functions `traceEvent
5655
When should I use Eventlog
5756
--------------------------
5857

59-
Eventlog is most useful when you need to :ref:`Characterize the Problem`. It
60-
yields runtime information on the specific subsystems the program relies on.
61-
Thus, it allows you to drill down into the behavior of the garbage collector,
62-
the scheduler, the heap and so. For example, using the flag ``+RTS -lg`` you can
63-
collect the ``CONC_MARK_BEGIN`` and ``CONC_MARK_END`` events which log the
64-
beginning and end of the concurrent garbage collectors marking phase. Similarly,
65-
you can collect ``MEM_RETURN`` which provides information about the current
66-
allocation of megablocks, attempts to return them to the operating system, and
67-
heap fragmentation.
58+
Eventlog is most useful when you need to :ref:`Characterize the Problem
59+
<characterize-the-problem>`. It yields runtime information on the specific
60+
subsystems the program relies on. Thus, it allows you to drill down into the
61+
behavior of the garbage collector, the scheduler, the heap and so. For example,
62+
using the flag ``+RTS -lg`` you can collect the ``CONC_MARK_BEGIN`` and
63+
``CONC_MARK_END`` events which log the beginning and end of the concurrent
64+
garbage collectors marking phase. Similarly, you can collect ``MEM_RETURN``
65+
which provides information about the current allocation of megablocks, attempts
66+
to return them to the operating system, and heap fragmentation.
6867

6968

7069
The Running Example

src/Measurement_Observation/Measurement_Libs/weigh.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _Weigh:
1+
.. _Weigh Chapter:
22

33
`Weigh`
44
=======
@@ -175,8 +175,8 @@ output from weigh:
175175
Foo2 336 0
176176
Benchmark weigh: FINISH
177177
178-
Notice that built in types such as ``()`` and ``True`` do not do any
179-
allocation. This is because these types are `wired-in
178+
Notice that built in types such as ``()`` and ``True`` do not do any allocation.
179+
This is because these types are `wired-in
180180
<https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/wired-in>`_ to
181181
GHC, which means that there is a single shared ``()`` in GHC, so our call to
182182
``value "()" ()`` performs no allocation because it references the shared

src/Measurement_Observation/the_recipe.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ definition we present them here instead of in the :ref:`glossary`:
4646
program which constitutes *normal operation*. This is how you know you have a
4747
problem.
4848

49+
.. _characterize-the-problem:
4950

5051
Characterize the Problem
5152
------------------------
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _Ordering Constructors Chapter:
22

33
:lightgrey:`Ordering Data Constructors`
4-
======================================
4+
=======================================
55

66
`TODO <https://github.com/input-output-hk/hs-opt-handbook.github.io/issues/47>`_

src/Optimizations/GHC_opt/lambda_lifting.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ hypothetical heap allocations a function will induce. GHC lists heuristics for
8383
when *not* to lambda lift in `Note [When to lift]
8484
<https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Stg/Lift/Analysis.hs#L46>`_
8585
, we repeat the basic ideas here. See :cite:t:`selectiveLambdaLifting`, and the
86-
`lambda lifting wiki
87-
<https://gitlab.haskell.org/ghc/ghc/-/wikis/late-lam-lift>`_ entry for more
88-
details.
86+
:ghcWiki:`lambda lifting wiki <late-lam-lift>` entry for more details.
8987

9088
GHC does not lambda lift:
9189

src/Optimizations/GHC_tech/ghc_flags.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. GHC Flags
1+
.. _GHC Flags:
22

33
:lightgrey:`GHC Flags`
44
======================

src/glossary.rst

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ Glossary
139139
Every heap allocated object in the runtime system keeps an information
140140
table that stores data such as: the object type (function, data
141141
constructor, thunk etc.) before the payload of the object. This is called
142-
the info table. See :cite:t:`pointerTaggingLaziness` and the `wiki
143-
<https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/rts/storage/heap-objects#info-tables>`_
144-
for more details.
142+
the info table. See :cite:t:`pointerTaggingLaziness` and the
143+
:ghcWiki:`wiki <commentary/rts/storage/heap-objects#info-tables>` for more
144+
details.
145145

146146
Join Point : Optimization
147147

@@ -167,15 +167,15 @@ Glossary
167167
avoid these problems and are particularly relevant for Stream
168168
:term:`Fusion` performance.
169169

170-
Known Function
170+
Known Function
171171

172-
A known function is a function in the STG machine of which GHC statically
173-
knows the :term:`Entry Code` pointer and the :term:`Arity` of. This means
174-
that the function binding site is statically visible, that is, the
175-
function is :term:`Top-Level`, or the function is bound by an enclosing
176-
``let``. With this information the STG machine can use a faster function
177-
application procedure because the function pointer does not need to be
178-
scrutinized. See also :term:`Unknown Function`.
172+
A known function is a function in the STG machine of which GHC statically
173+
knows the :term:`Entry Code` pointer and the :term:`Arity` of. This means
174+
that the function binding site is statically visible, that is, the
175+
function is :term:`Top-Level`, or the function is bound by an enclosing
176+
``let``. With this information the STG machine can use a faster function
177+
application procedure because the function pointer does not need to be
178+
scrutinized. See also :term:`Unknown Function`.
179179

180180

181181
Levity Polymorphism
@@ -205,9 +205,8 @@ Glossary
205205
closure that represents a function applied to *too few* arguments. PAPs
206206
should never be entered, and are only applied using the generic apply
207207
functions in the STG machine. See the file ``rts/Apply.cmm`` in GHC or the
208-
`heap object
209-
<https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/rts/storage/heap-objects>`_
210-
wiki page for more.
208+
:ghcWiki:`heap object <commentary/rts/storage/heap-objects>` wiki page for
209+
more.
211210

212211
Pinned : Memory
213212

0 commit comments

Comments
 (0)