1. 20 Dec, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Fix nasty recompilation bug in MkIface.computeChangedOccs · c4ea1371
      simonpj@microsoft.com authored
      	MERGE to 6.8 branch
      
      In computeChangedOccs we look up the old version of a Name.
      But a WiredIn Name doesn't have an old version, because WiredIn things
      don't appear in interface files at all.
      
      Result: ghc-6.9: panic! (the 'impossible' happened)
        (GHC version 6.9 for x86_64-unknown-linux):
      	lookupVers1 base:GHC.Prim chr#{v}
      
      This fixes the problem.  The patch should merge easily onto the branch.
      
      c4ea1371
  2. 06 Dec, 2007 5 commits
    • Simon Marlow's avatar
      comment only · 0cdde9d7
      Simon Marlow authored
      0cdde9d7
    • Simon Marlow's avatar
      comment typo · d5fbbe4c
      Simon Marlow authored
      d5fbbe4c
    • Simon Marlow's avatar
      add Outputable instance for OccIfaceEq · c004ec62
      Simon Marlow authored
      c004ec62
    • Simon Marlow's avatar
      Workaround for #1959: assume untracked names have changed · d5183f31
      Simon Marlow authored
      This fixes the 1959 test, but will do more recompilation than is
      strictly necessary (but only when -O is on).  Still, more
      recompilation is better than segfaults, link errors or other random
      breakage.
      d5183f31
    • Simon Marlow's avatar
      FIX part of #1959: declaration versions were not being incremented correctly · 89cc3988
      Simon Marlow authored
      We were building a mapping from ModuleName to [Occ] from the usage
      list, using the usg_mod field as the key.  Unfortunately, due to a
      very poor naming decision, usg_mod is actually the module version, not
      the ModuleName.  usg_name is the ModuleName.  Since Version is also an
      instance of Uniquable, there was no type error: all that happened was
      lookups in the map never succeeded.  I shall rename the fields of
      Usage in a separate patch.
      
      This doesn't completely fix #1959, but it gets part of the way there.
      
      I have to take partial blame as the person who wrote this fragment of
      code in late 2006 (patch "Interface file optimisation and removal of
      nameParent").
      89cc3988
  3. 07 Nov, 2007 1 commit
    • Simon Marlow's avatar
      FIX #1617: reloading didn't change the :browse output as it should · 23e4e103
      Simon Marlow authored
      The problem was that because the interface hadn't changed, we were
      re-using the old ModIface.  Unfortunately the ModIface contains the
      GlobalRdrEnv for the module, and that *had* changed.  The fix is to
      put the new GlobalRdrEnv in the ModIface even if the interface has not
      otherwise changed.
      
      ModIface is not really the right place for the GlobalRdrEnv, but
      neither is ModDetails, so we should think about a better way to do
      this.
      23e4e103
  4. 06 Nov, 2007 1 commit
    • Simon Marlow's avatar
      GHC API: add checkAndLoadModule · 7379e82a
      Simon Marlow authored
      Does what the name suggests: it performs the function of both
      checkModule and load on that module, avoiding the need to process each
      module twice when checking a batch of modules.  This will make Haddock
      and ghctags much faster.
      
      Along with this is the beginnings of a refactoring of the HscMain
      interface.  HscMain now exports functions for separately running the
      parser, typechecher, and generating ModIface and ModDetails.
      Eventually the plan is to complete this interface and use it to
      replace the existing one.
      7379e82a
  5. 10 Oct, 2007 1 commit
    • Dan Licata's avatar
      View patterns, record wildcards, and record puns · 6a05ec5e
      Dan Licata authored
      This patch implements three new features:
      * view patterns (syntax: expression -> pat in a pattern)
      * working versions of record wildcards and record puns
      See the manual for detailed descriptions.
      
      Other minor observable changes:
      * There is a check prohibiting local fixity declarations
        when the variable being fixed is not defined in the same let
      * The warn-unused-binds option now reports warnings for do and mdo stmts
      
      Implementation notes: 
      
      * The pattern renamer is now in its own module, RnPat, and the
      implementation is now in a CPS style so that the correct context is
      delivered to pattern expressions.
      
      * These features required a fairly major upheaval to the renamer.
      Whereas the old version used to collect up all the bindings from a let
      (or top-level, or recursive do statement, ...) and put them into scope
      before renaming anything, the new version does the collection as it
      renames.  This allows us to do the right thing with record wildcard
      patterns (which need to be expanded to see what names should be
      collected), and it allows us to implement the desired semantics for view
      patterns in lets.  This change had a bunch of domino effects brought on
      by fiddling with the top-level renaming.
      
      * Prior to this patch, there was a tricky bug in mkRecordSelId in HEAD,
      which did not maintain the invariant necessary for loadDecl.  See note
      [Tricky iface loop] for details.
      6a05ec5e
  6. 09 Oct, 2007 1 commit
  7. 02 Oct, 2007 1 commit
  8. 04 Sep, 2007 1 commit
  9. 03 Sep, 2007 1 commit
  10. 01 Sep, 2007 1 commit
  11. 28 Aug, 2007 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Type checking for type synonym families · 5822cb8d
      chak@cse.unsw.edu.au. authored
      This patch introduces type checking for type families of which associated
      type synonyms are a special case. E.g.
      
              type family Sum n m
      
              type instance Sum Zero n = n
              type instance Sum (Succ n) m = Succ (Sum n m)
      
      where
      
              data Zero       -- empty type
              data Succ n     -- empty type
      
      In addition we support equational constraints of the form:
      
              ty1 ~ ty2
      
      (where ty1 and ty2 are arbitrary tau types) in any context where
      type class constraints are already allowed, e.g.
      
              data Equals a b where
                      Equals :: a ~ b => Equals a b
      
      The above two syntactical extensions are disabled by default. Enable
      with the -XTypeFamilies flag.
      
      For further documentation about the patch, see:
      
              * the master plan
                http://hackage.haskell.org/trac/ghc/wiki/TypeFunctions
      
              * the user-level documentation
                http://haskell.org/haskellwiki/GHC/Indexed_types
      
      The patch is mostly backwards compatible, except for:
      
              * Some error messages have been changed slightly.
      
              * Type checking of GADTs now requires a bit more type declarations:
                not only should the type of a GADT case scrutinee be given, but also
                that of any identifiers used in the branches and the return type.
      
      Please report any unexpected behavior and incomprehensible error message 
      for existing code.
      
      Contributors (code and/or ideas):
              Tom Schrijvers
              Manuel Chakravarty
              Simon Peyton-Jones
              Martin Sulzmann 
      with special thanks to Roman Leshchinskiy
      5822cb8d
  12. 26 Aug, 2007 1 commit
  13. 03 Aug, 2007 1 commit
    • Simon Marlow's avatar
      FIX part of #1372, improvements to the recompilation checker · de21f53e
      Simon Marlow authored
      This patch adds a check that each imported module is listed in
      the dependencies from the previous interface.  It catches the
      following cases and forces recompilation:
         - an exposed package has been upgraded
         - we are compiling with different package flags
         - a home module that was shadowing a package module has been removed
         - a new home module has been added that shadows a package module
      
      I haven't yet added the package timestamping as described in #1372.
      de21f53e
  14. 16 Aug, 2007 1 commit
  15. 09 Aug, 2007 1 commit
  16. 17 Jul, 2007 1 commit
    • andy@galois.com's avatar
      Adding pushing of hpc translation status through hi files. · c1681a73
      andy@galois.com authored
      Now, if a single module *anywhere* on the module tree is built with
      -fhpc, the binary will enable reading/writing of <bin>.tix.
      
      Previously, you needed to compile Main to allow coverage to operate.
      
      This changes the file format for .hi files; you will need to recompile every library.
      c1681a73
  17. 16 Jul, 2007 1 commit
  18. 11 Jul, 2007 1 commit
  19. 22 May, 2007 1 commit
  20. 15 May, 2007 1 commit
  21. 11 May, 2007 1 commit
  22. 08 May, 2007 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Improved VectInfo · 098f818b
      chak@cse.unsw.edu.au. authored
      - We need to keep pairs of (f, f_CC) in VectInfo as it is difficult
        to obtain Names from OccNames (of imported modules) in Core passes.
      - There is a choice of keeping Names or Vars in VectInfo.  We go with Vars
        for now; mainly to avoid converting between Names and Vars repeatedly for
        the same VectInfo in other than one-shot mode.
      
        Again goes to the HEAD straight away to avoid conflicts down the road.
      098f818b
  23. 07 May, 2007 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Add VectInfo to HPT · e5f78a4a
      chak@cse.unsw.edu.au. authored
        I am putting this patch (as the previous VectInfo patch) straight away
        into the head to avoid the kind of merging disaster we had with the FC
        branch.  The patch does not interfere with any other functionality and
        hence should cause no harm in the head.
      e5f78a4a
  24. 04 May, 2007 1 commit
  25. 25 Apr, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Retain inline-pragma information on unfoldings in interface files · d33c0b24
      simonpj@microsoft.com authored
      	WARNING: this patch changes interface-file formats slightly
      	 	 you will need to recompile your libraries
      
      Duncan Coutts wanted to export a function that has a NOINLNE pragma
      in a local let-defintion.  This works fine within a module, but was 
      not surviving across the interface-file serialisation.
      
      http://www.haskell.org/pipermail/glasgow-haskell-users/2007-March/012171.html
      
      Regardless of whether or not he's doing something sensible, it seems
      reasonable to try to retain local-binder IdInfo across interface files.
      This initial patch just retains inline-pragma info, on the grounds that
      other IdInfo can be re-inferred at the inline site.
      
      Interface files get a tiny bit bigger, but it seesm slight.
      
      d33c0b24
  26. 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
  27. 23 Feb, 2007 1 commit
  28. 21 Feb, 2007 1 commit
    • 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
  29. 11 Jan, 2007 2 commits
  30. 10 Jan, 2007 1 commit
  31. 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
  32. 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
  33. 18 Oct, 2006 1 commit
    • simonpj@microsoft.com's avatar
      Add the primitive type Any, and use it for Dynamics · c128930d
      simonpj@microsoft.com authored
      GHC's code generator can only enter a closure if it's guaranteed
      not to be a function.  In the Dynamic module, we were using the 
      type (forall a.a) as the type to which the dynamic type was unsafely
      cast:
      	type Obj = forall a.a
      
      Gut alas this polytype was sometimes instantiated to (), something 
      like this (it only bit when profiling was enabled)
      	let y::() = dyn ()
      	in (y `cast` ..) p q
      As a result, an ASSERT in ClosureInfo fired (hooray).
      
      I've tided this up by making a new, primitive, lifted type Any, and
      arranging that Dynamic uses Any, thus:
      	type Obj = ANy
      
      While I was at it, I also arranged that when the type checker instantiates 
      un-constrained type variables, it now instantiates them to Any, not ()
      	e.g.  length Any []
      
      [There remains a Horrible Hack when we want Any-like things at arbitrary 
      kinds.  This essentially never happens, but see comments with 
      TysPrim.mkAnyPrimTyCon.]
      
      Anyway, this fixes Trac #905
      c128930d
  34. 13 Oct, 2006 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Keep track of family instance modules · 311b1cdf
      chak@cse.unsw.edu.au. authored
      - Now each modules carries
        (1) a flag saying whether it contains family instance declarations and
        (2) a list of all modules further down in the import tree that contain
            family instance declarations.
        (The information is split into these two parts for the exact same reasons why
        the info about orphan modules is split, too.)
      - This is the first step to *optimised* overlap checking of family instances
        coming from imported modules.
      
      *** WARNING: This patch changes the interface file format! ***
      ***          Recompile libraries and stage2 from scratch!  ***
      311b1cdf
  35. 11 Oct, 2006 1 commit
    • Simon Marlow's avatar
      Module header tidyup, phase 1 · 49c98d14
      Simon Marlow authored
      This patch is a start on removing import lists and generally tidying
      up the top of each module.  In addition to removing import lists:
      
         - Change DATA.IOREF -> Data.IORef etc.
         - Change List -> Data.List etc.
         - Remove $Id$
         - Update copyrights
         - Re-order imports to put non-GHC imports last
         - Remove some unused and duplicate imports
      49c98d14