9 years agoaccount for the new BLACKHOLEs in the GHCi debugger
Simon Marlow [Tue, 6 Apr 2010 13:34:06 +0000 (13:34 +0000)] 
account for the new BLACKHOLEs in the GHCi debugger

9 years agodon't forget to deRefTSO() in tryWakeupThread()
Simon Marlow [Tue, 6 Apr 2010 13:04:11 +0000 (13:04 +0000)] 
don't forget to deRefTSO() in tryWakeupThread()

9 years agoFix bug in popRunQueue
Simon Marlow [Tue, 6 Apr 2010 09:14:53 +0000 (09:14 +0000)] 
Fix bug in popRunQueue

9 years agofix bug in migrateThread()
Simon Marlow [Thu, 1 Apr 2010 10:58:40 +0000 (10:58 +0000)] 
fix bug in migrateThread()

9 years agoRemove the IND_OLDGEN and IND_OLDGEN_PERM closure types
Simon Marlow [Thu, 1 Apr 2010 09:35:19 +0000 (09:35 +0000)] 
Remove the IND_OLDGEN and IND_OLDGEN_PERM closure types
These are no longer used: once upon a time they used to have different
layout from IND and IND_PERM respectively, but that is no longer the
case since we changed the remembered set to be an array of addresses
instead of a linked list of closures.

9 years agoChange the representation of the MVar blocked queue
Simon Marlow [Thu, 1 Apr 2010 09:16:05 +0000 (09:16 +0000)] 
Change the representation of the MVar blocked queue

The list of threads blocked on an MVar is now represented as a list of
separately allocated objects rather than being linked through the TSOs
themselves.  This lets us remove a TSO from the list in O(1) time
rather than O(n) time, by marking the list object.  Removing this
linear component fixes some pathalogical performance cases where many
threads were blocked on an MVar and became unreachable simultaneously
(nofib/smp/threads007), or when sending an asynchronous exception to a
TSO in a long list of thread blocked on an MVar.

MVar performance has actually improved by a few percent as a result of
this change, slightly to my surprise.

This is the final cleanup in the sequence, which let me remove the old
way of waking up threads (unblockOne(), MSG_WAKEUP) in favour of the
new way (tryWakeupThread and MSG_TRY_WAKEUP, which is idempotent).  It
is now the case that only the Capability that owns a TSO may modify
its state (well, almost), and this simplifies various things.  More of
the RTS is based on message-passing between Capabilities now.

9 years agoeliminate some duplication with a bit of CPP
Simon Marlow [Tue, 30 Mar 2010 15:43:55 +0000 (15:43 +0000)] 
eliminate some duplication with a bit of CPP

9 years agoMake ioManagerDie() idempotent
Simon Marlow [Thu, 1 Apr 2010 10:07:05 +0000 (10:07 +0000)] 
Make ioManagerDie() idempotent
Avoids screeds of "event buffer overflowed; event dropped" in

9 years agoMove a thread to the front of the run queue when another thread blocks on it
Simon Marlow [Mon, 29 Mar 2010 14:45:21 +0000 (14:45 +0000)] 
Move a thread to the front of the run queue when another thread blocks on it
This fixes #3838, and was made possible by the new BLACKHOLE
infrastructure.  To allow reording of the run queue I had to make it
doubly-linked, which entails some extra trickiness with regard to
GC write barriers and suchlike.

9 years agoremove non-existent MUT_CONS symbols
Simon Marlow [Tue, 30 Mar 2010 15:26:00 +0000 (15:26 +0000)] 
remove non-existent MUT_CONS symbols

9 years agochange throwTo to use tryWakeupThread rather than unblockOne
Simon Marlow [Mon, 29 Mar 2010 14:46:13 +0000 (14:46 +0000)] 
change throwTo to use tryWakeupThread rather than unblockOne

9 years agotiny GC optimisation
Simon Marlow [Mon, 29 Mar 2010 14:45:51 +0000 (14:45 +0000)] 
tiny GC optimisation

