11 years agoTweak alternative layout rule
Ian Lynagh [Tue, 2 Mar 2010 20:51:05 +0000 (20:51 +0000)]
Tweak alternative layout rule
Now not only is if/then a bracketting pair, but then/else is too

11 years agoAdd transitional rules for the alternative layout rule
Ian Lynagh [Tue, 2 Mar 2010 20:20:35 +0000 (20:20 +0000)]
Add transitional rules for the alternative layout rule
If enabled, these accept more layout, but give warnings

11 years agoFix the alternative layout rule to handle explicit let/in
Ian Lynagh [Tue, 2 Mar 2010 16:51:19 +0000 (16:51 +0000)]
Fix the alternative layout rule to handle explicit let/in
It used to break on
    let {x = 'a'} in x
as the 'in' token would keep closing contexts looking for an implicit
'let' layout.

11 years agoexpand comments for #2578 fix
Simon Marlow [Mon, 1 Mar 2010 09:55:25 +0000 (09:55 +0000)]
expand comments for #2578 fix

11 years agoa faster appendFS [Sat, 27 Feb 2010 21:16:59 +0000 (21:16 +0000)]
a faster appendFS

11 years agoImplement a smart constructor mkUnsafeCoercion, and use it [Mon, 1 Mar 2010 11:17:44 +0000 (11:17 +0000)]
Implement a smart constructor mkUnsafeCoercion, and use it

This just ensures that an unsafe coercion is as localised as possible.
For example, instead of
    UnsafeCo (Int -> t1) (Int -> t2)
    Int -> UnsafeCo t1 t2

