1. 17 Dec, 2014 1 commit
    • Simon Peyton Jones's avatar
      Improve TidyPgm.hasCafRefs to account for Integer literals (Trac #8525) · 6b11bab6
      Simon Peyton Jones authored
      See Note [Disgusting computation of CafRefs] in TidyPgm.
      
      Also affects CoreUtils.rhsIsStatic.
      
      The real solution here is to compute CAF and arity information
      from the STG-program, and feed it back to tidied program for
      the interface file and later GHCi clients.  A battle for another
      day.
      
      But at least this commit reduces the number of gratuitous CAFs, and
      hence SRT entries.  And kills off a batch of ASSERT failures.
      6b11bab6
  2. 16 Dec, 2014 2 commits
    • Peter Wortmann's avatar
      Annotation linting · 07d604fa
      Peter Wortmann authored
      This adds a way by which we can make sure that the Core passes treat
      annotations right: We run them twice and compare the results.
      
      The main problem here is that Core equivalence is awkward: We do not
      want the comparison to care about the order of, say, top-level or
      recursive bindings. This is important even if GHC generally generates
      the bindings in the right order - after all, if something goes wrong
      we don't want linting to dump out the whole program as the offense.
      
      So instead we do some heuristic matching - first greedily match
      everything that's easy, then match the rest by label order. This
      should work as long as GHC generates the labels in roughly the same
      order for both pass runs.  In practice it seems to work alright.
      
      We also check that IdInfos match, as this might cause hard-to-spot
      bugs down the line (I had at least one bug because unfolding guidance
      didn't match!). We especially check unfoldings up until the point
      where it might get us into an infinite loop.
      
      (From Phabricator D169)
      07d604fa
    • Peter Wortmann's avatar
      Source notes (Core support) · 993975d3
      Peter Wortmann authored
      This patch introduces "SourceNote" tickishs that link Core to the
      source code that generated it. The idea is to retain these source code
      links throughout code transformations so we can eventually relate
      object code all the way back to the original source (which we can,
      say, encode as DWARF information to allow debugging).  We generate
      these SourceNotes like other tickshs in the desugaring phase. The
      activating command line flag is "-g", consistent with the flag other
      compilers use to decide DWARF generation.
      
      Keeping ticks from getting into the way of Core transformations is
      tricky, but doable. The changes in this patch produce identical Core
      in all cases I tested -- which at this point is GHC, all libraries and
      nofib. Also note that this pass creates *lots* of tick nodes, which we
      reduce somewhat by removing duplicated and overlapping source
      ticks. This will still cause significant Tick "clumps" - a possible
      future optimization could be to make Tick carry a list of Tickishs
      instead of one at a time.
      
      (From Phabricator D169)
      993975d3
  3. 03 Dec, 2014 1 commit
  4. 19 Sep, 2014 1 commit
  5. 07 Aug, 2014 3 commits
    • Gabor Greif's avatar
      Fix some typos in recent comments/notes · 18ac546d
      Gabor Greif authored
      18ac546d
    • Simon Peyton Jones's avatar
      Extensive Notes on can_fail and has_side_effects · ab6480b8
      Simon Peyton Jones authored
      In fixing Trac #9390 I discovered that I *still* didn't really understand
      what the can_fail and has_side_effects properties of a PrimOp mean, precisely.
      
      The big new things I learned are
      
      * has_side_effects needs to be true only of *write* effects,
        Reads (which are, strictly speaking, effects) don't matter here.
      
      * has_side_effects must be true of primops that can throw a synchronous
        Haskell exception (eg raiseIO#)
      
      * can_fail is true only of primops that can cause an *unchecked* (not
        Haskell) system exception, like divide by zero, or accessing memory
        out of range through an array read or write.
      
      I've documented all this now.  The changes in this patch are only
      in comments.
      ab6480b8
    • Simon Peyton Jones's avatar
      Comments and white space · 61baf710
      Simon Peyton Jones authored
      61baf710
  6. 11 Jun, 2014 1 commit
    • eir@cis.upenn.edu's avatar
      Fix #9062. · e79e2c39
      eir@cis.upenn.edu authored
      Removed (pprEqPred (coercionKind co)) in favor of
      (pprType (coercionType co)).
      
      Also had to make "~R#" a *symbolic* identifier and BuiltInSyntax
      to squelch prefix notation and module prefixes in output. These
      changes are both sensible independent of #9062.
      e79e2c39
  7. 15 May, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Add LANGUAGE pragmas to compiler/ source files · 23892440
      Herbert Valerio Riedel authored
      In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been
      reorganized, while following the convention, to
      
      - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before
        any `{-# OPTIONS_GHC #-}`-lines.
      
      - Moreover, if the list of language extensions fit into a single
        `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one
        line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each
        individual language extension. In both cases, try to keep the
        enumeration alphabetically ordered.
        (The latter layout is preferable as it's more diff-friendly)
      
      While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma
      occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
      23892440
  8. 08 May, 2014 1 commit
  9. 17 Dec, 2013 1 commit
  10. 12 Dec, 2013 1 commit
  11. 29 Nov, 2013 1 commit
  12. 27 Nov, 2013 1 commit
  13. 21 Nov, 2013 1 commit
  14. 12 Nov, 2013 1 commit
  15. 23 Sep, 2013 1 commit
  16. 29 Aug, 2013 2 commits
  17. 19 Aug, 2013 2 commits
  18. 02 Aug, 2013 1 commit
  19. 06 Jun, 2013 2 commits
  20. 13 Feb, 2013 1 commit
  21. 30 Jan, 2013 1 commit
  22. 22 Jan, 2013 1 commit
  23. 02 Jan, 2013 1 commit
  24. 24 Dec, 2012 1 commit
  25. 15 Oct, 2012 1 commit
    • Simon Peyton Jones's avatar
      Use isCheapApp in exprIsWorkFree · 81594da5
      Simon Peyton Jones authored
      exprIsWorkFree was returning False for constructor applications
      like (Just x).  Horror!  Now we delegate to isCheapApp, which does the
      right thing.
      
      I found this (by accident) when seeing why the simplifier was taking
      more iterations than I expected.  So not only should we generate
      better code as a result, but perhaps with fewer simplifier iterations.
      General happiness.
      81594da5
  26. 17 Sep, 2012 1 commit
  27. 28 Aug, 2012 1 commit
  28. 02 Aug, 2012 1 commit
  29. 20 Jul, 2012 1 commit
  30. 27 Jun, 2012 1 commit
    • Simon Peyton Jones's avatar
      Add silent superclass parameters (again) · aa1e0976
      Simon Peyton Jones authored and chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au. committed
      Silent superclass parameters solve the problem that
      the superclasses of a dicionary construction can easily
      turn out to be (wrongly) bottom.  The problem and solution
      are described in
         Note [Silent superclass arguments] in TcInstDcls
      
      I first implemented this fix (with Dimitrios) in Dec 2010, but removed
      it again in Jun 2011 becuase we thought it wasn't necessary any
      more. (The reason we thought it wasn't necessary is that we'd stopped
      generating derived superclass constraints for *wanteds*.  But we were
      wrong; that didn't solve the superclass-loop problem.)
      
      So we have to re-implement it.  It's not hard.  Main features:
      
        * The IdDetails for a DFunId says how many silent arguments it has
      
        * A DFunUnfolding describes which dictionary args are
          just parameters (DFunLamArg) and which are a function to apply
          to the parameters (DFunPolyArg).  This adds the DFunArg type
          to CoreSyn
      
        * Consequential changes to IfaceSyn.  (Binary hi file format changes
          slightly.)
      
        * TcInstDcls changes to generate the right dfuns
      
        * CoreSubst.exprIsConApp_maybe handles the new DFunUnfolding
      
      The thing taht is *not* done yet is to alter the vectoriser to
      pass the relevant extra argument when building a PA dictionary.
      aa1e0976
  31. 16 May, 2012 1 commit
  32. 09 May, 2012 1 commit
    • Simon Peyton Jones's avatar
      Be a little less aggressive about inlining (fixes Trac #5623) · 2112f43c
      Simon Peyton Jones authored
      When inlining, we are making a copy of the expression, so we have to
      be careful about duplicating work.  Previously we were using
      exprIsCheap for that, but it is willing to duplicate a cheap primop --
      and that is terribly bad if it happens inside some inner array loop
      (Trac #5623).  So now we use a new function exprIsWorkFree.  Even
      then there is some wiggle room:
         see Note [exprIsWorkFree] in CoreUtils
      
      This commit does make wheel-sieve1 allocate a lot more, but we decided
      that's just tough; it's more important for inlining to be robust
      about not duplicating work.
      2112f43c
  33. 07 May, 2012 1 commit
    • Simon Peyton Jones's avatar
      Yet another major refactoring of the constraint solver · dd7522c3
      Simon Peyton Jones authored
      This is the result of Simon and Dimitrios doing a code walk through.
      There is no change in behaviour, but the structure is much better.
      Main changes:
      
      * Given constraints contain an EvTerm not an EvVar
      
      * Correspondingly, TcEvidence is a recursive types that uses
        EvTerms rather than EvVars
      
      * Rename CtFlavor to CtEvidence
      
      * Every CtEvidence has a ctev_pred field.  And use record fields
        consistently for CtEvidence
      
      * The solved-constraint fields of InertSet (namely inert_solved and
        inert_solved_funeqs) contain CtEvidence, not Ct
      
      There is a long cascade of follow-on changes.
      dd7522c3
  34. 27 Apr, 2012 1 commit