11 years agoDo dependency analysis when kind-checking type declarations [Mon, 10 Jan 2011 11:03:51 +0000 (11:03 +0000)]
Do dependency analysis when kind-checking type declarations

This patch fixes Trac #4875.  The main point is to do dependency
analysis on type and class declarations, and kind-check them in
dependency order, so as to improve error messages.

This patch means that a few programs that would typecheck before won't
typecheck any more; but before we were (naughtily) going beyond
Haskell 98 without any language-extension flags, and Trac #4875
convinces me that doing so is a Bad Idea.

Here's an example that won't typecheck any more
       data T a b = MkT (a b)
       type F k = T k Maybe

If you look at T on its own you'd default 'a' to kind *->*;
and then kind-checking would fail on F.

But GHC currently accepts this program beause it looks at
the *occurrences* of T.

11 years agoMove imports around (no change in behaviour) [Mon, 10 Jan 2011 10:56:47 +0000 (10:56 +0000)]
Move imports around (no change in behaviour)

11 years agoMake fuzzy matching a little less eager for short identifiers [Fri, 7 Jan 2011 10:28:55 +0000 (10:28 +0000)]
Make fuzzy matching a little less eager for short identifiers

For single-character identifiers we now don't make any suggestions
See comments in Util.fuzzyLookup

11 years agoFix Trac #4870: get the inlining for an imported INLINABLE Id [Wed, 5 Jan 2011 00:27:12 +0000 (00:27 +0000)]
Fix Trac #4870: get the inlining for an imported INLINABLE Id