9 years agoNew implementation of BLACKHOLEs
Simon Marlow [Mon, 29 Mar 2010 14:44:56 +0000 (14:44 +0000)] 
New implementation of BLACKHOLEs

This replaces the global blackhole_queue with a clever scheme that
enables us to queue up blocked threads on the closure that they are
blocked on, while still avoiding atomic instructions in the common


 - gets rid of a locked global data structure and some tricky GC code
   (replacing it with some per-thread data structures and different
   tricky GC code :)

 - wakeups are more prompt: parallel/concurrent performance should
   benefit.  I haven't seen anything dramatic in the parallel
   benchmarks so far, but a couple of threading benchmarks do improve
   a bit.

 - waking up a thread blocked on a blackhole is now O(1) (e.g. if
   it is the target of throwTo).

 - less sharing and better separation of Capabilities: communication
   is done with messages, the data structures are strictly owned by a
   Capability and cannot be modified except by sending messages.

 - this change will utlimately enable us to do more intelligent
   scheduling when threads block on each other.  This is what started
   off the whole thing, but it isn't done yet (#3838).

I'll be documenting all this on the wiki in due course.

9 years agoFix warnings (allow pushOnRunQueue() to not be inlined)
Simon Marlow [Thu, 1 Apr 2010 11:45:59 +0000 (11:45 +0000)] 
Fix warnings (allow pushOnRunQueue() to not be inlined)

9 years agoremove out of date comment
Simon Marlow [Thu, 1 Apr 2010 10:58:53 +0000 (10:58 +0000)] 
remove out of date comment

9 years agotidy up spacing in stderr traces
Simon Marlow [Fri, 26 Mar 2010 16:31:22 +0000 (16:31 +0000)] 
tidy up spacing in stderr traces

9 years agoFix an assertion that was not safe when running in parallel
Simon Marlow [Thu, 25 Mar 2010 14:36:56 +0000 (14:36 +0000)] 
Fix an assertion that was not safe when running in parallel

9 years agoNever jump directly to a thunk's entry code, even if it is single-entry
Simon Marlow [Thu, 25 Mar 2010 11:48:47 +0000 (11:48 +0000)] 
Never jump directly to a thunk's entry code, even if it is single-entry
I don't think this fixes any bugs as we don't have single-entry thunks
at the moment, but it could cause problems for parallel execution if
we ever did re-introduce update avoidance.

9 years agoRename forgotten -dverbose-simpl to -dverbose-core2core in the docs.
Milan Straka [Wed, 31 Mar 2010 15:36:26 +0000 (15:36 +0000)] 
Rename forgotten -dverbose-simpl to -dverbose-core2core in the docs.

9 years agoAdd -pa and -V to the documentation of time profiling options.
Milan Straka [Mon, 29 Mar 2010 19:11:21 +0000 (19:11 +0000)] 
Add -pa and -V to the documentation of time profiling options.

9 years agoKeep gcc 4.5 happy
Simon Marlow [Tue, 30 Mar 2010 12:04:25 +0000 (12:04 +0000)] 
Keep gcc 4.5 happy

9 years agoFix warning compiling Linker.c for PPC Mac [Sat, 3 Apr 2010 18:23:55 +0000 (18:23 +0000)] 
Fix warning compiling Linker.c for PPC Mac
The warning message eliminated is:
> rts/Linker.c:4756:0:
>      warning: nested extern declaration of 'symbolsWithoutUnderscore'

