1. 17 Apr, 2007 2 commits
    • Simon Marlow's avatar
      2aeabd26
    • Simon Marlow's avatar
      Re-working of the breakpoint support · cdce6477
      Simon Marlow authored
      This is the result of Bernie Pope's internship work at MSR Cambridge,
      with some subsequent improvements by me.  The main plan was to
      
       (a) Reduce the overhead for breakpoints, so we could enable 
           the feature by default without incurrent a significant penalty
       (b) Scatter more breakpoint sites throughout the code
      
      Currently we can set a breakpoint on almost any subexpression, and the
      overhead is around 1.5x slower than normal GHCi.  I hope to be able to
      get this down further and/or allow breakpoints to be turned off.
      
      This patch also fixes up :print following the recent changes to
      constructor info tables.  (most of the :print tests now pass)
      
      We now support single-stepping, which just enables all breakpoints.
      
        :step <expr>     executes <expr> with single-stepping turned on
        :step            single-steps from the current breakpoint
      
      The mechanism is quite different to the previous implementation.  We
      share code with the HPC (haskell program coverage) implementation now.
      The coverage pass annotates source code with "tick" locations which
      are tracked by the coverage tool.  In GHCi, each "tick" becomes a
      potential breakpoint location.
      
      Previously breakpoints were compiled into code that magically invoked
      a nested instance of GHCi.  Now, a breakpoint causes the current
      thread to block and control is returned to GHCi.
      
      See the wiki page for more details and the current ToDo list:
      
        http://hackage.haskell.org/trac/ghc/wiki/NewGhciDebugger
      cdce6477
  2. 16 Apr, 2007 1 commit
  3. 11 Apr, 2007 1 commit
    • Simon Marlow's avatar
      Rationalise GhcMode, HscTarget and GhcLink · 3c22606b
      Simon Marlow authored
      This patch cleans up the GHC API, and adds some functionality: we can
      now compile to object code inside GHCi.
      
      Previously we had:
      
        data GhcMode
          = BatchCompile
          | Interactive
          | OneShot
          | JustTypecheck
          | MkDepend
        
        data HscTarget
          = HscC
          | HscAsm
          | HscJava
          | HscInterpreted
          | HscNothing
      
      There was redundancy here; if GhcMode is Interactive, then only
      HscInterpreted makes sense, and JustTypecheck required HscNothing.
      Now we have:
      
        data GhcMode
          = CompManager       -- ^ --make, GHCi, etc.
          | OneShot           -- ^ ghc -c Foo.hs
          | MkDepend          -- ^ ghc -M, see Finder for why we need this
      
      and HscTarget remains as before.
      
      Previously GhcLink looked like this:
      
        data GhcLink = NoLink | StaticLink
      
      Now we have:
      
        data GhcLink = NoLink | LinkBinary | LinkInMemory
      
      The idea being that you can have an HscTarget of HscAsm (for example)
      and still link in memory.
      
      There are two new flags:
      
        -fobject-code selects object code as the target (selects
                      either -fasm or -fvia-C, whichever is the default)
                      This can be usd with ':set' in GHCi, or on the command line.
      
        -fbyte-code   sets byte-code as the target.  Only works in GHCi.
                      One day maybe this could save the byte code in a file
                      when used outside GHCi.
      
        (names chosen for consistency with -fno-code).
      
      Changes to the GHC API: newSession no longer takes the GhcMode
      argument.  The GhcMode defaults to CompManager, which is usually what
      you want.  To do JustTypecheck now, just set hscTarget to HscNothing.
      3c22606b
  4. 02 Apr, 2007 1 commit
  5. 30 Mar, 2007 1 commit
    • simonpj@microsoft.com's avatar
      The ru_local field of a CoreRule is False for implicit Ids · ec81fdde
      simonpj@microsoft.com authored
      	MERGE to 6.6.1
      
      For class-ops, record selectors, data constructors, we want the ru_local
      field of the Rule to be False.  We do not attach the rule to the binding
      for the Id, because there simply isn't a binding until the code gen stage.
      
      (NB: the ru_local field is different to the orphan-hood of the rule.)
      
      This fixes a bug that meant that RULES on class ops were never exported.
      ec81fdde
  6. 23 Mar, 2007 1 commit
  7. 16 Mar, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Desugar applications of 'seq' specially; fix Trac #1031 · 3bdbcf16
      simonpj@microsoft.com authored
      Merge to 6.6 branch.  Test case is dsrun014.
      
      Note [Desugaring seq]  cf Trac #1031
      ~~~~~~~~~~~~~~~~~~~~~
         f x y = x `seq` (y `seq` (# x,y #))
      
      The [CoreSyn let/app invariant] means that, other things being equal, because 
      the argument to the outer 'seq' has an unlifted type, we'll use call-by-value thus:
      
         f x y = case (y `seq` (# x,y #)) of v -> x `seq` v
      
      But that is bad for two reasons: 
        (a) we now evaluate y before x, and 
        (b) we can't bind v to an unboxed pair
      
      Seq is very, very special!  So we recognise it right here, and desugar to
      	case x of _ -> case y of _ -> (# x,y #)
      
      The special case would be valid for all calls to 'seq', but it's only *necessary*
      for ones whose second argument has an unlifted type. So we only catch the latter
      case here, to avoid unnecessary tests.
      3bdbcf16
  8. 23 Feb, 2007 1 commit
  9. 22 Feb, 2007 1 commit
    • mnislaih's avatar
      Unbreak HEAD · 2c634afb
      mnislaih authored
      My previous patch was creating problems with hs-boot files. 
      2c634afb
  10. 11 Jan, 2007 1 commit
  11. 21 Feb, 2007 2 commits
    • mnislaih's avatar
      Improving the performance of breakpoints up to 50% (by playing with laziness) · 2bbec92e
      mnislaih authored
      This patch performs several optimizations with the goal of minimizing the cost of building the arguments to breakpointJump:
        - Group them all in a single tuple, to minimize closure creation in heap
        - Wrap this with the GHC.Base.lazy combinator, to induce max laziness
        - Remove as many literal strings as possible 
          * injecting a module-local CAF to store the module name and use that 
          * eliminating the package string (not needed).
      2bbec92e
    • simonpj@microsoft.com's avatar
      Deal more correctly with orphan instances · eb2bf7ad
      simonpj@microsoft.com authored
      Conal Eliott (Trac #1145) exposed a nasty flaw in the way in which
      orphan instances are computed, when there are functional dependencies
      in the class.  It took me some time to figure out what was going on,
      and led to more refactoring.
      
      Briefly:
      
      * Elaborate comments about orphan-hood and versioning added to IfaceSyn
      * The is_orph field vanishes from InstEnv.Instance
      * Similarly ru_orph vanishes from CoreSyn.CoreRule
      * Orphan-hood is computed in MkIface.instanceToIfaceInst, and
      	MkIface.coreRuleToIfaceRule
      
      Elsewhere just tidying up.
      eb2bf7ad
  12. 13 Feb, 2007 1 commit
  13. 05 Feb, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Establish the CoreSyn let/app invariant · 7b01315d
      simonpj@microsoft.com authored
      This patch clears up a long-standing wart.   For some time it's been the
      case that 
      	the RHS of a non-recursive let can be unlifed iff 
      	the RHS is ok-for-speculation
      
      This patch extends the invariant to the argument of an App, and 
      establishes it by the smart constructors mkDsApp, mkDsApps in the desugarer.
      
      Once established, it should be maintained by the optimiser.
      
      This tides up some awkward cases, notably in exprIsHNF, and I think it
      fixes a outright strictness bug in Simplify.prepareRhs.
      7b01315d
  14. 04 Feb, 2007 1 commit
  15. 02 Feb, 2007 3 commits
  16. 31 Jan, 2007 1 commit
  17. 21 Dec, 2006 1 commit
    • lennart@augustsson.net's avatar
      Add support for overloaded string literals. · 90dc9026
      lennart@augustsson.net authored
      The class is named IsString with the single method fromString.
      Overloaded strings work the same way as overloaded numeric literals.
      In expressions a string literals gets a fromString applied to it.
      In a pattern there will be an equality comparison with the fromString:ed literal.
      
      Use -foverloaded-strings to enable this extension.
       
      90dc9026
  18. 21 Jan, 2007 1 commit
  19. 07 Jan, 2007 1 commit
  20. 11 Jan, 2007 2 commits
    • mnislaih's avatar
      Too agressive breakpoint coalescing politics · 88941457
      mnislaih authored
      88941457
    • simonpj@microsoft.com's avatar
      Make the LiberateCase transformation understand associated types · 7aa3f524
      simonpj@microsoft.com authored
      Consider this FC program:
      	data family AT a :: *
      	data instance AT Int = T1 Int Int
      
      	f :: AT Int -> Int
      	f t = case t of DEFAULT -> <body>
      
      We'd like to replace the DEFAULT by a use of T1, so that if 
      we scrutinise t inside <body> we share the evaluation:
      
      	f t = case (t `cast` co) of T1 x y -> <body>
      
      I decided to do this as part of the liberate-case transformation,
      which is already trying to avoid redundant evals.  
      
      The new transformation requires knowledge of the family instance
      environment, so I had to extend ModGuts to carry the fam_inst_env,
      and put that envt into the liberate-case environment. 
      
      Otherwise it's all pretty straightforward.
      7aa3f524
  21. 29 Dec, 2006 1 commit
    • andy@galois.com's avatar
      Adding a GENERATED pragma · d386e0d2
      andy@galois.com authored
      Adding a {-# GENERATED "SourceFile" SourceSpan #-} <expr> pragma.
      This will be used to generate coverage for tool generated (or quoted) code.
      The pragma states the the expression was generated/quoted from the stated
      source file and source span.
      d386e0d2
  22. 28 Dec, 2006 1 commit
  23. 22 Dec, 2006 1 commit
  24. 20 Dec, 2006 1 commit
  25. 11 Dec, 2006 2 commits
  26. 10 Dec, 2006 3 commits
  27. 13 Dec, 2006 1 commit
  28. 09 Dec, 2006 1 commit
  29. 29 Nov, 2006 1 commit
    • andy@galois.com's avatar
      TickBox representation change · 8100cd43
      andy@galois.com authored
      This changes the internal representation of TickBoxes,
      from
              Note (TickBox "module" n)  <expr>
      into
      
              case tick<module,n> of
                _ -> <expr>
      
      tick has type :: #State #World, when the module and tick numbe
      are stored inside IdInfo.
      
      Binary tick boxes change from
      
               Note (BinaryTickBox "module" t f) <expr>
      
      into
      
                btick<module,t,f> <expr>
      
      btick has type :: Bool -> Bool, with the module and tick number
      stored inside IdInfo.
      8100cd43
  30. 01 Nov, 2006 1 commit
  31. 21 Nov, 2006 1 commit
  32. 25 Oct, 2006 1 commit