ghc-hetmet.git
15 years agodrop some debugging traces and use only one flag for new codegen
dias@eecs.harvard.edu [Wed, 26 Nov 2008 18:08:08 +0000 (18:08 +0000)]
drop some debugging traces and use only one flag for new codegen

15 years agoone more missing patch from new codegen path
dias@eecs.harvard.edu [Wed, 26 Nov 2008 16:57:42 +0000 (16:57 +0000)]
one more missing patch from new codegen path

15 years agoFix Trac #2817 (TH syntax -> HsSyn conversion)
simonpj@microsoft.com [Wed, 26 Nov 2008 15:40:22 +0000 (15:40 +0000)]
Fix Trac #2817 (TH syntax -> HsSyn conversion)

15 years agoFix Trac #2756: CorePrep strictness bug
simonpj@microsoft.com [Wed, 26 Nov 2008 14:34:48 +0000 (14:34 +0000)]
Fix Trac #2756: CorePrep strictness bug

15 years agoFormat output for :t more nicely
simonpj@microsoft.com [Wed, 26 Nov 2008 13:48:14 +0000 (13:48 +0000)]
Format output for :t more nicely

15 years agoFix Trac #2766: printing operator type variables
simonpj@microsoft.com [Wed, 26 Nov 2008 13:22:02 +0000 (13:22 +0000)]
Fix Trac #2766: printing operator type variables

15 years agoFix build following codegen patch
simonpj@microsoft.com [Wed, 26 Nov 2008 12:55:26 +0000 (12:55 +0000)]
Fix build following codegen patch

15 years agoRemoved warnings, made Haddock happy, added examples in documentation
dias@eecs.harvard.edu [Fri, 17 Oct 2008 17:07:07 +0000 (17:07 +0000)]
Removed warnings, made Haddock happy, added examples in documentation
The interesting examples talk about our story with heap checks in
case alternatives and our story with the case scrutinee as a Boolean.

15 years agoFixed linear regalloc bug, dropped some tracing code
dias@eecs.harvard.edu [Thu, 16 Oct 2008 10:42:18 +0000 (10:42 +0000)]
Fixed linear regalloc bug, dropped some tracing code
o The linear-scan register allocator sometimes allocated a block
  before allocating one of its predecessors, which could lead
  to inconsistent allocations. Now, we allocate a block only
  if a predecessor has set the "incoming" assignments for the block
  (or if it's the procedure's entry block).
o Also commented out some tracing code on the new codegen path.

15 years agoKeep update frames live even in functions that never return
dias@eecs.harvard.edu [Tue, 14 Oct 2008 16:54:37 +0000 (16:54 +0000)]
Keep update frames live even in functions that never return
An unusual case, but without it:
(a) we had an assertion failure
(b) we can overwrite the caller's infotable, which might cause
    the garbage collector to collect live data.
Better to keep the update frame live at all call sites,
not just at returns.

15 years agoRemoved space and time inefficiency in procpoint splitting
dias@eecs.harvard.edu [Tue, 14 Oct 2008 16:03:54 +0000 (16:03 +0000)]
Removed space and time inefficiency in procpoint splitting
I was adding extra jumps to every procpoint, even when the split-off graph
referred to only some of the procpoints. No effect on correctness,
but a big effect on space/time efficiency when there are lots of procpoints...

15 years agoClarify the SRT building process
dias@eecs.harvard.edu [Tue, 14 Oct 2008 14:02:02 +0000 (14:02 +0000)]
Clarify the SRT building process
Before: building a closure that would build an SRT given the top-level
SRT. It was somewhat difficult to understand the control flow, and it
may have had held onto some data structures long after they should be dead.
Now, I just bundle the info we need about CAFs along with the procedure
and directly call a new top-level function to build the SRTs later.

15 years agoDon't adjust hp up when the case scrutinee won't allocate
dias@eecs.harvard.edu [Tue, 14 Oct 2008 11:26:18 +0000 (11:26 +0000)]
Don't adjust hp up when the case scrutinee won't allocate

If the case scrutinee can't allocate, we don't need to do a heap
check in the case alternatives. (A previous patch got that right.)
In that case, we had better not adjust the heap pointer to recover
unused stack space before evaluating the scrutinee -- because we
aren't going to reallocate for the case alternative.

15 years agoFloating infotables were reversed in C back end
dias@eecs.harvard.edu [Mon, 13 Oct 2008 15:27:18 +0000 (15:27 +0000)]
Floating infotables were reversed in C back end