9 years agoFix error compiling AsmCodeGen.lhs for PPC Mac (mkRtsCodeLabel) [Sat, 3 Apr 2010 18:16:56 +0000 (18:16 +0000)] 
Fix error compiling AsmCodeGen.lhs for PPC Mac (mkRtsCodeLabel)
The error messages eliminated are:
> compiler/nativeGen/AsmCodeGen.lhs:875:31:
>     Not in scope: `mkRtsCodeLabel'
> compiler/nativeGen/AsmCodeGen.lhs:879:31:
>     Not in scope: `mkRtsCodeLabel'
> compiler/nativeGen/AsmCodeGen.lhs:883:31:
>     Not in scope: `mkRtsCodeLabel'

9 years agoFix error compiling AsmCodeGen.lhs for PPC Mac (DestBlockId) [Sat, 3 Apr 2010 18:06:43 +0000 (18:06 +0000)] 
Fix error compiling AsmCodeGen.lhs for PPC Mac (DestBlockId)
The error message eliminated is:
> compiler/nativeGen/AsmCodeGen.lhs:637:16:
>     Not in scope: data constructor `DestBlockId'

9 years agoFix boot-pkgs's sed usage to work with Solaris's sed
Ian Lynagh [Thu, 1 Apr 2010 15:34:41 +0000 (15:34 +0000)] 
Fix boot-pkgs's sed usage to work with Solaris's sed

