[GHC] #3372: Allow for multiple linker instances

GHC ghc-devs at haskell.org
Wed Jan 30 02:10:21 UTC 2019


#3372: Allow for multiple linker instances
-------------------------------------+-------------------------------------
        Reporter:  jcpetruzza        |                Owner:
                                     |  JulianLeviston
            Type:  feature request   |               Status:  new
        Priority:  low               |            Milestone:
       Component:  Runtime System    |              Version:
  (Linker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:  3658              |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by JulianLeviston):

 This is my plan so far:

 - add `DynLinker` `newtype` and use feed it into all the functions where
 we used to use the `v_PersistentLinkerState` global `IORef` state
 - rewrite `modifyPLS` and `modifyPLS_` to work with the passed-in
 `DynLinker` `IORef` value rather than the global
 - survey all the places where we've added `DynLinker` as an argument (in
 1st *or* 2nd pos)
   extendLoadedPkgs -
   extendLinkEnv -
   deleteFromLinkEnv -
   getHValue -
   withExtendedLinkEnv -
   initDynLinker -
   reallyInitDynLinker -
   linkCmdLineLibs -
   linkExpr -
   linkDecls -
   linkModule -
   unload -
   linkPackages -
 - refactor all the surveyed call sites such that they're also passing now
 the DynLinker argument
 - rewrite initDynLinker as per wiki
 - rewrite withLinkerState as per wiki (this is just old modifyPLS,
 basically...)
 - rewrite readPLS to be passed DynLinker and refactor its sole call-site
 - rewrite modifyMbPLS_ so it works with DynLinker
 - try compiling and fix any errors
 - write a test

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/3372#comment:24>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list