15 years agoforgot a few files
dias@eecs.harvard.edu [Mon, 13 Oct 2008 13:42:51 +0000 (13:42 +0000)]
forgot a few files

15 years agoBig collection of patches for the new codegen branch.
dias@eecs.harvard.edu [Mon, 13 Oct 2008 13:25:56 +0000 (13:25 +0000)]
Big collection of patches for the new codegen branch.
o Fixed bug that emitted the copy-in code for closure entry
  in the wrong place -- at the initialization of the closure.
o Refactored some of the closure entry code.
o Added code to check that no LocalRegs are live-in to a procedure
   -- trip up some buggy programs earlier
o Fixed environment bindings for thunks
   -- we weren't (re)binding the free variables in a thunk
o Fixed a bug in proc-point splitting that dropped some updates
  to the entry block in a procedure.
o Fixed improper calls to code that generates CmmLit's for strings
o New invariant on cg_loc in CgIdInfo: the expression is always tagged
o Code to load free vars on entry to a thunk was (wrongly) placed before
  the heap check.
o Some of the StgCmm code was redundantly passing around Id's
  along with CgIdInfo's; no more.
o Initialize the LocalReg's that point to a closure before allocating and
  initializing the closure itself -- otherwise, we have problems with
  recursive closure bindings
o BlockEnv and BlockSet types are now abstract.
o Update frames:
  - push arguments in Old call area
  - keep track of the return sp in the FCode monad
  - keep the return sp in every call, tail call, and return
      (because it might be different at different call sites,
       e.g. tail calls to the gc after a heap check are performed
            before pushing the update frame)
  - set the sp appropriately on returns and tail calls
o Reduce call, tail call, and return to a single LastCall node
o Added slow entry code, using different calling conventions on entry and tail call
o More fixes to the calling convention code.
  The tricky stuff is all about the closure environment: it must be passed in R1,
  but in non-closures, there is no such argument, so we can't treat all arguments
  the same way: the closure environment is special. Maybe the right step forward
  would be to define a different calling convention for closure arguments.
o Let-no-escapes need to be emitted out-of-line -- otherwise, we drop code.
o Respect RTS requirement of word alignment for pointers
  My stack allocation can pack sub-word values into a single word on the stack,
  but it wasn't requiring word-alignment for pointers. It does now,
  by word-aligning both pointer registers and call areas.
o CmmLint was over-aggresively ruling out non-word-aligned memory references,
  which may be kosher now that we can spill small values into a single word.
o Wrong label order on a conditional branch when compiling switches.
o void args weren't dropped in many cases.
  To help prevent this kind of mistake, I defined a NonVoid wrapper,
  which I'm applying only to Id's for now, although there are probably
  other good candidates.
o A little code refactoring: separate modules for procpoint analysis splitting,
  stack layout, and building infotables.
o Stack limit check: insert along with the heap limit check, using a symbolic
  constant (a special CmmLit), then replace it when the stack layout is known.
o Removed last node: MidAddToContext
o Adding block id as a literal: means that the lowering of the calling conventions
  no longer has to produce labels early, which was inhibiting common-block elimination.
  Will also make it easier for the non-procpoint-splitting path.
o Info tables: don't try to describe the update frame!
o Over aggressive use of NonVoid!!!!
  Don't drop the non-void args before setting the type of the closure!!!
o Sanity checking:
  Added a pass to stub dead dead slots on the stack
  (only ~10 lines with the dataflow framework)
o More sanity checking:
  Check that incoming pointer arguments are non-stubbed.
  Note: these checks are still subject to dead-code removal, but they should
  still be quite helpful.
o Better sanity checking: why stop at function arguments?
  Instead, in mkAssign, check that _any_ assignment to a pointer type is non-null
  -- the sooner the crash, the easier it is to debug.
  Still need to add the debugging flag to turn these checks on explicitly.
o Fixed yet another calling convention bug.
  This time, the calls to the GC were wrong. I've added a new convention
  for GC calls and invoked it where appropriate.
  We should really straighten out the calling convention stuff:
    some of the code (and documentation) is spread across the compiler,
    and there's some magical use of the node register that should really
    be handled (not avoided) by calling conventions.
