Skip to content
  • Cheng Shao's avatar
    2bb1e8df
    Link bytecode from interface-stored core bindings in oneshot mode · 2bb1e8df
    Cheng Shao authored and Marge Bot's avatar Marge Bot committed
    !13042
    
    Part of #T25090
    
    If the flag `-fprefer-byte-code` is given when compiling a module
    containing TH, GHC will use Core bindings stored in interfaces to
    compile and link bytecode for splices.
    
    This was only implemented for `--make` mode initially, so this commit
    adds the same mechanism to oneshot mode (`-c`).
    
    When an interface is loaded into the EPS in `loadInterface` that has
    dehydrated Core bindings, an entry is added to the new field
    `eps_iface_bytecode`, containing an IO action that produces a bytecode
    `Linkable`, lazily processing the `mi_extra_decls` by calling
    `loadIfaceByteCode`.
    
    When Template Haskell dependencies are resolved in `getLinkDeps`, this
    action is looked up after loading a module's interface.
    If it exists, the action is evaluated and the bytecode is added to the
    set of `Linkable`s used for execution of the splice; otherwise it falls
    back on the traditional object file.
    
    Metric Decrease:
        MultiLayerModules
        T13701
    2bb1e8df
    Link bytecode from interface-stored core bindings in oneshot mode
    Cheng Shao authored and Marge Bot's avatar Marge Bot committed
    !13042
    
    Part of #T25090
    
    If the flag `-fprefer-byte-code` is given when compiling a module
    containing TH, GHC will use Core bindings stored in interfaces to
    compile and link bytecode for splices.
    
    This was only implemented for `--make` mode initially, so this commit
    adds the same mechanism to oneshot mode (`-c`).
    
    When an interface is loaded into the EPS in `loadInterface` that has
    dehydrated Core bindings, an entry is added to the new field
    `eps_iface_bytecode`, containing an IO action that produces a bytecode
    `Linkable`, lazily processing the `mi_extra_decls` by calling
    `loadIfaceByteCode`.
    
    When Template Haskell dependencies are resolved in `getLinkDeps`, this
    action is looked up after loading a module's interface.
    If it exists, the action is evaluated and the bytecode is added to the
    set of `Linkable`s used for execution of the splice; otherwise it falls
    back on the traditional object file.
    
    Metric Decrease:
        MultiLayerModules
        T13701
Loading