cvs commit: fptools/ghc/includes Regs.h StgMacros.h
StgMiscClosures.h StgStorage.h Updates.h mkNativeHdr.c
fptools/ghc/rts GC.c HeapStackCheck.hc Interpreter.c Linker.c
PrimOps.hc RtsStartup.c Schedule.c Schedule.h StgMiscClosures.hc ...
Simon Marlow
simonmar@glass.cse.ogi.edu
Thu, 8 Nov 2001 04:46:32 -0800
simonmar 2001/11/08 04:46:32 PST
Modified files:
ghc/includes Regs.h StgMacros.h StgMiscClosures.h
StgStorage.h Updates.h mkNativeHdr.c
ghc/rts GC.c HeapStackCheck.hc Interpreter.c
Linker.c PrimOps.hc RtsStartup.c
Schedule.c Schedule.h StgMiscClosures.hc
StgStdThunks.hc Storage.c StoragePriv.h
Updates.hc
Removed files:
ghc/rts HeapStackCheck.h
Log:
Fix the large block allocation bug (Yay!)
-----------------------------------------
In order to do this, I had to
1. in each heap-check failure branch, return the amount of heap
actually requested, in a known location (I added another slot
in StgRegTable called HpAlloc for this purpose). This is
useful for other reasons - in particular it makes it possible
to get accurate allocation statistics.
2. In the scheduler, if a heap check fails and we wanted more than
BLOCK_SIZE_W words, then allocate a special large block and place
it in the nursery. The nursery now has to be double-linked so
we can insert the new block in the middle.
3. The garbage collector has to be able to deal with multiple objects
in a large block. It turns out that this isn't a problem as long as
the large blocks only occur in the nursery, because we always copy
objects from the nursery during GC. One small change had to be
made: in evacuate(), we may need to follow the link field from the
block descriptor to get to the block descriptor for the head of a
large block.
4. Various other parts of the storage manager had to be modified
to cope with a nursery containing a mixture of block sizes.
Point (3) causes a slight pessimization in the garbage collector. I
don't see a way to avoid this. Point (1) causes some code bloat (a
rough measurement is around 5%), so to offset this I made the
following change which I'd been meaning to do for some time:
- Store the values of some commonly-used absolute addresses
(eg. stg_update_PAP) in the register table. This lets us use
shorter instruction forms for some absolute jumps and saves some
code space.
- The type of Capability is no longer the same as an StgRegTable.
MainRegTable renamed to MainCapability. See Regs.h for details.
Other minor changes:
- remove individual declarations for the heap-check-failure jump
points, and declare them all in StgMiscClosures.h instead. Remove
HeapStackCheck.h.
Updates to the native code generator to follow.
Revision Changes Path
1.10 +74 -7 fptools/ghc/includes/Regs.h
1.39 +17 -17 fptools/ghc/includes/StgMacros.h
1.40 +58 -1 fptools/ghc/includes/StgMiscClosures.h
1.11 +2 -2 fptools/ghc/includes/StgStorage.h
1.25 +3 -3 fptools/ghc/includes/Updates.h
1.6 +18 -1 fptools/ghc/includes/mkNativeHdr.c
1.126 +9 -1 fptools/ghc/rts/GC.c
1.18 +8 -7 fptools/ghc/rts/HeapStackCheck.hc
1.31 +19 -19 fptools/ghc/rts/Interpreter.c
1.73 +16 -16 fptools/ghc/rts/Linker.c
1.84 +1 -2 fptools/ghc/rts/PrimOps.hc
1.55 +4 -4 fptools/ghc/rts/RtsStartup.c
1.105 +91 -32 fptools/ghc/rts/Schedule.c
1.23 +2 -7 fptools/ghc/rts/Schedule.h
1.69 +1 -2 fptools/ghc/rts/StgMiscClosures.hc
1.17 +3 -4 fptools/ghc/rts/StgStdThunks.hc
1.53 +42 -28 fptools/ghc/rts/Storage.c
1.19 +2 -2 fptools/ghc/rts/StoragePriv.h
1.35 +2 -3 fptools/ghc/rts/Updates.hc