o Switch bug: the arms in mkCmmLitSwitch weren't returning to a single join point.
o Environment shadowing problem in Stg->Cmm:
  When a closure f is bound at the top-level, we should not bind f to the
  node register on entry to the closure.
  Why? Because if the body of f contains a let-bound closure g that refers
  to f, we want to make sure that it refers to the static closure for f.
  Normally, this would all be fine, because when we compile a closure,
  we rebind free variables in the environment. But f doesn't look like
  a free variable because it's a static value. So, the binding for f
  remains in the environment when we compile g, inconveniently referring
  to the wrong thing.
  Now, I bind the variable in the local environment only if the closure is not
  bound at the top level. It's still okay to make assumptions about the
  node holding the closure environment; we just won't find the binding
  in the environment, so code that names the closure will now directly
  get the label of the static closure, not the node register holding a
  pointer to the static closure.
o Don't generate bogus Cmm code containing SRTs during the STG -> Cmm pass!
  The tables made reference to some labels that don't exist when we compute and
  generate the tables in the back end.
o Safe foreign calls need some special treatment (at least until we have the integrated
  codegen). In particular:
  o they need info tables
  o they are not procpoints -- the successor had better be in the same procedure
  o we cannot (yet) implement the calling conventions early, which means we have
    to carry the calling-conv info all the way to the end
o We weren't following the old convention when registering a module.
  Now, we use update frames to push any new modules that have to be registered
  and enter the youngest one on the stack.
  We also use the update frame machinery to specify that the return should pop
  the return address off the stack.
o At each safe foreign call, an infotable must be at the bottom of the stack,
  and the TSO->sp must point to it.
o More problems with void args in a direct call to a function:
  We were checking the args (minus voids) to check whether the call was saturated,
  which caused problems when the function really wasn't saturated because it
  took an extra void argument.
o Forgot to distinguish integer != from floating != during Stg->Cmm
o Updating slotEnv and areaMap to include safe foreign calls
  The dataflow analyses that produce the slotEnv and areaMap give
  results for each basic block, but we also need the results for
  a safe foreign call, which is a middle node.
  After running the dataflow analysis, we have another pass that
  updates the results to includ any safe foreign calls.
o Added a static flag for the debugging technique that inserts
  instructions to stub dead slots on the stack and crashes when
  a stubbed value is loaded into a pointer-typed LocalReg.
o C back end expects to see return continuations before their call sites.
  Sorted the flowgraphs appropriately after splitting.
o PrimOp calling conventions are special -- unlimited registers, no stack
  Yet another calling convention...
o More void value problems: if the RHS of a case arm is a void-typed variable,
  don't try to return it.
o When calling some primOp, they may allocate memory; if so, we need to
  do a heap check when we return from the call.

15 years agoMerging in the new codegen branch
dias@eecs.harvard.edu [Thu, 14 Aug 2008 12:40:27 +0000 (12:40 +0000)]
Merging in the new codegen branch
This merge does not turn on the new codegen (which only compiles
a select few programs at this point),
but it does introduce some changes to the old code generator.

The high bits:
1. The Rep Swamp patch is finally here.
   The highlight is that the representation of types at the
   machine level has changed.
   Consequently, this patch contains updates across several back ends.
2. The new Stg -> Cmm path is here, although it appears to have a
   fair number of bugs lurking.
3. Many improvements along the CmmCPSZ path, including:
   o stack layout
   o some code for infotables, half of which is right and half wrong
   o proc-point splitting

15 years agoMajor clean-up of HscMain.
Thomas Schilling [Tue, 25 Nov 2008 15:32:01 +0000 (15:32 +0000)]
Major clean-up of HscMain.

This patch entails a major restructuring of HscMain and a small bugfix
to MkIface (which required the restructuring in HscMain).

In MkIface:

  - mkIface* no longer outputs orphan warnings directly and also no
    longer quits GHC when -Werror is set.  Instead, errors are
    reported using the common IO (Messages, Maybe result) scheme.

