8 years agoFix spelling mistake in comment
David Terei [Mon, 25 Apr 2011 19:44:29 +0000 (12:44 -0700)] 
Fix spelling mistake in comment

8 years agocmm-notes updates.
Edward Z. Yang [Sat, 16 Apr 2011 20:43:42 +0000 (21:43 +0100)] 
cmm-notes updates.

Signed-off-by: Edward Z. Yang <>
8 years agoRaw versions of if and switch.
Edward Z. Yang [Fri, 15 Apr 2011 15:43:41 +0000 (16:43 +0100)] 
Raw versions of if and switch.

This makes the following statements valid C--, which uses the
block ID directly rather than generating an anonymous block:

    if (expr) goto foo;
    switch expr {
        case 0: goto foo;
        case 1: goto bar;

Signed-off-by: Edward Z. Yang <>
8 years agoDerive some Typeable instances
Ian Lynagh [Sun, 24 Apr 2011 18:16:12 +0000 (19:16 +0100)] 
Derive some Typeable instances

We were using the Typeable.hs macros, but for no good reason as
far as I can tell.

8 years agoUpdate time library ->
Ian Lynagh [Sun, 24 Apr 2011 13:49:23 +0000 (14:49 +0100)] 
Update time library ->

8 years ago"perl command" should be perl, not gcc!
Ian Lynagh [Sat, 23 Apr 2011 21:47:02 +0000 (22:47 +0100)] 
"perl command" should be perl, not gcc!

8 years agoFix warnings in DynFlags
Ian Lynagh [Sat, 23 Apr 2011 21:42:55 +0000 (22:42 +0100)] 
Fix warnings in DynFlags

I also made the -ffloat-all-lams flag not take an argument, as it just
ignored it.

8 years agoRename "GCC command" to "C compiler command"
Ian Lynagh [Sat, 23 Apr 2011 20:43:25 +0000 (21:43 +0100)] 
Rename "GCC command" to "C compiler command"

Makes it consistent with the existing "C compiler flags"

8 years agoGet CC_STAGE0 from the bootstrapping compiler
Ian Lynagh [Sat, 23 Apr 2011 19:40:43 +0000 (20:40 +0100)] 
Get CC_STAGE0 from the bootstrapping compiler

Rather than using the compiler that configure detects, we use
the "GCC command" field from the --info output of the bootstrapping
compiler (provided it is >= 7.1).

8 years agoAdd stage-specific versions of more ar-related makefile vars
Ian Lynagh [Sat, 23 Apr 2011 16:49:50 +0000 (17:49 +0100)] 
Add stage-specific versions of more ar-related makefile vars

8 years agoRemove unused ArSupportsInput makefile var
Ian Lynagh [Sat, 23 Apr 2011 16:31:43 +0000 (17:31 +0100)] 
Remove unused ArSupportsInput makefile var

8 years agoRemove now-unused BASH makefile variable
Ian Lynagh [Sat, 23 Apr 2011 16:25:25 +0000 (17:25 +0100)] 
Remove now-unused BASH makefile variable

8 years agoMake and use AR_STAGE[0123] makefile vars
Ian Lynagh [Sat, 23 Apr 2011 16:21:59 +0000 (17:21 +0100)] 
Make and use AR_STAGE[0123] makefile vars

8 years agoRemove now-unused compiler/Makefile.local
Ian Lynagh [Sat, 23 Apr 2011 16:09:51 +0000 (17:09 +0100)] 
Remove now-unused compiler/Makefile.local

8 years agoRemove unused makefile variable PREPROCESSCMD
Ian Lynagh [Sat, 23 Apr 2011 15:19:40 +0000 (16:19 +0100)] 
Remove unused makefile variable PREPROCESSCMD

8 years agoRemove unused Makefile.local
Ian Lynagh [Sat, 23 Apr 2011 12:44:04 +0000 (13:44 +0100)] 
Remove unused Makefile.local

8 years agoRemove unused
Ian Lynagh [Sat, 23 Apr 2011 12:43:12 +0000 (13:43 +0100)] 
Remove unused

8 years agoRemove an nhc-specific makefile
Ian Lynagh [Sat, 23 Apr 2011 12:42:04 +0000 (13:42 +0100)] 
Remove an nhc-specific makefile

8 years agoMake stage-specific CC variables
Ian Lynagh [Sat, 23 Apr 2011 12:40:52 +0000 (13:40 +0100)] 
Make stage-specific CC variables

This allows different gcc's to be used when building different stages,
which we need to do when cross-compiling.

8 years agoUpdate .gitignore for the extra-gcc-opts -> settings change
Ian Lynagh [Sat, 23 Apr 2011 10:59:56 +0000 (11:59 +0100)] 
Update .gitignore for the extra-gcc-opts -> settings change

8 years agoRemove UseGcc makefile var
Ian Lynagh [Fri, 22 Apr 2011 21:57:24 +0000 (22:57 +0100)] 
Remove UseGcc makefile var

It couldn't be overridden, and was defined as YES.

8 years agoRename FP_HAVE_GCC to FP_GCC_VERSION
Ian Lynagh [Fri, 22 Apr 2011 21:49:28 +0000 (22:49 +0100)] 

8 years agoRemove HaveGcc (it was always YES)
Ian Lynagh [Fri, 22 Apr 2011 21:45:04 +0000 (22:45 +0100)] 
Remove HaveGcc (it was always YES)

8 years agoRemove redundant tests for whether we're in a GHC tree
Ian Lynagh [Fri, 22 Apr 2011 21:27:50 +0000 (22:27 +0100)] 
Remove redundant tests for whether we're in a GHC tree

We always are, nowadays.

8 years agoRevert "Output ELF .size directives for functions"
Ian Lynagh [Fri, 22 Apr 2011 18:11:56 +0000 (19:11 +0100)] 
Revert "Output ELF .size directives for functions"

This reverts commit b1f453e16f0ce11a2ab18cc4c350bdcbd36299a6.
It caused dynHelloWorld(dyn) to fail.

8 years agoMove gcc's and perl's location to the settings file
Ian Lynagh [Fri, 22 Apr 2011 17:42:38 +0000 (18:42 +0100)] 
Move gcc's and perl's location to the settings file

They were hardcoded in Config.hs

8 years agoOutput ELF .size directives for functions
Johan Tibell [Tue, 19 Apr 2011 16:04:03 +0000 (18:04 +0200)] 
Output ELF .size directives for functions

This allows tools like Linux's perf events to display symbol names for
CMM primops.

8 years agoMove the opt* fields from DynFlags into the Settings type
Ian Lynagh [Fri, 22 Apr 2011 12:34:26 +0000 (13:34 +0100)] 
Move the opt* fields from DynFlags into the Settings type

The pgm* fields are already in Settings

8 years agoTweak build rules for libffi
Ian Lynagh [Fri, 22 Apr 2011 11:56:02 +0000 (12:56 +0100)] 
Tweak build rules for libffi

We were doing
    echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g'
but the only x86 value HOSTPLATFORM can have is i386.

We now tell libffi its build platform again, but we now tell it it's

8 years agono need to set --build when configuring libffi
Mark Lentczner [Thu, 14 Apr 2011 21:38:48 +0000 (14:38 -0700)] 
no need to set --build when configuring libffi

The value --build was set to broke cross-compilier builds, and isn't
needed for regular builds.

8 years agofix documentation of FP_ARG_WITH_PATH_GNU_PROG
Mark Lentczner [Thu, 14 Apr 2011 21:36:42 +0000 (14:36 -0700)] 
fix documentation of FP_ARG_WITH_PATH_GNU_PROG

8 years agoInitialise Settings before DynFlags
Ian Lynagh [Thu, 21 Apr 2011 23:21:23 +0000 (00:21 +0100)] 
Initialise Settings before DynFlags

Stops us having to temporarily have a panic in the DynFlags.
We still need a panic in the DynFlags used for the top-level
error handler, though.

8 years agoFix typo in shared libraries documentation.
Lennart Kolmodin [Thu, 21 Apr 2011 16:17:02 +0000 (18:17 +0200)] 
Fix typo in shared libraries documentation.

8 years agoSplit off a Settings type from DynFlags
Ian Lynagh [Thu, 21 Apr 2011 23:10:06 +0000 (00:10 +0100)] 
Split off a Settings type from DynFlags

8 years agoRename "extra-gcc-opts" to "settings", and start generalising it
Ian Lynagh [Thu, 21 Apr 2011 18:36:52 +0000 (19:36 +0100)] 
Rename "extra-gcc-opts" to "settings", and start generalising it

8 years agoFix typo in comment
Ian Lynagh [Thu, 21 Apr 2011 14:53:02 +0000 (15:53 +0100)] 
Fix typo in comment

8 years agoMerge branch 'master' of
Simon Peyton Jones [Thu, 21 Apr 2011 08:00:43 +0000 (09:00 +0100)] 
Merge branch 'master' of

8 years agodo not use sed for version date processing but rather cut and tr
Matthias Kilian [Mon, 18 Apr 2011 21:59:51 +0000 (23:59 +0200)] 
do not use sed for version date processing but rather cut and tr

Based on an idea from Karel Gardas, who had troubles with the original
sed version (which didn't work with /usr/bin/sed on Solaris).

8 years agoFor very short linker scripts dlopen may return 'file too short' instead
CJ van den Berg [Wed, 20 Apr 2011 21:25:22 +0000 (22:25 +0100)] 
For very short linker scripts dlopen may return 'file too short' instead
of 'invalid ELF header'.

8 years agoThis is required to successfully load terminfo into GHCi in current
CJ van den Berg [Wed, 20 Apr 2011 21:25:16 +0000 (22:25 +0100)] 
This is required to successfully load terminfo into GHCi in current
versions of Fedora. The INPUT command is use by in

8 years agoAdd "./sync-all clean" command
Matthias Kilian [Sat, 16 Apr 2011 12:58:15 +0000 (14:58 +0200)] 
Add "./sync-all clean" command

8 years agoTidy up SigTv
Simon Peyton Jones [Wed, 20 Apr 2011 16:29:19 +0000 (17:29 +0100)] 
Tidy up SigTv

This just a refactoring, removing dead code

8 years agoFix Trac #5130: missed error report
Simon Peyton Jones [Wed, 20 Apr 2011 16:28:00 +0000 (17:28 +0100)] 
Fix Trac #5130: missed error report

Some out of date code in TcErrors was suppressing an error
report -- so some type-incorrect code leaked out and confused
a later bit of the compiler.

8 years agoDont print "Constraint solver steps = n" if -dno-debug-output is on
Simon Peyton Jones [Wed, 20 Apr 2011 16:18:45 +0000 (17:18 +0100)] 
Dont print "Constraint solver steps = n" if -dno-debug-output is on

8 years agoAdd pprDefiniteTrace and use it
Simon Peyton Jones [Wed, 20 Apr 2011 16:16:46 +0000 (17:16 +0100)] 
Add pprDefiniteTrace and use it

The point here is that a very few uses of pprTrace are
controlled by a flag like -ddump-inlinings or -ddump-rule-firings,
and we want to see that output even with -dno-debug-output

8 years agoFix Trac #5126: generate correct usage info in TH declaration quotes
Simon Peyton Jones [Wed, 20 Apr 2011 16:15:38 +0000 (17:15 +0100)] 
Fix Trac #5126: generate correct usage info in TH declaration quotes

In RnBinds.rnValBindsRHS I had
      (sig_dus `plusDU` bind_dus)
when it should be
      (bind_dus `plusDU` sig_dus)

So the fix is easy.

8 years agoMerge branch 'master' of
Simon Peyton Jones [Wed, 20 Apr 2011 11:27:31 +0000 (12:27 +0100)] 
Merge branch 'master' of

8 years agoIgnore .rej files
Simon Peyton Jones [Wed, 20 Apr 2011 11:24:48 +0000 (12:24 +0100)] 
Ignore .rej files

8 years agoPretty-print type variables that are operators correctly
Simon Peyton Jones [Wed, 20 Apr 2011 11:24:38 +0000 (12:24 +0100)] 
Pretty-print type variables that are operators correctly

Fixes Trac #5141.  Thanks to Adam Megacz.

8 years agoDon't generate a prototype for cas
Ian Lynagh [Tue, 19 Apr 2011 22:51:19 +0000 (23:51 +0100)] 
Don't generate a prototype for cas

I'm not sure if this is the best way to fix this, but it fixes the
unreg build.

8 years agoMake the compiler depend on unlit existing
Ian Lynagh [Tue, 19 Apr 2011 11:55:45 +0000 (12:55 +0100)] 
Make the compiler depend on unlit existing

Fixes an unreg build failure. I've also now made these sorts of
dependencies order-only.

8 years agoRemove use of -fno-asm-mangling flag; fixes #5134
Ian Lynagh [Tue, 19 Apr 2011 11:54:18 +0000 (12:54 +0100)] 
Remove use of -fno-asm-mangling flag; fixes #5134

The flag no longer exists, but we always behave as if it had been used.

8 years agoLLVM: Fix #5131. Add support for missing stg regs
David Terei [Tue, 19 Apr 2011 21:51:16 +0000 (14:51 -0700)] 
LLVM: Fix #5131. Add support for missing stg regs

8 years agoSlightly better tracing in the constraint solver
simonpj [Tue, 19 Apr 2011 12:36:53 +0000 (13:36 +0100)] 
Slightly better tracing in the constraint solver

8 years agoFix Trac #5038 (missing free variable in ifThenElse rebindable syntax)
simonpj [Tue, 19 Apr 2011 12:36:11 +0000 (13:36 +0100)] 
Fix Trac #5038 (missing free variable in ifThenElse rebindable syntax)

8 years agoSimplify treatement of pragmas slightly
simonpj [Tue, 19 Apr 2011 12:35:27 +0000 (13:35 +0100)] 
Simplify treatement of pragmas slightly

8 years agoFix typo in comment
simonpj [Tue, 19 Apr 2011 12:34:32 +0000 (13:34 +0100)] 
Fix typo in comment

8 years agoRemove unused function sigForThisGroup
simonpj [Tue, 19 Apr 2011 12:34:04 +0000 (13:34 +0100)] 
Remove unused function sigForThisGroup

8 years agoFix Trac #5045: add ticks to HsArrForms
simonpj [Tue, 19 Apr 2011 12:33:09 +0000 (13:33 +0100)] 
Fix Trac #5045: add ticks to HsArrForms

I don't know why these were left out.  I did the obvious
thing... I hope it's right!

8 years agoFix Trac #5041: parse the trailing '#'
simonpj [Tue, 19 Apr 2011 12:31:53 +0000 (13:31 +0100)] 
Fix Trac #5041: parse the trailing '#'

This matters for constructors and field labels that
have a trailing hash (MagicHash language extension).

8 years agoMerge branch 'master' of
Simon Peyton Jones [Tue, 19 Apr 2011 10:42:38 +0000 (11:42 +0100)] 
Merge branch 'master' of

8 years agoAdd more ignorance
Simon Peyton Jones [Tue, 19 Apr 2011 10:41:42 +0000 (11:41 +0100)] 
Add more ignorance

8 years agoMake ghc less keen to pass -v to gcc and friends
Ian Lynagh [Sun, 17 Apr 2011 20:32:02 +0000 (21:32 +0100)] 
Make ghc less keen to pass -v to gcc and friends

Also a small refactoring in how the verbosity flag is handled.

8 years agoSet stdout to use line buffering in ghc-cabal
Ian Lynagh [Sun, 17 Apr 2011 17:48:39 +0000 (18:48 +0100)] 
Set stdout to use line buffering in ghc-cabal

8 years agoDocument -fwarn-missing-local-sigs; part of #4817
Ian Lynagh [Sat, 16 Apr 2011 20:53:48 +0000 (21:53 +0100)] 
Document -fwarn-missing-local-sigs; part of #4817

8 years agoMake sure the main git repo is case-insensitive too
Ian Lynagh [Fri, 15 Apr 2011 13:23:02 +0000 (14:23 +0100)] 
Make sure the main git repo is case-insensitive too

8 years agoTidy sync-all up a bit, and turn on ignorecase for git repos
Ian Lynagh [Fri, 15 Apr 2011 13:21:47 +0000 (14:21 +0100)] 
Tidy sync-all up a bit, and turn on ignorecase for git repos

8 years agoMore sync-all refactoring
Ian Lynagh [Fri, 15 Apr 2011 13:09:46 +0000 (14:09 +0100)] 
More sync-all refactoring

8 years agoRefactor sync-all a bit
Ian Lynagh [Fri, 15 Apr 2011 12:18:38 +0000 (13:18 +0100)] 
Refactor sync-all a bit

8 years agoadd --no-<tag>, so e.g. we can omit DPH with --no-dph
Simon Marlow [Fri, 15 Apr 2011 08:35:24 +0000 (09:35 +0100)] 
add --no-<tag>, so e.g. we can omit DPH with --no-dph

8 years agoThe hash table implementation had some static free lists that were
Simon Marlow [Thu, 14 Apr 2011 15:40:35 +0000 (16:40 +0100)] 
The hash table implementation had some static free lists that were
not protected by locks in the threaded RTS.  This moves the free lists
to the individual hash tables and removes the static variables.

Spotted by Marcin Orczyk <>, thanks!  This could
definitely cause actual crashes.

8 years agofix a shutdown memory leak
Simon Marlow [Thu, 14 Apr 2011 15:38:00 +0000 (16:38 +0100)] 
fix a shutdown memory leak

8 years agoRevert "Generalized assignment rewriting pass."
Edward Z. Yang [Fri, 15 Apr 2011 09:32:33 +0000 (10:32 +0100)] 
Revert "Generalized assignment rewriting pass."

This reverts commit 2ec796239b782505cfb305af2789abcfa820baaf.

8 years agoGeneralized assignment rewriting pass.
Edward Z. Yang [Wed, 13 Apr 2011 10:16:36 +0000 (11:16 +0100)] 
Generalized assignment rewriting pass.

This assignment rewriting pass subsumes the previous reload
sinking pass, and also performs basic inlining.

Signed-off-by: Edward Z. Yang <>
8 years agoDisable check word address lint check, due to inlined pointer tags.
Edward Z. Yang [Wed, 13 Apr 2011 10:14:34 +0000 (11:14 +0100)] 
Disable check word address lint check, due to inlined pointer tags.

Signed-off-by: Edward Z. Yang <>
8 years agoAdd GenCmmGraph, which is a generic version of CmmGraph.
Edward Z. Yang [Wed, 13 Apr 2011 10:08:44 +0000 (11:08 +0100)] 
Add GenCmmGraph, which is a generic version of CmmGraph.

Signed-off-by: Edward Z. Yang <>
8 years agoCheck for ^M in packages file when booting
Ian Lynagh [Thu, 14 Apr 2011 21:45:02 +0000 (22:45 +0100)] 
Check for ^M in packages file when booting

If we find one then we print an error message and fail.

8 years agoFix typo in docs; spotted by Rustom Mody in beginners@
Ian Lynagh [Thu, 14 Apr 2011 19:45:55 +0000 (20:45 +0100)] 
Fix typo in docs; spotted by Rustom Mody in beginners@

8 years agoMake the boot script complain if mk/ doesn't exist
Ian Lynagh [Thu, 14 Apr 2011 18:56:51 +0000 (19:56 +0100)] 
Make the boot script complain if mk/ doesn't exist

If we aren't validating and mk/ doesn't exist then boot
prints a warning, pointing at instructions for setting up mk/

8 years agoRefactor how dependencies are included; fixes #5109
Ian Lynagh [Thu, 14 Apr 2011 18:42:51 +0000 (19:42 +0100)] 
Refactor how dependencies are included; fixes #5109

This avoids duplicating some logic around the build system.

8 years agoAdd a final newline to the link-time C file that we generate,
Simon Marlow [Thu, 14 Apr 2011 09:40:17 +0000 (10:40 +0100)] 
Add a final newline to the link-time C file that we generate,
otherwise some versions of gcc complain about a missing final newline.

8 years agoAvoid accumulating slop in the pinned_object_block.
Simon Marlow [Thu, 14 Apr 2011 07:59:39 +0000 (08:59 +0100)] 
Avoid accumulating slop in the pinned_object_block.

The pinned_object_block is where we allocate small pinned ByteArray#
objects.  At a GC the pinned_object_block was being treated like other
large objects and promoted to the next step/generation, even if it was
only partly full.  Under some ByteString-heavy workloads this would
accumulate on average 2k of slop per GC, and this memory is never
released until the ByteArray# objects in the block are freed.

So now, we keep allocating into the pinned_object_block until it is
completely full, at which point it is handed over to the GC as before.
The pinned_object_block might therefore contain objects which a large
range of ages, but I don't think this is any worse than the situation
before.  We still have the fragmentation issue in general, but the new
scheme can improve the memory overhead for some workloads

8 years agoAdmonish the user to read the wiki page!
Edward Z. Yang [Wed, 13 Apr 2011 14:58:02 +0000 (15:58 +0100)] 
Admonish the user to read the wiki page!

Signed-off-by: Edward Z. Yang <>
8 years agoFor BC labels, emit empty data section instead of empty proc.
Edward Z. Yang [Wed, 13 Apr 2011 14:29:48 +0000 (15:29 +0100)] 
For BC labels, emit empty data section instead of empty proc.

This fixes two bugs:

    - The new code generator doesn't like procedures with
      empty graphs, and panicked in labelAGraph.

    - LLVM optimizes away empty procedures but not empty
      data sections, so now the backwards-compatibility
      labels actually work with -fllvm.

Signed-off-by: Edward Z. Yang <>
8 years agoMerge branch 'master' of
Ian Lynagh [Wed, 13 Apr 2011 22:47:45 +0000 (23:47 +0100)] 
Merge branch 'master' of

8 years agoNow that -fvia-C is gone, we don't need -march=i686 on i386 Darwin
Ian Lynagh [Wed, 13 Apr 2011 22:36:29 +0000 (23:36 +0100)] 
Now that -fvia-C is gone, we don't need -march=i686 on i386 Darwin

This fixes #5106 (objc compilation was failing on i386 Darwin).

8 years agoAdd adjustUFM, adjustUFM_Directly and joinUFM to UniqFM.
Edward Z. Yang [Wed, 13 Apr 2011 10:09:37 +0000 (11:09 +0100)] 
Add adjustUFM, adjustUFM_Directly and joinUFM to UniqFM.

Renamed adjustUFM in GraphOps to adjustUFM_C, to account
for alternate argument order.

Signed-off-by: Edward Z. Yang <>
8 years agoAlways support optimization fuel.
Edward Z. Yang [Wed, 13 Apr 2011 11:54:53 +0000 (12:54 +0100)] 
Always support optimization fuel.

Signed-off-by: Edward Z. Yang <>
8 years agoUpdate CmmRegOff shorthand for CmmMachOp.
Edward Z. Yang [Wed, 13 Apr 2011 10:09:09 +0000 (11:09 +0100)] 
Update CmmRegOff shorthand for CmmMachOp.

Signed-off-by: Edward Z. Yang <>
8 years agofix a bug introduced in 1fb38442d3a55ac92795aa6c5ed4df82011df724,
Simon Marlow [Wed, 13 Apr 2011 10:27:20 +0000 (11:27 +0100)] 
fix a bug introduced in 1fb38442d3a55ac92795aa6c5ed4df82011df724,
symptom was 2047(threaded2) was crashing.

8 years agoFix compiling on linux-powerpc.
Erik de Castro Lopo [Mon, 4 Apr 2011 12:40:15 +0000 (22:40 +1000)] 
Fix compiling on linux-powerpc.

8 years agoChange the way module initialisation is done (#3252, #4417)
Simon Marlow [Tue, 12 Apr 2011 12:49:09 +0000 (13:49 +0100)] 
Change the way module initialisation is done (#3252, #4417)

Previously the code generator generated small code fragments labelled
with __stginit_M for each module M, and these performed whatever
initialisation was necessary for that module and recursively invoked
the initialisation functions for imported modules.  This appraoch had

 - FFI users had to call hs_add_root() to ensure the correct
   initialisation routines were called.  This is a non-standard,
   and ugly, API.

 - unless we were using -split-objs, the __stginit dependencies would
   entail linking the whole transitive closure of modules imported,
   whether they were actually used or not.  In an extreme case (#4387,
   #4417), a module from GHC might be imported for use in Template
   Haskell or an annotation, and that would force the whole of GHC to
   be needlessly linked into the final executable.

So now instead we do our initialisation with C functions marked with
__attribute__((constructor)), which are automatically invoked at
program startup time (or DSO load-time).  The C initialisers are
emitted into the stub.c file.  This means that every time we compile
with -prof or -hpc, we now get a stub file, but thanks to #3687 that
is now invisible to the user.

There are some refactorings in the RTS (particularly for HPC) to
handle the fact that initialisers now get run earlier than they did

The __stginit symbols are still generated, and the hs_add_root()
function still exists (but does nothing), for backwards compatibility.

8 years agoCleanup sweep and fix a bug in RTS flag processing.
Simon Marlow [Tue, 12 Apr 2011 12:21:41 +0000 (13:21 +0100)] 
Cleanup sweep and fix a bug in RTS flag processing.

This code has accumulated a great deal of cruft over the years, this
pass cleans up a lot of the surrounding cruft but leaves the actual
argument processing alone - so there's still more that could be done.

Bug fixed:

  - ghc_rts_opts should not be subject to the --rtsopts setting.  If
    the programmer explicitly declares options with ghc_rts_opts, they
    shouldn't also have to accept command-line RTS options to make them

8 years agoisAlive: re-apply the tag if we find a forwarding pointer. This is a
Simon Marlow [Tue, 12 Apr 2011 08:41:01 +0000 (09:41 +0100)] 
isAlive: re-apply the tag if we find a forwarding pointer. This is a
real bug, spotted by Marcin Orczyk (thanks!).  I'm not sure if it lead
to any actual crashes.

8 years agoRemove debugging CmmComment from old code generator.
Edward Z. Yang [Mon, 11 Apr 2011 14:33:15 +0000 (15:33 +0100)] 
Remove debugging CmmComment from old code generator.

Warning: This change seems to tickle a bug in ghc-stage1 compiler
built with GHC 6.12.1 during validates.

Signed-off-by: Edward Z. Yang <>
8 years agoFlag for defaulting the codegen GhcStageXDefaultNewCodegen.
Edward Z. Yang [Mon, 4 Apr 2011 11:56:00 +0000 (12:56 +0100)] 
Flag for defaulting the codegen GhcStageXDefaultNewCodegen.

Signed-off-by: Edward Z. Yang <>
8 years agoImplement mapUFM_Directly.
Edward Z. Yang [Mon, 11 Apr 2011 15:04:14 +0000 (16:04 +0100)] 
Implement mapUFM_Directly.

Signed-off-by: Edward Z. Yang <>
8 years agoUnsafe foreign calls (fat machine instructions) do not kill all registers.
Edward Z. Yang [Mon, 11 Apr 2011 10:54:34 +0000 (11:54 +0100)] 
Unsafe foreign calls (fat machine instructions) do not kill all registers.

The new code generator was doing some interesting spilling across
unsafe foreign calls:

     _c1ao::I32 = Hp - 4;
     I32[Sp - 20] = _c1ao::I32;
     foreign "ccall"
       newCAF((BaseReg, PtrHint), (R1, PtrHint))[_unsafe_call_];
     _c1ao::I32 = I32[Sp - 20];

This is fairly unnecessary, and resulted from over-conservative
liveness analysis from CmmLive.  We can see that the old code
generator only saved volatile registers across unsafe foreign calls:
spilling variables was done by saveVolatileVarsAndRegs, which was
only performed for ordinary calls.

This commit removes the excess kill from the liveness analysis, as well
as the *redundant* excess kill from spilling-and-reloading, and adds a
note to CmmNode to this effect.  The only registers we need to kill
are the ones that the foreign call assigns to, just like any other
machine instruction.

Signed-off-by: Edward Z. Yang <>
8 years agoRefactoring and tidy up
Simon Marlow [Mon, 11 Apr 2011 13:48:49 +0000 (14:48 +0100)] 
Refactoring and tidy up

This is a port of some of the changes from my private local-GC branch
(which is still in darcs, I haven't converted it to git yet).  There
are a couple of small functional differences in the GC stats: first,
per-thread GC timings should now be more accurate, and secondly we now
report average and maximum pause times. e.g. from minimax +RTS -N8 -s:

                                    Tot time (elapsed)  Avg pause  Max pause
  Gen  0      2755 colls,  2754 par   13.16s    0.93s     0.0003s    0.0150s
  Gen  1       769 colls,   769 par    3.71s    0.26s     0.0003s    0.0059s

8 years agoghc-pkg dependency on ghc-cabal should be an order-only dependency,
Simon Marlow [Tue, 5 Apr 2011 19:17:37 +0000 (20:17 +0100)] 
ghc-pkg dependency on ghc-cabal should be an order-only dependency,
otherwise we repeatedly try to rebuild ghc-pkg if ghc-cabal is newer.