Simon Marlow [Wed, 19 Nov 2008 14:32:05 +0000 (14:32 +0000)]
Fix some unsigned comparisions that should be signed
Fixes crashes when using reclaimSpark() (not used currently, but may
be in the future).
Simon Marlow [Wed, 19 Nov 2008 14:30:43 +0000 (14:30 +0000)]
Remove incorrect assertions in steal()
Simon Marlow [Fri, 14 Nov 2008 12:10:22 +0000 (12:10 +0000)]
don't run sparks if there are other threads on this Capability
Simon Marlow [Wed, 19 Nov 2008 13:10:56 +0000 (13:10 +0000)]
Fix typo (HAVE_LIBGMP => HAVE_LIB_GMP); omit local gmp includes if HAVE_LIB_GMP
If we're using the system's installed GMP, we don't want to be picking
up the local gmp.h header file.
Fixes 2469(ghci) for me, because it turns out the system's GMP is more
up-to-date than GHC's version and has a fix for more recent versions
of gcc. We also need to pull in a more recent GMP, but that's a
separte issue.
Simon Marlow [Wed, 19 Nov 2008 12:48:48 +0000 (12:48 +0000)]
Fix some more shutdown races
There were races between workerTaskStop() and freeTaskManager(): we
need to be sure that all Tasks have exited properly before we start
tearing things down. This isn't completely straighforward, see
comments for details.
Judah Jacobson [Fri, 14 Nov 2008 18:33:34 +0000 (18:33 +0000)]
Add help messages about --with-editline-(includes,libraries) to the ghc configure script.
Simon Marlow [Tue, 18 Nov 2008 14:24:42 +0000 (14:24 +0000)]
Add optional eager black-holing, with new flag -feager-blackholing
Eager blackholing can improve parallel performance by reducing the
chances that two threads perform the same computation. However, it
has a cost: one extra memory write per thunk entry.
To get the best results, any code which may be executed in parallel
should be compiled with eager blackholing turned on. But since
there's a cost for sequential code, we make it optional and turn it on
for the parallel package only. It might be a good idea to compile
applications (or modules) with parallel code in with
-feager-blackholing.
ToDo: document -feager-blackholing.
Simon Marlow [Mon, 17 Nov 2008 14:45:15 +0000 (14:45 +0000)]
Fix #2783: detect black-hole loops properly
At some point we regressed on detecting simple black-hole loops. This
happened due to the introduction of duplicate-work detection for
parallelism: a black-hole loop looks very much like duplicate work,
except it's duplicate work being performed by the very same thread.
So we have to detect and handle this case.
Simon Marlow [Mon, 17 Nov 2008 14:30:47 +0000 (14:30 +0000)]
Fix warning on Windows (use deleteThread() not deleteThread_())
Simon Marlow [Mon, 17 Nov 2008 14:28:31 +0000 (14:28 +0000)]
fix compile breakage on Windows
Simon Marlow [Mon, 17 Nov 2008 12:05:56 +0000 (12:05 +0000)]
Attempt to fix #2512 and #2063; add +RTS -xm<address> -RTS option
On x86_64, the RTS needs to allocate memory in the low 2Gb of the
address space. On Linux we can do this with MAP_32BIT, but sometimes
this doesn't work (#2512) and other OSs don't support it at all
(#2063). So to work around this:
- Try MAP_32BIT first, if available.
- Otherwise, try allocating memory from a fixed address (by default
1Gb)
- We now provide an option to configure the address to allocate
from. This allows a workaround on machines where the default
breaks, and also provides a way for people to test workarounds
that we can incorporate in future releases.
Simon Marlow [Mon, 17 Nov 2008 09:43:50 +0000 (09:43 +0000)]
Another shutdown fix
If we encounter a runnable thread during shutdown, just kill it. All
the threads are supposed to be dead at this stage, but this catches
threads that might have just returned from a foreign call, or were
finalizers created by the GC.
Fixes memo002(threaded1)
Ian Lynagh [Sun, 16 Nov 2008 17:49:38 +0000 (17:49 +0000)]
Correct an example in the users guide
Ian Lynagh [Sun, 16 Nov 2008 17:41:22 +0000 (17:41 +0000)]
Fix gen_contents_index when not run inplace; trac #2764
Based on a patch from juhpetersen.
Simon Marlow [Fri, 14 Nov 2008 13:09:58 +0000 (13:09 +0000)]
close the temporary Handle before removing the file
Simon Marlow [Fri, 14 Nov 2008 09:58:17 +0000 (09:58 +0000)]
refactor: move unlockClosure() into SMPClosureOps() where it should be
Simon Marlow [Fri, 14 Nov 2008 09:57:38 +0000 (09:57 +0000)]
Omit definitions of cas() and xchg() in .hc code
They cause compilation errors (correctly) with newer gccs
Shows up compiling the RTS via C, which happens on Windows
Simon Marlow [Fri, 14 Nov 2008 13:05:46 +0000 (13:05 +0000)]
Don't put stdin into non-blocking mode (#2778, #2777)
This used to be necessary when our I/O library needed all FDs in
O_NONBLOCK mode, and readline used to put stdin back into blocking
mode. Nowadays the I/O library can cope with FDs in blocking mode,
and #2778/#2777 show why this is important.
Simon Marlow [Fri, 14 Nov 2008 12:49:29 +0000 (12:49 +0000)]
Rmoeve --enable-dotnet
Simon Marlow [Fri, 14 Nov 2008 12:47:48 +0000 (12:47 +0000)]
#2751: disourage --enable-shared in ./configure --help
Simon Marlow [Fri, 14 Nov 2008 10:40:34 +0000 (10:40 +0000)]
add a warning that --enable-shared is experimental
Simon Marlow [Thu, 13 Nov 2008 12:29:27 +0000 (12:29 +0000)]
lookupSymbol: revert to looking up both with and without the @N suffix
Simon Marlow [Thu, 13 Nov 2008 11:46:26 +0000 (11:46 +0000)]
#2768: fix compatibility problem with newer version of mingw
Simon Marlow [Thu, 13 Nov 2008 11:43:42 +0000 (11:43 +0000)]
notice ^C exceptions when waiting for I/O
Thomas Schilling [Thu, 13 Nov 2008 16:26:53 +0000 (16:26 +0000)]
Fix a bug in the recompilation checking logic.
Previously, using target HscNothing resulted in unnessesary
recompilation because 'upsweep_mod' treated HscInterface specially.
This patch changes relaxes this.
When running GHC with debug level 5, 'upsweep_mod' will now also be
more verbose about what it is doing.
There is (at least) one possible remaining problem, though: When using
target 'HscNothing' we generate a fake linkable to signal that we have
processed a module. When switching to 'HscInterpreted' this may cause
objects to not be recompiled. Switching from HscNothing to
HscInterpreted is therefore only safe if we unload everything first.
Simon Marlow [Thu, 13 Nov 2008 16:00:05 +0000 (16:00 +0000)]
Fix another subtle shutdown deadlock
The problem occurred when a thread tries to GC during shutdown. In
order to GC it has to acquire all the Capabilities in the system, but
during shutdown, some of the Capabilities have already been closed and
can never be acquired.
Simon Marlow [Thu, 13 Nov 2008 15:57:30 +0000 (15:57 +0000)]
Fix an extremely subtle deadlock bug on x86_64
The recent_activity flag was an unsigned int, but we sometimes do a
64-bit xchg() on it, which overwrites the next word in memory. This
happened to contain the sched_state flag, which is used to control the
orderly shutdown of the system. If the xchg() happened during
shutdown, the scheduler would get confused and deadlock. Don't you
just love C?
Simon Marlow [Thu, 13 Nov 2008 15:45:42 +0000 (15:45 +0000)]
move an assertion
Simon Marlow [Wed, 12 Nov 2008 11:15:18 +0000 (11:15 +0000)]
Always zap the trailing @N from symbols when looking up in a DLL
Fixes win32002(ghci)
Previously we only did this for references from object files, but we
should do it for all symbols, including those that GHCi looks up due
to FFI calls from bytecode.
Simon Marlow [Wed, 12 Nov 2008 11:21:44 +0000 (11:21 +0000)]
Only allocate a mark stack if we're actually doing marking
saves a bit of memory in major GCs
Simon Marlow [Tue, 11 Nov 2008 13:53:44 +0000 (13:53 +0000)]
Fix parse error with older gccs (#2752)
Simon Marlow [Tue, 11 Nov 2008 12:56:19 +0000 (12:56 +0000)]
Fix to i386_insert_ffrees (#2724, #1944)
The i386 native code generator has to arrange that the FPU stack is
clear on exit from any function that uses the FPU. Unfortunately it
was getting this wrong (and has been ever since this code was written,
I think): it was looking for basic blocks that used the FPU and adding
the code to clear the FPU stack on any non-local exit from the block.
In fact it should be doing this on a whole-function basis, rather than
individual basic blocks.
Simon Marlow [Mon, 10 Nov 2008 13:43:18 +0000 (13:43 +0000)]
Fix bootstrap with 6.10.1 on Windows
ghc-pkg doesn't understand the old syntax any more, so 'ghc-pkg -l' fails
Neil Mitchell [Wed, 5 Nov 2008 13:43:15 +0000 (13:43 +0000)]
Perform case-insensitive matching of path components in getBaseDir on Windows (Fixes bug 2743)
Thomas Schilling [Mon, 10 Nov 2008 17:56:14 +0000 (17:56 +0000)]
Documentation only. Clarify that 'load*' may indeed throw SourceErrors.
I don't think errors during dependency analysis should be passed to
the logger.
Thomas Schilling [Mon, 10 Nov 2008 15:38:19 +0000 (15:38 +0000)]
Fix documentation (to say the opposite).
Thomas Schilling [Mon, 10 Nov 2008 15:36:21 +0000 (15:36 +0000)]
Fix line numbers in TAGS files.
Thomas Schilling [Mon, 10 Nov 2008 15:34:56 +0000 (15:34 +0000)]
Documentation only.
Thomas Schilling [Mon, 10 Nov 2008 14:35:10 +0000 (14:35 +0000)]
Add 'packageDbModules' function to GHC API.
This function returns a list of all modules available through the
package DB.
MERGE TO 6.10
Ian Lynagh [Sat, 8 Nov 2008 14:47:23 +0000 (14:47 +0000)]
We now require GHC 6.6, so we always have Applicative
Ian Lynagh [Sat, 8 Nov 2008 14:45:44 +0000 (14:45 +0000)]
Remove a CPP test that's always true (__GLASGOW_HASKELL__ >= 605)
Ian Lynagh [Sat, 8 Nov 2008 14:44:59 +0000 (14:44 +0000)]
Remove some dead code now that __GLASGOW_HASKELL__ >= 606
Ian Lynagh [Sat, 8 Nov 2008 14:44:12 +0000 (14:44 +0000)]
Remove some flag duplication from a Makefile
Ian Lynagh [Sat, 8 Nov 2008 14:43:28 +0000 (14:43 +0000)]
ghc_ge_605 is now always YES
Ian Lynagh [Sat, 8 Nov 2008 14:34:23 +0000 (14:34 +0000)]
Remove the GHC 6.4 unicode compat stuff; we can now just use Data.Char
Clemens Fruhwirth [Sat, 8 Nov 2008 09:47:25 +0000 (09:47 +0000)]
Fix libffi bindist
Clemens Fruhwirth [Fri, 7 Nov 2008 16:07:35 +0000 (16:07 +0000)]
Replace couple of fromJust with expectJust
Simon Marlow [Fri, 7 Nov 2008 09:29:25 +0000 (09:29 +0000)]
Bugfix for patch "Do not filter the rts from linked libraries..." (#2745)
The sense of the #ifdef was wrong
Simon Marlow [Fri, 7 Nov 2008 09:04:32 +0000 (09:04 +0000)]
fix via-C compilation: import ghczmprim_GHCziBool_False_closure
Simon Marlow [Fri, 7 Nov 2008 08:52:50 +0000 (08:52 +0000)]
disable instance MonadPlus CoreM for GHC <= 6.6
Simon Marlow [Thu, 6 Nov 2008 16:08:10 +0000 (16:08 +0000)]
re-instate counting of sparks converted
lost in patch "Run sparks in batches"
Simon Marlow [Thu, 6 Nov 2008 15:58:26 +0000 (15:58 +0000)]
fix ASSERT_SPARK_POOL_INVARIANTS(): top>bottom is valid
Simon Marlow [Thu, 6 Nov 2008 15:56:48 +0000 (15:56 +0000)]
pruneSparkQueue(): fix bug when top>bottom
Simon Marlow [Thu, 6 Nov 2008 15:53:56 +0000 (15:53 +0000)]
don't yield if the system is shutting down
Simon Marlow [Thu, 6 Nov 2008 13:21:05 +0000 (13:21 +0000)]
leave out ATTRIBUTE_ALIGNED on Windows, it gives a warning
Simon Marlow [Thu, 6 Nov 2008 11:40:45 +0000 (11:40 +0000)]
Cope with ThreadRelocated when traversing the blocked_queue
Fixes "invalid what_next field" in ioref001 on Windows, and perhaps others
Thomas Schilling [Fri, 31 Oct 2008 16:20:36 +0000 (16:20 +0000)]
Remove dead code.
Simon Marlow [Thu, 6 Nov 2008 11:36:39 +0000 (11:36 +0000)]
Run sparks in batches, instead of creating a new thread for each one
Signficantly reduces the overhead for par, which means that we can
make use of paralellism at a much finer granularity.
Simon Marlow [Thu, 6 Nov 2008 11:37:14 +0000 (11:37 +0000)]
allocateInGen(): increase alloc_blocks (#2747)
Simon Marlow [Thu, 6 Nov 2008 10:04:11 +0000 (10:04 +0000)]
disable MonadPlus instance that doesn't compile with 6.6
Simon Marlow [Wed, 5 Nov 2008 15:49:28 +0000 (15:49 +0000)]
don't yield the Capability if blackholes_need_checking
Simon Marlow [Wed, 5 Nov 2008 15:05:42 +0000 (15:05 +0000)]
deadlock fix: reset the flag *after* checking the blackhole queue
Simon Marlow [Wed, 5 Nov 2008 15:03:59 +0000 (15:03 +0000)]
retreat the top/bottom fields of the spark pool in pruneSparkPool()
Simon Marlow [Tue, 4 Nov 2008 09:29:29 +0000 (09:29 +0000)]
fix the :help docs for :set stop (#2737)
Simon Marlow [Tue, 4 Nov 2008 14:21:47 +0000 (14:21 +0000)]
bugfix: don't ingore the return value from rts_evalIO()
Simon Marlow [Fri, 24 Oct 2008 12:02:36 +0000 (12:02 +0000)]
Document the new SPARKS statistic, and xref from the parallelism section
Simon Marlow [Fri, 24 Oct 2008 10:43:01 +0000 (10:43 +0000)]
Move the freeing of Capabilities later in the shutdown sequence
Fixes a bug whereby the Capability has been freed but other
Capabilities are still trying to steal sparks from its pool.
Simon Marlow [Thu, 23 Oct 2008 08:07:49 +0000 (08:07 +0000)]
Pad Capabilities and Tasks to 64 bytes
This is just good practice to avoid placing two structures heavily
accessed by different CPUs on the same cache line
simonpj@microsoft.com [Mon, 3 Nov 2008 11:08:19 +0000 (11:08 +0000)]
Fix desugaring of record update (fixes Trac #2735)
Ian Lynagh [Fri, 31 Oct 2008 18:17:46 +0000 (18:17 +0000)]
Refuse to register packages with unversioned dependencies; trac #1837
Ian Lynagh [Fri, 31 Oct 2008 17:15:06 +0000 (17:15 +0000)]
We now require GHC 6.6 to build the HEAD (and thus 6.12)
Ian Lynagh [Fri, 31 Oct 2008 14:52:27 +0000 (14:52 +0000)]
:set prompt now understand Haskell String syntax; trace #2652
simonpj@microsoft.com [Fri, 31 Oct 2008 14:02:36 +0000 (14:02 +0000)]
Comments only
Thomas Schilling [Fri, 31 Oct 2008 11:31:25 +0000 (11:31 +0000)]
Quickfix for warning.
Thomas Schilling [Tue, 28 Oct 2008 18:23:10 +0000 (18:23 +0000)]
Export typeclasses for accessing compiler results.
MERGE TO 6.10.
Thomas Schilling [Tue, 28 Oct 2008 18:22:02 +0000 (18:22 +0000)]
Minor refactoring.
Thomas Schilling [Tue, 28 Oct 2008 18:05:38 +0000 (18:05 +0000)]
Include record fields in tags.
simonpj@microsoft.com [Fri, 31 Oct 2008 09:23:06 +0000 (09:23 +0000)]
Fix imports
simonpj@microsoft.com [Thu, 30 Oct 2008 14:39:47 +0000 (14:39 +0000)]
Improve error reporting for non-rigid GADT matches
Following suggestions from users, this patch improves the error message
when a GADT match needs a rigid type:
tcfail172.hs:19:10:
GADT pattern match in non-rigid context for `Nil'
- Solution: add a type signature
+ Probable solution: add a type signature for `is_normal'
In the pattern: Nil
In the definition of `is_normal': is_normal Nil = True
Now GHC tries to tell you what to give a type signature *for*.
Thanks to Daniel Gorin and others for the suggestions.
simonpj@microsoft.com [Thu, 30 Oct 2008 12:51:08 +0000 (12:51 +0000)]
Add (a) CoreM monad, (b) new Annotations feature
This patch, written by Max Bolingbroke, does two things
1. It adds a new CoreM monad (defined in simplCore/CoreMonad),
which is used as the top-level monad for all the Core-to-Core
transformations (starting at SimplCore). It supports
* I/O (for debug printing)
* Unique supply
* Statistics gathering
* Access to the HscEnv, RuleBase, Annotations, Module
The patch therefore refactors the top "skin" of every Core-to-Core
pass, but does not change their functionality.
2. It adds a completely new facility to GHC: Core "annotations".
The idea is that you can say
{#- ANN foo (Just "Hello") #-}
which adds the annotation (Just "Hello") to the top level function
foo. These annotations can be looked up in any Core-to-Core pass,
and are persisted into interface files. (Hence a Core-to-Core pass
can also query the annotations of imported things.) Furthermore,
a Core-to-Core pass can add new annotations (eg strictness info)
of its own, which can be queried by importing modules.
The design of the annotation system is somewhat in flux. It's
designed to work with the (upcoming) dynamic plug-ins mechanism,
but is meanwhile independently useful.
Do not merge to 6.10!
simonpj@microsoft.com [Thu, 30 Oct 2008 09:45:28 +0000 (09:45 +0000)]
Fix Trac #2674: in TH reject empty case expressions and function definitions
simonpj@microsoft.com [Wed, 29 Oct 2008 14:08:58 +0000 (14:08 +0000)]
Change naming conventions for compiler-generated dictionaries and type functions
Up to now, the data constructor dictionary for class C as been called
":DC". But there is no reason for the colon to be at the front; indeed
it confuses the (simple-minded) pretty-printer for types. So this
patch changes it to be "D:C". This makes Core a lot easier to read.
Having a colon in the middle ensures that it can't clash with a user-written
data type.
Similarly I changed
T:C Data type corresponding a class dictionary (was :TC)
D:C Data constructor for class dictionary (was :DC)
NTCo:T Coercion mapping from a newtype T to its representation type
(was :CoT)
TFCo:R Coercion mapping from a data family to its respresentation type R
(was :CoFR)
Rn:T The n'th respresentation data type for a data type T
(was :RnT)
Do not merge to 6.10.
HEADS-UP: you'll need to recompile libraries from scratch.
ROMAN: you could do the same for OccName.mkVectTyConOcc etc, if you wanted.
simonpj@microsoft.com [Wed, 29 Oct 2008 13:01:55 +0000 (13:01 +0000)]
Fix tcrun031: yet more tidying up in TcDeriv
simonpj@microsoft.com [Wed, 29 Oct 2008 13:01:14 +0000 (13:01 +0000)]
Add Outputable instance for CoercionI
simonpj@microsoft.com [Tue, 28 Oct 2008 14:08:28 +0000 (14:08 +0000)]
Fix Trac #2720: inlining and casts
The issue here is what happens when we have
(f |> co) x
where f is itself marked INLINE. We want callSiteInline to "see"
the fact that the function is applied, and hence have some incentive
to inline. I've done this by extending CoreUnfold.CallCtxt with
ValAppCtxt. I think that should catch this case without messing up
any of the others.
simonpj@microsoft.com [Tue, 28 Oct 2008 13:30:09 +0000 (13:30 +0000)]
Clarify documentatoin
Ian Lynagh [Thu, 23 Oct 2008 14:40:18 +0000 (14:40 +0000)]
Update library version numbers in the release notes
Simon Marlow [Tue, 7 Oct 2008 15:16:47 +0000 (15:16 +0000)]
various updates to the release notes
Ian Lynagh [Sat, 20 Sep 2008 15:57:22 +0000 (15:57 +0000)]
Add library release notes
Ian Lynagh [Sat, 20 Sep 2008 11:48:57 +0000 (11:48 +0000)]
Add release notes for the compiler
Ian Lynagh [Tue, 28 Oct 2008 15:05:34 +0000 (15:05 +0000)]
Doc fix
Ian Lynagh [Tue, 28 Oct 2008 15:04:47 +0000 (15:04 +0000)]
Rename some variables in docs
Ian Lynagh [Tue, 28 Oct 2008 14:46:55 +0000 (14:46 +0000)]
Fix typos
simonpj@microsoft.com [Tue, 28 Oct 2008 11:54:27 +0000 (11:54 +0000)]
Mostly-fix Trac #2595: updates for existentials
Ganesh wanted to update records that involve existentials. That
seems reasonable to me, and this patch covers existentials, GADTs,
and data type families.
The restriction is that
The types of the updated fields may mention only the
universally-quantified type variables of the data constructor
This doesn't allow everything in #2595 (it allows 'g' but not 'f' in
the ticket), but it gets a lot closer.
Lots of the new lines are comments!
simonpj@microsoft.com [Tue, 28 Oct 2008 11:04:45 +0000 (11:04 +0000)]
Fix Trac #2723: keep track of record field names in the renamer
The idea here is that with -XNamedFieldPuns and -XRecordWildCards we don't
want to report shadowing errors for
let fld = <blah> in C { .. }
But to suppress such shadowing errors, the renamer needs to know that
'fld' *is* a record selector. Hence the new NameSet in
TcRnFypes.RecFieldEnv
simonpj@microsoft.com [Tue, 28 Oct 2008 07:46:39 +0000 (07:46 +0000)]
Remove dead code
simonpj@microsoft.com [Mon, 27 Oct 2008 22:27:38 +0000 (22:27 +0000)]
Fix Trac #2713: refactor and tidy up renaming of fixity decls
In fixing #2713, this patch also eliminates two almost-unused
functions from RnEnv (lookupBndr and lookupBndr_maybe). The
net lines of code is prety much unchanged, but more of them
are comments!
simonpj@microsoft.com [Sat, 25 Oct 2008 17:12:11 +0000 (17:12 +0000)]
Fix Trac #2701: make deriving check better for unlifted args
Getting the automatic deriving mechanism to work really smoothly
is surprisingly hard. I keep finding myself in TcDeriv!
Anyway, this is a nice clean fix to Trac #2701.
Ian Lynagh [Fri, 24 Oct 2008 11:24:00 +0000 (11:24 +0000)]
Use pdflatex rather than latex for building
The Windows builder is having problems running ps2pdf, so this works
aroudn the problem.
Ian Lynagh [Fri, 24 Oct 2008 11:17:50 +0000 (11:17 +0000)]
Remove an unmatched } in core.tex