diff options
author | simonmar <unknown> | 2003-07-28 16:05:39 +0000 |
---|---|---|
committer | simonmar <unknown> | 2003-07-28 16:05:39 +0000 |
commit | 387a411e5d6478249de6872c283f2df78ef83bf4 (patch) | |
tree | ea8ec8acc776e6049984fd2178429cd77d57a230 /ghc/compiler/codeGen/CgHeapery.lhs | |
parent | cc19a5c807af2b8128943dfb18eed0a566218b13 (diff) | |
download | haskell-387a411e5d6478249de6872c283f2df78ef83bf4.tar.gz |
[project @ 2003-07-28 16:05:30 by simonmar]
Disable update-in-place. In its current form, it has a serious bug:
if the thunk being updated happens to have turned into a BLACKHOLE_BQ,
then the mutable list will be corrupted by the update.
Disabling update-in-place has some performance implications: many
programs are not affected, but one program in nofib (nucleic2) goes
about 20% slower. However, I can get it to go 300% faster by adding a
few strictness annotations and compiling with -funbox-strict-fields.
Diffstat (limited to 'ghc/compiler/codeGen/CgHeapery.lhs')
-rw-r--r-- | ghc/compiler/codeGen/CgHeapery.lhs | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/ghc/compiler/codeGen/CgHeapery.lhs b/ghc/compiler/codeGen/CgHeapery.lhs index 7cf05ca65e..2329dcb6d2 100644 --- a/ghc/compiler/codeGen/CgHeapery.lhs +++ b/ghc/compiler/codeGen/CgHeapery.lhs @@ -1,14 +1,14 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgHeapery.lhs,v 1.38 2003/07/18 14:39:06 simonmar Exp $ +% $Id: CgHeapery.lhs,v 1.39 2003/07/28 16:05:35 simonmar Exp $ % \section[CgHeapery]{Heap management functions} \begin{code} module CgHeapery ( funEntryChecks, altHeapCheck, unbxTupleHeapCheck, thunkChecks, - allocDynClosure, inPlaceAllocDynClosure + allocDynClosure, -- new functions, basically inserting macro calls into Code -- HWL ,fetchAndReschedule, yield @@ -368,38 +368,3 @@ allocDynClosure closure_info use_cc blame_cc amodes_with_offsets closure_size = closureSize closure_info slop_size = slopSize closure_info \end{code} - -Occasionally we can update a closure in place instead of allocating -new space for it. This is the function that does the business, assuming: - - - the new closure doesn't contain any pointers if we're - using a generational collector. - -\begin{code} -inPlaceAllocDynClosure - :: ClosureInfo - -> CAddrMode -- Pointer to beginning of closure - -> CAddrMode -- Cost Centre to stick in the object - - -> [(CAddrMode, VirtualHeapOffset)] -- Offsets from start of the object - -- ie Info ptr has offset zero. - -> Code - -inPlaceAllocDynClosure closure_info head use_cc amodes_with_offsets - = let -- do_move IS THE ASSIGNMENT FUNCTION - do_move (amode, offset_from_start) - = CAssign (CVal (CIndex head (mkIntCLit offset_from_start) WordRep) - (getAmodeRep amode)) - amode - in - -- GENERATE THE CODE - absC ( mkAbstractCs ( - [ - -- don't forget to AWAKEN_BQ_CLOSURE: even though we're - -- doing update-in-place, the thunk might still have been - -- blackholed and another thread might be waiting on it. - CMacroStmt AWAKEN_BQ_CLOSURE [head], - CInitHdr closure_info head use_cc 0{-no alloc-} - ] - ++ (map do_move amodes_with_offsets))) -\end{code} |