In HscMain:

  - Get rid of the 'Comp' monad.  This monad was mostly GhcMonad + two
    reader arguments, a ModSummary for the currently compiled module
    and a possible old interface.  The latter actually lead to a small
    space-leak since only its hash was needed (to check whether the
    newly-generated interface file was the same as the original one).

    Functions originally of type 'Comp' now only take the arguments
    that they actually need.  This leads to slighly longer argument
    lists in some places, however, it is now much easier to see what
    is actually going on.

  - Get rid of 'myParseModule'.  Rename 'parseFile' to 'hscParse'.

  - Join 'deSugarModule' and 'hscDesugar' (keeping the latter).

  - Rename 'typecheck{Rename}Module{'}' to 'hscTypecheck{Rename}'.
    One variant keeps the renamed syntax, the other doesn't.

  - Parameterise 'HscStatus', so that 'InteractiveStatus' is just a
    different parameterisation of 'HscStatus'.

  - 'hscCompile{OneShot,Batch,Nothing,Interactive}' are now
    implemented using a (local) typeclass called 'HsCompiler'.  The
    idea is to make the common structure more obvious.  Using this
    typeclass we now have two functions 'genericHscCompile' (original
    'hscCompiler') and 'genericHscRecompile' (original 'genComp')
    describing the default pipeline.  The methods of the typeclass
    describe a sort of "hook" interface (in OO-terms this would be
    called the "template method" pattern).

    One problem with this approach is that we parameterise over the
    /result/ type which, in fact, is not actually different for
    "nothing" and "batch" mode.  To avoid functional dependencies or
    associated types, we use type tags to make them artificially
    different and parameterise the type class over the result type.
    A perhaps better approach might be to use records instead.

  - Drop some redundant 'HscEnv' arguments.  These were likely
    different from what 'getSession' would return because during
    compilation we temporarily set the module's DynFlags as well as a
    few other fields.  We now use the 'withTempSession' combinator to
    temporarily change the 'HscEnv' and automatically restore the
    original session after the enclosed action has returned (even in
    case of exceptions).

  - Rename 'hscCompile' to 'hscGenHardCode' (since that is what it
    does).

Calls in 'GHC' and 'DriverPipeline' accordingly needed small
adaptions.

15 years agoFix Trac #2799: TcType.isOverloadedTy
simonpj@microsoft.com [Tue, 25 Nov 2008 11:05:40 +0000 (11:05 +0000)]
Fix Trac #2799: TcType.isOverloadedTy

A missing case (for equality predicates) in isOverloadedTy make
bindInstsOfLocalFuns/Pats do the wrong thing.  Core Lint nailed it.

Merge to 6.10 branch.

15 years agoFix #2740: we were missing the free variables on some expressions
Simon Marlow [Tue, 25 Nov 2008 10:31:13 +0000 (10:31 +0000)]
Fix #2740: we were missing the free variables on some expressions
Particularly boolean expresions: the conditional of an 'if', and
guards, were missing their free variables.

15 years agoFix symbol macro names in Linker.c
Thorkil Naur [Fri, 21 Nov 2008 16:01:49 +0000 (16:01 +0000)]
Fix symbol macro names in Linker.c

15 years agoAdd a --machine-readable RTS flag
Ian Lynagh [Sun, 23 Nov 2008 15:21:27 +0000 (15:21 +0000)]
Add a --machine-readable RTS flag
Currently it only affects the -t flag output

15 years agoReturn errors instead of dying in myParseModule.
Thomas Schilling [Sat, 22 Nov 2008 15:41:51 +0000 (15:41 +0000)]
Return errors instead of dying in myParseModule.

15 years agoComments/Haddockification only.
Thomas Schilling [Sat, 22 Nov 2008 14:30:18 +0000 (14:30 +0000)]
Comments/Haddockification only.

15 years agoReport source span instead of just source location for unused names.
Thomas Schilling [Sat, 22 Nov 2008 14:26:41 +0000 (14:26 +0000)]
Report source span instead of just source location for unused names.

15 years agoChange 'handleFlagWarnings' to throw exceptions instead of dying.
Thomas Schilling [Sat, 22 Nov 2008 13:06:58 +0000 (13:06 +0000)]
Change 'handleFlagWarnings' to throw exceptions instead of dying.

It now uses the standard warning log and error reporting mechanism.

15 years agoDocument exported functions in main/HeaderInfo.
Thomas Schilling [Fri, 21 Nov 2008 14:53:07 +0000 (14:53 +0000)]
Document exported functions in main/HeaderInfo.

15 years agoRemove warning supression klugde in main/HeaderInfo
Thomas Schilling [Fri, 21 Nov 2008 14:41:55 +0000 (14:41 +0000)]
Remove warning supression klugde in main/HeaderInfo

15 years agoUse mutator threads to do GC, instead of having a separate pool of GC threads
Simon Marlow [Fri, 21 Nov 2008 15:12:33 +0000 (15:12 +0000)]
Use mutator threads to do GC, instead of having a separate pool of GC threads

