Andreas Klebinger pushed to branch wip/andreask/build-opt at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Hs/Instances.hs-boot
    ... ... @@ -2,35 +2,8 @@
    2 2
     {-# LANGUAGE UndecidableInstances #-}
    
    3 3
     {-# OPTIONS_GHC -fno-warn-orphans #-}
    
    4 4
     
    
    5
    --- This module contains exclusively Data instances, which are going to be slow
    
    6
    --- no matter what we do. Furthermore, they are incredibly slow to compile with
    
    7
    --- optimisation (see #9557). Consequently we compile this with -O0.
    
    8
    --- See #18254.
    
    9
    -
    
    10 5
     module GHC.Hs.Instances where
    
    11 6
     
    
    12
    --- This module defines the Data instances for the hsSyn AST.
    
    13
    -
    
    14
    --- It happens here to avoid massive constraint types on the AST with concomitant
    
    15
    --- slow GHC bootstrap times.
    
    16
    -
    
    17
    --- UndecidableInstances ?
    
    18
    -
    
    19
    -{- Note [Data.Data instances for GHC AST Types]
    
    20
    -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    21
    -We give all of the frontend types and their instantiations (HsSyn) and
    
    22
    -some other types Data.Data instances. There are two main motivations to
    
    23
    -do so:
    
    24
    -
    
    25
    -* For users of the GHC API it allows to write Generic code over the GHC AST.
    
    26
    -* GHC itself has a few uses of these as well:
    
    27
    -    * In the showAstData, showAstDataFull helpers to print a representation of
    
    28
    -      the actual AST using it's constructors rather than just user facing pretty printing.
    
    29
    -    * It's used to some degree for HIE file generation in the ToHIE instances.
    
    30
    -    * TH serialization uses it for serialization of Annotations (GHC.Serialized)
    
    31
    -    * Some of the dump flags use showAstData to produce the actual dump output.
    
    32
    --}
    
    33
    -
    
    34 7
     {- Note [hs-boot files as "header" files]
    
    35 8
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    36 9
     We can use hs-boot files like C header files to unlock parallel
    
    ... ... @@ -64,8 +37,10 @@ inlining things from TakesForever.hs or needs to know the exact representation o
    64 37
     types for unboxing or similar this trick will do more harm than good.
    
    65 38
     
    
    66 39
     For GHC itself we can figure out where it makes sense to insert such "header" boot
    
    67
    -files by looking at a build profile and look for places where the build sequentializes
    
    68
    -to one or two concurrent GHC invocations.
    
    40
    +files by looking at a build profile generated by shake.
    
    41
    +They can be generated via `--profile=report.trace` and looking for places where
    
    42
    +the build sequentializes to one or two concurrent GHC invocations is visually
    
    43
    +pretty obvious in those cases.
    
    69 44
     -}
    
    70 45
     
    
    71 46
     import Data.Data hiding ( Fixity )