9 years agoPass "-i org.haskell.GHC" to packagemaker when building the OS X installer
Ian Lynagh [Wed, 31 Mar 2010 14:47:07 +0000 (14:47 +0000)] 
Pass "-i org.haskell.GHC" to packagemaker when building the OS X installer
This seems to fix this failure:
rm -f -f GHC-system.pmdoc/*-contents.xml
/Developer/usr/bin/packagemaker -v --doc GHC-system.pmdoc\
             -o /Users/ian/to_release/ghc-
2010-03-31 15:08:15.695 packagemaker[13909:807] Setting to : 0 (null)
2010-03-31 15:08:15.709 packagemaker[13909:807] Setting to : 0 org.haskell.glasgowHaskellCompiler.ghc.pkg
2010-03-31 15:08:15.739 packagemaker[13909:807] relocate: (null) 0
2010-03-31 15:08:15.740 packagemaker[13909:807] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSXMLDocument initWithXMLString:options:error:]: nil argument'
2010-03-31 15:08:15.741 packagemaker[13909:807] Stack: (
make[1]: *** [framework-pkg] Trace/BPT trap
make: *** [framework-pkg] Error 2

9 years agoUse machdepCCOpts when compiling the file to toggle -(no-)rtsopts
Ian Lynagh [Wed, 31 Mar 2010 16:13:02 +0000 (16:13 +0000)] 
Use machdepCCOpts when compiling the file to toggle -(no-)rtsopts
Should fix toggling on OS X "Snow Leopard". Diagnosed by Roman Leshchinskiy.

9 years agoAvoid a non-portable use of tar reported by Roman Leshchinskiy
Ian Lynagh [Tue, 30 Mar 2010 14:58:02 +0000 (14:58 +0000)] 
Avoid a non-portable use of tar reported by Roman Leshchinskiy

9 years agoDon't install EXTRA_PACKAGES by default
Simon Marlow [Tue, 30 Mar 2010 14:27:14 +0000 (14:27 +0000)] 
Don't install EXTRA_PACKAGES by default

9 years agofix a non-portable printf format
Simon Marlow [Tue, 30 Mar 2010 13:44:37 +0000 (13:44 +0000)] 
fix a non-portable printf format

9 years agoavoid single quote in #error
Simon Marlow [Tue, 30 Mar 2010 12:03:46 +0000 (12:03 +0000)] 
avoid single quote in #error

9 years agouse FMT_Word64 instead of locally-defined version
Simon Marlow [Tue, 30 Mar 2010 11:46:50 +0000 (11:46 +0000)] 
use FMT_Word64 instead of locally-defined version

9 years agoremove old/unused DotnetSupport and GhcLibsWithUnix
Simon Marlow [Tue, 30 Mar 2010 12:37:32 +0000 (12:37 +0000)] 
remove old/unused DotnetSupport and GhcLibsWithUnix

9 years agofix return type cast in f.i.wrapper when using libffi (#3516)
Simon Marlow [Mon, 29 Mar 2010 15:42:20 +0000 (15:42 +0000)] 
fix return type cast in f.i.wrapper when using libffi (#3516)

Original fix submitted by
  Sergei Trofimovich <>
modified by me:
 - exclude 64-bit types
 - compare uniques, not strings
 - #include "ffi.h" is conditional

9 years agolibffi: install 'ffitarget.h' header as sole 'ffi.h' is unusable
Simon Marlow [Mon, 29 Mar 2010 13:57:34 +0000 (13:57 +0000)] 
libffi: install 'ffitarget.h' header as sole 'ffi.h' is unusable
Submitted by: Sergei Trofimovich <>
Re-recorded against HEAD.

9 years agoavoid a fork deadlock (see comments)
Simon Marlow [Mon, 29 Mar 2010 13:23:29 +0000 (13:23 +0000)] 
avoid a fork deadlock (see comments)

9 years agotidy up the end of the all_tasks list after forking
Simon Marlow [Mon, 29 Mar 2010 13:22:53 +0000 (13:22 +0000)] 
tidy up the end of the all_tasks list after forking

9 years agoAdd a 'setKeepCAFs' external function (#3900)
Simon Marlow [Mon, 29 Mar 2010 11:00:36 +0000 (11:00 +0000)] 
Add a 'setKeepCAFs' external function (#3900)

9 years agoExplicitly check whether ar supports the @file syntax
Ian Lynagh [Mon, 29 Mar 2010 12:33:25 +0000 (12:33 +0000)] 
Explicitly check whether ar supports the @file syntax
rather than assuming that all GNU ar's do.
Apparently OpenBSD's older version doesn't.

9 years agoFix the format specifier for Int64/Word64 on Windows
Ian Lynagh [Sat, 27 Mar 2010 18:21:26 +0000 (18:21 +0000)] 
Fix the format specifier for Int64/Word64 on Windows
mingw doesn't understand %llu/%lld - it treats them as 32-bit rather
than 64-bit. We use %I64u/%I64d instead.

9 years agoFix the ghci startmenu item
Ian Lynagh [Fri, 26 Mar 2010 23:59:34 +0000 (23:59 +0000)] 
Fix the ghci startmenu item
I'm not sure what changed, but it now doesn't work for me without
the "Start in" field being set.

9 years agoFix paths to docs in "Start Menu" entries in Windows installer; fixes #3847
Ian Lynagh [Fri, 26 Mar 2010 15:59:17 +0000 (15:59 +0000)] 
Fix paths to docs in "Start Menu" entries in Windows installer; fixes #3847

9 years agoAdd a licence file for the Windows installer to use
Ian Lynagh [Fri, 26 Mar 2010 15:51:30 +0000 (15:51 +0000)] 
Add a licence file for the Windows installer to use

9 years agoAdd gcc-g++ to the inplace mingw installation; fixes #3893
Ian Lynagh [Fri, 26 Mar 2010 15:47:14 +0000 (15:47 +0000)] 
Add gcc-g++ to the inplace mingw installation; fixes #3893

9 years agoAdd the licence file to the Windows installer. Fixes #3934
Ian Lynagh [Fri, 26 Mar 2010 15:24:49 +0000 (15:24 +0000)] 
Add the licence file to the Windows installer. Fixes #3934

9 years agoQuote the paths to alex and happy in configure
Ian Lynagh [Thu, 25 Mar 2010 14:34:49 +0000 (14:34 +0000)] 
Quote the paths to alex and happy in configure

9 years agoUse </> rather than ++ "/"
Ian Lynagh [Thu, 25 Mar 2010 13:32:37 +0000 (13:32 +0000)] 
Use </> rather than ++ "/"
This stops us generating paths like
which windres doesn't understand.

9 years agoAppend $(exeext) to utils/ghc-pkg_dist_PROG
Ian Lynagh [Wed, 24 Mar 2010 23:34:47 +0000 (23:34 +0000)] 
Append $(exeext) to utils/ghc-pkg_dist_PROG
Fixes bindist creation

9 years agoA sanity check
Simon Marlow [Thu, 25 Mar 2010 11:05:00 +0000 (11:05 +0000)] 
A sanity check

9 years agodo_checks: do not set HpAlloc if the stack check fails
Simon Marlow [Thu, 25 Mar 2010 11:03:28 +0000 (11:03 +0000)] 
do_checks: do not set HpAlloc if the stack check fails

This fixes a very rare heap corruption bug, whereby

 - a context switch is requested, which sets HpLim to zero
   (contextSwitchCapability(), called by the timer signal or
   another Capability).

 - simultaneously a stack check fails, in a code fragment that has
   both a stack and a heap check.

The RTS then assumes that a heap-check failure has occurred and
subtracts HpAlloc from Hp, although in fact it was a stack-check
failure and retreating Hp will overwrite valid heap objects.  The bug
is that HpAlloc should only be set when Hp has been incremented by the
heap check.  See comments in rts/HeapStackCheck.cmm for more details.

This bug is probably incredibly rare in practice, but I happened to be
working on a test that triggers it reliably:
concurrent/should_run/throwto001, compiled with -O -threaded, args 30
300 +RTS -N2, run repeatedly in a loop.

9 years agocomments and formatting only
Simon Marlow [Thu, 25 Mar 2010 10:46:17 +0000 (10:46 +0000)] 
comments and formatting only

9 years agoChange how perl scripts get installed; partially fixes #3863
Ian Lynagh [Wed, 24 Mar 2010 17:14:22 +0000 (17:14 +0000)] 
Change how perl scripts get installed; partially fixes #3863
We now regenerate them when installing, which means the path for perl
doesn't get baked in

9 years agoPass the location of gcc in the ghc wrapper script; partially fixes #3863
Ian Lynagh [Wed, 24 Mar 2010 17:14:08 +0000 (17:14 +0000)] 
Pass the location of gcc in the ghc wrapper script; partially fixes #3863
This means we don't rely on baking a path to gcc into the executable

9 years agoQuote the ar path in configure
Ian Lynagh [Wed, 24 Mar 2010 16:20:43 +0000 (16:20 +0000)] 
Quote the ar path in configure

9 years agoRemove unused cUSER_WAY_NAMES cUSER_WAY_OPTS
Ian Lynagh [Wed, 24 Mar 2010 14:50:48 +0000 (14:50 +0000)] 

9 years agoRemove unused cCONTEXT_DIFF
Ian Lynagh [Wed, 24 Mar 2010 14:50:13 +0000 (14:50 +0000)] 
Remove unused cCONTEXT_DIFF

9 years agoRemove unused cEnableWin32DLLs
Ian Lynagh [Wed, 24 Mar 2010 14:48:41 +0000 (14:48 +0000)] 
Remove unused cEnableWin32DLLs

9 years agoRemove unused cGHC_CP
Ian Lynagh [Wed, 24 Mar 2010 14:46:56 +0000 (14:46 +0000)] 
Remove unused cGHC_CP

9 years agoFix the build for non-GNU-ar
Ian Lynagh [Wed, 24 Mar 2010 13:29:07 +0000 (13:29 +0000)] 
Fix the build for non-GNU-ar

9 years agoTweak the Makefile code for making .a libs; fixes trac #3642
Ian Lynagh [Tue, 23 Mar 2010 22:13:25 +0000 (22:13 +0000)] 
Tweak the Makefile code for making .a libs; fixes trac #3642
The main change is that, rather than using "xargs ar" we now put
all the filenames into a file, and do "ar @file". This means that
ar adds all the files at once, which works around a problem where
files with the same basename in a later invocation were overwriting
the existing file in the .a archive.

9 years agoEnable shared libraries on Windows; fixes trac #3879
Ian Lynagh [Sat, 20 Mar 2010 23:14:14 +0000 (23:14 +0000)] 
Enable shared libraries on Windows; fixes trac #3879

9 years agoAdd the external core PDF to the new build system
Ian Lynagh [Sun, 21 Mar 2010 16:19:09 +0000 (16:19 +0000)] 
Add the external core PDF to the new build system

9 years agoAllow specifying $threads directly when validating
Ian Lynagh [Sun, 21 Mar 2010 11:28:35 +0000 (11:28 +0000)] 
Allow specifying $threads directly when validating

9 years agoRemove LazyUniqFM; fixes trac #3880
Ian Lynagh [Sat, 20 Mar 2010 21:38:37 +0000 (21:38 +0000)] 
Remove LazyUniqFM; fixes trac #3880

9 years agoUNDO: slight improvement to scavenging ...
Simon Marlow [Fri, 19 Mar 2010 15:34:13 +0000 (15:34 +0000)] 
UNDO: slight improvement to scavenging ...

Accidnetally pushed this patch which, while it validates, isn't

rolling back:

Fri Mar 19 11:21:27 GMT 2010  Simon Marlow <>
  * slight improvement to scavenging of update frames when a collision has occurred

    M ./rts/sm/Scav.c -19 +15

9 years agoslight improvement to scavenging of update frames when a collision has occurred
Simon Marlow [Fri, 19 Mar 2010 11:21:27 +0000 (11:21 +0000)] 
slight improvement to scavenging of update frames when a collision has occurred

9 years agoDon't install the utf8-string package
Ian Lynagh [Wed, 17 Mar 2010 21:27:09 +0000 (21:27 +0000)] 
Don't install the utf8-string package

9 years agoDon't use -Bsymbolic when linking the RTS
Ian Lynagh [Tue, 16 Mar 2010 23:33:57 +0000 (23:33 +0000)] 
Don't use -Bsymbolic when linking the RTS
This makes the RTS hooks work when doing dynamic linking

9 years agoFix Trac #3920: Template Haskell kinds [Wed, 17 Mar 2010 12:35:19 +0000 (12:35 +0000)] 
Fix Trac #3920: Template Haskell kinds

Fix two places where we were doing foldl instead of foldr
after decomposing a Kind.  Strange that the same bug appears
in two quite different places!

9 years agocopy_tag_nolock(): fix write ordering and add a write_barrier()
Simon Marlow [Tue, 16 Mar 2010 14:31:03 +0000 (14:31 +0000)] 
copy_tag_nolock(): fix write ordering and add a write_barrier()

Fixes a rare crash in the parallel GC.

If we copy a closure non-atomically during GC, as we do for all
immutable values, then before writing the forwarding pointer we better
make sure that the closure itself is visible to other threads that
might follow the forwarding pointer.  I imagine this doesn't happen
very often, but I just found one case of it: in scavenge_stack, the
RET_FUN case, after evacuating ret_fun->fun we then follow it and look
up the info pointer.

9 years agoAdd sliceP mapping to vectoriser builtins [Tue, 16 Mar 2010 06:05:17 +0000 (06:05 +0000)] 
Add sliceP mapping to vectoriser builtins

9 years agoComments only [Thu, 11 Mar 2010 06:45:18 +0000 (06:45 +0000)] 
Comments only

9 years agoWhen saying RTS options are disabled, also say how to enable them 2010-03-16
Ian Lynagh [Mon, 15 Mar 2010 17:35:41 +0000 (17:35 +0000)] 
When saying RTS options are disabled, also say how to enable them

9 years agoFix profiling build following removal of specific STM object types
Simon Marlow [Mon, 15 Mar 2010 09:32:56 +0000 (09:32 +0000)] 
Fix profiling build following removal of specific STM object types

9 years agoWhen compiling with GHC >= 6.13, use -rtsopts
Ian Lynagh [Sun, 14 Mar 2010 17:20:18 +0000 (17:20 +0000)] 
When compiling with GHC >= 6.13, use -rtsopts

9 years agoDocument the new RTS linker flags
Ian Lynagh [Sun, 14 Mar 2010 14:08:47 +0000 (14:08 +0000)] 
Document the new RTS linker flags

9 years agoDon't enable RTS options by default
Ian Lynagh [Sun, 14 Mar 2010 13:36:48 +0000 (13:36 +0000)] 
Don't enable RTS options by default

9 years agoAdd a -with-rtsopts link-time flag
Ian Lynagh [Sat, 13 Mar 2010 23:13:42 +0000 (23:13 +0000)] 
Add a -with-rtsopts link-time flag
You can now link with
    -with-rtsopts="-H128m -K1m"

9 years agoRename a variable
Ian Lynagh [Sat, 13 Mar 2010 22:48:52 +0000 (22:48 +0000)] 
Rename a variable

9 years agoAdd a link-time flag to en/disable the RTS options
Ian Lynagh [Sat, 13 Mar 2010 15:45:55 +0000 (15:45 +0000)] 
Add a link-time flag to en/disable the RTS options
If RTS options are disabled then:
* The ghc_rts_opts C code variable is processed as normal
* The GHCRTS environment variable is ignored and, if it is defined, a
  warning is emitted
* The +RTS flag gives an error and terminates the program

9 years agoFix a couple of bugs in the throwTo handling, exposed by conc016(threaded2)
Simon Marlow [Thu, 11 Mar 2010 12:37:05 +0000 (12:37 +0000)] 
Fix a couple of bugs in the throwTo handling, exposed by conc016(threaded2)

9 years agoUse message-passing to implement throwTo in the RTS
Simon Marlow [Thu, 11 Mar 2010 09:57:44 +0000 (09:57 +0000)] 
Use message-passing to implement throwTo in the RTS

This replaces some complicated locking schemes with message-passing
in the implementation of throwTo. The benefits are

 - previously it was impossible to guarantee that a throwTo from
   a thread running on one CPU to a thread running on another CPU
   would be noticed, and we had to rely on the GC to pick up these
   forgotten exceptions. This no longer happens.

 - the locking regime is simpler (though the code is about the same

 - threads can be unblocked from a blocked_exceptions queue without
   having to traverse the whole queue now.  It's a rare case, but
   replaces an O(n) operation with an O(1).

 - generally we move in the direction of sharing less between
   Capabilities (aka HECs), which will become important with other
   changes we have planned.

Also in this patch I replaced several STM-specific closure types with
a generic MUT_PRIM closure type, which allowed a lot of code in the GC
and other places to go away, hence the line-count reduction.  The
message-passing changes resulted in about a net zero line-count

9 years agofix bug in discardTasksExcept() that broke forkProcess
Simon Marlow [Thu, 11 Mar 2010 09:36:32 +0000 (09:36 +0000)] 
fix bug in discardTasksExcept() that broke forkProcess

10 years agodisable a false assertion, add a comment to explain why
Simon Marlow [Mon, 23 Nov 2009 11:04:16 +0000 (11:04 +0000)] 
disable a false assertion, add a comment to explain why

9 years agoFix Trac #1954: newtype deriving caused 'defined but not used' error [Tue, 9 Mar 2010 17:35:55 +0000 (17:35 +0000)] 
Fix Trac #1954: newtype deriving caused 'defined but not used' error

We were getting a bogus claim that a newtype "data constructor" was
unused.  The fix is easy, although I had to add a field to the constructor

See Note [Newtype deriving and unused constructors] in TcDeriv

9 years agoRule binders shouldn't have IdInfo [Tue, 9 Mar 2010 17:33:27 +0000 (17:33 +0000)] 
Rule binders shouldn't have IdInfo

While I was looking at the rule binders generated in DsBinds for specialise pragmas,
I also looked at Specialise.  It too was "cloning" the dictionary binders including
their IdInfo. In this case they should not have any, but its seems better to make
them completely fresh rather than substitute in existing (albeit non-existent) IdInfo.

9 years agoAdd comment [Tue, 9 Mar 2010 17:31:20 +0000 (17:31 +0000)] 
Add comment

9 years agoRule binders shouldn't have DFun pragmas [Tue, 9 Mar 2010 17:31:00 +0000 (17:31 +0000)] 
Rule binders shouldn't have DFun pragmas

When DsBinds deals with a SPECIALISE pragma, it makes up the binders
for a RULE. These binders should be very vanilla: no IdInfo of any sort.
But the way it was before they could have DFun pragmas, which led to
Bad Joss downstream.  (Actually to cause a downstream *error* was itself
a bug, which I've fixed, but it's clearly wrong for them to be DFuns!)

9 years agoA bug in isClosedUnfolding [Tue, 9 Mar 2010 17:28:42 +0000 (17:28 +0000)] 
A bug in isClosedUnfolding

isClosedUnfolding should say False for DFUnUnfolding!

9 years agoComments only [Tue, 9 Mar 2010 17:28:14 +0000 (17:28 +0000)] 
Comments only

9 years agoComments and type signatures only [Tue, 9 Mar 2010 17:27:56 +0000 (17:27 +0000)] 
Comments and type signatures only

9 years agoComments only [Tue, 9 Mar 2010 17:27:43 +0000 (17:27 +0000)] 
Comments only

9 years agoTidy up pretty-printing of InlinePragma [Tue, 9 Mar 2010 17:27:30 +0000 (17:27 +0000)] 
Tidy up pretty-printing of InlinePragma

We were getting "INLINEALWAYS" printed out here and there.
Now there are always brackets around the activation, thus "INLINE[ALWAYS]"

9 years agoSplit part of the Task struct into a separate struct InCall
Simon Marlow [Tue, 9 Mar 2010 14:31:11 +0000 (14:31 +0000)] 
Split part of the Task struct into a separate struct InCall

The idea is that this leaves Tasks and OSThread in one-to-one
correspondence.  The part of a Task that represents a call into
Haskell from C is split into a separate struct InCall, pointed to by
the Task and the TSO bound to it.  A given OSThread/Task thus always
uses the same mutex and condition variable, rather than getting a new
one for each callback.  Conceptually it is simpler, although there are
more types and indirections in a few places now.

This improves callback performance by removing some of the locks that
we had to take when making in-calls.  Now we also keep the current Task
in a thread-local variable if supported by the OS and gcc (currently
only Linux).

9 years agoadd a note
Simon Marlow [Tue, 9 Mar 2010 13:37:21 +0000 (13:37 +0000)] 
add a note

9 years agoFix a rare deadlock when the IO manager thread is slow to start up
Simon Marlow [Tue, 9 Mar 2010 09:58:31 +0000 (09:58 +0000)] 
Fix a rare deadlock when the IO manager thread is slow to start up
This fixes occasional failures of ffi002(threaded1) on a loaded

9 years agoWhen BUILD_DOCBOOK_HTML is NO, keep the rules, just omit the target [Fri, 5 Mar 2010 17:30:04 +0000 (17:30 +0000)] 
When BUILD_DOCBOOK_HTML is NO, keep the rules, just omit the target

  (and similarly for PS and PDF)

The previous setup nuked the rules for making the documentation when
BUILD_DOCBOOK_HTML=NO.  This meant that "make html" didn't work.

There isn't any reason to nuke the rules (so far as Simon and I know).

9 years agoFix Trac #3736: do not preInlineUnconditionally with INLINE [Fri, 5 Mar 2010 17:27:59 +0000 (17:27 +0000)] 
Fix Trac #3736: do not preInlineUnconditionally with INLINE

preInlineUnconditionally was, in effect, nuking an INLINE pragma, with
very bad effect on runtime in this program.  Fortunately the fix is
very simple.

See Note [InlineRule and preInlineUnconditionally] in SimplUtils.

9 years agoComments only [Thu, 4 Mar 2010 12:59:30 +0000 (12:59 +0000)] 
Comments only

9 years agoComments only [Thu, 4 Mar 2010 12:54:02 +0000 (12:54 +0000)] 
Comments only