Previously, the GC had its own pool of threads to use as workers when
doing parallel GC.  There was a "leader", which was the mutator thread
that initiated the GC, and the other threads were taken from the pool.

This was simple and worked fine for sequential programs, where we did
most of the benchmarking for the parallel GC, but falls down for
parallel programs.  When we have N mutator threads and N cores, at GC
time we would have to stop N-1 mutator threads and start up N-1 GC
threads, and hope that the OS schedules them all onto separate cores.
It practice it doesn't, as you might expect.

Now we use the mutator threads to do GC.  This works quite nicely,
particularly for parallel programs, where each mutator thread scans
its own spark pool, which is probably in its cache anyway.

There are some flag changes:

  -g<n> is removed (-g1 is still accepted for backwards compat).
  There's no way to have a different number of GC threads than mutator
  threads now.

  -q1       Use one OS thread for GC (turns off parallel GC)
  -qg<n>    Use parallel GC for generations >= <n> (default: 1)

Using parallel GC only for generations >=1 works well for sequential
programs.  Compiling an ordinary sequential program with -threaded and
running it with -N2 or more should help if you do a lot of GC.  I've
found that adding -qg0 (do parallel GC for generation 0 too) speeds up
some parallel programs, but slows down some sequential programs.
Being conservative, I left the threshold at 1.

ToDo: document the new options.

15 years agowe shouldn't update topBound in discardSparks()
Simon Marlow [Fri, 21 Nov 2008 11:35:39 +0000 (11:35 +0000)]
we shouldn't update topBound in discardSparks()

15 years agoThrow SourceErrors instead of ProgramErrors in main/HeaderInfo.
Thomas Schilling [Fri, 21 Nov 2008 14:13:39 +0000 (14:13 +0000)]
Throw SourceErrors instead of ProgramErrors in main/HeaderInfo.

Parse errors during dependency analysis or options parsing really
shouldn't kill GHC; this is particularly annoying for GHC API clients.

15 years agofix the build when !USE_MMAP
Simon Marlow [Fri, 21 Nov 2008 08:54:18 +0000 (08:54 +0000)]
fix the build when !USE_MMAP

15 years agoround the size up to a page in mmapForLinker() instead of in the caller
Simon Marlow [Thu, 20 Nov 2008 15:40:14 +0000 (15:40 +0000)]
round the size up to a page in mmapForLinker() instead of in the caller

15 years agoFix a race in the deadlock-detection code
Simon Marlow [Thu, 20 Nov 2008 11:24:38 +0000 (11:24 +0000)]
Fix a race in the deadlock-detection code
After a deadlock it was possible for the timer signal to remain off,
which meant that the next deadlock would not be detected, and the
system would hang.  Spotted by conc047(threaded2).

15 years agoerror message wibble
Simon Marlow [Thu, 20 Nov 2008 08:49:01 +0000 (08:49 +0000)]
error message wibble

15 years agoFix flag name -XDisambiguateRecordFields
simonpj@microsoft.com [Thu, 20 Nov 2008 12:32:05 +0000 (12:32 +0000)]
Fix flag name -XDisambiguateRecordFields

15 years agoFix regTableToCapability() if gcc introduces padding
Simon Marlow [Wed, 19 Nov 2008 16:29:10 +0000 (16:29 +0000)]
Fix regTableToCapability() if gcc introduces padding
Also avoid padding if possible using __attribute__((packed))
Fixes the Windows build

15 years agoFix 32-bit breakage
Simon Marlow [Wed, 19 Nov 2008 14:54:29 +0000 (14:54 +0000)]
Fix 32-bit breakage

15 years agoSmall refactoring, and add comments
Simon Marlow [Wed, 19 Nov 2008 14:37:02 +0000 (14:37 +0000)]
Small refactoring, and add comments
I discovered a new invariant while experimenting (blackholing is not
optional when using parallel GC), so documented it.

15 years agoFix some unsigned comparisions that should be signed
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).

15 years agoRemove incorrect assertions in steal()
Simon Marlow [Wed, 19 Nov 2008 14:30:43 +0000 (14:30 +0000)]
Remove incorrect assertions in steal()

15 years agodon't run sparks if there are other threads on this Capability
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

15 years agoFix typo (HAVE_LIBGMP => HAVE_LIB_GMP); omit local gmp includes if HAVE_LIB_GMP
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.

15 years agoFix some more shutdown races
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.

