| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This is now working apparently. It relates to when a
polymorphic function gets instantiated, under some
implicit paramter bindings.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes a regression introduced, post 8.0.1, by
this major commit:
commit 15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Sat Jun 11 23:49:27 2016 +0100
Improve typechecking of let-bindings
This major commit was initially triggered by #11339, but it
spiraled into a major review of the way in which type
signatures for bindings are handled, especially partial type
signatures.
I didn't get the typechecking of pattern bindings right, leading
to Trac #12427.
In fixing this I found that this program doesn't work:
data T where
T :: a -> ((forall b. [b]->[b]) -> Int) -> T
h1 y = case y of T _ v -> v
Works in 7.10, but not in 8.0.1.
There's a happy ending. I found a way to fix this, and improve
pattern bindings too. Not only does this fix #12427, but it also
allows
In particular,we now can accept
data T where MkT :: a -> Int -> T
... let { MkT _ q = t } in ...
Previously this elicited "my head exploded" but it's really
fine since q::Int.
The approach is described in detail in TcBinds
Note [Typechecking pattern bindings]
Super cool. And not even a big patch!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Modify TcType.ExpType to make a distinct data type,
InferResult for the Infer case, and consequential
refactoring.
2. Define a new function TcUnify.fillInferResult, to fill in
an InferResult. It uses TcMType.promoteTcType to promote
the type to the level of the InferResult.
See TcMType Note [Promoting a type]
This refactoring is in preparation for an improvement
to typechecking pattern bindings, coming next.
I flirted with an elaborate scheme to give better
higher rank inference, but it was just too complicated.
See TcMType Note [Promotion and higher rank types]
3. Add to InferResult a new field ir_inst :: Bool to say
whether or not the type used to fill in the
InferResult should be deeply instantiated. See
TcUnify Note [Deep instantiation of InferResult].
4. Add a TcLevel to SkolemTvs. This will be useful generally
- it's a fast way to see if the type
variable escapes when floating (not used yet)
- it provides a good consistency check when updating a
unification variable (TcMType.writeMetaTyVarRef, the
level_check_ok check)
I originally had another reason (related to the flirting
in (2), but I left it in because it seems like a step in
the right direction.
5. Reduce and simplify the plethora of uExpType,
tcSubType and related functions in TcUnify. It was
such an opaque mess and it's still not great, but it's
better.
6. Simplify the uo_expected field of TypeEqOrigin. Richard
had generatlised it to a ExpType, but it was almost always
a Check type. Now it's back to being a plain TcType which
is much easier.
7. Improve error messages by refraining from skolemisation when
it's clear that there's an error: see
TcUnify Note [Don't skolemise unnecessarily]
8. Type.isPiTy and isForAllTy seem to be missing a coreView check,
so I added it
All these changes led to quite bit of error message wibbling
|
| |
|
|
|
|
|
|
|
| |
This reverts commit e3e2e49a8f6952e1c8a19321c729c17b294d8c92.
I'm reverting because it makes ghc-stage2 seg-fault on
64-bit Windows machines. Even ghc-stage2 --version seg-faults.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
For symmetry with `gcastWith` in `Data.Type.Equality`.
Fixes #12493.
Test Plan: It compiles
Reviewers: bgamari, goldfire, hvr, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2456
GHC Trac Issues: #12493
|
|
|
|
| |
This reverts commit 773e3aadac4bbee9a0173ebc90ffdc9458a2a3a9.
|
|
|
|
|
| |
Simpler code, and simpler to understand.
No change in behaviour.
|
|
|
|
|
|
|
|
|
| |
defaultCallStacks generates evidence bindings for call stacks,
but wasn't setting the binding site correctly. As a result
they were simply discarded in the case of pattern synonyms,
giving rise to Trac #12489.
The fix is easy; and I added an ASSERT to catch the error earlier.
|
|
|
|
|
| |
This fixes Trac #12406. A not-in-scope error shoudl be an error
even if you have -fdefer-typed-holes.
|
| |
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
malloc'd memory is not guaranteed to be zeroed. On Linux, however,
it is often zeroed, leading to latent bugs. In fact, with this
patch I fix two uninitialized memory bugs stemming from this.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonmar, austin, Phyx, bgamari, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2455
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some recent versions of XCode ship a broken version of `nm`. Detect this
at configure time, and error out with a suggestion to rerun configure
with a `--with-nm=...` argument.
Test Plan: Test of Linux and OS X
Reviewers: carter, hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2425
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch refactors GNU C version test (for 4.5 and more modern)
due to usage of __builtin_unreachable done in the CNF.c code directly
into the new RTS_UNREACHABLE macro placed into Rts.h
Reviewers: bgamari, austin, simonmar, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2457
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch fixes compilation failure on OpenBSD. The OpenBSD's
GNU C compiler is of 4.2.1 version and problematic __builtin_unreachable
was added in GNU C 4.5 release. Let's use pure abort() call
on OpenBSD instead of __builtin_unreachable
Reviewers: bgamari, austin, erikd, simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2453
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
GHC's configure script seems to normalize the values returned from config.guess.
So for Windows it turns x86_64-pc-mingw64 into x86_64-unknown-mingw32.
These mangled names are stored in the values $BuildPlatform, $HostPlatform
and $TargetPlatform.
However further down the file when the comparison is done between the stage0
compiler and the host the normalized versions are not used.
So when normalization actually changes the triple this check will fail.
Not sure why it's worked for all this time.. Nor if this is the right fix?
Does it still work for cross compiling correctly?
Test Plan: ./configure
Reviewers: hvr, austin, thomie, bgamari, erikd
Reviewed By: erikd
Subscribers: erikd, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D2452
GHC Trac Issues: #12487
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With BuildFlavour set to `perf-llvm`, GHCi would fail as soon as it
was run with:
ghc-stage2: .../ghc-prim/dist-install/build/HSghc-prim-0.5.0.0.o:
unknown symbol `__udivti3'
ghc-stage2: unable to load package `ghc-prim-0.5.0.0'
Fix this by adding `__udivti3` and `__umodti3` to RtsSymbols.c.
Test Plan: Validate
Reviewers: simonmar, austin, bgamari, Phyx, trofi
Reviewed By: Phyx, trofi
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2449
GHC Trac Issues: #11981
|
|
|
|
| |
Fixes Trac #12484
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The idea behind adding special "rubbish" arguments was in unboxed sum types
depending on the tag some arguments are not used and we don't want to move some
special values (like 0 for literals and some special pointer for boxed slots)
for those arguments (to stack locations or registers). "StgRubbishArg" was an
indicator to the code generator that the value won't be used. During Stg-to-Cmm
we were then not generating any move or store instructions at all.
This caused problems in the register allocator because some variables were only
initialized in some code paths. As an example, suppose we have this STG: (after
unarise)
Lib.$WT =
\r [dt_sit]
case
case dt_sit of {
Lib.F dt_siv [Occ=Once] ->
(#,,#) [1# dt_siv StgRubbishArg::GHC.Prim.Int#];
Lib.I dt_siw [Occ=Once] ->
(#,,#) [2# StgRubbishArg::GHC.Types.Any dt_siw];
}
of
dt_six
{ (#,,#) us_giC us_giD us_giE -> Lib.T [us_giC us_giD us_giE];
};
This basically unpacks a sum type to an unboxed sum with 3 fields, and then
moves the unboxed sum to a constructor (`Lib.T`).
This is the Cmm for the inner case expression (case expression in the scrutinee
position of the outer case):
ciN:
...
-- look at dt_sit's tag
if (_ciT::P64 != 1) goto ciS; else goto ciR;
ciS: -- Tag is 2, i.e. Lib.F
_siw::I64 = I64[_siu::P64 + 6];
_giE::I64 = _siw::I64;
_giD::P64 = stg_RUBBISH_ENTRY_info;
_giC::I64 = 2;
goto ciU;
ciR: -- Tag is 1, i.e. Lib.I
_siv::P64 = P64[_siu::P64 + 7];
_giD::P64 = _siv::P64;
_giC::I64 = 1;
goto ciU;
Here one of the blocks `ciS` and `ciR` is executed and then the execution
continues to `ciR`, but only `ciS` initializes `_giE`, in the other branch
`_giE` is not initialized, because it's "rubbish" in the STG and so we don't
generate an assignment during code generator. The code generator then panics
during the register allocations:
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 8.1.20160722 for x86_64-unknown-linux):
LocalReg's live-in to graph ciY {_giE::I64}
(`_giD` is also "rubbish" in `ciS`, but it's still initialized because it's a
pointer slot, we have to initialize it otherwise garbage collector follows the
pointer to some random place. So we only remove assignment if the "rubbish" arg
has unboxed type.)
This patch removes `StgRubbishArg` and `CmmArg`. We now always initialize
rubbish slots. If the slot is for boxed types we use the existing `absentError`,
otherwise we initialize the slot with literal 0.
Reviewers: simonpj, erikd, austin, simonmar, bgamari
Reviewed By: erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2446
|
|
|
|
|
|
| |
We need to maintain the invariant that the layout fields are always sorted.
Two tests that were previously broken are added.
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's a substantial bump to the haddock.Cabal allocation
stats, because we added 50% more modules, so of course allocations
are going to increase 50%. (But perhaps this is indicative of
some bad constant factor in Haddock related to modules.)
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: ggreif, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2442
|
|
|
|
| |
[ci skip]
|
|
|
|
|
|
|
| |
T1969 was broken by 714beb (which actually reduced allocations but
residency was increased). Instead of disabling it completely, just bump
the number a little bit to avoid making things even worse in the
meantime. See also #12437.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug #9439 only affects some ghc 7.8 versions of the compiler and since
git HEAD no longer builds with ghc-7.8 we can drop this check.
Test Plan: Works here!
Reviewers: hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2427
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
`Data.Data` uses an internal datatype `CONST`, which can be replaced
completely by `Const` from `Data.Functor.Const`.
Reviewers: austin, bgamari, hvr
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2396
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Noticed on today's build failure:
rts/Printer.c:659:13: error:
error: conflicting types for 'DEBUG_LoadSymbols'
extern void DEBUG_LoadSymbols( const char *name )
^~~~~~~~~~~~~~~~~
In file included from rts/Printer.c:17:0: error:
rts/Printer.h:29:13: error:
note: previous declaration of 'DEBUG_LoadSymbols' was here
extern void DEBUG_LoadSymbols( char *name );
^~~~~~~~~~~~~~~~~
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This is surprisingly tricky. There were linked list bugs in the
previous version (D2430) that showed up as a test failure in
setnumcapabilities001 (that's a great stress test!).
This new version uses a different strategy that doesn't suffer from
the problem that @ezyang pointed out in D2430. We now pre-calculate
how many threads to keep for this capability, and then migrate any
surplus threads off the front of the queue, taking care to account for
threads that can't be migrated.
Test Plan:
1. setnumcapabilities001 stress test with sanity checking (+RTS -DS) turned on:
```
cd testsuite/tests/concurrent/should_run
make TEST=setnumcapabilities001 WAY=threaded1 EXTRA_HC_OPTS=-with-rtsopts=-DS CLEANUP=0
while true; do ./setnumcapabilities001.run/setnumcapabilities001 4 9 2000 || break; done
```
2. The test case from #12419
Reviewers: niteria, ezyang, rwbarton, austin, bgamari, erikd
Subscribers: thomie, ezyang
Differential Revision: https://phabricator.haskell.org/D2441
GHC Trac Issues: #12419
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
ASSERT_THREADED_CAPABILITY_INVARIANTS was testing properties of the
returning_tasks queue, but that requires cap->lock to access safely.
This assertion would randomly fail if stressed enough.
Instead I've removed it from the catch-all
ASSERT_PARTIAL_CAPABILITIY_INVARIANTS and made it a separate assertion
only called under cap->lock.
Test Plan:
```
cd testsuite/tests/concurrent/should_run
make TEST=setnumcapabilities001 WAY=threaded1 EXTRA_HC_OPTS=-with-rtsopts=-DS CLEANUP=0
while true; do ./setnumcapabilities001.run/setnumcapabilities001 4 9 2000 || break; done
```
Reviewers: niteria, bgamari, ezyang, austin, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2440
GHC Trac Issues: #10860
|
|
|
|
|
|
|
|
|
|
|
| |
This adds notes to the Haddock documentation for various core datatypes
expanding abbreviations.
Reviewers: bgamari, thomie
Differential Revision: https://phabricator.haskell.org/D2406
GHC Trac Issues: #12405
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was a complication on the x86_64 platform, where pointers were 64
bits, but the tools didn't support 64-bit relative relocations. This
was true before binutils 2.17, which nowadays is quite standart (even
CentOs 5 is shipped with 2.17).
Hacks were removed from x86 genSwitch and asm pretty printer. Also
[x86-64-relative] note was dropped from
includes/rts/storage/InfoTables.h as it's not referenced anywhere now.
Reviewers: austin, simonmar, rwbarton, erikd, bgamari
Reviewed By: simonmar, erikd, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2426
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #12062.
Reviewers: bgamari, thomie, austin, simonmar
Reviewed By: bgamari, thomie, simonmar
Subscribers: simonmar, thomie
Differential Revision: https://phabricator.haskell.org/D2415
GHC Trac Issues: #12062
|
|
|
|
|
|
|
| |
... in LocalBuildInfo, getting rid of a TODO in the
process. Turns out that componentsConfigs won't be
a field in Cabal 2.0 any more, so this can be seen
as a preparation for it.
|
|
|
|
|
|
|
| |
... that we grep out of libraries/Cabal/Cabal/Cabal.cabal
This is necessary because the file got reformatted
in the 'master' branch.
|
| |
|
|
|
|
| |
This matches the implementations of `castPtr` and `castFunPtr`.
|