simonpj@microsoft.com [Wed, 22 Dec 2010 13:11:56 +0000 (13:11 +0000)]
Make the occurrence analyser track preInlineUnconditionally
This fixes a somewhat obscure situation in which an
over-optimistic use of "occurs once" led to an infinite
sequence of simplifier iterations. Se Note [Cascading inlines]
for the details.
This showed up when compiling rather large DPH programs, which
run lots of iterations of the simplifier, which in turn made
compilation take much longer than necessary.
simonpj@microsoft.com [Wed, 22 Dec 2010 13:08:54 +0000 (13:08 +0000)]
Make mkDFunUnfolding more robust
It now uses tcSplitDFunTy, which is designed for the purpose and
allows arbitrary argument types to the dfun, rather than
tcSplitSigmaTy. This generality is used in DPH, which has
internally-generated dfuns with impliciation-typed arguments.
To do this I had to make tcSplitDFunTy return the number of
arguments, so there are some minor knock-on effects in other
modules.
Simon Marlow [Tue, 21 Dec 2010 15:29:56 +0000 (15:29 +0000)]
Count allocations more accurately
The allocation stats (+RTS -s etc.) used to count the slop at the end
of each nursery block (except the last) as allocated space, now we
count the allocated words accurately. This should make allocation
figures more predictable, too.
This has the side effect of reducing the apparent allocations by a
small amount (~1%), so remember to take this into account when looking
at nofib results.
simonpj@microsoft.com [Tue, 21 Dec 2010 16:58:00 +0000 (16:58 +0000)]
Add a simple arity analyser
I've wanted to do this for ages, but never gotten around to
it. The main notes are in Note [Arity analysis] in SimplUtils.
The motivating example for arity analysis is this:
f = \x. let g = f (x+1)
in \y. ...g...
What arity does f have? Really it should have arity 2, but a naive
look at the RHS won't see that. You need a fixpoint analysis which
says it has arity "infinity" the first time round.
This makes things more robust to the way in which you write code. For
example, see Trac #4474 which is fixed by this change.
Not a huge difference, but worth while:
Program Size Allocs Runtime Elapsed
--------------------------------------------------------------------------------
Min -0.4% -2.2% -10.0% -10.0%
Max +2.7% +0.3% +7.1% +6.9%
Geometric Mean -0.3% -0.2% -2.1% -2.2%
I don't really believe the runtime numbers, because the machine was
busy, but the bottom line is that not much changes, and what does
change reliably (allocation and size) is in the right direction.
simonpj@microsoft.com [Tue, 21 Dec 2010 16:19:31 +0000 (16:19 +0000)]
Miscellaneous tidying up and refactoring
simonpj@microsoft.com [Tue, 21 Dec 2010 16:19:18 +0000 (16:19 +0000)]
Comments only
simonpj@microsoft.com [Tue, 21 Dec 2010 16:19:11 +0000 (16:19 +0000)]
Single-method classes are implemented with a newtype
This patch changes things so that such classes rely on the coercion
mechanism for inlining (since the constructor is really just a cast)
rather than on the dfun mechanism, therby removing some needless
runtime indirections.
simonpj@microsoft.com [Mon, 1 Nov 2010 08:07:36 +0000 (08:07 +0000)]
For single-method classes use newtypes
This clears up an awkward hack for exprIsConApp_maybe, and
works better too. See Note [Single-method classes] in
TcInstDcls.
Simon Marlow [Tue, 21 Dec 2010 11:58:07 +0000 (11:58 +0000)]
boundTaskExiting: don't set task->stopped unless this is the last call (#4850)
The bug in this case was that we had a worker thread making a foreign
call which invoked a callback (in this case it was performGC, I
think). When the callback ended, boundTaskExiting() was setting
task->stopped, but the Task is now per-OS-thread, so it is shared by
the worker that made the original foreign call. When the foreign call
returned, because task->stopped was set, the worker was not placed on
the queue of spare workers. Somehow the worker woke up again, and
found the spare_workers queue empty, which lead to a crash.
Two bugs here: task->stopped should not have been set by
boundTaskExiting (this broke when I split the Task and InCall structs,
in 6.12.2), and releaseCapabilityAndQueueWorker() should not be
testing task->stopped anyway, because it should only ever be called
when task->stopped is false (this is now an assertion).
Simon Marlow [Tue, 21 Dec 2010 11:49:11 +0000 (11:49 +0000)]
releaseCapabilityAndQueueWorker: task->stopped should be false (#4850)
Simon Marlow [Tue, 21 Dec 2010 10:21:01 +0000 (10:21 +0000)]
Fix Windows build
Simon Marlow [Tue, 21 Dec 2010 10:14:11 +0000 (10:14 +0000)]
raiseExceptionHelper: update tso->stackobj->sp before calling threadStackOverflow (#4845)
Simon Marlow [Tue, 21 Dec 2010 10:02:54 +0000 (10:02 +0000)]
add 'make re2' for rebuilding stage2 (similarly re1 and re3)
Simon Marlow [Thu, 16 Dec 2010 16:04:15 +0000 (16:04 +0000)]
fix warning
simonpj@microsoft.com [Mon, 20 Dec 2010 12:37:15 +0000 (12:37 +0000)]
Small improvement to CorePrep
This change avoids unnecessary bindings. Example
foo (let fn = \x.blah in
in fn)
We were generating something stupid like
let fn = \x.blah in
let fn' = \eta. fn eta
in foo fn
Now we don't. The change is quite small.
Thanks to Ben for showing me an example of this happening.
Ian Lynagh [Sun, 19 Dec 2010 20:27:11 +0000 (20:27 +0000)]
Fix warnings
Ian Lynagh [Sun, 19 Dec 2010 19:40:32 +0000 (19:40 +0000)]
Small refactoring
Matthias Kilian [Sun, 19 Dec 2010 18:02:39 +0000 (18:02 +0000)]
Drop GhcWithLlvmCodeGen configuration bits
The LLVM code generator is always built unconditionally, so both the
configuration variable in mk/config.mk.in as well as the string in
compilerInfo can be removed.
Ian Lynagh [Sun, 19 Dec 2010 12:52:43 +0000 (12:52 +0000)]
Pass --hoogle to haddock; fixes trac #4521
Roman Leshchinskiy [Sat, 18 Dec 2010 23:48:38 +0000 (23:48 +0000)]
vectoriser: don't always pass superclass dictionaries to PA dfuns
This is just a guess at how this should work.
Roman Leshchinskiy [Sat, 18 Dec 2010 12:53:50 +0000 (12:53 +0000)]
vectoriser: delete dead code
Roman Leshchinskiy [Sat, 18 Dec 2010 11:49:53 +0000 (11:49 +0000)]
vectoriser: adapt to new superclass story part I (dictionary construction)
Ian Lynagh [Sat, 18 Dec 2010 23:08:27 +0000 (23:08 +0000)]
Replace uses of the old try function with the new one
Ian Lynagh [Sat, 18 Dec 2010 21:33:50 +0000 (21:33 +0000)]
Replace uses of the old catch function with the new one
Ian Lynagh [Sat, 18 Dec 2010 18:49:25 +0000 (18:49 +0000)]
Create ~/.ghc/ if it doesn't already exist; fixes trac #4522
Ian Lynagh [Sat, 18 Dec 2010 15:01:21 +0000 (15:01 +0000)]
Document GADTSyntax extension
Ian Lynagh [Sat, 18 Dec 2010 14:45:50 +0000 (14:45 +0000)]
Implement GADTSyntax extension
Ian Lynagh [Fri, 17 Dec 2010 23:41:24 +0000 (23:41 +0000)]
Whitespace-only in rts/Linker.c
Ian Lynagh [Fri, 17 Dec 2010 22:38:11 +0000 (22:38 +0000)]
Add some casts to fix warnings; patch from Greg Wright
Ian Lynagh [Fri, 17 Dec 2010 22:37:07 +0000 (22:37 +0000)]
Put an up-to-date Makefile in docs/Makefile
It doesn't do anything useful yet, but it works with the new build system
Karel Gardas [Fri, 17 Dec 2010 08:51:33 +0000 (08:51 +0000)]
do not compile part of shared lib RTS with -fno-PIC on Solaris
Karel Gardas [Fri, 17 Dec 2010 08:46:17 +0000 (08:46 +0000)]
provide shared libraries support on i386-unknown-solaris2 platform
Karel Gardas [Fri, 17 Dec 2010 08:45:10 +0000 (08:45 +0000)]
fix CPP detection of Solaris in NCG
Ian Lynagh [Thu, 16 Dec 2010 20:11:21 +0000 (20:11 +0000)]
Fix checkBinaries on OS X
Ian Lynagh [Thu, 16 Dec 2010 19:06:05 +0000 (19:06 +0000)]
Remove redundant HpcMap and HpcSet wrappers around Data.{Map,Set}
Ian Lynagh [Thu, 16 Dec 2010 14:52:35 +0000 (14:52 +0000)]
Use "-perm -u+x" rather than "-executable" to find executables
On Windows, -executable is matching the html docs.
Ian Lynagh [Thu, 16 Dec 2010 01:14:59 +0000 (01:14 +0000)]
Remove a debugging print
Ian Lynagh [Wed, 15 Dec 2010 21:46:56 +0000 (21:46 +0000)]
__GLASGOW_HASKELL__ >= 604 is now always true
Ian Lynagh [Wed, 15 Dec 2010 21:37:15 +0000 (21:37 +0000)]
Remove more dead code now we require GHC >= 6.12
Simon Marlow [Thu, 16 Dec 2010 12:31:51 +0000 (12:31 +0000)]
refactor and tidy up the section on RTS options
Orphi [Thu, 9 Dec 2010 17:04:40 +0000 (17:04 +0000)]
Related to #4826: Some minor tweaks to the wording of the User Guide, section 4.16
Orphi [Thu, 9 Dec 2010 16:51:52 +0000 (16:51 +0000)]
FIX #4826 partial: Add -rtsopts and -with-rtsopts to User Guide section 4.11.6
Orphi [Thu, 9 Dec 2010 14:41:48 +0000 (14:41 +0000)]
FIX #4826 partially: Change -f to -? in User Guide section F4.16
Simon Marlow [Thu, 16 Dec 2010 11:44:52 +0000 (11:44 +0000)]
fix #3910
Simon Marlow [Wed, 15 Dec 2010 15:26:56 +0000 (15:26 +0000)]
remove an optimisation that wasn't
Simon Marlow [Thu, 16 Dec 2010 10:57:23 +0000 (10:57 +0000)]
fix a warning
Simon Marlow [Thu, 16 Dec 2010 10:57:09 +0000 (10:57 +0000)]
use EXTERN_INLINE instead of STATIC_INLINE to avoid some gcc warnings
Simon Marlow [Thu, 16 Dec 2010 10:49:44 +0000 (10:49 +0000)]
remove dead code
Simon Marlow [Thu, 16 Dec 2010 10:39:00 +0000 (10:39 +0000)]
fix retainer profiling: add missing case for TSO
Simon Marlow [Thu, 16 Dec 2010 10:21:00 +0000 (10:21 +0000)]
add a missing STACK case
Ian Lynagh [Wed, 15 Dec 2010 20:10:06 +0000 (20:10 +0000)]
Remove code that is dead now that we need >= 6.12 to build
Simon Marlow [Wed, 15 Dec 2010 15:24:19 +0000 (15:24 +0000)]
fix for large stack allocations
Simon Marlow [Wed, 15 Dec 2010 12:08:43 +0000 (12:08 +0000)]
Implement stack chunks and separate TSO/STACK objects
This patch makes two changes to the way stacks are managed:
1. The stack is now stored in a separate object from the TSO.
This means that it is easier to replace the stack object for a thread
when the stack overflows or underflows; we don't have to leave behind
the old TSO as an indirection any more. Consequently, we can remove
ThreadRelocated and deRefTSO(), which were a pain.
This is obviously the right thing, but the last time I tried to do it
it made performance worse. This time I seem to have cracked it.
2. Stacks are now represented as a chain of chunks, rather than
a single monolithic object.
The big advantage here is that individual chunks are marked clean or
dirty according to whether they contain pointers to the young
generation, and the GC can avoid traversing clean stack chunks during
a young-generation collection. This means that programs with deep
stacks will see a big saving in GC overhead when using the default GC
settings.
A secondary advantage is that there is much less copying involved as
the stack grows. Programs that quickly grow a deep stack will see big
improvements.
In some ways the implementation is simpler, as nothing special needs
to be done to reclaim stack as the stack shrinks (the GC just recovers
the dead stack chunks). On the other hand, we have to manage stack
underflow between chunks, so there's a new stack frame
(UNDERFLOW_FRAME), and we now have separate TSO and STACK objects.
The total amount of code is probably about the same as before.
There are new RTS flags:
-ki<size> Sets the initial thread stack size (default 1k) Egs: -ki4k -ki2m
-kc<size> Sets the stack chunk size (default 32k)
-kb<size> Sets the stack chunk buffer size (default 1k)
-ki was previously called just -k, and the old name is still accepted
for backwards compatibility. These new options are documented.
Simon Marlow [Tue, 14 Dec 2010 10:13:40 +0000 (10:13 +0000)]
comments on SRC_HC_OPTS (#4829)
Simon Marlow [Thu, 9 Dec 2010 16:39:19 +0000 (16:39 +0000)]
fix another sanity error, and refactor/tidy up
simonpj@microsoft.com [Wed, 15 Dec 2010 12:37:25 +0000 (12:37 +0000)]
Fix a bug in functorLikeTraverse, which was giving wrong answer for tuples
This bug led to Trac #4816, which is hereby fixed
simonpj@microsoft.com [Wed, 15 Dec 2010 12:19:55 +0000 (12:19 +0000)]
Improve printing for -ddump-deriv
simonpj@microsoft.com [Wed, 15 Dec 2010 12:19:27 +0000 (12:19 +0000)]
Tighten up what it means to be an "enumeration data constructor"
See Note [Enumeration types] in TyCon, and comments in Trac #4528
simonpj@microsoft.com [Wed, 15 Dec 2010 12:18:17 +0000 (12:18 +0000)]
Allow enumerations to have phantom arguments.
The bytecode generator was being too eager.
Fixes Trac #4528, or rather, a near variant.
simonpj@microsoft.com [Tue, 14 Dec 2010 18:05:00 +0000 (18:05 +0000)]
Instance declaration overlap allowed if *either* has -XOverlappingInstances
This satisfies Trac #3877. Documentation is changed too.
I'm not sure if this should go in 7.0.2.
simonpj@microsoft.com [Tue, 14 Dec 2010 17:47:55 +0000 (17:47 +0000)]
Fix Trac #4841: behave right with TypeSynonymInstances and NoFlexibleInstances
When we have TypeSynonymInstances without FlexibleInstances we should still
insist on a H98-style instance head, after looking through the synonym.
This patch also make FlexibleInstances imply TypeSynonymInstances. Anything
else is a bit awkward, and not very useful.
simonpj@microsoft.com [Tue, 14 Dec 2010 18:03:44 +0000 (18:03 +0000)]
Fix Trac #3731: more superclass subtlety (sigh)
I will add more comments, but I want to commit this tonight,
so the overnight builds get it.
simonpj@microsoft.com [Tue, 14 Dec 2010 18:02:48 +0000 (18:02 +0000)]
Less verbose debug print
simonpj@microsoft.com [Tue, 14 Dec 2010 08:29:39 +0000 (08:29 +0000)]
Wibble to InstEnv.instanceHead
Fixes an accidental glitch in T1835
Ian Lynagh [Tue, 14 Dec 2010 01:10:11 +0000 (01:10 +0000)]
Remove dead code now that we require the bootstrapping compiler be >= 6.12
Ian Lynagh [Tue, 14 Dec 2010 01:09:23 +0000 (01:09 +0000)]
GHC 6.12 is now needed to build the HEAD
Ian Lynagh [Mon, 13 Dec 2010 22:31:53 +0000 (22:31 +0000)]
Add libstdc++-4.5.0-1-mingw32-dll-6.tar.lzma to mingw tarballs
simonpj@microsoft.com [Mon, 13 Dec 2010 17:15:11 +0000 (17:15 +0000)]
Fix recursive superclasses (again). Fixes Trac #4809.
This patch finally deals with the super-delicate question of
superclases in possibly-recursive dictionaries. The key idea
is the DFun Superclass Invariant (see TcInstDcls):
In the body of a DFun, every superclass argument to the
returned dictionary is
either * one of the arguments of the DFun,
or * constant, bound at top level
To establish the invariant, we add new "silent" superclass
argument(s) to each dfun, so that the dfun does not do superclass
selection internally. There's a bit of hoo-ha to make sure that
we don't print those silent arguments in error messages; a knock
on effect was a change in interface-file format.
A second change is that instead of the complex and fragile
"self dictionary binding" in TcInstDcls and TcClassDcl,
using the same mechanism for existential pattern bindings.
See Note [Subtle interaction of recursion and overlap] in TcInstDcls
and Note [Binding when looking up instances] in InstEnv.
Main notes are here:
* Note [Silent Superclass Arguments] in TcInstDcls,
including the DFun Superclass Invariant
Main code changes are:
* The code for MkId.mkDictFunId and mkDictFunTy
* DFunUnfoldings get a little more complicated;
their arguments are a new type DFunArg (in CoreSyn)
* No "self" argument in tcInstanceMethod
* No special tcSimplifySuperClasss
* No "dependents" argument to EvDFunApp
IMPORTANT
It turns out that it's quite tricky to generate the right
DFunUnfolding for a specialised dfun, when you use SPECIALISE
INSTANCE. For now I've just commented it out (in DsBinds) but
that'll lose some optimisation, and I need to get back to
this.
dimitris@microsoft.com [Fri, 10 Dec 2010 13:22:21 +0000 (13:22 +0000)]
Doing the smart canonicalization only if we are not simplifying a Rule LHS.
Also, same thing now applies for adding superclasses.
dimitris@microsoft.com [Thu, 9 Dec 2010 14:12:15 +0000 (14:12 +0000)]
Moved canonicalisation inside solveInteract
Moreover canonicalisation now is "clever", i.e. it never canonicalizes a class
constraint if it can already discharge it from some other inert or previously
encountered constraints. See Note [Avoiding the superclass explosion]
Ian Lynagh [Mon, 13 Dec 2010 12:49:30 +0000 (12:49 +0000)]
GHCi linker: Assume non-Haskell libraries are dynamic libs
This works around a segfault we get when trying to load libiconv.a on
some platforms.
Ian Lynagh [Sun, 12 Dec 2010 21:36:00 +0000 (21:36 +0000)]
Add --version support to ghc-cabal
Ian Lynagh [Fri, 10 Dec 2010 18:54:02 +0000 (18:54 +0000)]
Don't link the GHC RTS into our C-only programs
Ian Lynagh [Fri, 10 Dec 2010 18:11:23 +0000 (18:11 +0000)]
Build a copy of ghc-cabal with the in-tree compiler, for the bindist
Ian Lynagh [Fri, 10 Dec 2010 16:12:18 +0000 (16:12 +0000)]
Add a test that all programs in the bindist were built with the right GHC
They should use the GHC from the build tree, not the bootstrapping compiler.
simonpj@microsoft.com [Fri, 10 Dec 2010 08:45:30 +0000 (08:45 +0000)]
Fix Trac #4534: renamer bug
The renamer wasn't attaching the right used-variables to a
TransformStmt constructor.
The real modification is in RnExpr; the rest is just
pretty-printing and white space.
simonpj@microsoft.com [Fri, 10 Dec 2010 08:42:55 +0000 (08:42 +0000)]
White space only
simonpj@microsoft.com [Fri, 10 Dec 2010 08:41:16 +0000 (08:41 +0000)]
Comments only
simonpj@microsoft.com [Wed, 8 Dec 2010 17:22:51 +0000 (17:22 +0000)]
Make the case-to-let transformation a little less eager
See Note [Case elimination: lifted case].
Thanks to Roman for identifying this case.
Simon Marlow [Fri, 10 Dec 2010 09:40:02 +0000 (09:40 +0000)]
warning fix: don't redefine BLOCKS_PER_MBLOCK
Simon Marlow [Fri, 10 Dec 2010 09:39:51 +0000 (09:39 +0000)]
Only reset the event log if logging is turned on (addendum to #4512)
Simon Marlow [Fri, 10 Dec 2010 09:39:06 +0000 (09:39 +0000)]
allocate enough room for the longer filename (addendum to #4512)
Simon Marlow [Fri, 10 Dec 2010 09:00:45 +0000 (09:00 +0000)]
Fix Windows build: move rtsTimerSignal to the POSIX-only section
Ben Lippmeier [Fri, 10 Dec 2010 06:01:54 +0000 (06:01 +0000)]
Default the value of -dppr-cols when the static flags aren't initialised yet
If GHC's command line options are bad then the options parser uses the
pretty printer before the -dppr-cols flag has been read.
Ben Lippmeier [Fri, 10 Dec 2010 04:59:22 +0000 (04:59 +0000)]
Defensify naked read in LLVM mangler
Ben Lippmeier [Fri, 10 Dec 2010 04:26:00 +0000 (04:26 +0000)]
Formatting only
Ben Lippmeier [Wed, 8 Dec 2010 07:05:08 +0000 (07:05 +0000)]
Always ppr case alts on separate lines
Ben Lippmeier [Wed, 8 Dec 2010 07:02:45 +0000 (07:02 +0000)]
Add -dppr-colsN to set width of dumps
Ben Lippmeier [Wed, 8 Dec 2010 06:55:48 +0000 (06:55 +0000)]
Add -dppr-case-as-let to print "strict lets" as actual lets
Ben Lippmeier [Wed, 8 Dec 2010 06:30:37 +0000 (06:30 +0000)]
Suppress more info with -dsuppress-idinfo
Ben Lippmeier [Wed, 8 Dec 2010 06:28:14 +0000 (06:28 +0000)]
Implement -dsuppress-type-signatures
Ben Lippmeier [Wed, 8 Dec 2010 02:07:23 +0000 (02:07 +0000)]
Add more suppression flags
-dsuppress-all
-dsuppress-type-applications
-dsuppress-idinfo
Simon Marlow [Thu, 9 Dec 2010 12:04:04 +0000 (12:04 +0000)]
fix ticket number (#4505)
Simon Marlow [Thu, 9 Dec 2010 11:58:44 +0000 (11:58 +0000)]
fix warnings
Simon Marlow [Thu, 9 Dec 2010 11:40:05 +0000 (11:40 +0000)]
Catch too-large allocations and emit an error message (#4505)
This is a temporary measure until we fix the bug properly (which is
somewhat tricky, and we think might be easier in the new code
generator).
For now we get:
ghc-stage2: sorry! (unimplemented feature or known bug)
(GHC version 7.1 for i386-unknown-linux):
Trying to allocate more than 1040384 bytes.
See: http://hackage.haskell.org/trac/ghc/ticket/4550
Suggestion: read data from a file instead of having large static data
structures in the code.
Dmitry Astapov [Wed, 8 Dec 2010 18:37:55 +0000 (18:37 +0000)]
Export the value of the signal used by scheduler (#4504)
Simon Marlow [Wed, 8 Dec 2010 16:32:12 +0000 (16:32 +0000)]
Tweak the "sorry" message a bit
- "sorry! (this is work in progress)\n"
+ "sorry! (unimplemented feature or known bug)\n"
Boris Lykah [Tue, 23 Nov 2010 19:01:32 +0000 (19:01 +0000)]
:unset settings support
Added support for settings [args, prog, prompt, editor and stop].
Now :unset supports the same set of options as :set.
Ian Lynagh [Wed, 8 Dec 2010 15:23:49 +0000 (15:23 +0000)]
Fix Windows memory freeing: add a check for fb == NULL; fixes trac #4506
Also added a few comments, and a load of code got indented 1 level deeper.
Dmitry Astapov [Fri, 3 Dec 2010 13:39:50 +0000 (13:39 +0000)]
Fixes for #4512: EventLog.c - provides ability to terminate event logging, Schedule.c - uses them in forkProcess.