ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.HsToCore.Breakpoints

Contents

- ModBreaks
  - Re-exports BreakpointId

Description

Information attached to Breakpoints generated from Ticks

The breakpoint information stored in `ModBreaks` is generated during desugaring from the ticks annotating the source expressions.

This information can be queried per-breakpoint using the `BreakpointId` datatype, which indexes tick-level breakpoint information.

`ModBreaks` and `BreakpointId`s are not to be confused with `InternalModBreaks` and `InternalBreakId`s. The latter are constructed during bytecode generation and can be found in `Breakpoints`.

See Note [ModBreaks vs InternalModBreaks] and Note [Breakpoint identifiers]

Synopsis

- mkModBreaks :: Bool -> Module -> SizedSeq Tick -> ModBreaks
- data ModBreaks = ModBreaks {
  - modBreaks_locs :: !(Array BreakTickIndex SrcSpan)
  - modBreaks_vars :: !(Array BreakTickIndex [OccName])
  - modBreaks_decls :: !(Array BreakTickIndex [String])
  - modBreaks_ccs :: !(Array BreakTickIndex (String, String))
  - modBreaks_module :: !Module
  }
- data BreakpointId = BreakpointId {
  - bi_tick_mod :: !Module
  - bi_tick_index :: !BreakTickIndex
  }
- type BreakTickIndex = Int

# ModBreaks

mkModBreaks #

Arguments

:: Bool | Whether the interpreter is profiled and thus if we should include store a CCS array
-> Module |
-> SizedSeq Tick |
-> ModBreaks |

Initialize memory for breakpoint data that is shared between the bytecode generator and the interpreter.

Since GHCi and the RTS need to interact with breakpoint data and the bytecode generator needs to encode this information for each expression, the data is allocated remotely in GHCi's address space and passed to the codegen as foreign pointers.

data ModBreaks #

All the information about the source-relevant breakpoints for a module

This information is constructed once during desugaring (with `mkModBreaks`) from breakpoint ticks and fixed/unchanged from there on forward. It could be exported as an abstract datatype because it should never be updated after construction, only queried.

The arrays can be indexed using the int in the corresponding `BreakpointId` (i.e. the `BreakpointId` whose `Module` matches the `Module` corresponding to these `ModBreaks`) with the accessors `modBreaks_locs`, `modBreaks_vars`, and `modBreaks_decls`.

Constructors

ModBreaks |

Fields

- modBreaks_locs :: !(Array BreakTickIndex SrcSpan)

  An array giving the source span of each breakpoint.

- modBreaks_vars :: !(Array BreakTickIndex [OccName])

  An array giving the names of the free variables at each breakpoint.

- modBreaks_decls :: !(Array BreakTickIndex [String])

  An array giving the names of the declarations enclosing each breakpoint. See Note [Field modBreaks_decls]

- modBreaks_ccs :: !(Array BreakTickIndex (String, String))

  Array pointing to cost centre info for each breakpoint; actual `CostCentre` allocation is done at link-time.

- modBreaks_module :: !Module

  The module to which this ModBreaks is associated. We also cache this here for internal sanity checks.

## Re-exports BreakpointId

data BreakpointId #

Breakpoint identifier.

Indexes into the structures in the ``ModBreaks`` created during desugaring (after inserting the breakpoint ticks in the expressions). See Note [Breakpoint identifiers]

Constructors

BreakpointId |

Fields

- bi_tick_mod :: !Module

  Breakpoint tick module

- bi_tick_index :: !BreakTickIndex

  Breakpoint tick index

#### Instances

Instances details

NFData BreakpointId # |
Instance details Defined in GHC.Types.Tickish Methods rnf :: BreakpointId -> () #
Data BreakpointId # |

Instance details

Defined in GHC.Types.Tickish

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BreakpointId -> c BreakpointId #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BreakpointId #

toConstr :: BreakpointId -> Constr #

dataTypeOf :: BreakpointId -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BreakpointId) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BreakpointId) #

gmapT :: (forall b. Data b => b -> b) -> BreakpointId -> BreakpointId #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BreakpointId -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BreakpointId -> r #

gmapQ :: (forall d. Data d => d -> u) -> BreakpointId -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> BreakpointId -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> BreakpointId -> m BreakpointId #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BreakpointId -> m BreakpointId #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BreakpointId -> m BreakpointId #

Outputable BreakpointId # |
Instance details Defined in GHC.Types.Tickish Methods ppr :: BreakpointId -> SDoc #
Eq BreakpointId # |
Instance details Defined in GHC.Types.Tickish Methods (==) :: BreakpointId -> BreakpointId -> Bool # (/=) :: BreakpointId -> BreakpointId -> Bool #
Ord BreakpointId # |

Instance details

Defined in GHC.Types.Tickish

Methods

compare :: BreakpointId -> BreakpointId -> Ordering #

(<) :: BreakpointId -> BreakpointId -> Bool #

(<=) :: BreakpointId -> BreakpointId -> Bool #

(>) :: BreakpointId -> BreakpointId -> Bool #

(>=) :: BreakpointId -> BreakpointId -> Bool #

max :: BreakpointId -> BreakpointId -> BreakpointId #

min :: BreakpointId -> BreakpointId -> BreakpointId #

type BreakTickIndex = Int #

Breakpoint tick index newtype BreakTickIndex = BreakTickIndex Int deriving (Eq, Ord, Data, Ix, NFData, Outputable)