1. 04 May, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Make -frewrite-rules into a dynamic flag; off for -O0 · 5943ce90
      simonpj@microsoft.com authored
      Argubly rewrite rules should not fire with -O0, and it turns
      out that when compiling GHC.Base with -O0 we get a crash if
      the rewrite rules do fire (see Note [Scoping for Builtin rules]
      in PrelRules).
      
      So unless someone yells, rewrite rules are off with -O0.
      
      The new (now dynamic) flag is 
          -frewrite rules (with -fno-rewrite-rules to disable)
      
      The old (static) flag -frules-off is gone.
      5943ce90
  2. 29 Apr, 2007 1 commit
  3. 25 Apr, 2007 1 commit
  4. 17 Apr, 2007 1 commit
    • 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
  5. 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
  6. 22 Mar, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Add -ddump-mod-cycles to -M behaviour · a896a832
      simonpj@microsoft.com authored
      This patch adds a flag -ddump-mod-cycles to the "ghc -M" dependency analyser.
      
      The effect of
      	ghc -M -ddump-mod-cycles
      is to dump a list of cycles foud in the module graph.  The display is
      trimmed so that only dependencies within the cycle are shown; and the
      list of modules in a cycle is itself sorted into dependency order, so that
      it is easy to track the chain of dependencies.
      
      Open question: should the flag be "-ddump-mod-cycles" or "-optdep-dump-mod-cycles"?  For this reason I have not yet added to the documentation.
      a896a832
  7. 09 Feb, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Major improvement to SpecConstr · cac2aca1
      simonpj@microsoft.com authored
      This patch improves the SpecConstr pass, by 
        a) making it work with join points
        b) making it generate specialisations transitively
      
      As part of it, SpecConstr now carries a substitution with it, which
      runs over the whole program as it goes.  This turned out to be 
      a big win; simplified the implementation quite a bit.
      
      I have *disabled* the specialisation on lambdas; it's pretty fragile,
      and sometimes generates more and more specialisations. Something to
      come back to, perhaps.
      
      I rejigged the flag-handling a bit.  Now the specification of passes
      in DynFlags is a bit nicer; see
      	- optLevelFlags top-level data structure
      	- runWhen function
      	- CoreDoPasses constructor
      
      There are now command-line flags
      	-fspec-constr
      	-fliberate-case
      	-fspec-threshold=N
      which do the obvious thing.  -O2 switches on both spec-constr and liberate-case.
      You can use -fno-liberate-case, -fno-spec-constr after -O2 to switch them off again.
      
      The spec-threshold applies to both these transformations; default value 200 for now.
      
      
      
      
      cac2aca1
  8. 07 Feb, 2007 2 commits
  9. 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
  10. 12 Jan, 2007 1 commit
  11. 11 Jan, 2007 2 commits
  12. 09 Jan, 2007 1 commit
  13. 16 Dec, 2006 1 commit
  14. 11 Dec, 2006 2 commits
  15. 10 Dec, 2006 2 commits
  16. 09 Dec, 2006 1 commit
  17. 01 Dec, 2006 1 commit
    • wolfgang.thaller@gmx.net's avatar
      Decouple -O from -fvia-C · 8971f720
      wolfgang.thaller@gmx.net authored
      Nowadays, there are situations where -fvia-C is definitely unwanted, such
      as when -fPIC is used on some platforms, so we do not want implicit -fvia-C
      any more.
      8971f720
  18. 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
  19. 20 Nov, 2006 1 commit
  20. 24 Oct, 2006 1 commit
    • andy@galois.com's avatar
      Haskell Program Coverage · d5934bbb
      andy@galois.com authored
      This large checkin is the new ghc version of Haskell
      Program Coverage, an expression-level coverage tool for Haskell.
      
      Parts:
      
       - Hpc.[ch] - small runtime support for Hpc; reading/writing *.tix files.
       - Coverage.lhs - Annotates the HsSyn with coverage tickboxes.
        - New Note's in Core,
            - TickBox      -- ticked on entry to sub-expression
            - BinaryTickBox  -- ticked on exit to sub-expression, depending
      	       	     -- on the boolean result.
      
        - New Stg level TickBox (no BinaryTickBoxes, though) 
      
      You can run the coverage tool with -fhpc at compile time. 
      Main must be compiled with -fhpc. 
      				      
      d5934bbb
  21. 11 Oct, 2006 1 commit
  22. 05 Oct, 2006 1 commit
  23. 04 Oct, 2006 1 commit
  24. 27 Sep, 2006 2 commits
  25. 20 Sep, 2006 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Option -findexed-types · 284d83ee
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 19:42:48 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Option -findexed-types
        Fri Sep  8 21:35:37 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Option -findexed-types
          - Introduced the switch -findexed-types to activate the indexed type family 
            framework.
          - The switch enables the special 'family' and allows kind signatures (which are
            currently compulsory for associated families).
      284d83ee
  26. 19 Sep, 2006 1 commit
    • Simon Marlow's avatar
      Packages cleanup, and allow new packages to be loaded with :set again · ee565d46
      Simon Marlow authored
      This cleans up the package subsystem a little.  There are some
      changes to the GHC API as a result.
      
        - GHC.init and GHC.initFromArgs are no longer necessary.
      
        - GHC.newSession takes the root of the GHC tree as an argument
          (previously passed to GHC.init).
      
        - You *must* do GHC.setSessionDynFlags after GHC.newSession,
          this is what loads the package database.
      
        - Several global vars removed from SysTools
      
        - The :set command in GHCi can now cause new packages to be loaded,
          or can hide/ignore existing packages.
      ee565d46
  27. 01 Sep, 2006 1 commit
  28. 07 Aug, 2006 1 commit
    • simonpj@microsoft.com's avatar
      Add -fextended-default-rules and -fmono-pat-binds · 6e0c3f50
      simonpj@microsoft.com authored
      Add -fextended-deafult-rules (in response to Don Stewart's message below),
      and document them.
      
      Also doucument -fmono-pat-binds/-fno-mono-pat-binds, which has been in 
      GHC a few weeks now. 
      
      (The two are in one patch because the diffs were so close together
      that Darcs combined them.)
      
      Simon
      
      
      From: Donald Bruce Stewart [mailto:dons@cse.unsw.edu.au] 
      Sent: 07 August 2006 10:52
      
      While we're thinking about defaulting, I have a question..
      
      ghci uses an extended defaulting system, to allow things like:
              Prelude> reverse []
              []
      to work, and to have the right instance of Show found. The manual says:
      
          "..it is tiresome for the user to have to specify the type, so GHCi extends
          Haskell's type-defaulting rules (Section 4.3.4 of the Haskell 98 Report
          (Revised)) as follows. If the expression yields a set of type constraints
          that are all from standard classes (Num, Eq etc.), and at least one is
          either a numeric class or the Show, Eq, or Ord class, GHCi will try to use
          one of the default types, just as described in the Report. The standard
          defaulting rules require that one of the classes is numeric; the difference
          here is that defaulting is also triggered at least one is Show, Eq, or Ord."
      
      Currently, there is no way to get at this "extended" defaulting for compiled
      modules. However, I have a use case for in fact doing this.
      
      With runtime evaluated Haskell, embedding 'interpreters' (over hs-plugins) is
      easy. lambdabot, for example, implements a sandboxed haskell eval system. But
      it doesn't have access to the defaulting mechanism of ghci, so we have:
      
          dons:: > reverse []
          lambdabot:: Add a type signature
          dons:: > reverse [] :: [()]
          lambdabot:: []
      
      Which is annoying -- newbies wonder why they have to add these extra
      constraints to get a Show instance.
      
      I'm wondering, since the extended defaulting mechanisms are already
      implemented, could they be made available to compiled modules as well,
      perhaps using a flag, -fextended-defaulting? 
      6e0c3f50
  29. 27 Jul, 2006 2 commits
  30. 25 Jul, 2006 1 commit
    • Simon Marlow's avatar
      Generalise Package Support · 61d2625a
      Simon Marlow authored
      This patch pushes through one fundamental change: a module is now
      identified by the pair of its package and module name, whereas
      previously it was identified by its module name alone.  This means
      that now a program can contain multiple modules with the same name, as
      long as they belong to different packages.
      
      This is a language change - the Haskell report says nothing about
      packages, but it is now necessary to understand packages in order to
      understand GHC's module system.  For example, a type T from module M
      in package P is different from a type T from module M in package Q.
      Previously this wasn't an issue because there could only be a single
      module M in the program.
      
      The "module restriction" on combining packages has therefore been
      lifted, and a program can contain multiple versions of the same
      package.
      
      Note that none of the proposed syntax changes have yet been
      implemented, but the architecture is geared towards supporting import
      declarations qualified by package name, and that is probably the next
      step.
      
      It is now necessary to specify the package name when compiling a
      package, using the -package-name flag (which has been un-deprecated).
      Fortunately Cabal still uses -package-name.
      
      Certain packages are "wired in".  Currently the wired-in packages are:
      base, haskell98, template-haskell and rts, and are always referred to
      by these versionless names.  Other packages are referred to with full
      package IDs (eg. "network-1.0").  This is because the compiler needs
      to refer to entities in the wired-in packages, and we didn't want to
      bake the version of these packages into the comiler.  It's conceivable
      that someone might want to upgrade the base package independently of
      GHC.
      
      Internal changes:
      
        - There are two module-related types:
      
              ModuleName      just a FastString, the name of a module
              Module          a pair of a PackageId and ModuleName
      
          A mapping from ModuleName can be a UniqFM, but a mapping from Module
          must be a FiniteMap (we provide it as ModuleEnv).
      
        - The "HomeModules" type that was passed around the compiler is now
          gone, replaced in most cases by the current package name which is
          contained in DynFlags.  We can tell whether a Module comes from the
          current package by comparing its package name against the current
          package.
      
        - While I was here, I changed PrintUnqual to be a little more useful:
          it now returns the ModuleName that the identifier should be qualified
          with according to the current scope, rather than its original
          module.  Also, PrintUnqual tells whether to qualify module names with
          package names (currently unused).
      
      Docs to follow.
      61d2625a
  31. 22 Jul, 2006 1 commit
    • simonpj@microsoft.com's avatar
      Add -fmono-pat-binds, and make it the default · 10ffe4f7
      simonpj@microsoft.com authored
      In Haskell 98, pattern bindings are generalised.  Thus in
      	(f,g) = (\x->x, \y->y)
      both f and g will get polymorphic types.  I have become convinced
      that generalisation for pattern-bound variables is just a bridge
      toof far. It is (I claim) almost never needed, and it adds significant
      complication.  (All the more so if we add bang patterns.)
      
      So the flag -fmono-pat-binds switches off generalisation for pattern
      bindings.  (A single variable is treated as a degnerate funtction
      binding.)  
      
      Furthremore, as an experiment, I'm making it the default.  I want
      to see how many progarms fail with monomorphic pattern bindings.
      
      You can recover the standard behaviour with -fno-mono-pa-binds.
      10ffe4f7
  32. 12 Jul, 2006 1 commit
    • simonpj@microsoft.com's avatar
      Experimental flag -fdicts-cheap · e1231b2b
      simonpj@microsoft.com authored
      This experimental flag, -fdicts-cheap, makes a let-binding that bind a
      value of dictionary type look cheap.  That in turn leads to more
      eta expansion.  Instead of
      	f = /\a. \(d1:Ord a). let d2:Ord [a] = dfOrd a d1 in
                       \(x:a). <stuff>
      which has arity 1, you get
      	f = /\a. \(d1:Ord a). \(x:a).
      	         let d2:Ord [a] = dfOrd a d1 in <stuff>
      Now f has arity 2.
      
      This can cretainly waste dictionary-construction work, if f is
      partially applied to its dictionary argument.  However it has knock-on
      effects.  Because f has arity 2, we won't float (f Int d) out of
      	\x. h (f Int d)
      Floating f out of this lambda makes it impossible for an h/f fusion
      rule to fire; and this unexpected loss of RULE application was the
      immediate reason for implementing this flag. (Roman Leshchinskiy came
      across this when working on array fusion.)
      
      
      I've implemented the change only in CoreUtils.arityType, which
      only affects eta expansion.  I thought of putting the change in
      exprIsCheap, which is a more systematic place (the former calls
      the latter) but
      
      	a) I wanted this under flag control, and the flags 
      	are not readily available to all callers of exprIsCheap
      
      	b) I'm not 100% convinced that this change is a good
      	idea, so it's reasonable to do the narrowest change
      	that solves the immediate problem.
      e1231b2b
  33. 04 Jul, 2006 1 commit
  34. 23 May, 2006 1 commit