#3843: Merge plugins into HEAD
---------------------------------+------------------------------------------
Reporter: dreixel | Owner: simonpj
Type: task | Status: new
Priority: normal | Milestone: 7.2.1
Component: Compiler | Version: 6.13
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by simonpj):
OK I have pushed a patch to HEAD. My starting point was Austin's patch,
in turn based on Max's work, but needless to say I did some refactoring.
Mainly, I simplified it. For example, instead of three constructors for
the plugin pass (corresponding to different interfaces), there is one, of
type `ModGuts -> CoreM ModGuts`, plus some impedence matching functions.
I also used fewer different modules, and removed module loops. I made a
quck test of the result with the CSE pass above (changed a bit to match
the new API).
So, '''Austin, could I ask you to do the final bits?'''
* Add some words to the user manual to describe the new capability. This
can be relatively brief reference material; point to the wiki for examples
and further elaboration.
* Update the wiki page to accurately reflect the final version.
Presumably [wiki:NewPlugins]
* Add at least one test to the testsuite. (Should test the flag-passing
mechamism.)
Many thanks.
{{{
commit 592def09c4f87f517b31aa4c4cec51fc8764a859
Author: Simon Peyton Jones <[email protected]>
Date: Thu Jun 16 17:22:47 2011 +0100
Add dynamically-linked plugins (see Trac #3843)
This patch was originally developed by Max Bolingbroke, and worked on
further by Austin Seipp. It allows you to write a Core-to-Core pass
and have it dynamically linked into an otherwise-unmodified GHC, and
run at a place you specify in the Core optimisation pipeline.
Main components:
- CoreMonad: new types Plugin, PluginPass
plus a new constructor CoreDoPluginPass in CoreToDo
- SimplCore: stuff to dynamically load any plugins, splice
them into the core-to-core pipeline, and invoke them
- Move "getCoreToDo :: DynFlags -> [CoreToDo]"
which constructs the main core-to-core pipeline
from CoreMonad to SimplCore
SimplCore is the driver for the optimisation pipeline, and it
makes more sense to have the pipeline construction in the driver
not in the infrastructure module.
- New module DynamicLoading: invoked by SimplCore to load any
plugins
Some consequential changes in Linker.
- New module GhcPlugins: this should be imported by plugin modules;
it
it not used by GHC itself.
compiler/basicTypes/Module.lhs | 4 +-
compiler/ghc.cabal.in | 2 +
compiler/ghci/Linker.lhs | 41 +++++-
compiler/main/DynFlags.hs | 23 +++
compiler/main/DynamicLoading.hs | 150 +++++++++++++++++++
compiler/main/GhcPlugins.hs | 83 +++++++++++
compiler/prelude/PrelNames.lhs | 18 +++
compiler/simplCore/CoreMonad.lhs | 261
+++++++++-------------------------
compiler/simplCore/SimplCore.lhs | 294
++++++++++++++++++++++++++++++++++++--
9 files changed, 665 insertions(+), 211 deletions(-)
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3843#comment:25>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs