[GHC] #14090: Static pointers are not being registered under certain conditions

GHC ghc-devs at haskell.org
Sat Aug 19 01:37:22 UTC 2017


#14090: Static pointers are not being registered under certain conditions
-------------------------------------+-------------------------------------
        Reporter:  mnislaih          |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3843
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by facundo.dominguez):

 I know of three ways to accomplish it in ghc-8.2.1 without the SPT.

 1. Use {{{addForeignFile}}} and {{{addTopDecls}}} to make the bytecode
 available via a foreign import.
 https://gist.github.com/facundominguez/82f6768e1f4d5fbfecf008115226a484

 2. Use {{{addForeignFile}}} to insert a constructor function in the module
 to initialize a global bytecode table when the module is loaded.
 https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-
 constructor-function-attribute

 3. Like (2), but instead of using {{{addForeignFile}}} to insert the
 constructor function, use a GHC plugin to inject it. This is the approach
 that inline-java uses in the latest version in the repo.
 https://github.com/tweag/inline-
 java/blob/6c4aa0e94a4952ce91a498d2b64198a5e158ee57/src/Language/Java/Inline/Plugin.hs#L73

 (3) works with 8.0.2 as well.

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


More information about the ghc-tickets mailing list