1. 31 Mar, 2015 1 commit
    • Herbert Valerio Riedel's avatar
      Drop old integer-gmp-0.5 from GHC source tree · 995e8c1c
      Herbert Valerio Riedel authored
      This completes what c774b28f (#9281)
      started.  `integer-gmp-1.0` was added as an additional
      `libraries/integer-gmp2` folder while retaining the ability to configure
      GHC w/ the old `integer-gmp-0.5` to have a way back, and or the ability
      to easily switch between old/new `integer-gmp` for benchmark/debugging
      purposes.
      
      This commit removes the old `libraries/integer-gmp` folder and moves
      `libraries/integer-gmp2` into its place, while removing any mentions of
      "gmp2" as well as the to support two different `integer-gmp` packages in
      GHC's source-tree.
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D769
      995e8c1c
  2. 30 Mar, 2015 1 commit
    • Joachim Breitner's avatar
      Refactor the story around switches (#10137) · de1160be
      Joachim Breitner authored
      This re-implements the code generation for case expressions at the Stg →
      Cmm level, both for data type cases as well as for integral literal
      cases. (Cases on float are still treated as before).
      
      The goal is to allow for fancier strategies in implementing them, for a
      cleaner separation of the strategy from the gritty details of Cmm, and
      to run this later than the Common Block Optimization, allowing for one
      way to attack #10124. The new module CmmSwitch contains a number of
      notes explaining this changes. For example, it creates larger
      consecutive jump tables than the previous code, if possible.
      
      nofib shows little significant overall improvement of runtime. The
      rather large wobbling comes from changes in the code block order
      (see #8082, not much we can do about it). But the decrease in code size
      alone makes this worthwhile.
      
      ```
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
                  Min          -1.8%      0.0%     -6.1%     -6.1%     -2.9%
                  Max          -0.7%     +0.0%     +5.6%     +5.7%     +7.8%
       Geometric Mean          -1.4%     -0.0%     -0.3%     -0.3%     +0.0%
      ```
      
      Compilation time increases slightly:
      ```
              -1 s.d.                -----            -2.0%
              +1 s.d.                -----            +2.5%
              Average                -----            +0.3%
      ```
      
      The test case T783 regresses a lot, but it is the only one exhibiting
      any regression. The cause is the changed order of branches in an
      if-then-else tree, which makes the hoople data flow analysis traverse
      the blocks in a suboptimal order. Reverting that gets rid of this
      regression, but has a consistent, if only very small (+0.2%), negative
      effect on runtime. So I conclude that this test is an extreme outlier
      and no reason to change the code.
      
      Differential Revision: https://phabricator.haskell.org/D720
      de1160be
  3. 24 Mar, 2015 1 commit
  4. 11 Mar, 2015 1 commit
  5. 17 Feb, 2015 1 commit
  6. 16 Jan, 2015 1 commit
    • Alan Zimmerman's avatar
      API Annotations tweaks. · 11881ec6
      Alan Zimmerman authored
      Summary:
      HsTyLit now has SourceText
      
      Update documentation of HsSyn to reflect which annotations are attached to which element.
      
      Ensure that the parser always keeps HsSCC and HsTickPragma values, to
      be ignored in the desugar phase if not needed
      
      Bringing in SourceText for pragmas
      
      Add Location in NPlusKPat
      
      Add Location in FunDep
      
      Make RecCon payload Located
      
      Explicitly add AnnVal to RdrName where it is compound
      
      Add Location in IPBind
      
      Add Location to name in IEThingAbs
      
      Add Maybe (Located id,Bool) to Match to track fun_id,infix
        This includes converting Match into a record and adding a note about why
        the fun_id needs to be replicated in the Match.
      
      Add Location in KindedTyVar
      
      Sort out semi-colons for parsing
      
        - import statements
        - stmts
        - decls
        - decls_cls
        - decls_inst
      
      This updates the haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin, goldfire, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D538
      11881ec6
  7. 15 Dec, 2014 1 commit
    • Simon Peyton Jones's avatar
      Fix dll-split problem with patch 'Make Core Lint check for locally-bound GlobalId' · 3f87866a
      Simon Peyton Jones authored
      The trouble was that my changes made a lot more files transitively link with
      DynFlags, which is the root module for the revolting Windows dll-split stuff.
      
      Anyway this patch fixes it, in a good way:
      
       - Make GHC/Hooks *not* import DsMonad, because DsMonad imports too
         much other stuff (notably tcLookup variants).  Really, Hooks depends
         only on *types* not *code*.
      
       - To do this I need the DsM type, and the types it depends on,
         not to be part of DsMonad.  So I moved it to TcRnTypes, which is
         where the similar pieces for the TcM and IfM monads live.
      
       - We can then delete DsMonad.hs-boot
      
       - There are a bunch of knock-on change, of no great significance
      3f87866a
  8. 01 Dec, 2014 2 commits
  9. 27 Nov, 2014 2 commits
    • Sergei Trofimovich's avatar
      compiler: add new modules pulling in FunFlags · 65cae368
      Sergei Trofimovich authored
      And also sync type signature under '#ifndef GHCI'
      Tested by setting
          GhcWithInterpreter = NO
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      65cae368
    • Herbert Valerio Riedel's avatar
      Embed Git commit id into `ghc --info` output · 73e5e2f8
      Herbert Valerio Riedel authored
      Since we switched to a Git submodule based GHC Git repo, `ghc.git`'s
      commit id uniquely identifies the state of the GHC source-tree. So
      having that information embedded into the `ghc` executable provides
      valuable information to track accurately (especially when created by
      buildbots) from which source-tree-state a given `ghc` snapshot
      (distribution) was generated.
      
      So this commit adds a new field `"Project Git commit id"` to the
      `ghc --info` meta-data containing the `./configure`-time Git commit id
      as reported by `git rev-parse HEAD`.
      
      This field can also be queried with `ghc --print-project-git-commit-id`.
      
      For source distributions, the file `GIT_COMMIT_ID` is created (with some
      sanity checking to detect stale commit ids, as that would render this
      information rather useless)
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D528
      73e5e2f8
  10. 21 Nov, 2014 4 commits
    • Alan Zimmerman's avatar
      Capture original source for literals · c0ad5bc0
      Alan Zimmerman authored
      Summary:
      Make HsLit and OverLitVal have original source strings, for source to
      source conversions using the GHC API
      
      This is part of the ongoing AST Annotations work, as captured in
      https://ghc.haskell.org/trac/ghc/wiki/GhcAstAnnotations and
      https://ghc.haskell.org/trac/ghc/ticket/9628#comment:28
      
      The motivations for the literals is as follows
      
      ```lang=haskell
      x,y :: Int
      x = 0003
      y = 0x04
      
      s :: String
      s = "\x20"
      
      c :: Char
      c = '\x20'
      
      d :: Double
      d = 0.00
      
      blah = x
        where
          charH = '\x41'#
          intH = 0004#
          wordH = 005##
          floatH = 3.20#
          doubleH = 04.16##
          x = 1
      ```
      
      Test Plan: ./sh validate
      
      Reviewers: simonpj, austin
      
      Reviewed By: simonpj, austin
      
      Subscribers: thomie, goldfire, carter, simonmar
      
      Differential Revision: https://phabricator.haskell.org/D412
      
      GHC Trac Issues: #9628
      c0ad5bc0
    • Alan Zimmerman's avatar
      Add API Annotations · 803fc5db
      Alan Zimmerman authored
      Summary:
      The final design and discussion is captured at
      https://ghc.haskell.org/trac/ghc/wiki/GhcAstAnnotations
      
      This is a proof of concept implementation of a completely
      separate annotation structure, populated in the parser,and tied to the
      AST by means of a virtual "node-key" comprising the surrounding
      SrcSpan and a value derived from the specific constructor used for the
      node.
      
      The key parts of the design are the following.
      
      == The Annotations ==
      
      In `hsSyn/ApiAnnotation.hs`
      
      ```lang=haskell
      type ApiAnns = (Map.Map ApiAnnKey SrcSpan, Map.Map SrcSpan [Located Token])
      
      type ApiAnnKey = (SrcSpan,AnnKeywordId)
      
      -- ---------------------------------------------------------------------
      
      -- | Retrieve an annotation based on the @SrcSpan@ of the annotated AST
      -- element, and the known type of the annotation.
      getAnnotation :: ApiAnns -> SrcSpan -> AnnKeywordId -> Maybe SrcSpan
      getAnnotation (anns,_) span ann = Map.lookup (span,ann) anns
      
      -- |Retrieve the comments allocated to the current @SrcSpan@
      getAnnotationComments :: ApiAnns -> SrcSpan -> [Located Token]
      getAnnotationComments (_,anns) span =
        case Map.lookup span anns of
          Just cs -> cs
          Nothing -> []
      
      -- | Note: in general the names of these are taken from the
      -- corresponding token, unless otherwise noted
      data AnnKeywordId
               = AnnAs
               | AnnBang
               | AnnClass
               | AnnClose -- ^ } or ] or ) or #) etc
               | AnnComma
               | AnnDarrow
               | AnnData
               | AnnDcolon
               ....
      ```
      
      == Capturing in the lexer/parser ==
      
      The annotations are captured in the lexer / parser by extending PState to include a field
      
      In `parser/Lexer.x`
      
      ```lang=haskell
      data PState = PState {
              ....
              annotations :: [(ApiAnnKey,SrcSpan)]
              -- Annotations giving the locations of 'noise' tokens in the
              -- source, so that users of the GHC API can do source to
              -- source conversions.
           }
      ```
      
      The lexer exposes a helper function to add an annotation
      
      ```lang=haskell
      addAnnotation :: SrcSpan -> Ann -> SrcSpan -> P ()
      addAnnotation l a v = P $ \s -> POk s {
        annotations = ((AK l a), v) : annotations s
        } ()
      
      ```
      
      The parser also has some helper functions of the form
      
      ```lang=haskell
      type MaybeAnn = Maybe (SrcSpan -> P ())
      
      gl = getLoc
      gj x = Just (gl x)
      
      ams :: Located a -> [MaybeAnn] -> P (Located a)
      ams a@(L l _) bs = (mapM_ (\a -> a l) $ catMaybes bs) >> return a
      ```
      
      This allows annotations to be captured in the parser by means of
      
      ```
      ctypedoc :: { LHsType RdrName }
              : 'forall' tv_bndrs '.' ctypedoc {% hintExplicitForall (getLoc $1) >>
                                                  ams (LL $ mkExplicitHsForAllTy $2 (noLoc []) $4)
                                                      [mj AnnForall $1,mj AnnDot $3] }
              | context '=>' ctypedoc         {% ams (LL $ mkQualifiedHsForAllTy   $1 $3)
                                                     [mj AnnDarrow $2] }
              | ipvar '::' type               {% ams (LL (HsIParamTy (unLoc $1) $3))
                                                     [mj AnnDcolon $2] }
              | typedoc                       { $1 }
      ```
      
      == Parse result ==
      
      ```lang-haskell
      data HsParsedModule = HsParsedModule {
          hpm_module    :: Located (HsModule RdrName),
          hpm_src_files :: [FilePath],
             -- ^ extra source files (e.g. from #includes).  The lexer collects
             -- these from '# <file> <line>' pragmas, which the C preprocessor
             -- leaves behind.  These files and their timestamps are stored in
             -- the .hi file, so that we can force recompilation if any of
             -- them change (#3589)
          hpm_annotations :: ApiAnns
        }
      
      -- | The result of successful parsing.
      data ParsedModule =
        ParsedModule { pm_mod_summary   :: ModSummary
                     , pm_parsed_source :: ParsedSource
                     , pm_extra_src_files :: [FilePath]
                     , pm_annotations :: ApiAnns }
      ```
      
      This diff depends on D426
      
      Test Plan: sh ./validate
      
      Reviewers: austin, simonpj, Mikolaj
      
      Reviewed By: simonpj, Mikolaj
      
      Subscribers: Mikolaj, goldfire, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D438
      
      GHC Trac Issues: #9628
      803fc5db
    • eir@cis.upenn.edu's avatar
      Fix #7484, checking for good binder names in Convert. · da2fca9e
      eir@cis.upenn.edu authored
      This commit also refactors a bunch of lexeme-oriented code into
      a new module Lexeme, and includes a submodule update for haddock.
      da2fca9e
    • Simon Peyton Jones's avatar
      Remove TcMType from compiler_stage2_dll0_MODULES · 5f39c4de
      Simon Peyton Jones authored
      I can't say I really understand this DLL-split thing, but the build fails
      if I don't remove TcMType here.
      
      I've put this in a commit on its own, but it's a knock-on effect of the
      immediately preceding wave of typechecker changes
      5f39c4de
  11. 19 Nov, 2014 1 commit
  12. 13 Nov, 2014 1 commit
  13. 12 Nov, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Implement new integer-gmp2 from scratch (re #9281) · c774b28f
      Herbert Valerio Riedel authored
      This is done as a separate `integer-gmp2` backend library because it
      turned out to become a complete rewrite from scratch.
      
      Due to the different (over)allocation scheme and potentially different
      accounting (via the new `{shrink,resize}MutableByteArray#` primitives),
      some of the nofib benchmarks actually results in increased allocation
      numbers (but not necessarily an increase in runtime!).  I believe the
      allocation numbers could improve if `{resize,shrink}MutableByteArray#`
      could be optimised to reallocate in-place more efficiently.
      
      Here are the more apparent changes in the latest nofib comparision
      between `integer-gmp` and `integer-gmp2`:
      
        ------------------------------------------------------------------
                Program     Size    Allocs   Runtime   Elapsed  TotalMem
        ------------------------------------------------------------------
                    ...
             bernouilli    +1.6%    +15.3%     0.132     0.132      0.0%
                    ...
           cryptarithm1    -2.2%      0.0%     -9.7%     -9.7%      0.0%
                    ...
                  fasta    -0.7%     -0.0%    +10.9%    +10.9%      0.0%
                    ...
                  kahan    +0.6%    +38.9%     0.169     0.169      0.0%
                    ...
                   lcss    -0.7%     -0.0%     -6.4%     -6.4%      0.0%
                    ...
                 mandel    +1.6%    +33.6%     0.049     0.049      0.0%
                    ...
               pidigits    +0.8%     +8.5%     +3.9%     +3.9%      0.0%
                  power    +1.4%    -23.8%    -18.6%    -18.6%    -16.7%
                    ...
              primetest    +1.3%    +50.1%     0.085     0.085      0.0%
                    ...
                    rsa    +1.6%    +53.4%     0.026     0.026      0.0%
                    ...
                    scs    +1.2%     +6.6%     +6.5%     +6.6%    +14.3%
                    ...
                 symalg    +1.0%     +9.5%     0.010     0.010      0.0%
                    ...
              transform    -0.6%     -0.0%     -5.9%     -5.9%      0.0%
                    ...
        ------------------------------------------------------------------
                    Min    -2.3%    -23.8%    -18.6%    -18.6%    -16.7%
                    Max    +1.6%    +53.4%    +10.9%    +10.9%    +14.3%
         Geometric Mean    -0.3%     +1.9%     -0.8%     -0.8%     +0.0%
      
      (see P35 / https://phabricator.haskell.org/P35 for full report)
      
      By default, `INTEGER_LIBRARY=integer-gmp2` is active now, which results
      in the package `integer-gmp-1.0.0.0` being registered in the package db.
      The previous `integer-gmp-0.5.1.0` can be restored by setting
      `INTEGER_LIBRARY=integer-gmp` (but will probably be removed altogether
      for GHC 7.12). In-tree GMP support has been stolen from the old
      `integer-gmp` (while unpatching the custom memory-allocators, as well as
      forcing `-fPIC`)
      
      A minor hack to `ghc-cabal` was necessary in order to support two different
      `integer-gmp` packages (in different folders) with the same package key.
      
      There will be a couple of follow-up commits re-implementing some features
      that were dropped to keep D82 minimal, as well as further
      clean-ups/improvements.
      
      More information can be found via #9281 and
      https://ghc.haskell.org/trac/ghc/wiki/Design/IntegerGmp2
      
      Reviewed By: austin, rwbarton, simonmar
      
      Differential Revision: https://phabricator.haskell.org/D82
      c774b28f
  14. 07 Oct, 2014 1 commit
    • thomie's avatar
      Remove RAWCPP_FLAGS · 460eebec
      thomie authored
      Summary:
      #9094 mentions to "remove the RAW_CPP bits from the ghc build system because
      they're not longer needed", "once the CPP settings ticket is merged #8683"
      
      #8683 was merged with 34f7e9a3, Phab:D26.
      
      Test Plan: harbormaster
      
      Reviewers: carter, austin
      
      Reviewed By: austin
      
      Subscribers: simonmar, ezyang, carter
      
      Differential Revision: https://phabricator.haskell.org/D240
      
      GHC Trac Issues: #9094
      460eebec
  15. 05 Oct, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Implement `MIN_VERSION_GLASGOW_HASKELL()` macro · 3549c952
      Herbert Valerio Riedel authored
      This exposes the `cProjectPatchLevel{1,2}` value at the CPP level to
      allow it to be used in CPP conditionals. Concretely, GHC 7.10.2.20150623
      would result in
      
        #define __GLASGOW_HASKELL__             710
        #define __GLASGOW_HASKELL_PATCHLEVEL1__ 2
        #define __GLASGOW_HASKELL_PATCHLEVEL2__ 20150623
      
      while GHC 7.10.3 results in
      
        #define __GLASGOW_HASKELL__             710
        #define __GLASGOW_HASKELL_PATCHLEVEL1__ 3
      
      and finally GHC 7.9.20141009 results in
      
        #define __GLASGOW_HASKELL__             709
        #define __GLASGOW_HASKELL_PATCHLEVEL1__ 20141009
      
      As it's error-prone to properly express CPP conditionals for testing GHC
      multi-component versions, a new macro `MIN_VERSION_GLASGOW_HASKELL()` is
      provided (also via the new CPP include file `ghcversion.h`)
      
      Finally, in order to make it easier to define the new CPP macro
      `MIN_VERSION_GLASGOW_HASKELL()`, a new default-included
      `include/ghcversion.h` is used for the new CPP definitions.
      
      Reviewed By: ekmett, austin, #ghc
      
      Differential Revision: https://phabricator.haskell.org/D66
      3549c952
  16. 04 Oct, 2014 1 commit
    • Sergei Trofimovich's avatar
      ghc.mk: fix list for dll-split on GHCi-less builds · 2a8ea474
      Sergei Trofimovich authored
      To reproduce build failure it's enough to try
      to build GHC on amd64 with the following setup:
      
          $ cat mk/build.mk
          # for #9552
          GhcWithInterpreter = NO
      
      It gives:
      
          Reachable modules from DynFlags out of date
          Please fix compiler/ghc.mk, or building DLLs on Windows may break (#7780)
          Redundant modules: Bitmap BlockId ... <list of 42 modules>
          <make error>
      
      dll-split among other things makes sure
      all mentioned modules are used by DynFlags.
      '#ifdef GHCI' keeps is from happening.
      
      Patch moves those 42 modules under
      'GhcWithInterpreter' guard.
      
      Fixes Issue #9552
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      2a8ea474
  17. 06 Sep, 2014 1 commit
  18. 05 Aug, 2014 1 commit
    • Edward Z. Yang's avatar
      Package keys (for linking/type equality) separated from package IDs. · 66218d15
      Edward Z. Yang authored
      This patch set makes us no longer assume that a package key is a human
      readable string, leaving Cabal free to "do whatever it wants" to allocate
      keys; we'll look up the PackageId in the database to display to the user.
      This also means we have a new level of qualifier decisions to make at the
      package level, and rewriting some Safe Haskell error reporting code to DTRT.
      
      Additionally, we adjust the build system to use a new ghc-cabal output
      Make variable PACKAGE_KEY to determine library names and other things,
      rather than concatenating PACKAGE/VERSION as before.
      
      Adds a new `-this-package-key` flag to subsume the old, erroneously named
      `-package-name` flag, and `-package-key` to select packages by package key.
      
      RFC: The md5 hashes are pretty tough on the eye, as far as the file
      system is concerned :(
      
      ToDo: safePkg01 test had its output updated, but the fix is not really right:
      the rest of the dependencies are truncated due to the fact the we're only
      grepping a single line, but ghc-pkg is wrapping its output.
      
      ToDo: In a later commit, update all submodules to stop using -package-name
      and use -this-package-key.  For now, we don't do it to avoid submodule
      explosion.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, simonmar, hvr, austin
      
      Subscribers: simonmar, relrod, carter
      
      Differential Revision: https://phabricator.haskell.org/D80
      66218d15
  19. 02 Jul, 2014 2 commits
  20. 17 Feb, 2014 1 commit
  21. 20 Jan, 2014 1 commit
    • cactus's avatar
      Implement pattern synonyms · 4f8369bf
      cactus authored
      This patch implements Pattern Synonyms (enabled by -XPatternSynonyms),
      allowing y ou to assign names to a pattern and abstract over it.
      
      The rundown is this:
      
        * Named patterns are introduced by the new 'pattern' keyword, and can
          be either *unidirectional* or *bidirectional*. A unidirectional
          pattern is, in the simplest sense, simply an 'alias' for a pattern,
          where the LHS may mention variables to occur in the RHS. A
          bidirectional pattern synonym occurs when a pattern may also be used
          in expression context.
      
        * Unidirectional patterns are declared like thus:
      
              pattern P x <- x:_
      
          The synonym 'P' may only occur in a pattern context:
      
              foo :: [Int] -> Maybe Int
              foo (P x) = Just x
              foo _     = Nothing
      
        * Bidirectional patterns are declared like thus:
      
              pattern P x y = [x, y]
      
          Here, P may not only occur as a pattern, but also as an expression
          when given values for 'x' and 'y', i.e.
      
              bar :: Int -> [Int]
              bar x = P x 10
      
        * Patterns can't yet have their own type signatures; signatures are inferred.
      
        * Pattern synonyms may not be recursive, c.f. type synonyms.
      
        * Pattern synonyms are also exported/imported using the 'pattern'
          keyword in an import/export decl, i.e.
      
              module Foo (pattern Bar) where ...
      
          Note that pattern synonyms share the namespace of constructors, so
          this disambiguation is required as a there may also be a 'Bar'
          type in scope as well as the 'Bar' pattern.
      
        * The semantics of a pattern synonym differ slightly from a typical
          pattern: when using a synonym, the pattern itself is matched,
          followed by all the arguments. This means that the strictness
          differs slightly:
      
              pattern P x y <- [x, y]
      
              f (P True True) = True
              f _             = False
      
              g [True, True] = True
              g _            = False
      
          In the example, while `g (False:undefined)` evaluates to False,
          `f (False:undefined)` results in undefined as both `x` and `y`
          arguments are matched to `True`.
      
      For more information, see the wiki:
      
          https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms
          https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms/ImplementationReviewed-by: Simon Peyton Jones's avatarSimon Peyton Jones <simonpj@microsoft.com>
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      4f8369bf
  22. 27 Nov, 2013 1 commit
  23. 13 Nov, 2013 1 commit
    • Iavor S. Diatchki's avatar
      Make type-level evaluation work with :kind! · b2fa2d41
      Iavor S. Diatchki authored
      The main change is to add a case to `reduceTyFamApp_maybe` to evaluate
      built-in type constructors (e.g., (+), (*), and friends).
      
      To avoid problems with recursive modules, I moved the definition of
      TcBuiltInSynFamily from `FamInst` to `FamInstEnv`.  I am still not sure if
      this is the right place.
      
      There is also a wibble that it'd be nice to fix:
      
      when we evaluate a built-in type function, using`sfMatchFam`, we get
      a `TcCoercion`.  However, `reduceTyFamApp_maybe` needs a `Corecion`.
      I couldn't find a nice way to convert between the two, so I resorted to
      a bit of hack (marked with `XXX`).
      
      The hack is that we happen to know that the built-in constructors for
      the type-nat functions always return coercions of shape `TcAxiomRuleCo`,
      with no assumptions, so it easy to convert `TcCoercion` to `Coercion`
      in this one case.  This is enough to make things work, but it is clearly
      a cludge.
      b2fa2d41
  24. 11 Oct, 2013 1 commit
  25. 01 Oct, 2013 1 commit
  26. 23 Sep, 2013 1 commit
    • gmainlan@microsoft.com's avatar
      SIMD primops are now generated using schemas that are polymorphic in · 16b350a4
      gmainlan@microsoft.com authored
      width and element type.
      
      SIMD primops are now polymorphic in vector size and element type, but
      only internally to the compiler. More specifically, utils/genprimopcode
      has been extended so that it "knows" about SIMD vectors. This allows us
      to, for example, write a single definition for the "add two vectors"
      primop in primops.txt.pp and have it instantiated at many vector types.
      This generates a primop in GHC.Prim for each vector type at which "add
      two vectors" is instantiated, but only one data constructor for the
      PrimOp data type, so the code generator is much, much simpler.
      16b350a4
  27. 22 Sep, 2013 1 commit
  28. 18 Sep, 2013 3 commits
    • Jan Stolarek's avatar
      Restore old names of comparison primops · 53948f91
      Jan Stolarek authored
      In 6579a6c7 we removed existing comparison primops and introduced new ones
      returning Int# instead of Bool. This commit (and associated commits in
      array, base, dph, ghc-prim, integer-gmp, integer-simple, primitive, testsuite and
      template-haskell) restores old names of primops. This allows us to keep
      our API cleaner at the price of not having backwards compatibility.
      
      This patch also temporalily disables fix for #8317 (optimization of
      tagToEnum# at Core level). We need to fix #8326 first, otherwise
      our primops code will be very slow.
      53948f91
    • Jan Stolarek's avatar
      Trailing whitespaces · 6eec7bc5
      Jan Stolarek authored
      6eec7bc5
    • twanvl's avatar
      Implement checkable "minimal complete definitions" (#7633) · bd42c9df
      twanvl authored
      This commit adds a `{-# MINIMAL #-}` pragma, which defines the possible
      minimal complete definitions for a class. The body of the pragma is a
      boolean formula of names.
      
      The old warning for missing methods is replaced with this new one.
      
      Note: The interface file format is changed to store the minimal complete
      definition.
      Authored-by: twanvl's avatarTwan van Laarhoven <twanvl@gmail.com>
      Signed-off-by: Herbert Valerio Riedel's avatarHerbert Valerio Riedel <hvr@gnu.org>
      bd42c9df
  29. 13 Sep, 2013 1 commit
    • Iavor S. Diatchki's avatar
      Add support for evaluation of type-level natural numbers. · 1f77a534
      Iavor S. Diatchki authored
      This patch implements some simple evaluation of type-level expressions
      featuring natural numbers.  We can evaluate *concrete* expressions that
      use the built-in type families (+), (*), (^), and (<=?), declared in
      GHC.TypeLits.   We can also do some type inference involving these
      functions.  For example, if we encounter a constraint such as `(2 + x) ~ 5`
      we can infer that `x` must be 3.  Note, however, this is used only to
      resolve unification variables (i.e., as a form of a constraint improvement)
      and not to generate new facts.  This is similar to how functional
      dependencies work in GHC.
      
      The patch adds a new form of coercion, `AxiomRuleCo`, which makes use
      of a new form of axiom called `CoAxiomRule`.  This is the form of evidence
      generate when we solve a constraint, such as `(1 + 2) ~ 3`.
      
      The patch also adds support for built-in type-families, by adding a new
      form of TyCon rhs: `BuiltInSynFamTyCon`.  such built-in type-family
      constructors contain a record with functions that are used by the
      constraint solver to simplify and improve constraints involving the
      built-in function (see `TcInteract`).  The record in defined in `FamInst`.
      
      The type constructors and rules for evaluating the type-level functions
      are in a new module called `TcTypeNats`.
      1f77a534
  30. 09 Sep, 2013 1 commit
    • thoughtpolice's avatar
      Fix optimization of Parser.y.pp · 9f8e9d29
      thoughtpolice authored
      In 9e133b, the build was modified to pass -fcmm-sink to Parser, but
      unfortunately Parser specifies -O0 in its OPTIONS_GHC directive, meaning
      the sinking pass was actually turned off.
      
      HC_OPTS is the last thing passed to the compiler for that source file
      however, so the correct fix is to also move -O0 out into the build
      system as well.
      
      This was uncovered thanks to a build report from Kazu Yamamoto. Thanks
      to Jan Stolarek for eyeballing this bug and finding it.
      Signed-off-by: thoughtpolice's avatarAustin Seipp <aseipp@pobox.com>
      9f8e9d29
  31. 04 Sep, 2013 1 commit
    • thoughtpolice's avatar
      Make sure -fcmm-sink is passed to Parser properly · 9e133b9d
      thoughtpolice authored
      Parser.hs needs to be compiled with -fcmm-sink on x86 platforms, so the
      register allocator doesn't run out of stack slots. Previously, we had to
      do some CPP hacks in order to emit an #ifdef into the file - this is
      because we preprocess it once up front, and run the preprocessor again
      when we compile it.
      
      There's two cases: the boostrap compiler is > 7.8, and the stage1 parser
      needs the flag, or the stage1 compiler is compiling the stage2
      Parser.hs, and needs the flag..
      
      The previous approach was super fragile with Clang. The more principled
      fix is to instead do this through the build system.
      
      This fixes #8182.
      Signed-off-by: thoughtpolice's avatarAustin Seipp <aseipp@pobox.com>
      9e133b9d
  32. 27 Aug, 2013 1 commit
    • parcs's avatar
      UniqSupply: make mkSplitUniqSupply thread-safe · 036910ad
      parcs authored
      unsafeInterleaveIO is used instead of unsafeDupableInterleaveIO because
      a mk_supply thunk that is simultaneously entered by two threads should
      evaluate to the same UniqSupply.
      
      The UniqSupply counter is now incremented atomically using the RTS's
      atomic_inc().
      
      To mitigate the extra overhead of unsafeInterleaveIO in the
      single-threaded compiler, noDuplicate# is changed to exit early when
      n_capabilities == 1.
      036910ad