compiler: Store ForeignStubs and foreign C files in interfaces
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
Showing
- compiler/GHC/Cmm/CLabel.hs 43 additions, 1 deletioncompiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Driver/Main.hs 54 additions, 35 deletionscompiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Pipeline.hs 6 additions, 7 deletionscompiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Pipeline/Execute.hs 14 additions, 10 deletionscompiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/HsToCore/Usage.hs 1 addition, 1 deletioncompiler/GHC/HsToCore/Usage.hs
- compiler/GHC/Iface/Make.hs 9 additions, 4 deletionscompiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Recomp.hs 3 additions, 1 deletioncompiler/GHC/Iface/Recomp.hs
- compiler/GHC/IfaceToCore.hs 3 additions, 3 deletionscompiler/GHC/IfaceToCore.hs
- compiler/GHC/Linker/Deps.hs 5 additions, 3 deletionscompiler/GHC/Linker/Deps.hs
- compiler/GHC/Linker/Loader.hs 7 additions, 12 deletionscompiler/GHC/Linker/Loader.hs
- compiler/GHC/Linker/Types.hs 101 additions, 20 deletionscompiler/GHC/Linker/Types.hs
- compiler/GHC/Unit/Finder.hs 2 additions, 1 deletioncompiler/GHC/Unit/Finder.hs
- compiler/GHC/Unit/Module/ModIface.hs 26 additions, 4 deletionscompiler/GHC/Unit/Module/ModIface.hs
- compiler/GHC/Unit/Module/WholeCoreBindings.hs 399 additions, 2 deletionscompiler/GHC/Unit/Module/WholeCoreBindings.hs
- testsuite/tests/bytecode/T24634/Hello.hs 7 additions, 2 deletionstestsuite/tests/bytecode/T24634/Hello.hs
- testsuite/tests/bytecode/T24634/Makefile 12 additions, 4 deletionstestsuite/tests/bytecode/T24634/Makefile
- testsuite/tests/bytecode/T24634/T24634a.stdout 3 additions, 0 deletionstestsuite/tests/bytecode/T24634/T24634a.stdout
- testsuite/tests/bytecode/T24634/T24634b.stdout 4 additions, 0 deletionstestsuite/tests/bytecode/T24634/T24634b.stdout
- testsuite/tests/bytecode/T24634/all.T 9 additions, 5 deletionstestsuite/tests/bytecode/T24634/all.T
- testsuite/tests/bytecode/T24634/hello_c.c 1 addition, 1 deletiontestsuite/tests/bytecode/T24634/hello_c.c
Loading
Please register or sign in to comment