We need the unfolding even for a *recursive* function (indeed
that's the point) and I was using the wrong function to get it
(idUnfolding rather than realIdUnfolding).

11 years agoRejig the includes/ installation rules
Ian Lynagh [Sun, 9 Jan 2011 18:11:58 +0000 (18:11 +0000)]
Rejig the includes/ installation rules
They're a little nicer now, and a regression in the cygwin build is
fixed (the $i in the destination wasn't surviving being passed through

11 years agoMake DESTDIR an absolute path when installing; fixes #4883
Ian Lynagh [Sat, 8 Jan 2011 17:16:35 +0000 (17:16 +0000)]
Make DESTDIR an absolute path when installing; fixes #4883

11 years agoAdd utils/ghc-cabal/Makefile
Ian Lynagh [Sat, 8 Jan 2011 14:40:49 +0000 (14:40 +0000)]
Add utils/ghc-cabal/Makefile

11 years agoRemove redundant import
Ian Lynagh [Sat, 8 Jan 2011 13:00:47 +0000 (13:00 +0000)]
Remove redundant import

11 years agoImprove error message of :set in ghci (ticket #4190).
Michal Terepeta [Tue, 30 Nov 2010 21:15:05 +0000 (21:15 +0000)]
Improve error message of :set in ghci (ticket #4190).

11 years agoImprove error message when importing data constructors (ticket #4058).
Michal Terepeta [Sat, 27 Nov 2010 21:13:38 +0000 (21:13 +0000)]
Improve error message when importing data constructors (ticket #4058).

11 years agocatch SIGTSTP and save/restore terminal settings (#4460)
Simon Marlow [Fri, 7 Jan 2011 12:40:42 +0000 (12:40 +0000)]
catch SIGTSTP and save/restore terminal settings (#4460)
As far as I can tell, it is the responsibility of the program to save
and restore its own terminal settings across a suspend/foreground, the
shell doesn't do it (which seems odd).  So I've added a signal handler
for SIGTSTP to the RTS which will save and restore the terminal
settings iff we modified them with hSetBuffering or hSetEcho (we
already restore them at exit time in these cases).

11 years agocomment updates
Simon Marlow [Fri, 7 Jan 2011 09:42:36 +0000 (09:42 +0000)]
comment updates

11 years agoOn Cygwin, use a Cygwin-style path for /bin/install's destination
Ian Lynagh [Thu, 6 Jan 2011 22:30:30 +0000 (22:30 +0000)]
On Cygwin, use a Cygwin-style path for /bin/install's destination

cygwin's /bin/install doesn't set file modes correctly if the
destination path is a C: style path:

$ /bin/install -c -m 644 foo /cygdrive/c/cygwin/home/ian/foo2
$ /bin/install -c -m 644 foo c:/cygwin/home/ian/foo3
$ ls -l foo*
-rw-r--r-- 1 ian None 0 2011-01-06 18:28 foo
-rw-r--r-- 1 ian None 0 2011-01-06 18:29 foo2
-rwxrwxrwx 1 ian None 0 2011-01-06 18:29 foo3

This causes problems for bindisttest/ which then
thinks that e.g. the userguide HTML files are binaries.

We therefore use a /cygdrive path if we are on cygwin

11 years agoFix mkUserGuidePart program name on Windows
Ian Lynagh [Thu, 6 Jan 2011 14:37:07 +0000 (14:37 +0000)]
Fix mkUserGuidePart program name on Windows

11 years agoadd comment to remind people to update driver/gcc/gcc.c
Simon Marlow [Thu, 6 Jan 2011 15:24:02 +0000 (15:24 +0000)]
add comment to remind people to update driver/gcc/gcc.c

11 years agouse Win32 CreateProcess() rather than mingw spawnv() (#4531)
Simon Marlow [Thu, 6 Jan 2011 13:38:34 +0000 (13:38 +0000)]
use Win32 CreateProcess() rather than mingw spawnv() (#4531)

11 years agoupdate paths now that we upgraded gcc to 4.5.0
Simon Marlow [Thu, 6 Jan 2011 13:37:29 +0000 (13:37 +0000)]
update paths now that we upgraded gcc to 4.5.0

11 years agofix markup
Simon Marlow [Thu, 6 Jan 2011 09:31:52 +0000 (09:31 +0000)]
fix markup

11 years agofix up multi-line GHCi patch (#4316)
Simon Marlow [Wed, 5 Jan 2011 15:45:48 +0000 (15:45 +0000)]
fix up multi-line GHCi patch (#4316)

11 years agomultiline commands in GHCi #4316
Vivian McPhail [Fri, 5 Nov 2010 05:13:08 +0000 (05:13 +0000)]
multiline commands in GHCi #4316
This patch adds support for multiline commands in GHCi.

The first line of input is lexed.  If there is an active
layout context once the lexer reaches the end of file, the
user is prompted for more input.

Multiline input is exited by an empty line and can be escaped
with a user interrupt.

Multiline mode is toggled with `:set +m`

11 years agoReplace a #if with a Haskell conditional
Ian Lynagh [Wed, 5 Jan 2011 18:30:11 +0000 (18:30 +0000)]
Replace a #if with a Haskell conditional

11 years agoWhitespace only in X86.Ppr
Ian Lynagh [Wed, 5 Jan 2011 17:11:24 +0000 (17:11 +0000)]
Whitespace only in X86.Ppr

11 years agoFix error compiling AsmCodeGen.lhs for PPC Mac (unused makeFar addr) [Sun, 19 Dec 2010 21:35:55 +0000 (21:35 +0000)]
Fix error compiling AsmCodeGen.lhs for PPC Mac (unused makeFar addr)

11 years agoDefine cTargetArch and start to use it rather than ifdefs
Ian Lynagh [Tue, 4 Jan 2011 22:00:13 +0000 (22:00 +0000)]
Define cTargetArch and start to use it rather than ifdefs
Using Haskell conditionals means the compiler sees all the code, so
there should be less rot of code specific to uncommon arches. Code
for other platforms should still be optimised away, although if we want
to support targetting other arches then we'll need to compile it
for-real anyway.

11 years agoFix error compiling AsmCodeGen.lhs for PPC Mac (rtsPackageId) [Sun, 19 Dec 2010 21:25:30 +0000 (21:25 +0000)]
Fix error compiling AsmCodeGen.lhs for PPC Mac (rtsPackageId)

11 years agoRename the c*Platform variables to c*PlatformString
Ian Lynagh [Tue, 4 Jan 2011 21:02:50 +0000 (21:02 +0000)]
Rename the c*Platform variables to c*PlatformString

11 years agoFix #4829 (build does not respect --with-gcc option) [Tue, 21 Dec 2010 13:32:33 +0000 (13:32 +0000)]
Fix #4829 (build does not respect --with-gcc option)

This patch fixes what seems to be the last problem with the --with-gcc
option.  On OS X, we need to pass the path to gcc to dtrace as the
preprocessor.  (Internally, dtrace on OS X sets the default preprocessor
to /usr/bin/gcc.)  ATM, dtrace is only supported on OS X, so we don't
need any conditionalization.  If dtrace is ported to other platforms,
we might need to change this. However, usage on other platforms will
probably be similar to OS X, since many of Apple's changes are to
use the gnu toolchain instead of the Sun toolchain.

11 years agoDrop a seven years old workaround for happy
Matthias Kilian [Fri, 31 Dec 2010 19:23:43 +0000 (19:23 +0000)]
Drop a seven years old workaround for happy

11 years agoAdd gcc and ld flags to --info output
Ian Lynagh [Mon, 20 Dec 2010 17:35:20 +0000 (17:35 +0000)]
Add gcc and ld flags to --info output

11 years agoFix Trac #4525: report type errors in terms of the immediate type synonym [Fri, 24 Dec 2010 08:25:20 +0000 (08:25 +0000)]
Fix Trac #4525: report type errors in terms of the immediate type synonym

This small change means that if you have
     type Age = Int
and you try to unify Age and Bool, you'll get a complaint about
not matching Age and Bool, rather than Int and Bool.  See the notes
with Trac #4525

11 years agoComments only [Fri, 24 Dec 2010 08:23:10 +0000 (08:23 +0000)]
Comments only

11 years agoImplement fuzzy matching for the Finder [Wed, 22 Dec 2010 17:54:00 +0000 (17:54 +0000)]
Implement fuzzy matching for the Finder that you get a more helpful message when
you mis-spell a module name in an 'import'.

Validates, but not fully tested.

Based on Max's patch in Trac #2442, but heavily refactored.

11 years agoImplement fuzzy matching for the renamer [Wed, 22 Dec 2010 17:53:06 +0000 (17:53 +0000)]
Implement fuzzy matching for the renamer that you get helpful suggestions when you mis-spell a name
Based on Max's patch in Trac #2442, but heavily refactored.

11 years agoAdd fuzzyLookup, a variant of fuzzyMatch [Wed, 22 Dec 2010 17:51:24 +0000 (17:51 +0000)]
Add fuzzyLookup, a variant of fuzzyMatch

Plus, I changed quite a bit of layout to make the lines shorter.

11 years agoWhite space only [Wed, 22 Dec 2010 17:50:01 +0000 (17:50 +0000)]
White space only

11 years agoLayout and white space only [Wed, 22 Dec 2010 17:49:50 +0000 (17:49 +0000)]
Layout and white space only

11 years agoTidy up rebindable syntax for MDo [Wed, 22 Dec 2010 13:22:10 +0000 (13:22 +0000)]
Tidy up rebindable syntax for MDo

For a long time an 'mdo' expression has had a SyntaxTable
attached to it.  However, we're busy deprecating SyntaxTables
in favour of rebindable syntax attached to individual Stmts,
and MDoExpr was totally inconsistent with DoExpr in this

This patch tidies it all up.  Now there's no SyntaxTable on
MDoExpr, and 'modo' is generally handled much more like 'do'.

There is resulting small change in behaviour: now MonadFix is
required only if you actually *use* recursion in mdo. This
seems consistent with the implicit dependency analysis that
is done for mdo.

Still to do:
  * Deal with #4148 (this patch is on the way)
  * Get rid of the last remaining SyntaxTable on HsCmdTop

11 years agoMake the occurrence analyser track preInlineUnconditionally [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.

11 years agoMake mkDFunUnfolding more robust [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

11 years agoCount allocations more accurately
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.

11 years agoAdd a simple arity analyser [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.

11 years agoMiscellaneous tidying up and refactoring [Tue, 21 Dec 2010 16:19:31 +0000 (16:19 +0000)]
Miscellaneous tidying up and refactoring

11 years agoComments only [Tue, 21 Dec 2010 16:19:18 +0000 (16:19 +0000)]
Comments only

11 years agoSingle-method classes are implemented with a newtype [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.

11 years agoFor single-method classes use newtypes [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

11 years agoboundTaskExiting: don't set task->stopped unless this is the last call (#4850)
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).

11 years agoreleaseCapabilityAndQueueWorker: task->stopped should be false (#4850)
Simon Marlow [Tue, 21 Dec 2010 11:49:11 +0000 (11:49 +0000)]
releaseCapabilityAndQueueWorker: task->stopped should be false (#4850)

11 years agoFix Windows build
Simon Marlow [Tue, 21 Dec 2010 10:21:01 +0000 (10:21 +0000)]
Fix Windows build

11 years agoraiseExceptionHelper: update tso->stackobj->sp before calling threadStackOverflow...
Simon Marlow [Tue, 21 Dec 2010 10:14:11 +0000 (10:14 +0000)]
raiseExceptionHelper: update tso->stackobj->sp before calling threadStackOverflow (#4845)

11 years agoadd 'make re2' for rebuilding stage2 (similarly re1 and re3)
Simon Marlow [Tue, 21 Dec 2010 10:02:54 +0000 (10:02 +0000)]
add 'make re2' for rebuilding stage2 (similarly re1 and re3)

11 years agofix warning
Simon Marlow [Thu, 16 Dec 2010 16:04:15 +0000 (16:04 +0000)]
fix warning

11 years agoSmall improvement to CorePrep [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.

11 years agoFix warnings
Ian Lynagh [Sun, 19 Dec 2010 20:27:11 +0000 (20:27 +0000)]
Fix warnings

11 years agoSmall refactoring
Ian Lynagh [Sun, 19 Dec 2010 19:40:32 +0000 (19:40 +0000)]
Small refactoring

11 years agoDrop GhcWithLlvmCodeGen configuration bits
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/ as well as the string in
compilerInfo can be removed.

11 years agoPass --hoogle to haddock; fixes trac #4521
Ian Lynagh [Sun, 19 Dec 2010 12:52:43 +0000 (12:52 +0000)]
Pass --hoogle to haddock; fixes trac #4521

11 years agovectoriser: don't always pass superclass dictionaries to PA dfuns
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.

11 years agovectoriser: delete dead code
Roman Leshchinskiy [Sat, 18 Dec 2010 12:53:50 +0000 (12:53 +0000)]
vectoriser: delete dead code

11 years agovectoriser: adapt to new superclass story part I (dictionary construction)
Roman Leshchinskiy [Sat, 18 Dec 2010 11:49:53 +0000 (11:49 +0000)]
vectoriser: adapt to new superclass story part I (dictionary construction)

11 years agoReplace uses of the old try function with the new one
Ian Lynagh [Sat, 18 Dec 2010 23:08:27 +0000 (23:08 +0000)]
Replace uses of the old try function with the new one

11 years agoReplace uses of the old catch 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

11 years agoCreate ~/.ghc/ if it doesn't already exist; fixes trac #4522
Ian Lynagh [Sat, 18 Dec 2010 18:49:25 +0000 (18:49 +0000)]
Create ~/.ghc/ if it doesn't already exist; fixes trac #4522

11 years agoDocument GADTSyntax extension
Ian Lynagh [Sat, 18 Dec 2010 15:01:21 +0000 (15:01 +0000)]
Document GADTSyntax extension

11 years agoImplement GADTSyntax extension
Ian Lynagh [Sat, 18 Dec 2010 14:45:50 +0000 (14:45 +0000)]
Implement GADTSyntax extension

11 years agoWhitespace-only in rts/Linker.c
Ian Lynagh [Fri, 17 Dec 2010 23:41:24 +0000 (23:41 +0000)]
Whitespace-only in rts/Linker.c

11 years agoAdd some casts to fix warnings; patch from Greg Wright
Ian Lynagh [Fri, 17 Dec 2010 22:38:11 +0000 (22:38 +0000)]
Add some casts to fix warnings; patch from Greg Wright

11 years agoPut an up-to-date Makefile in docs/Makefile
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

11 years agodo not compile part of shared lib RTS with -fno-PIC on Solaris
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

11 years agoprovide shared libraries support on i386-unknown-solaris2 platform
Karel Gardas [Fri, 17 Dec 2010 08:46:17 +0000 (08:46 +0000)]
provide shared libraries support on i386-unknown-solaris2 platform

11 years agofix CPP detection of Solaris in NCG
Karel Gardas [Fri, 17 Dec 2010 08:45:10 +0000 (08:45 +0000)]
fix CPP detection of Solaris in NCG

11 years agoFix checkBinaries on OS X
Ian Lynagh [Thu, 16 Dec 2010 20:11:21 +0000 (20:11 +0000)]
Fix checkBinaries on OS X

11 years agoRemove redundant HpcMap and HpcSet wrappers around Data.{Map,Set}
Ian Lynagh [Thu, 16 Dec 2010 19:06:05 +0000 (19:06 +0000)]
Remove redundant HpcMap and HpcSet wrappers around Data.{Map,Set}

11 years agoUse "-perm -u+x" rather than "-executable" to find executables
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.

11 years agoRemove a debugging print
Ian Lynagh [Thu, 16 Dec 2010 01:14:59 +0000 (01:14 +0000)]
Remove a debugging print

11 years ago__GLASGOW_HASKELL__ >= 604 is now always true
Ian Lynagh [Wed, 15 Dec 2010 21:46:56 +0000 (21:46 +0000)]
__GLASGOW_HASKELL__ >= 604 is now always true

11 years agoRemove more dead code now we require GHC >= 6.12
Ian Lynagh [Wed, 15 Dec 2010 21:37:15 +0000 (21:37 +0000)]
Remove more dead code now we require GHC >= 6.12

11 years agorefactor and tidy up the section on RTS options
Simon Marlow [Thu, 16 Dec 2010 12:31:51 +0000 (12:31 +0000)]
refactor and tidy up the section on RTS options

11 years agoRelated to #4826: Some minor tweaks to the wording of the User Guide, section 4.16
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

11 years agoFIX #4826 partial: Add -rtsopts and -with-rtsopts to User Guide section 4.11.6
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

11 years agoFIX #4826 partially: Change -f to -? in User Guide section F4.16
Orphi [Thu, 9 Dec 2010 14:41:48 +0000 (14:41 +0000)]
FIX #4826 partially: Change -f to -? in User Guide section F4.16

11 years agofix #3910
Simon Marlow [Thu, 16 Dec 2010 11:44:52 +0000 (11:44 +0000)]
fix #3910

11 years agoremove an optimisation that wasn't
Simon Marlow [Wed, 15 Dec 2010 15:26:56 +0000 (15:26 +0000)]
remove an optimisation that wasn't

11 years agofix a warning
Simon Marlow [Thu, 16 Dec 2010 10:57:23 +0000 (10:57 +0000)]
fix a warning

11 years agouse EXTERN_INLINE instead of STATIC_INLINE to avoid some gcc warnings
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

11 years agoremove dead code
Simon Marlow [Thu, 16 Dec 2010 10:49:44 +0000 (10:49 +0000)]
remove dead code

11 years agofix retainer profiling: add missing case for TSO
Simon Marlow [Thu, 16 Dec 2010 10:39:00 +0000 (10:39 +0000)]
fix retainer profiling: add missing case for TSO

11 years agoadd a missing STACK case
Simon Marlow [Thu, 16 Dec 2010 10:21:00 +0000 (10:21 +0000)]
add a missing STACK case

11 years agoRemove code that is dead now that we need >= 6.12 to build
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

11 years agofix for large stack allocations
Simon Marlow [Wed, 15 Dec 2010 15:24:19 +0000 (15:24 +0000)]
fix for large stack allocations

11 years agoImplement stack chunks and separate TSO/STACK objects
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

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

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.

11 years agocomments on SRC_HC_OPTS (#4829)
Simon Marlow [Tue, 14 Dec 2010 10:13:40 +0000 (10:13 +0000)]
comments on SRC_HC_OPTS (#4829)

11 years agofix another sanity error, and refactor/tidy up
Simon Marlow [Thu, 9 Dec 2010 16:39:19 +0000 (16:39 +0000)]
fix another sanity error, and refactor/tidy up

11 years agoFix a bug in functorLikeTraverse, which was giving wrong answer for tuples [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

11 years agoImprove printing for -ddump-deriv [Wed, 15 Dec 2010 12:19:55 +0000 (12:19 +0000)]
Improve printing for -ddump-deriv

11 years agoTighten up what it means to be an "enumeration data constructor" [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

11 years agoAllow enumerations to have phantom arguments. [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.

11 years agoInstance declaration overlap allowed if *either* has -XOverlappingInstances [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.

11 years agoFix Trac #4841: behave right with TypeSynonymInstances and NoFlexibleInstances [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.

11 years agoFix Trac #3731: more superclass subtlety (sigh) [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.

11 years agoLess verbose debug print [Tue, 14 Dec 2010 18:02:48 +0000 (18:02 +0000)]
Less verbose debug print