1. 21 Oct, 2010 1 commit
  2. 19 Oct, 2010 3 commits
  3. 23 Sep, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Avoid ASSERT black hole · 528db2ad
      simonpj@microsoft.com authored
      When this ASSERT tripped in CoreToStg it tried to print out
      too much, which tripped the asssertion again.  Result: an
      infinite loop with no output at all.  Hard to debug!
      528db2ad
  4. 22 Sep, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Fix an ASSERT failure with profiling · 9e6ca39b
      simonpj@microsoft.com authored
      The problem arose with this kind of thing
      
         x = (,) (scc "blah" Nothing)
      
      Then 'x' is marked NoCafRefs by CoreTidy, becuase it has 
      arity 1, and doesn't mention any caffy things.
      
      That in turns means that CorePrep must not float out the
      sat binding to give
      
        sat = scc "blah" Nothing
        x = (,) sat
      
      Rather we must generate
      
        x = \eta. let sat = scc "blah" Nothing 
                  in (,) sat eta
      
      URGH! This Caf stuff is such a mess.
      9e6ca39b
  5. 13 Sep, 2010 1 commit
  6. 04 Jan, 2010 1 commit
  7. 02 Jan, 2010 1 commit
  8. 15 Oct, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Fix Trac #959: a long-standing bug in instantiating otherwise-unbound type variables · 388e3356
      simonpj@microsoft.com authored
          
         DO NOT MERGE TO GHC 6.12 branch
         (Reason: interface file format change.)
      
      The typechecker needs to instantiate otherwise-unconstraint type variables to
      an appropriately-kinded constant type, but we didn't have a supply of 
      arbitrarily-kinded tycons for this purpose.  Now we do.
      
      The details are described in Note [Any types] in TysPrim.  The
      fundamental change is that there is a new sort of TyCon, namely
      AnyTyCon, defined in TyCon.
      
      Ter's a small change to interface-file binary format, because the new
      AnyTyCons have to be serialised.
      
      I tided up the handling of uniques a bit too, so that mkUnique is not
      exported, so that we can see all the different name spaces in one module.
      388e3356
  9. 09 Jun, 2009 1 commit
    • Duncan Coutts's avatar
      Add PrimCall to the STG layer and update Core -> STG translation · cbbee4e8
      Duncan Coutts authored
      It adds a third case to StgOp which already hold StgPrimOp and StgFCallOp.
      The code generation for the new StgPrimCallOp case is almost exactly the
      same as for out-of-line primops. They now share the tailCallPrim function.
      In the Core -> STG translation we map foreign calls using the "prim"
      calling convention to the StgPrimCallOp case. This is because in Core we
      represent prim calls using the ForeignCall stuff. At the STG level however
      the prim calls are really much more like primops than foreign calls.
      cbbee4e8
  10. 13 Jan, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Rewrite CorePrep and improve eta expansion · 62eeda5a
      simonpj@microsoft.com authored
      This patch does two main things
      
      a) Rewrite most of CorePrep to be much easier to understand (I hope!).
         The invariants established by CorePrep are now written out, and
         the code is more perspicuous.  It is surpringly hard to get right,
         and the old code had become quite incomprehensible.
      
      b) Rewrite the eta-expander so that it does a bit of simplifying
         on-the-fly, and thereby guarantees to maintain the CorePrep
         invariants.  This make it much easier to use from CorePrep, and
         is a generally good thing anyway.
      
      A couple of pieces of re-structuring:
      
      *  I moved the eta-expander and arity analysis stuff into a new
         module coreSyn/CoreArity.
      
         Max will find that the type CoreArity.EtaInfo looks strangely 
         familiar.
      
      *  I moved a bunch of comments from Simplify to OccurAnal; that's
         why it looks as though there's a lot of lines changed in those
         modules.
      
      On the way I fixed various things
      
        - Function arguments are eta expanded
             f (map g)  ===>  let s = \x. map g x in f s
      
        - Trac #2368
      
      The result is a modest performance gain, I think mainly due
      to the first of these changes:
      
      --------------------------------------------------------------------------------
              Program           Size    Allocs   Runtime   Elapsed
      --------------------------------------------------------------------------------
                  Min          -1.0%    -17.4%    -19.1%    -46.4%
                  Max          +0.3%     +0.5%     +5.4%    +53.8%
       Geometric Mean          -0.1%     -0.3%     -7.0%    -10.2%
      
      
      62eeda5a
  11. 02 Jan, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Make record selectors into ordinary functions · 9ffadf21
      simonpj@microsoft.com authored
      This biggish patch addresses Trac #2670.  The main effect is to make
      record selectors into ordinary functions, whose unfoldings appear in
      interface files, in contrast to their previous existence as magic
      "implicit Ids".  This means that the usual machinery of optimisation,
      analysis, and inlining applies to them, which was failing before when
      the selector was somewhat complicated.  (Which it can be when
      strictness annotations, unboxing annotations, and GADTs are involved.)
      
      The change involves the following points
      
      * Changes in Var.lhs to the representation of Var.  Now a LocalId can
        have an IdDetails as well as a GlobalId.  In particular, the
        information that an Id is a record selector is kept in the
        IdDetails.  While compiling the current module, the record selector
        *must* be a LocalId, so that it participates properly in compilation
        (free variables etc).
      
        This led me to change the (hidden) representation of Var, so that there
        is now only one constructor for Id, not two.
      
      * The IdDetails is persisted into interface files, so that an
        importing module can see which Ids are records selectors.
      
      * In TcTyClDecls, we generate the record-selector bindings in renamed,
        but not typechecked form.  In this way, we can get the typechecker
        to add all the types and so on, which is jolly helpful especially
        when GADTs or type families are involved.  Just like derived
        instance declarations.
      
        This is the big new chunk of 180 lines of code (much of which is
        commentary).  A call to the same function, mkAuxBinds, is needed in
        TcInstDcls for associated types.
      
      * The typechecker therefore has to pin the correct IdDetails on to 
        the record selector, when it typechecks it.  There was a neat way
        to do this, by adding a new sort of signature to HsBinds.Sig, namely
        IdSig.  This contains an Id (with the correct Name, Type, and IdDetails);
        the type checker uses it as the binder for the final binding.  This
        worked out rather easily.
      
      * Record selectors are no longer "implicit ids", which entails changes to
           IfaceSyn.ifaceDeclSubBndrs
           HscTypes.implicitTyThings
           TidyPgm.getImplicitBinds
        (These three functions must agree.)
      
      * MkId.mkRecordSelectorId is deleted entirely, some 300+ lines (incl
        comments) of very error prone code.  Happy days.
      
      * A TyCon no longer contains the list of record selectors: 
        algTcSelIds is gone
      
      The renamer is unaffected, including the way that import and export of
      record selectors is handled.
      
      Other small things
      
      * IfaceSyn.ifaceDeclSubBndrs had a fragile test for whether a data
        constructor had a wrapper.  I've replaced that with an explicit flag
        in the interface file. More robust I hope.
      
      * I renamed isIdVar to isId, which touched a few otherwise-unrelated files.
      
      9ffadf21
  12. 08 Dec, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Add assertion for arity match (checks Trac #2844) · 60881299
      simonpj@microsoft.com authored
      The exported arity of a function must match the arity for the
      STG function.  Trac #2844 was a pretty obscure manifestation of
      the failure of this invariant. This patch doesn't cure the bug;
      rather it adds an assertion to CoreToStg to check the invariant
      so we should get an earlier and less obscure warning if this
      fails in future.
      60881299
  13. 05 Dec, 2008 1 commit
  14. 31 Jul, 2008 1 commit
  15. 04 May, 2008 1 commit
  16. 12 Apr, 2008 1 commit
  17. 22 Apr, 2008 1 commit
  18. 10 Apr, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Ensure that arity is accurate in back end · 3dcb2a66
      simonpj@microsoft.com authored
      See Note [exprArity invariant] in CoreUtils.  In code generated by Happy
      I was seeing this after TidyPgm and CorePrep
      
      	f :: Any
      	f {arity 1} = id `cast` unsafe-co
      
      So f claimed to have arity 1 (because exprArity looked inside), but
      did not have any top-level lambdas (because its type is Any).  
      
      This triggered a slightly-obscure ASSERT failure in CoreToStg
      
      This patch 
      	- makes exprArity trim the arity if the type is not a function
      	- adds a stronger ASSERT in TidyPgm
      
      It's not the only way to solve this problem (see Note [exprArity invariant])
      but it's enough for now. 
      3dcb2a66
  19. 29 Mar, 2008 2 commits
  20. 17 Jan, 2008 1 commit
    • twanvl's avatar
      Monadify stgSyn/CoreToStg · 625ca288
      twanvl authored
       - made LneM a newtype instead of a type synonym
       - use do, return and standard monad functions
       - removed custom versions of monad functions
      625ca288
  21. 21 Dec, 2007 1 commit
  22. 16 Oct, 2007 1 commit
  23. 03 Oct, 2007 1 commit
  24. 08 Sep, 2007 1 commit
  25. 04 Sep, 2007 1 commit
  26. 03 Sep, 2007 1 commit
  27. 01 Sep, 2007 1 commit
  28. 10 May, 2007 1 commit
  29. 07 May, 2007 1 commit
  30. 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
  31. 07 Nov, 2006 2 commits
  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. 04 Oct, 2006 1 commit
  34. 04 Aug, 2006 1 commit
  35. 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
  36. 07 Apr, 2006 1 commit
    • Simon Marlow's avatar
      Reorganisation of the source tree · 0065d5ab
      Simon Marlow authored
      Most of the other users of the fptools build system have migrated to
      Cabal, and with the move to darcs we can now flatten the source tree
      without losing history, so here goes.
      
      The main change is that the ghc/ subdir is gone, and most of what it
      contained is now at the top level.  The build system now makes no
      pretense at being multi-project, it is just the GHC build system.
      
      No doubt this will break many things, and there will be a period of
      instability while we fix the dependencies.  A straightforward build
      should work, but I haven't yet fixed binary/source distributions.
      Changes to the Building Guide will follow, too.
      0065d5ab