Skip to content
Snippets Groups Projects
  1. Apr 01, 2017
  2. Mar 31, 2017
  3. Mar 29, 2017
    • Richard Eisenberg's avatar
      Fix #13458 · 662c6422
      Richard Eisenberg authored and Ben Gamari's avatar Ben Gamari committed
      Core Lint shouldn't check representations of types that don't
      have representations.
      
      test case: typecheck/should_compile/T13458
      
      (cherry picked from commit cea71418)
      662c6422
    • Simon Peyton Jones's avatar
      Fix ASSERT failure in TcErrors · 95ca115d
      Simon Peyton Jones authored
      This fixes Trac #13494, by improving
      
         commit e0ad55f8
         Author: Simon Peyton Jones <simonpj@microsoft.com>
         Date:   Mon Mar 27 10:32:08 2017 +0100
      
         Fix error-message suppress on given equalities
      
      which in turn was a fix to #13446
      
      (cherry picked from commit f88ac374)
      95ca115d
    • Simon Peyton Jones's avatar
      Allow unbound Refl binders in a RULE · 7087abfe
      Simon Peyton Jones authored
      Trac #13410 was failing because we had a RULE with a binder
         (c :: t~t)
      and the /occurrences/ of c on the LHS were being optimised to Refl,
      leaving a binder that would not be filled in by matching the LHS
      of the rule.
      
      I flirted with trying to ensure that occurrences (c :: t~t) are
      not optimised to Relf, but that turned out to be fragile; it was
      being done, for good reasons, in multiple places, including
        - TyCoRep.substCoVarBndr
        - Simplify.simplCast
        - Corecion.mkCoVarCo
      
      So I fixed it in one place by making Rules.matchN deal happily
      with an unbound binder (c :: t~t).  Quite easy.  See "Coercion
      variables" in Note [Unbound RULE binders] in Rules.
      
      In addition, I needed to make CoreLint be happy with an bound
      RULE binder that is a Relf coercion variable
      
      In debugging this, I was perplexed that occurrences of a variable
      (c :: t~t) mysteriously turned into Refl.  I found out how it
      was happening, and decided to move it:
      
      * In TyCoRep.substCoVarBndr, do not substitute Refl for a
        binder (c :: t~t).
      
      * In mkCoVarCo do not optimise (c :: t~t) to Refl.
      
      Instead, we do this optimisation in optCoercion (specifically
      opt_co4) where, surprisingly, the optimisation was /not/
      being done.  This has no effect on what programs compile;
      it just moves a relatively-expensive optimisation to optCoercion,
      where it seems more properly to belong.  It's actually not clear
      to me which is really "better", but this way round is less
      surprising.
      
      One small simplifying refactoring
      
      * Eliminate TyCoRep.substCoVarBndrCallback, which was only
        called locally.
      
      (cherry picked from commit 8674883c)
      7087abfe
    • Simon Peyton Jones's avatar
      Complete the fix for #13441 (pattern synonyms) · 765219d9
      Simon Peyton Jones authored
      Do not attempt to typecheck both directions of an
      implicitly-bidirectional pattern synonym simultanously,
      as we were before.  Instead, the builder is typechecked
      when we typecheck the code for the builder, which was
      of course happening already, even in both bidirectional
      cases.
      
      See Note [Checking against a pattern signature], under
      "Existential type variables".
      
      (cherry picked from commit b5c81203)
      765219d9
    • Sergei Trofimovich's avatar
      unique: fix UNIQUE_BITS crosscompilation (Trac #13491) · 3389bb34
      Sergei Trofimovich authored and Ben Gamari's avatar Ben Gamari committed
      
      The #13491 manifests best when we try to crosscompile
      from 32-bit (i386-linux) to 64-bit (powerpc64-linux)
      system:
          ./configure --target=powerpc64-unknown-linux-gnu
      
      The build fails at assembly time:
        "inplace/bin/ghc-stage1" ...  -c rts/StgStartup.cmm
          /tmp/ghc19687_0/ghc_4.s: Assembler messages:
      
          /tmp/ghc19687_0/ghc_4.s:11:0: error:
               Error: unknown pseudo-op: `.l'
             |
          11 | .L<\x00>4:
             | ^
      
      That happens because UNIQUE_BITS is defined in terms
      of WORD_SIZE_IN_BITS macro:
          #define UNIQUE_BITS (WORD_SIZE_IN_BITS - 8)
      
      WORD_SIZE_IN_BITS is 64 bits (equals to target value)
      while ghc-stage1 is still running on i386-linux
      
      The fix is to stop relying on target macros and use
      host's 'sizeof (HsInt)' and 'finiteBitSize' way to
      determine unique layout.
      
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      
      Test Plan: build i386-to-powerpc64 crosscompiler
      
      Reviewers: rwbarton, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: RyanGlScott, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3397
      
      (cherry picked from commit 01b062ec)
      3389bb34
    • Moritz Angermann's avatar
      Various patches to support android cross compilation · 56c57384
      Moritz Angermann authored and Ben Gamari's avatar Ben Gamari committed
      - Better test for SHT_INIT_ARRAY than openbsd_HOST_OS
        This is actually bens patch:
        https://gist.github.com/bgamari/c846e6a5f2cd988716cd5e36c68d5bef
      - linux-android defines.
      - No need for -lpthread on OSAndroid
        However, I’m confused why we do not use the AC NEED_PTHREAD_LIB
        value here?
      - Use mmap on android
      - Support `none` vendor.
      
      Reviewers: austin, hvr, bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, erikd
      
      Differential Revision: https://phabricator.haskell.org/D3356
      
      (cherry picked from commit 924a65fc)
      56c57384
    • Moritz Angermann's avatar
      Check TargetPlatform instead of HostPlatform for leading underscore · 808cd4e8
      Moritz Angermann authored and Ben Gamari's avatar Ben Gamari committed
      Reviewers: austin, hvr, rwbarton, bgamari
      
      Reviewed By: rwbarton, bgamari
      
      Subscribers: rwbarton, thomie, erikd
      
      Differential Revision: https://phabricator.haskell.org/D3348
      
      (cherry picked from commit 81f5b6ec)
      808cd4e8
    • Matthew Pickering's avatar
      -fspec-constr-keen docs typos [skip ci] · 973de1fb
      Matthew Pickering authored and Ben Gamari's avatar Ben Gamari committed
      (cherry picked from commit 5025fe24)
      973de1fb
    • Simon Peyton Jones's avatar
      Remove utterly bogus code · 844c5a71
      Simon Peyton Jones authored
      The commit 67465497
          Author: Richard Eisenberg <eir@cis.upenn.edu>
          Date:   Fri Dec 11 18:19:53 2015 -0500
      
          Add kind equalities to GHC.
      
      added this entirely bogus code to Simplify.simplLam:
      
          env' | Coercion co <- arg
               = extendCvSubst env bndr co
               | otherwise
               = env
      
      It's bogus because 'co' is an 'InCoercion', but a CvSubst should have
      only OutCoercions in it.  Moreover, completeBind does the job nicely.
      
      This led to an ASSERT failure in an experimental branch; but I have
      not got a repro case that works on HEAD.  But still, the patch deletes
      code and fixes a bug, so it must be good.
      
      The only mystery is why Richard added it in the first place :-).
      I hope I'm not missing anything.  But it validates fine.
      
      (cherry picked from commit de4723fd)
      844c5a71
    • Simon Peyton Jones's avatar
      Fix error-message suppress on given equalities · c9935f15
      Simon Peyton Jones authored
      I'd got the logic slightly wrong when reporting type errors
      for insoluble 'given' equalities.  We suppress insoluble givens
      under some circumstances (see Note [Given errors]), but we then
      suppressed subsequent 'wanted' errors because the (suppressed)
      'given' error "won".  Result: no errors at all :-(.
      
      This patch fixes it and
       - Renames TcType.isTyVarUnderDatatype to the more
         perspicuous TcType.isInsolubleOccursCheck
      
      In doing this I realise that I don't understand why we need
      to keep the insolubles partitioned out separately at all...
      but that is for another day.
      
      (cherry picked from commit e0ad55f8)
      c9935f15
    • Simon Peyton Jones's avatar
      Fix explicitly-bidirectional pattern synonyms · 8a857f50
      Simon Peyton Jones authored
      This partly fixes Trac #13441, at least for the explicitly
      bidirectional case.
      
      See Note [Checking against a pattern signature], the part about
      "Existential type variables".
      
      Alas, the implicitly-bidirectional case is still not quite right, but
      at least there is a workaround by making it explicitly bidirectional.
      
      (cherry picked from commit 7c7479d0)
      8a857f50
    • Simon Peyton Jones's avatar
      Typechecker comments and debug tracing only · 55adbbde
      Simon Peyton Jones authored
      (cherry picked from commit 7e1c492d)
      55adbbde
    • Simon Peyton Jones's avatar
      Eliminate a user manual warning · 20dc2534
      Simon Peyton Jones authored
      I was getting
        docs/users_guide/glasgow_exts.rst:12783:
           WARNING: Title underline too short.
      
        ``COLUMN`` pragma
        ---------------
      
      So I lengthened the row of hyphens.
      
      (cherry picked from commit af33073c)
      20dc2534
    • Simon Peyton Jones's avatar
      Simplify the logic for tc_hs_sig_type · 208c3ec2
      Simon Peyton Jones authored
      In fixing Trac #13337, and introducing solveSomeEqualities,
      Richard introduce the higher-order function tc_hs_sig_type_x,
      with a solver as its argument.
      
      It turned out that there was a much simpler way to do the
      same thing, which this patch implements.  Less code, easier
      to grok.  No change in behaviour though.
      
      (cherry picked from commit 1e06d8b8)
      208c3ec2
    • Simon Marlow's avatar
      Make the test fail if compiled without -threaded · 67f00af6
      Simon Marlow authored and Ben Gamari's avatar Ben Gamari committed
      Test Plan: validate
      
      Reviewers: bgamari, austin, erikd
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3387
      
      (cherry picked from commit c77551ab)
      67f00af6
    • Simon Marlow's avatar
      Fix #13433 · bdcb0c85
      Simon Marlow authored and Ben Gamari's avatar Ben Gamari committed
      Summary: See comments for details.
      
      Test Plan: validate
      
      Reviewers: mpickering, bgamari, austin, erikd
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3386
      
      (cherry picked from commit 074d13eb)
      bdcb0c85
    • Ben Gamari's avatar
      base: Check for path separators chars in openTempFile' template string · 02a9c6a3
      Ben Gamari authored
      This fixes #13489.
      
      (cherry picked from commit b04ded8f)
      02a9c6a3
    • Simon Marlow's avatar
      More fixes for #5654 · 8a1f4e59
      Simon Marlow authored and Ben Gamari's avatar Ben Gamari committed
      * In stg_ap_0_fast, if we're evaluating a thunk, the thunk might
        evaluate to a function in which case we may have to adjust its CCS.
      
      * The interpreter has its own implementation of stg_ap_0_fast, so we
        have to do the same shenanigans with creating empty PAPs and copying
        PAPs there.
      
      * GHCi creates Cost Centres as children of CCS_MAIN, which enterFunCCS()
        wrongly assumed to imply that they were CAFs.  Now we use the is_caf
        flag for this, which we have to correctly initialise when we create a
        Cost Centre in GHCi.
      
      (cherry picked from commit 3a18baff)
      8a1f4e59
    • Simon Marlow's avatar
      Fix bug in previous fix for #5654 · fd269386
      Simon Marlow authored and Ben Gamari's avatar Ben Gamari committed
      I forgot to account for BCOs, which have a different layout from
      functions.  This caused crashes when using profiling with GHCi (via
      -fexternal-interpreter -prof), which unfortunately is not tested at all
      by validate, even when profiling is enabled.  I'm going to add some
      testing that would have caught this in a separate patch.
      
      Test Plan:
      ```
      cd nofib/spectral/puzzle && make NoFibWithGHCi=YES
      EXTRA_RUNTEST_OPTS='-fexternal-interpreter -prof'
      ```
      New testsuite tests coming in a separate diff.
      
      Reviewers: niteria, austin, erikd, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2868
      
      GHC Trac Issues: #5654
      
      (cherry picked from commit 2a02040b)
      fd269386
    • Simon Marlow's avatar
      Fix cost-centre-stacks bug (#5654) · 9a1ac01f
      Simon Marlow authored and Ben Gamari's avatar Ben Gamari committed
      This fixes some cases of wrong stacks being generated by the profiler.
      For background and details on the fix see
      `Note [Evaluating functions with profiling]` in `rts/Apply.cmm`.
      
      This does have an impact on allocations for some programs when
      profiling.  nofib results:
      
      ```
         k-nucleotide          +0.0%     +8.8%    +11.0%    +11.0%      0.0%
               puzzle          +0.0%    +12.5%     0.244     0.246      0.0%
            typecheck           0.0%     +8.7%    +16.1%    +16.2%      0.0%
      ------------------------------------------------------------------------
      --------
                  Min          -0.0%     -0.0%    -34.4%    -35.5%    -25.0%
                  Max          +0.0%    +12.5%    +48.9%    +49.4%    +10.6%
       Geometric Mean          +0.0%     +0.6%     +2.0%     +1.8%     -0.3%
      
      ```
      
      But runtimes don't seem to be affected much, and the examples I looked
      at were completely legitimate.  For example, in puzzle we have this:
      
      ```
      position :: ItemType -> StateType ->  BankType
      position Bono = bonoPos
      position Edge = edgePos
      position Larry = larryPos
      position Adam = adamPos
      ```
      
      where the identifiers on the rhs are all record selectors.  Previously
      the profiler gave a stack that looked like
      
      ```
        position
        bonoPos
        ...
      ```
      
      i.e. `bonoPos` was at the same level of the call stack as `position`,
      but now it looks like
      
      ```
        position
         bonoPos
         ...
      ```
      
      I used the normaliser from the testsuite to diff the profiling output
      from other nofib programs and they all looked better.
      
      Test Plan:
      * the broken test passes
      * validate
      * compiled and ran all of nofib, measured perf, diff'd several .prof
      files
      
      Reviewers: niteria, erikd, austin, scpmw, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2804
      
      GHC Trac Issues: #5654, #10007
      
      (cherry picked from commit 394231b3)
      9a1ac01f
    • Joachim Breitner's avatar
      Zap Call Arity info in the simplifier · d88d0258
      Joachim Breitner authored and Ben Gamari's avatar Ben Gamari committed
      As #13479 shows, there are corner cases where the simplifier decides to
      not eta-expand a function as much as its call arity would suggest, but
      instead transforms the code that the call arity annotation becomes a
      lie.
      
      As the call arity information is only meant to be used by the
      immediatelly following simplifier run, it makes sense to simply zap the
      information there.
      
      Differential Revision: https://phabricator.haskell.org/D3390
      
      (cherry picked from commit e07211f7)
      d88d0258
  4. Mar 27, 2017
Loading