Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
Source project has a limited visibility.
  • Cheng Shao's avatar
    821d0a9a
    compiler: Store ForeignStubs and foreign C files in interfaces · 821d0a9a
    Cheng Shao authored and Marge Bot's avatar Marge Bot committed
    This data is used alongside Core bindings to reconstruct intermediate
    build products when linking Template Haskell splices with bytecode.
    
    Since foreign stubs and files are generated in the pipeline, they were
    lost with only Core bindings stored in interfaces.
    
    The interface codec type `IfaceForeign` contains a simplified
    representation of `ForeignStubs` and the set of foreign sources that
    were manually added by the user.
    
    When the backend phase writes an interface, `mkFullIface` calls
    `encodeIfaceForeign` to read foreign source file contents and assemble
    `IfaceForeign`.
    
    After the recompilation status check of an upstream module,
    `initWholeCoreBindings` calls `decodeIfaceForeign` to restore
    `ForeignStubs` and write the contents of foreign sources to the file
    system as temporary files.
    The restored foreign inputs are then processed by `hscInteractive` in
    the same manner as in a regular pipeline.
    
    When linking the stub objects for splices, they are excluded from suffix
    adjustment for the interpreter way through a new flag in `Unlinked`.
    
    For details about these processes, please consult Note [Foreign stubs
    and TH bytecode linking].
    
    Metric Decrease:
        T13701
    821d0a9a
    History
    compiler: Store ForeignStubs and foreign C files in interfaces
    Cheng Shao authored and Marge Bot's avatar Marge Bot committed
    This data is used alongside Core bindings to reconstruct intermediate
    build products when linking Template Haskell splices with bytecode.
    
    Since foreign stubs and files are generated in the pipeline, they were
    lost with only Core bindings stored in interfaces.
    
    The interface codec type `IfaceForeign` contains a simplified
    representation of `ForeignStubs` and the set of foreign sources that
    were manually added by the user.
    
    When the backend phase writes an interface, `mkFullIface` calls
    `encodeIfaceForeign` to read foreign source file contents and assemble
    `IfaceForeign`.
    
    After the recompilation status check of an upstream module,
    `initWholeCoreBindings` calls `decodeIfaceForeign` to restore
    `ForeignStubs` and write the contents of foreign sources to the file
    system as temporary files.
    The restored foreign inputs are then processed by `hscInteractive` in
    the same manner as in a regular pipeline.
    
    When linking the stub objects for splices, they are excluded from suffix
    adjustment for the interpreter way through a new flag in `Unlinked`.
    
    For details about these processes, please consult Note [Foreign stubs
    and TH bytecode linking].
    
    Metric Decrease:
        T13701
Code owners
Assign users and groups as approvers for specific file changes. Learn more.