11 years agoSuggest -XGeneralizedNewtypeDeriving (fix Trac #3888) [Mon, 1 Mar 2010 11:15:55 +0000 (11:15 +0000)]
Suggest -XGeneralizedNewtypeDeriving (fix Trac #3888)

If we can't derive a type, but it's a reasonable possibility that
newtype deriving would do the job, suggest it.

A little refactoring too, moving non_iso_class to top level,
and putting it with std_class_via_iso.

11 years agoTidy up AnyTyCon stuff [Mon, 1 Mar 2010 11:14:01 +0000 (11:14 +0000)]
Tidy up AnyTyCon stuff

If we find ourselves making up an AnyTyCon of kind '??', say,
then default it to liftedTypeKind.  And similarly for any sub-kind
of LiftedTypeKind.

This is just a tidy-up.

11 years agoFix pretty-printing of IfaceAnyTc (fixes Trac #3883) [Mon, 1 Mar 2010 11:10:40 +0000 (11:10 +0000)]
Fix pretty-printing of IfaceAnyTc (fixes Trac #3883)

The panic message in ifaceTyConName on IfaceAnyTc
called the pretty-printer, called ifaceTyConName again,
which caused an infinite regress.  Stupid.

 * Note [The Name of an IfaceAnyTc], and
 * The Outputable instance for IfaceTyCon

11 years agoOmit unnecessary parens when pretty-printing IfaceExpr [Mon, 1 Mar 2010 11:07:48 +0000 (11:07 +0000)]
Omit unnecessary parens when pretty-printing IfaceExpr

11 years agoComments only [Thu, 25 Feb 2010 17:41:12 +0000 (17:41 +0000)]
Comments only

11 years agoAdd comment [Thu, 25 Feb 2010 17:40:48 +0000 (17:40 +0000)]
Add comment

11 years agoChange pretty printing of InlinePrag slightly [Thu, 25 Feb 2010 17:40:28 +0000 (17:40 +0000)]
Change pretty printing of InlinePrag slightly

11 years agoAdd -no-auto-link-packages docs to the user guide; fixes trac #3759
Ian Lynagh [Sun, 28 Feb 2010 19:18:37 +0000 (19:18 +0000)]
Add -no-auto-link-packages docs to the user guide; fixes trac #3759

11 years agoWhitespace only in docs/users_guide/packages.xml
Ian Lynagh [Sun, 28 Feb 2010 18:29:45 +0000 (18:29 +0000)]
Whitespace only in docs/users_guide/packages.xml

11 years agoAdd a LICENSE file to libraries/bin-package-db
Ian Lynagh [Sat, 27 Feb 2010 20:56:26 +0000 (20:56 +0000)]
Add a LICENSE file to libraries/bin-package-db
Silences a (harmless) error from tar when making bindists

11 years agoHave separate rules to generate tags and TAGS
Ian Lynagh [Sat, 27 Feb 2010 20:25:17 +0000 (20:25 +0000)]
Have separate rules to generate tags and TAGS
This works around the two filenames being the same on case-insensitive
file systems.

11 years agoFix trac #2578
Ian Lynagh [Sat, 27 Feb 2010 17:39:51 +0000 (17:39 +0000)]
Fix trac #2578
We define empty datatypes as not being enumerations, which means the
empty blocks aren't generated.

11 years agoFix the build with GHC < 6.12
Ian Lynagh [Fri, 26 Feb 2010 22:39:31 +0000 (22:39 +0000)]
Fix the build with GHC < 6.12

11 years agoupdate the docs to reflect changes in the tracing flags
Simon Marlow [Fri, 26 Feb 2010 11:12:05 +0000 (11:12 +0000)]
update the docs to reflect changes in the tracing flags

11 years agoTweak the tracing flags slightly, and clean up error handling and diagnostics
Simon Marlow [Fri, 26 Feb 2010 11:06:08 +0000 (11:06 +0000)]
Tweak the tracing flags slightly, and clean up error handling and diagnostics

Tracing flags are now:

   -l[flags]  Log events in binary format to the file <program>.eventlog
   -v[flags]  Log events to stderr
              where [flags] can contain:
                 s    scheduler events
                 t    add time stamps (only useful with -v)

and there are more helpful error messages when using flags that are
only available in particular variants of the RTS:

 the flag -v requires the program to be built with -debug
 the flag -Ds requires the program to be built with -debug
 the flag -p requires the program to be built with -prof
 the flag -N requires the program to be built with -threaded
 the flag -v requires the program to be built with -debug

Also, I fixed the crash reported in #3874, with +RTS -ls -v.

11 years agoFix crash when using printf format specifiers in traceEvent (#3874)
Simon Marlow [Fri, 26 Feb 2010 09:32:15 +0000 (09:32 +0000)]
Fix crash when using printf format specifiers in traceEvent (#3874)

11 years agohack to make the docs build again in a lndir build tree (see comments)
Simon Marlow [Thu, 25 Feb 2010 13:16:16 +0000 (13:16 +0000)]
hack to make the docs build again in a lndir build tree (see comments)

11 years agoForce encoding to UTF-8 when writing individual .conf files
Simon Marlow [Wed, 24 Feb 2010 15:25:19 +0000 (15:25 +0000)]
Force encoding to UTF-8 when writing individual .conf files

11 years agoFix build for non-x86 arches again. [Mon, 22 Feb 2010 07:51:44 +0000 (07:51 +0000)]
Fix build for non-x86 arches again.

11 years agoFix the link to the ghc docs in libraries/prologue.txt
Ian Lynagh [Tue, 23 Feb 2010 18:16:44 +0000 (18:16 +0000)]
Fix the link to the ghc docs in libraries/prologue.txt

11 years agoFix more library links in the user guide
Ian Lynagh [Tue, 23 Feb 2010 16:45:51 +0000 (16:45 +0000)]
Fix more library links in the user guide

11 years agoFix the links to the base docs from the user guide
Ian Lynagh [Tue, 23 Feb 2010 15:05:22 +0000 (15:05 +0000)]
Fix the links to the base docs from the user guide

11 years agoRemove old, unused release notes
Ian Lynagh [Tue, 23 Feb 2010 15:03:27 +0000 (15:03 +0000)]
Remove old, unused release notes

11 years agoFix #3875: Crash in parallel GC, wrong pointer was being tested. [Mon, 22 Feb 2010 03:16:27 +0000 (03:16 +0000)]
Fix #3875: Crash in parallel GC, wrong pointer was being tested.

11 years agoAdd utils/ghctags/
Ian Lynagh [Sun, 21 Feb 2010 18:52:00 +0000 (18:52 +0000)]
Add utils/ghctags/

11 years agoMake "make tags" work in the new build system
Ian Lynagh [Sun, 21 Feb 2010 16:44:32 +0000 (16:44 +0000)]
Make "make tags" work in the new build system

11 years agoRemove the old hstags util
Ian Lynagh [Sat, 20 Feb 2010 23:59:09 +0000 (23:59 +0000)]
Remove the old hstags util

11 years agoCheck for suitable versions of make in bindists; fixes trac #3860
Ian Lynagh [Sat, 20 Feb 2010 21:11:57 +0000 (21:11 +0000)]
Check for suitable versions of make in bindists; fixes trac #3860
We already had a check in configure of the actual build. This patch
adds it to the configure of the bindists too.

11 years agoFix build on Windows
Ian Lynagh [Fri, 19 Feb 2010 13:42:22 +0000 (13:42 +0000)]
Fix build on Windows

11 years agoUse the shared C wrapper code in ghci.c too
Ian Lynagh [Thu, 18 Feb 2010 17:17:16 +0000 (17:17 +0000)]
Use the shared C wrapper code in ghci.c too

11 years agoRefactor gcc.c, pulling out the reusable code
Ian Lynagh [Thu, 18 Feb 2010 17:09:31 +0000 (17:09 +0000)]
Refactor gcc.c, pulling out the reusable code

11 years agoFix a recompilation checking bug when a package dependency changes
Simon Marlow [Wed, 17 Feb 2010 13:32:50 +0000 (13:32 +0000)]
Fix a recompilation checking bug when a package dependency changes

We weren't forcing enough recompilationg when package dependencies
changed, with the result that bumping a package version could lead to
linking failures or other problems later.

The problem/solutation are described on the wiki:

11 years agodarcs-all --extra get: gets a few extra packages
Simon Marlow [Wed, 17 Feb 2010 10:46:34 +0000 (10:46 +0000)]
darcs-all --extra get: gets a few extra packages
currently deepseq, parallel, stm.

11 years agoAllow extra packages to be added to the build, by setting $(EXTRA_PACKAGES)
Simon Marlow [Wed, 17 Feb 2010 10:31:34 +0000 (10:31 +0000)]
Allow extra packages to be added to the build, by setting $(EXTRA_PACKAGES)

11 years agoBeef up cmmMiniInline a tiny bit
Simon Marlow [Tue, 16 Feb 2010 15:05:06 +0000 (15:05 +0000)]
Beef up cmmMiniInline a tiny bit
Allow a temporary assignment to be pushed past an assignment to a
global if the global is not mentioned in the rhs of the assignment we
are inlining.

This fixes up some bad code.  We should make sure we're doing
something equivalent in the new backend in due course.

11 years agoWrite the binary cache file atomically
Simon Marlow [Tue, 16 Feb 2010 13:48:41 +0000 (13:48 +0000)]
Write the binary cache file atomically
Should fix an occasional build error of the form
 ghc-pkg: too few bytes. Failed reading at byte position 8

11 years agodisable a false assertion, with a comment to explain why
Simon Marlow [Tue, 16 Feb 2010 12:35:44 +0000 (12:35 +0000)]
disable a false assertion, with a comment to explain why

11 years agoFix a bug that can lead to noDuplicate# not working sometimes.
Simon Marlow [Tue, 16 Feb 2010 12:34:11 +0000 (12:34 +0000)]
Fix a bug that can lead to noDuplicate# not working sometimes.

The symptom is that under some rare conditions when running in
parallel, an unsafePerformIO or unsafeInterleaveIO computation might
be duplicated, so e.g. lazy I/O might give the wrong answer (the
stream might appear to have duplicate parts or parts missing).

I have a program that demonstrates it -N3 or more, some lazy I/O, and
a lot of shared mutable state.  See the comment with stg_noDuplicatezh
in PrimOps.cmm that explains the problem and the fix.  This took me
about a day to find :-(

11 years agoRepresent the free register set using Word64 on x86-64 (fixes ffi009)
Simon Marlow [Mon, 15 Feb 2010 13:01:02 +0000 (13:01 +0000)]
Represent the free register set using Word64 on x86-64 (fixes ffi009)
Following recent changes to the numbering of registers, we overflowed
Word32 on x86-64, with the result that xmm8 and later we not being

11 years agofix lost context switches in GHCi (fixes test 3429(ghci))
Simon Marlow [Mon, 15 Feb 2010 09:32:05 +0000 (09:32 +0000)]
fix lost context switches in GHCi (fixes test 3429(ghci))

11 years agoFix build for non-x86 architectures [Mon, 15 Feb 2010 01:47:19 +0000 (01:47 +0000)]
Fix build for non-x86 architectures

11 years agoAdd comments about the ForceSpecConstr mechanism
Roman Leshchinskiy [Mon, 15 Feb 2010 03:01:03 +0000 (03:01 +0000)]
Add comments about the ForceSpecConstr mechanism

11 years agoSpot ForceSpecConstr arguments in polymorphic loops
Roman Leshchinskiy [Mon, 15 Feb 2010 02:53:08 +0000 (02:53 +0000)]
Spot ForceSpecConstr arguments in polymorphic loops

11 years agoDon't rely on tar supporting -z; trac #3841
Ian Lynagh [Sun, 14 Feb 2010 22:04:50 +0000 (22:04 +0000)]
Don't rely on tar supporting -z; trac #3841

11 years agodon't constant fold division that would result in negative zero (#3676)
Simon Marlow [Thu, 11 Feb 2010 13:15:43 +0000 (13:15 +0000)]
don't constant fold division that would result in negative zero (#3676)

11 years agoImprove error dump in TcEnv [Wed, 10 Feb 2010 14:52:10 +0000 (14:52 +0000)]
Improve error dump in TcEnv

11 years agoKeep track of explicit kinding in HsTyVarBndr; plus fix Trac #3845 [Wed, 10 Feb 2010 14:51:55 +0000 (14:51 +0000)]
Keep track of explicit kinding in HsTyVarBndr; plus fix Trac #3845

To print HsTypes correctly we should remember whether the Kind on
a HsTyVarBndr came from type inference, or was put there by the
user.  See Note [Printing KindedTyVars] in HsTypes.  So instead of
changing a UserTyVar to a KindedTyVar during kind checking, we
simply add a PostTcKind to the UserTyVar.

The change was provoked by Trac #3830, although other changes
mean that #3830 gets a diferent and better error message now.
So this patch is simply doing the Right Thing for the future.

This patch also fixes Trac #3845, which was caused by a *type splice*
not remembering the free *term variables* mentioned in it.  Result
was that we build a 'let' when it should have been 'letrec'.
Hence a new FreeVars field in HsSpliceTy.

While I was at it, I got rid of HsSpliceTyOut and use a PostTcKind
on HsSpliceTy instead, just like on the UserTyVar.

11 years agoDocumentation for changes to Template Haskell and quasi-quotation [Wed, 10 Feb 2010 11:42:13 +0000 (11:42 +0000)]
Documentation for changes to Template Haskell and quasi-quotation

11 years agoRemove redundant import [Mon, 8 Feb 2010 16:57:56 +0000 (16:57 +0000)]
Remove redundant import

11 years agoStop fruitless ANF-ing [Wed, 10 Feb 2010 09:47:33 +0000 (09:47 +0000)]
Stop fruitless ANF-ing

The simplifier is taking more iterations than it should, because we
were fruitlessly ANF-ing a top-level declaration of form

   x = Ptr "foo"#

to get

   x = let v = "foo"# in Ptr v

and then inlining v again.  This patch makes Simplify.makeTrivial
top-level aware, so that it doesn't ANF if it's going to be undone.

11 years agoComments only [Wed, 10 Feb 2010 09:45:37 +0000 (09:45 +0000)]
Comments only

11 years agoSimplify syntax for quasi-quotation [Wed, 10 Feb 2010 09:44:19 +0000 (09:44 +0000)]
Simplify syntax for quasi-quotation

After some discussion we decided to make a quasi-quote look like

   [pads| ...blah... |]

rather than

   [$pads| ...blah... |]

as before. The new syntax is quieter, although it does not signal
quite as clearly that there is a splice going on.

11 years agoSeveral TH/quasiquote changes [Wed, 10 Feb 2010 09:39:10 +0000 (09:39 +0000)]
Several TH/quasiquote changes

a) Added quasi-quote forms for
   e.g.   f :: [$qq| ... |]

b) Allow Template Haskell pattern quotes (but not splices)
   e.g.  f x = [p| Int -> $x |]

c) Improve pretty-printing for HsPat to remove superfluous
   parens.  (This isn't TH related really, but it affects
   some of the same code.)

A consequence of (a) is that when gathering and grouping declarations
in RnSource.findSplice, we must expand quasiquotes as we do so.
Otherwise it's all fairly straightforward.  I did a little bit of
refactoring in TcSplice.

User-manual changes still to come.

11 years agogenerate slightly better code for ccall argument-pushing on x86
Simon Marlow [Tue, 9 Feb 2010 10:11:14 +0000 (10:11 +0000)]
generate slightly better code for ccall argument-pushing on x86

11 years ago--lazy overrides --partial too
Simon Marlow [Tue, 9 Feb 2010 09:39:27 +0000 (09:39 +0000)]
--lazy overrides --partial too
At least until we switch to --lazy being the default

11 years agoFix Trac #3850 [Mon, 8 Feb 2010 16:37:51 +0000 (16:37 +0000)]
Fix Trac #3850

This patch simply avoids a needless difference in behaviour from
6.10, and one that happens to affect HList. See Note [Stupid theta].

11 years agoFix a bug introduced in the SSE2 support: callClobberedRegs was wrong
Simon Marlow [Fri, 5 Feb 2010 11:29:38 +0000 (11:29 +0000)]
Fix a bug introduced in the SSE2 support: callClobberedRegs was wrong

11 years agoImplement SSE2 floating-point support in the x86 native code generator (#594)
Simon Marlow [Thu, 4 Feb 2010 10:48:49 +0000 (10:48 +0000)]
Implement SSE2 floating-point support in the x86 native code generator (#594)

The new flag -msse2 enables code generation for SSE2 on x86.  It
results in substantially faster floating-point performance; the main
reason for doing this was that our x87 code generation is appallingly
bad, and since we plan to drop -fvia-C soon, we need a way to generate
half-decent floating-point code.

The catch is that SSE2 is only available on CPUs that support it (P4+,
AMD K8+).  We'll have to think hard about whether we should enable it
by default for the libraries we ship.  In the meantime, at least
-msse2 should be an acceptable replacement for "-fvia-C
-optc-ffast-math -fexcess-precision".

SSE2 also has the advantage of performing all operations at the
correct precision, so floating-point results are consistent with other

I also tweaked the x87 code generation a bit while I was here, now
it's slighlty less bad than before.

11 years agoadd libraries/binary
Simon Marlow [Wed, 3 Feb 2010 13:54:21 +0000 (13:54 +0000)]
add libraries/binary

11 years agoadd comment for srt_bitmap field
Simon Marlow [Wed, 3 Feb 2010 10:34:31 +0000 (10:34 +0000)]
add comment for srt_bitmap field

11 years agoUse bash to run boot-pkgs, the default Solaris shell doesn't support the -ot test... [Wed, 3 Feb 2010 03:07:48 +0000 (03:07 +0000)]
Use bash to run boot-pkgs, the default Solaris shell doesn't support the -ot test flag

11 years agoDisable -Wcast-align when building the rts [Wed, 3 Feb 2010 02:46:05 +0000 (02:46 +0000)]
Disable -Wcast-align when building the rts
This flag seems buggy on GCC 4.1.2, which is the only GCC version we
have that can bootstrap the SPARC build. We end up with lots of supurious
warnings of the form "cast increases required alignment of target type".
Some legitimate warnings can be fixed by adding an intermediate cast to
(void*), but we get others in rts/sm/GCUtils.c concerning the gct var
that look innocuous to me. We could enable this again once we deprecate
support for registerised builds on this arch.

11 years agoStifle warning about printf format strings [Wed, 3 Feb 2010 02:31:24 +0000 (02:31 +0000)]
Stifle warning about printf format strings

11 years agoCast to (void*) to stifle warning about signedness [Wed, 3 Feb 2010 02:30:29 +0000 (02:30 +0000)]
Cast to (void*) to stifle warning about signedness

11 years agoAdd missing import sm_mutex, which fixes the -fvia-c build [Tue, 2 Feb 2010 05:14:51 +0000 (05:14 +0000)]
Add missing import sm_mutex, which fixes the -fvia-c build

11 years agoFix typo in error message (#3848)
Simon Marlow [Sat, 30 Jan 2010 09:46:28 +0000 (09:46 +0000)]
Fix typo in error message (#3848)

11 years agoFix Trac #3831: blowup in SpecConstr [Mon, 1 Feb 2010 00:24:20 +0000 (00:24 +0000)]
Fix Trac #3831: blowup in SpecConstr

It turned out that there were two bugs.  First, we were getting an
exponential number of specialisations when we had a deep nest of
join points.  See Note [Avoiding exponential blowup]. I fixed this
by dividing sc_count (in ScEnv) by the number of specialisations
when recursing.  Crude but effective.

Second, when making specialisations I was looking at the result of
applying specExpr to the RHS of the function, whereas I should have
been looking at the original RHS.  See Note [Specialise original

There's a tantalising missed opportunity here, though.  In this
example (recorded as a test simplCore/should_compile/T3831), each join
point has *exactly one* call pattern, so we should really just
specialise for that alone, in which case there's zero code-blow-up.
In particular, we don't need the *original* RHS at all.  I need to think
more about how to exploit this.

But the blowup is now limited, so compiling terminfo with -O2 works again.

11 years agoRe-read pragmas after preprocessing (#2464, #3674, #3457)
Simon Marlow [Fri, 29 Jan 2010 11:40:50 +0000 (11:40 +0000)]
Re-read pragmas after preprocessing (#2464, #3674, #3457)
This was a lot easier than I imagined.

11 years agotweak the totally-bogus arbitrary stack-squeezing heuristic to fix #2797
Simon Marlow [Thu, 28 Jan 2010 12:44:54 +0000 (12:44 +0000)]
tweak the totally-bogus arbitrary stack-squeezing heuristic to fix #2797
In #2797, a program that ran in constant stack space when compiled
needed linear stack space when interpreted.  It turned out to be
nothing more than stack-squeezing not happening.  We have a heuristic
to avoid stack-squeezing when it would be too expensive (shuffling a
large amount of memory to save a few words), but in some cases even
expensive stack-squeezing is necessary to avoid linear stack usage.
One day we should implement stack chunks, which would make this less

11 years agofix warning on Windows
Simon Marlow [Wed, 27 Jan 2010 16:29:54 +0000 (16:29 +0000)]
fix warning on Windows

11 years agofix Windows build (GHC.Conc.runHandlers is Unix-only)
Simon Marlow [Wed, 27 Jan 2010 14:57:18 +0000 (14:57 +0000)]
fix Windows build (GHC.Conc.runHandlers is Unix-only)

11 years agoDon't Terminate the ticker thread (#3748)
Simon Marlow [Wed, 27 Jan 2010 13:54:30 +0000 (13:54 +0000)]
Don't Terminate the ticker thread (#3748)

11 years agoWin32 yieldThread(): use SwitchToThread() instead of Sleep(0)
Simon Marlow [Wed, 27 Jan 2010 13:31:06 +0000 (13:31 +0000)]
Win32 yieldThread(): use SwitchToThread() instead of Sleep(0)

11 years agofix warnings
Simon Marlow [Wed, 27 Jan 2010 13:30:40 +0000 (13:30 +0000)]
fix warnings

11 years agocatch SIGHUP and SIGTERM and raise an exception (#3656)
Simon Marlow [Wed, 27 Jan 2010 14:04:38 +0000 (14:04 +0000)]
catch SIGHUP and SIGTERM and raise an exception (#3656)

11 years agodefine INFINITY and NAN if they don't exist (#2929)
Simon Marlow [Wed, 27 Jan 2010 13:36:32 +0000 (13:36 +0000)]
define INFINITY and NAN if they don't exist (#2929)

11 years agoremove suspicious whitespace-only lines
Simon Marlow [Wed, 27 Jan 2010 13:30:08 +0000 (13:30 +0000)]
remove suspicious whitespace-only lines

11 years agoaddCoverageTicksToBinds: tolerate a non-existent .hs file (#3803)
Simon Marlow [Wed, 27 Jan 2010 11:32:05 +0000 (11:32 +0000)]
addCoverageTicksToBinds: tolerate a non-existent .hs file (#3803)

11 years agoavoid using non-standard %zd format specifier (#3804)
Simon Marlow [Tue, 26 Jan 2010 16:33:22 +0000 (16:33 +0000)]
avoid using non-standard %zd format specifier (#3804)

11 years agoFix signal segfaults on Solaris (#3790)
Simon Marlow [Tue, 26 Jan 2010 15:54:49 +0000 (15:54 +0000)]
Fix signal segfaults on Solaris (#3790)

11 years agocomment-out an incorrect assertion
Simon Marlow [Tue, 26 Jan 2010 15:01:03 +0000 (15:01 +0000)]
comment-out an incorrect assertion

11 years agoFix a deadlock, and possibly other problems
Simon Marlow [Tue, 26 Jan 2010 15:00:37 +0000 (15:00 +0000)]
Fix a deadlock, and possibly other problems
After a bound thread had completed, its TSO remains in the heap until
it has been GC'd, although the associated Task is returned to the
caller where it is freed and possibly re-used.

The bug was that GC was following the pointer to the Task and updating
the TSO field, meanwhile the Task had already been recycled (it was
being used by exitScheduler()). Confusion ensued, leading to a very
occasional deadlock at shutdown, but in principle it could result in
other crashes too.

The fix is to remove the link between the TSO and the Task when the
TSO has completed and the call to schedule() has returned; see
comments in Schedule.c.

12 years agoWhen acquiring a spinlock, yieldThread() every 1000 spins (#3553, #3758)
Simon Marlow [Fri, 22 Jan 2010 16:49:11 +0000 (16:49 +0000)]
When acquiring a spinlock, yieldThread() every 1000 spins (#3553, #3758)

This helps when the thread holding the lock has been descheduled,
which is the main cause of the "last-core slowdown" problem.  With
this patch, I get much better results with -N8 on an 8-core box,
although some benchmarks are still worse than with 7 cores.

I also added a yieldThread() into the any_work() loop of the parallel
GC when it has no work to do. Oddly, this seems to improve performance
on the parallel GC benchmarks even when all the cores are busy.
Perhaps it is due to reducing contention on the memory bus.

12 years ago'store' should be static (#3835)
Simon Marlow [Fri, 22 Jan 2010 16:48:34 +0000 (16:48 +0000)]
'store' should be static (#3835)

12 years agoAdd some missing getStablePtr()s for CAFs that the RTS refers to
Simon Marlow [Fri, 22 Jan 2010 14:36:58 +0000 (14:36 +0000)]
Add some missing getStablePtr()s for CAFs that the RTS refers to

A recent patch ("Refactor CoreArity a bit") changed the arity of
GHC.Conc.runSparks such that it became a CAF, and the RTS was not
explicitly retaining it, which led to a crash when the CAF got GC'd.
While fixing this I found a couple of other closures that the RTS
refers to which weren't getting the correct CAF treatment.

12 years agoRemove an out-of-date comment
Ian Lynagh [Fri, 22 Jan 2010 13:08:53 +0000 (13:08 +0000)]
Remove an out-of-date comment

12 years agofix build on Windows
Simon Marlow [Fri, 22 Jan 2010 12:10:16 +0000 (12:10 +0000)]
fix build on Windows

12 years agofix warning on Windows
Simon Marlow [Fri, 22 Jan 2010 12:03:28 +0000 (12:03 +0000)]
fix warning on Windows

12 years agoFix docs for sizeofByteArray#/sizeofMutableByteArray# (#3800)
Simon Marlow [Tue, 19 Jan 2010 10:38:25 +0000 (10:38 +0000)]
Fix docs for sizeofByteArray#/sizeofMutableByteArray# (#3800)
In 6.14.1 we'll switch these primops to return the exact byte size,
but for 6.12.2 we need to fix the docs.

12 years agoInclude regex.h in Linker.c on OS X too
Ian Lynagh [Wed, 20 Jan 2010 20:19:58 +0000 (20:19 +0000)]
Include regex.h in Linker.c on OS X too

12 years agoWe no longer need a prototype for __eprintf
Ian Lynagh [Wed, 20 Jan 2010 19:50:24 +0000 (19:50 +0000)]
We no longer need a prototype for __eprintf
It looks like it was only needed on OSX, but it has a prototype in
assert.h which now gets #included.

12 years agoFix build
Ian Lynagh [Wed, 20 Jan 2010 16:31:01 +0000 (16:31 +0000)]
Fix build
Remove a prototype of a function that wasn't defined

12 years agoFIX #2615 (linker scripts in .so files) [Wed, 16 Dec 2009 18:51:55 +0000 (18:51 +0000)]
FIX #2615 (linker scripts in .so files)
This patch does not apply to Windows. It only applies to systems with
ELF binaries.

This is a patch to rts/Linker.c to recognize linker scripts in .so
files and find the real target .so shared library for loading.

12 years agoFix Trac #3813: unused variables in GHCi bindings [Wed, 20 Jan 2010 09:45:33 +0000 (09:45 +0000)]
Fix Trac #3813: unused variables in GHCi bindings

In a GHCi stmt we don't want to report unused variables,
because we don't know the scope of the binding, eg

Prelude> x <- blah

Fixing this needed a little more info about the context of the stmt,
thus the new constructor GhciStmt in the HsStmtContext type.