1. 17 Nov, 2016 1 commit
    • Edward Z. Yang's avatar
      Test for type synonym loops on TyCon. · 31398fbc
      Edward Z. Yang authored
      Summary:
      Previously, we tested for type synonym loops by doing
      a syntactic test on the literal type synonym declarations.
      However, in some cases, loops could go through hs-boot
      files, leading to an infinite loop (#12042); a similar
      situation can occur when signature merging.
      
      This commit replaces the syntactic test with a test on
      TyCon, simply by walking down all type synonyms until
      we bottom out, or find we've looped back.  It's a lot
      simpler.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, austin, bgamari
      
      Subscribers: goldfire, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2656
      
      GHC Trac Issues: #12042
      31398fbc
  2. 16 Nov, 2016 4 commits
  3. 15 Nov, 2016 1 commit
  4. 14 Nov, 2016 1 commit
    • Simon Marlow's avatar
      Remove CONSTR_STATIC · 55d535da
      Simon Marlow authored
      Summary:
      We currently have two info tables for a constructor
      
      * XXX_con_info: the info table for a heap-resident instance of the
        constructor, It has type CONSTR, or one of the specialised types like
        CONSTR_1_0
      
      * XXX_static_info: the info table for a static instance of this
        constructor, which has type CONSTR_STATIC or CONSTR_STATIC_NOCAF.
      
      I'm getting rid of the latter, and using the `con_info` info table for
      both static and dynamic constructors.  For rationale and more details
      see Note [static constructors] in SMRep.hs.
      
      I also removed these macros: `isSTATIC()`, `ip_STATIC()`,
      `closure_STATIC()`, since they relied on the CONSTR/CONSTR_STATIC
      distinction, and anyway HEAP_ALLOCED() does the same job.
      
      Test Plan: validate
      
      Reviewers: bgamari, simonpj, austin, gcampax, hvr, niteria, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2690
      
      GHC Trac Issues: #12455
      55d535da
  5. 13 Nov, 2016 1 commit
    • Ben Gamari's avatar
      Kill Type pretty-printer · 6c0f10fa
      Ben Gamari authored
      Here we consolidate the pretty-printing logic for types in IfaceType. We
      need IfaceType regardless and the printer for Type can be implemented in
      terms of that for IfaceType. See #11660.
      
      Note that this is very much a work-in-progress. Namely I still have yet
      to ponder how to ease the hs-boot file situation, still need to rip out
      more dead code, need to move some of the special cases for, e.g., `*` to
      the IfaceType printer, and need to get it to validate. That being said,
      it comes close to validating as-is.
      
      Test Plan: Validate
      
      Reviewers: goldfire, austin
      
      Subscribers: goldfire, thomie, simonpj
      
      Differential Revision: https://phabricator.haskell.org/D2528
      
      GHC Trac Issues: #11660
      6c0f10fa
  6. 12 Nov, 2016 2 commits
  7. 11 Nov, 2016 3 commits
    • Ben Gamari's avatar
      Pass -no-pie to GCC · d421a7e2
      Ben Gamari authored
      Certain distributions (e.g. Debian and Ubuntu) have enabled PIE be
      default in their GCC packaging. This breaks our abuse of GCC as a linker
      which requires that we pass -Wl,-r, which is incompatible with
      PIE (since the former implies that we are generating a relocatable
      object file and the latter an executable).
      
      This is a second attempt at D2691. This attempt constrasts with D2691 in that
      it preserves the "does gcc support -no-pie" flag in settings, allowing this to
      be reconfigured by `configure` during installation of a binary distribution.
      Thanks for @rwbarton for drawing attention to this issue.
      
      Test Plan: Validate
      
      Reviewers: austin, hvr, erikd
      
      Reviewed By: erikd
      
      Subscribers: thomie, rwbarton, erikd
      
      Differential Revision: https://phabricator.haskell.org/D2693
      
      GHC Trac Issues: #12759
      d421a7e2
    • Simon Peyton Jones's avatar
      Revert "Refactor CallStack defaulting slightly" · 7a7bb5d2
      Simon Peyton Jones authored
      This reverts commit 317236db.
      
      I totally missed that in simplifyInfer for local functions
      we must NOT default call stacks.  So I'm reverting this.
      
      Fortunately caught by T10845, which sadly isn't run by
      validate --fast
      7a7bb5d2
    • Ben Gamari's avatar
      Revert "Pass -no-pie to GCC" · 60bb9d1c
      Ben Gamari authored
      This reverts commit bae4a55b.
      
      This will be superceded by D2693.
      60bb9d1c
  8. 10 Nov, 2016 6 commits
    • Ryan Scott's avatar
      Prevent GND from inferring an instance context for method-less classes · 03e8d26f
      Ryan Scott authored
      When `GeneralizedNewtypeDeriving` is used with a type class that has no
      methods, it will generate a redundant context, and as a result, it can
      trigger warnings when compiled with `-Wredundant-constraints`. This is a
      simple change in behavior to check beforehand if a class has methods
      when deriving it with GND, and if it has no methods, avoid inferring the
      redundant context.
      
      Beware that the test for #6088, which used to be expected to fail, now
      compiles without issue since it doesn't infer a problematic instance
      context.
      
      Thanks to Simon Peyton Jones for doing the necessary refactoring in
      f05d685a.
      
      Fixes #12814.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, rwbarton, simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2692
      
      GHC Trac Issues: #12814
      03e8d26f
    • Ben Gamari's avatar
      Pass -no-pie to GCC · bae4a55b
      Ben Gamari authored
      Certain distributions (e.g. Debian and Ubuntu) have enabled PIE be
      default in their GCC packaging. This breaks our abuse of GCC as a linker
      which requires that we pass -Wl,-r, which is incompatible with
      PIE (since the former implies that we are generating a relocatable
      object file and the latter an executable).
      
      Test Plan: Validate
      
      Reviewers: hvr, austin
      
      Subscribers: rwbarton, thomie, erikd
      
      Differential Revision: https://phabricator.haskell.org/D2691
      
      GHC Trac Issues: #12759
      bae4a55b
    • Simon Peyton Jones's avatar
      Refactor CallStack defaulting slightly · 317236db
      Simon Peyton Jones authored
      This moves call-stack defaulting from simpl_top to solveWanteds,
      for reasons described in Note [CallStack defaulting].
      
      No change in visible behaviour.
      317236db
    • Simon Peyton Jones's avatar
      Refactoring of mkNewTypeEqn · f05d685a
      Simon Peyton Jones authored
      The refactoring here is very small.  I did it while studying
      Trac #12814.
      
      To implement the change in #12814, we can just un-comment the
      lines at line 1275.  It's ready to go but I didn't want to pull
      the trigger in this commit
      f05d685a
    • Simon Peyton Jones's avatar
      Adapt the (commented out) pprTrace in OccurAnal · 7fe71636
      Simon Peyton Jones authored
      I did this while investigating Trac #12776
      7fe71636
    • Alex Biehl's avatar
      Fix comment about pointer tagging · 2325afe9
      Alex Biehl authored
      `Lcall` enters the closure. If it has tags we jump directly to `Lret`. 
      
      Confirmed with some generated cmm code: 
      
      ```
                 R1 = _s2pP::P64;
                 Sp = Sp - 8;
                 if (R1 & 7 != 0) goto c2x0; else goto c2x1;
             c2x1:
                 call (I64[R1])(R1) returns to c2x0, args: 8, res: 8, upd: 8;
             c2x0:
                 _s2pQ::P64 = R1;
      ```
      2325afe9
  9. 06 Nov, 2016 5 commits
  10. 05 Nov, 2016 1 commit
  11. 04 Nov, 2016 3 commits
  12. 03 Nov, 2016 3 commits
    • Simon Marlow's avatar
      Omit unnecessary linker flags · a977c965
      Simon Marlow authored
      Summary:
      This omits -L and -l flags from the linker command line that shouldn't
      be necessary because GHC will already add them via the -package-id
      flags we pass.
      
      This also reverts part of 90538d86
      that rearranges the linker command line and causes some knock-on
      problems (see D2618).
      
      Test Plan: validate (need to validate on Windows too)
      
      Reviewers: Phyx, bgamari, niteria, austin, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2639
      
      GHC Trac Issues: #12738
      a977c965
    • Alan Zimmerman's avatar
      API Annotations: make all ModuleName Located · f46bfeb8
      Alan Zimmerman authored
      Summary:
      This also changes the backpack Renaming type to use a Maybe for the
      renameTo field, to more accurately reflect the parsed source.
      
      Updates haddock submodule to match AST changes
      
      Test Plan: ./validate
      
      Reviewers: ezyang, bgamari, austin
      
      Reviewed By: bgamari
      
      Subscribers: thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2670
      f46bfeb8
    • Ben Gamari's avatar
      Merge cpe_ExprIsTrivial and exprIsTrivial · 967dd5c9
      Ben Gamari authored
      Strangely my previous attempts at resolving this all seemed to end in
      perplexing segmentation faults in the GHC testsuite (including some
      rather recent attempts). Somehow this attempt miraculously works.
      
      However, there was one wrinkle that I still need to work out fully: we
      need to consider Lits as non-trivial in cpeArg. Failure to do this means
      that we would transform something like,
      
          $trModule = TrModule "HelloWorld"#
      
      into
      
          $trModule = case "HelloWorld"# of x { __DEFAULT -> TrModule x }
      
      Which then fails the consistentStgInfo check in CoreToStg for reasons
      that I am still trying to work out.
      
      Mark T12757 as fixed
      
      Reviewers: simonmar, simonpj, austin
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2666
      
      GHC Trac Issues: #11158
      967dd5c9
  13. 02 Nov, 2016 9 commits
    • Ben Gamari's avatar
      Add notes describing SRT concepts · 80076fa6
      Ben Gamari authored
      Test Plan: Read it
      
      Reviewers: austin, erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2663
      80076fa6
    • Michal Terepeta's avatar
      Hoopl/Dataflow: make the module more self-contained · dc4d5962
      Michal Terepeta authored
      This makes the GHC's Dataflow module more self-contained by also
      forking the `DataflowLattice` (instead of only the analysis
      algorithm). Effects/benefits:
      - We no longer need to use the deprecated Hoopl functions (and can
        remove `-fno-warn-warnings-deprecations` from two modules).
      - We can remove the unnecessary `Label` parameter of `JoinFun` (already
        ignored in all our implementations).
      - We no longer mix Hoopl's `Dataflow` module and GHC's one.
      - We can replace some calls to lazy folds in Hoopl with the strict ones
        (see `joinOutFacts` and `mkFactBase`).
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: validate
      
      Reviewers: austin, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2660
      dc4d5962
    • Sylvain HENRY's avatar
      Uninstall signal handlers · 8a5960ad
      Sylvain HENRY authored
      GHC installs signal handlers in runGhc/runGhcT to handle ^C but it
      never uninstalls them.
      It can be an issue, especially when using GHC as a library.
      
      Test Plan: validate
      
      Reviewers: bgamari, erikd, austin, simonmar
      
      Reviewed By: bgamari, simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2633
      
      GHC Trac Issues: #4162
      8a5960ad
    • Simon Peyton Jones's avatar
      Renaming and comments in CorePrep · 623b8e44
      Simon Peyton Jones authored
      In particular I renamed
        'triv' to 'arg'
        CpeTriv to CpeArg
      in Note [CorePrep invariants], with knock on consequences.
      
      This is groundwork for the fix to Trac #11158
      623b8e44
    • Simon Peyton Jones's avatar
      Fix Trac #12797: approximateWC · 13508bad
      Simon Peyton Jones authored
      This patch makes approximateWC a bit more gung-ho when called
      from the defaulting code.  See Note [ApproximateWC], item (1).
      13508bad
    • Simon Peyton Jones's avatar
      Use substTyUnchecked in TcMType.new_meta_tv_x · f4a14d6c
      Simon Peyton Jones authored
      Sadly, one of the indirect callers of this function doesn't yet
      enforce the in-scope set.  It's in the TcHsType.tc_infer_args swamp,
      so I'm not going to wade in there today.
      
      The assertion tripped when investigating Trac #12785; but this patch
      does NOT fix the actual bug reported there.
      f4a14d6c
    • Simon Peyton Jones's avatar
      Simplify the API for TcHsType.kcHsTyVarBndrs · 7a509660
      Simon Peyton Jones authored
      Pass in a Bool rather than return a funcion!
      
      No change in behaviour.
      7a509660
    • Simon Peyton Jones's avatar
      Get rid of TcTyVars more assiduously · 99689492
      Simon Peyton Jones authored
      * I found a bug in 'generalize' in TcTyClsDecls.kcTyClGroup, where
        the kind variables weren't being turned into proper TyVars, so
        we got (skolem) TcTyVars in TyCons, which shouldn't happen.  Fix
        was easy.
      
      * Similarly TcHsType.kindGeneralizeType wasn't turning the forall'd
        TcTyVars into TyVars.  To achieve this I defined TcHsTyn.zonkSigType.
      
      * All this allowed me to remove awkward and ill-explained bit of
        footwork on DFunIds in Inst.newClsInst
      
      This is just refactoring, but it does make the printout from
      -ddump-deriv make a bit more sense by not grautuitiously cloning
      type variables.  In the display I was seeing
      
         instance C [a_df4] where
            f x = ...a_dx5...
      
      where actually the d_df4 and a_dx5 were the same.
      99689492
    • Simon Peyton Jones's avatar
      Tiny refactor · 79fb6e66
      Simon Peyton Jones authored
      Swap order of calls in genInst just to make
      the two cases the same
      
      Plus some alpha-renaming
      79fb6e66