15 years agoAdd help messages about --with-editline-(includes,libraries) to the ghc configure...
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.

15 years agoAdd optional eager black-holing, with new flag -feager-blackholing
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.

15 years agoFix #2783: detect black-hole loops properly
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.

15 years agoFix warning on Windows (use deleteThread() not deleteThread_())
Simon Marlow [Mon, 17 Nov 2008 14:30:47 +0000 (14:30 +0000)]
Fix warning on Windows (use deleteThread() not deleteThread_())

15 years agofix compile breakage on Windows
Simon Marlow [Mon, 17 Nov 2008 14:28:31 +0000 (14:28 +0000)]
fix compile breakage on Windows

15 years agoAttempt to fix #2512 and #2063; add +RTS -xm<address> -RTS option
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.

15 years agoAnother shutdown fix
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)

15 years agoCorrect an example in the users guide
Ian Lynagh [Sun, 16 Nov 2008 17:49:38 +0000 (17:49 +0000)]
Correct an example in the users guide

15 years agoFix gen_contents_index when not run inplace; trac #2764
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.

15 years agoclose the temporary Handle before removing the file
Simon Marlow [Fri, 14 Nov 2008 13:09:58 +0000 (13:09 +0000)]
close the temporary Handle before removing the file

15 years agorefactor: move unlockClosure() into SMPClosureOps() where it should be
Simon Marlow [Fri, 14 Nov 2008 09:58:17 +0000 (09:58 +0000)]
refactor: move unlockClosure() into SMPClosureOps() where it should be

15 years agoOmit definitions of cas() and xchg() in .hc code
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

15 years agoDon't put stdin into non-blocking mode (#2778, #2777)
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.

15 years agoRmoeve --enable-dotnet
Simon Marlow [Fri, 14 Nov 2008 12:49:29 +0000 (12:49 +0000)]
Rmoeve --enable-dotnet

15 years ago#2751: disourage --enable-shared in ./configure --help
Simon Marlow [Fri, 14 Nov 2008 12:47:48 +0000 (12:47 +0000)]
#2751: disourage --enable-shared in ./configure --help

15 years agoadd a warning that --enable-shared is experimental
Simon Marlow [Fri, 14 Nov 2008 10:40:34 +0000 (10:40 +0000)]
add a warning that --enable-shared is experimental

15 years agolookupSymbol: revert to looking up both with and without the @N suffix
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

15 years ago#2768: fix compatibility problem with newer version of mingw
Simon Marlow [Thu, 13 Nov 2008 11:46:26 +0000 (11:46 +0000)]
#2768: fix compatibility problem with newer version of mingw

15 years agonotice ^C exceptions when waiting for I/O
Simon Marlow [Thu, 13 Nov 2008 11:43:42 +0000 (11:43 +0000)]
notice ^C exceptions when waiting for I/O

15 years agoFix a bug in the recompilation checking logic.
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.

15 years agoFix another subtle shutdown deadlock
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.

15 years agoFix an extremely subtle deadlock bug on x86_64
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?

15 years agomove an assertion
Simon Marlow [Thu, 13 Nov 2008 15:45:42 +0000 (15:45 +0000)]
move an assertion

15 years agoAlways zap the trailing @N from symbols when looking up in a DLL
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.

15 years agoOnly allocate a mark stack if we're actually doing marking
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

