diff options
author | Ben Gamari <ben@smart-cactus.org> | 2016-11-30 10:54:45 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-11-30 10:56:10 -0500 |
commit | e2330b6dde805a5507898c3c4ddf38599df969da (patch) | |
tree | d52c52b99f510553b2d1733d006747d75be68a6d /docs | |
parent | 03766cdbd26855e50719bd8ffcaf19898bd33f16 (diff) | |
download | haskell-e2330b6dde805a5507898c3c4ddf38599df969da.tar.gz |
Revert "Make globals use sharedCAF"
This reverts commit 6f7ed1e51bf360621a3c2a447045ab3012f68575 due to breakage of
the build on Windows.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/extending_ghc.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/users_guide/extending_ghc.rst b/docs/users_guide/extending_ghc.rst index c02c93fac1..17d061ec3e 100644 --- a/docs/users_guide/extending_ghc.rst +++ b/docs/users_guide/extending_ghc.rst @@ -305,6 +305,7 @@ just returns the original compilation pipeline, unmodified, and says install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo] install _ todo = do + reinitializeGlobals putMsgS "Hello!" return todo @@ -313,6 +314,16 @@ cabal for instance,) you can then use it by just specifying ``-fplugin=DoNothing.Plugin`` on the command line, and during the compilation you should see GHC say 'Hello'. +Note carefully the ``reinitializeGlobals`` call at the beginning of the +installation function. Due to bugs in the windows linker dealing with +``libghc``, this call is necessary to properly ensure compiler plugins +have the same global state as GHC at the time of invocation. Without +``reinitializeGlobals``, compiler plugins can crash at runtime because +they may require state that hasn't otherwise been initialized. + +In the future, when the linking bugs are fixed, ``reinitializeGlobals`` +will be deprecated with a warning, and changed to do nothing. + .. _core-plugins-in-more-detail: Core plugins in more detail @@ -385,6 +396,7 @@ in a module it compiles: install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo] install _ todo = do + reinitializeGlobals return (CoreDoPluginPass "Say name" pass : todo) pass :: ModGuts -> CoreM ModGuts @@ -434,6 +446,7 @@ will print out the name of any top-level non-recursive binding with the install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo] install _ todo = do + reinitializeGlobals return (CoreDoPluginPass "Say name" pass : todo) pass :: ModGuts -> CoreM ModGuts |