[project @ 2003-03-24 14:46:53 by simonmar]
authorsimonmar <unknown>
Mon, 24 Mar 2003 14:46:57 +0000 (14:46 +0000)
committersimonmar <unknown>
Mon, 24 Mar 2003 14:46:57 +0000 (14:46 +0000)
commitb3f530814c15886a7a010ed871bb1f054a3918b3
tree25d1e1617d4f5d9e6d555c3a88c64cbbac325b70
parent82387309d1fe1e08aed80abb7220b84346f71343
[project @ 2003-03-24 14:46:53 by simonmar]
Fix some bugs in compacting GC.

Bug 1: When threading the fields of an AP or PAP, we were grabbing the
info table of the function without unthreading it first.

Bug 2: eval_thunk_selector() might accidentally find itself in
to-space when going through indirections in a compacted generation.
We must check for this case and bale out if necessary.

Bug 3: This is somewhat more nasty.  When we have an AP or PAP that
points to a BCO, the layout info for the AP/PAP is in the BCO's
instruction array, which is two objects deep from the AP/PAP itself.
The trouble is, during compacting GC, we can only safely look one
object deep from the current object, because pointers from objects any
deeper might have been already updated to point to their final
destinations.

The solution is to put the arity and bitmap info for a BCO into the
BCO object itself.  This means BCOs become variable-length, which is a
slight annoyance, but it also means that looking up the arity/bitmap
is quicker.  There is a slight reduction in complexity in the byte
code generator due to not having to stuff the bitmap at the front of
the instruction stream.
13 files changed:
ghc/compiler/ghci/ByteCodeAsm.lhs
ghc/compiler/ghci/ByteCodeLink.lhs
ghc/compiler/prelude/primops.txt.pp
ghc/includes/Closures.h
ghc/mk/version.mk
ghc/rts/GC.c
ghc/rts/GCCompact.c
ghc/rts/Interpreter.c
ghc/rts/PrimOps.hc
ghc/rts/ProfHeap.c
ghc/rts/Sanity.c
ghc/rts/Storage.h
ghc/utils/genapply/GenApply.hs