[commit: ghc] supercompiler: Make the speculation flag work properly (f2b4a3f)

Max Bolingbroke <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : supercompiler

http://hackage.haskell.org/trac/ghc/changeset/f2b4a3f7bfbbb51d927b61ec7251ba387132e385

>---------------------------------------------------------------

commit f2b4a3f7bfbbb51d927b61ec7251ba387132e385
Author: Max Bolingbroke <[email protected]>
Date:   Fri Nov 16 14:10:56 2012 +0000

    Make the speculation flag work properly

>---------------------------------------------------------------

 .../supercompile/Supercompile/Drive/Process.hs     |    3 ++-
 .../supercompile/Supercompile/Drive/Process1.hs    |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/compiler/supercompile/Supercompile/Drive/Process.hs b/compiler/supercompile/Supercompile/Drive/Process.hs
index 5f9dcbd..c7727b0 100644
--- a/compiler/supercompile/Supercompile/Drive/Process.hs
+++ b/compiler/supercompile/Supercompile/Drive/Process.hs
@@ -696,7 +696,8 @@ nothingSpeculated = S.empty
 -- FIXME: if I speculate roughly in dependency order then GHCs inlining heuristics will have more information
 -- to work with in the reduce invocations
 speculate :: AlreadySpeculated -> (SCStats, State) -> (AlreadySpeculated, (SCStats, State))
-speculate speculated (stats, (deeds, heap, k, in_e)) = (speculated', (stats', (deeds', heap', k, in_e)))
+speculate speculated (stats, state) | not sPECULATION = (speculated,  (stats, state))
+speculate speculated (stats, (deeds, heap, k, in_e))  = (speculated', (stats', (deeds', heap', k, in_e)))
   where (speculated', (stats', deeds', heap')) = speculateHeap speculated (stats, deeds, heap)
 
 --type SpecRB = SpecHistory -> SpecM (SpecHistory, Deeds, Heap)
diff --git a/compiler/supercompile/Supercompile/Drive/Process1.hs b/compiler/supercompile/Supercompile/Drive/Process1.hs
index 09cb6b2..323b0ae 100644
--- a/compiler/supercompile/Supercompile/Drive/Process1.hs
+++ b/compiler/supercompile/Supercompile/Drive/Process1.hs
@@ -454,7 +454,7 @@ sc' hist speculated state = handlePrint $ (\raise -> check raise) `catchScpM` \g
     continue hist = do traceRenderScpM "reduce end (continue)" (PrettyDoc (pPrintFullState quietStatePrettiness state'))
                        addStats stats
                        liftM (\(_, deeds, e') -> (deeds, e')) $ split state' (liftPB . sc hist speculated')
-      where (speculated', (stats, state')) = (if sPECULATION then speculate speculated else ((,) speculated)) $ reduceWithStats state -- TODO: experiment with doing admissability-generalisation on reduced terms. My suspicion is that it won't help, though (such terms are already stuck or non-stuck but loopy: throwing stuff away does not necessarily remove loopiness).
+      where (speculated', (stats, state')) = speculate speculated $ reduceWithStats state -- TODO: experiment with doing admissability-generalisation on reduced terms. My suspicion is that it won't help, though (such terms are already stuck or non-stuck but loopy: throwing stuff away does not necessarily remove loopiness).
 
 memo :: (AlreadySpeculated -> State -> ScpBM (Deeds, Out FVedTerm))
      ->  AlreadySpeculated -> State -> ScpPM (Deeds, Out FVedTerm)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.