15 years agoFix parse error with older gccs (#2752)
Simon Marlow [Tue, 11 Nov 2008 13:53:44 +0000 (13:53 +0000)]
Fix parse error with older gccs (#2752)

15 years agoFix to i386_insert_ffrees (#2724, #1944)
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.

15 years agoFix bootstrap with 6.10.1 on Windows
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

15 years agoPerform case-insensitive matching of path components in getBaseDir on Windows (Fixes...
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)

15 years agoDocumentation only. Clarify that 'load*' may indeed throw SourceErrors.
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.

15 years agoFix documentation (to say the opposite).
Thomas Schilling [Mon, 10 Nov 2008 15:38:19 +0000 (15:38 +0000)]
Fix documentation (to say the opposite).

15 years agoFix line numbers in TAGS files.
Thomas Schilling [Mon, 10 Nov 2008 15:36:21 +0000 (15:36 +0000)]
Fix line numbers in TAGS files.

15 years agoDocumentation only.
Thomas Schilling [Mon, 10 Nov 2008 15:34:56 +0000 (15:34 +0000)]
Documentation only.

15 years agoAdd 'packageDbModules' function to GHC API.
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

15 years agoWe now require GHC 6.6, so we always have Applicative
Ian Lynagh [Sat, 8 Nov 2008 14:47:23 +0000 (14:47 +0000)]
We now require GHC 6.6, so we always have Applicative

15 years agoRemove a CPP test that's always true (__GLASGOW_HASKELL__ >= 605)
Ian Lynagh [Sat, 8 Nov 2008 14:45:44 +0000 (14:45 +0000)]
Remove a CPP test that's always true (__GLASGOW_HASKELL__ >= 605)

15 years agoRemove some dead code now that __GLASGOW_HASKELL__ >= 606
Ian Lynagh [Sat, 8 Nov 2008 14:44:59 +0000 (14:44 +0000)]
Remove some dead code now that __GLASGOW_HASKELL__ >= 606

15 years agoRemove some flag duplication from a Makefile
Ian Lynagh [Sat, 8 Nov 2008 14:44:12 +0000 (14:44 +0000)]
Remove some flag duplication from a Makefile

15 years agoghc_ge_605 is now always YES
Ian Lynagh [Sat, 8 Nov 2008 14:43:28 +0000 (14:43 +0000)]
ghc_ge_605 is now always YES

15 years agoRemove the GHC 6.4 unicode compat stuff; we can now just use Data.Char
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

15 years agoFix libffi bindist
Clemens Fruhwirth [Sat, 8 Nov 2008 09:47:25 +0000 (09:47 +0000)]
Fix libffi bindist

15 years agoReplace couple of fromJust with expectJust
Clemens Fruhwirth [Fri, 7 Nov 2008 16:07:35 +0000 (16:07 +0000)]
Replace couple of fromJust with expectJust

15 years agoBugfix for patch "Do not filter the rts from linked libraries..." (#2745)
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

15 years agofix via-C compilation: import ghczmprim_GHCziBool_False_closure
Simon Marlow [Fri, 7 Nov 2008 09:04:32 +0000 (09:04 +0000)]
fix via-C compilation: import ghczmprim_GHCziBool_False_closure

15 years agodisable instance MonadPlus CoreM for GHC <= 6.6
Simon Marlow [Fri, 7 Nov 2008 08:52:50 +0000 (08:52 +0000)]
disable instance MonadPlus CoreM for GHC <= 6.6

15 years agore-instate counting of sparks converted
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"

15 years agofix ASSERT_SPARK_POOL_INVARIANTS(): top>bottom is valid
Simon Marlow [Thu, 6 Nov 2008 15:58:26 +0000 (15:58 +0000)]
fix ASSERT_SPARK_POOL_INVARIANTS(): top>bottom is valid

15 years agopruneSparkQueue(): fix bug when top>bottom
Simon Marlow [Thu, 6 Nov 2008 15:56:48 +0000 (15:56 +0000)]
pruneSparkQueue(): fix bug when top>bottom

15 years agodon't yield if the system is shutting down
Simon Marlow [Thu, 6 Nov 2008 15:53:56 +0000 (15:53 +0000)]
don't yield if the system is shutting down

15 years agoleave out ATTRIBUTE_ALIGNED on Windows, it gives a warning
Simon Marlow [Thu, 6 Nov 2008 13:21:05 +0000 (13:21 +0000)]
leave out ATTRIBUTE_ALIGNED on Windows, it gives a warning

15 years agoCope with ThreadRelocated when traversing the blocked_queue
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

15 years agoRemove dead code.
Thomas Schilling [Fri, 31 Oct 2008 16:20:36 +0000 (16:20 +0000)]
Remove dead code.

15 years agoRun sparks in batches, instead of creating a new thread for each one
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.

15 years agoallocateInGen(): increase alloc_blocks (#2747)
Simon Marlow [Thu, 6 Nov 2008 11:37:14 +0000 (11:37 +0000)]
allocateInGen(): increase alloc_blocks (#2747)

15 years agodisable MonadPlus instance that doesn't compile with 6.6
Simon Marlow [Thu, 6 Nov 2008 10:04:11 +0000 (10:04 +0000)]
disable MonadPlus instance that doesn't compile with 6.6

15 years agodon't yield the Capability if blackholes_need_checking
Simon Marlow [Wed, 5 Nov 2008 15:49:28 +0000 (15:49 +0000)]
don't yield the Capability if blackholes_need_checking