summaryrefslogtreecommitdiff
path: root/ghc/compiler/codeGen
diff options
context:
space:
mode:
authorsimonmar <unknown>2003-07-28 16:05:39 +0000
committersimonmar <unknown>2003-07-28 16:05:39 +0000
commit387a411e5d6478249de6872c283f2df78ef83bf4 (patch)
treeea8ec8acc776e6049984fd2178429cd77d57a230 /ghc/compiler/codeGen
parentcc19a5c807af2b8128943dfb18eed0a566218b13 (diff)
downloadhaskell-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')
-rw-r--r--ghc/compiler/codeGen/CgCon.lhs43
-rw-r--r--ghc/compiler/codeGen/CgHeapery.lhs39
2 files changed, 3 insertions, 79 deletions
diff --git a/ghc/compiler/codeGen/CgCon.lhs b/ghc/compiler/codeGen/CgCon.lhs
index 57bfffe748..c83a03527a 100644
--- a/ghc/compiler/codeGen/CgCon.lhs
+++ b/ghc/compiler/codeGen/CgCon.lhs
@@ -32,7 +32,7 @@ import CgUsages ( getRealSp, getVirtSp, setRealAndVirtualSp,
import CgRetConv ( assignRegs )
import Constants ( mAX_INTLIKE, mIN_INTLIKE, mAX_CHARLIKE, mIN_CHARLIKE,
mIN_UPD_SIZE )
-import CgHeapery ( allocDynClosure, inPlaceAllocDynClosure )
+import CgHeapery ( allocDynClosure )
import CgTailCall ( performReturn, mkStaticAlgReturnCode,
returnUnboxedTuple )
import CLabel ( mkClosureLabel )
@@ -316,47 +316,6 @@ cgReturnDataCon con amodes
jump_to_join_point sequel = absC (CJump (CLbl deflt_lbl CodePtrRep))
-- Ignore the sequel: we've already looked at it above
- -- If the sequel is an update frame, we might be able to
- -- do update in place...
- UpdateCode
- | not (isNullaryDataCon con) -- no nullary constructors, please
- && not (any isFollowableRep (map getAmodeRep amodes))
- -- no ptrs please (generational gc...)
- && closureSize closure_info <= mIN_UPD_SIZE
- -- don't know the real size of the
- -- thunk, so assume mIN_UPD_SIZE
-
- -> -- get a new temporary and make it point to the updatee
- let
- uniq = getUnique con
- temp = CTemp uniq PtrRep
- in
-
- profCtrC FSLIT("TICK_UPD_CON_IN_PLACE")
- [mkIntCLit (length amodes)] `thenC`
-
- getSpRelOffset args_sp `thenFC` \ sp_rel ->
- absC (CAssign temp
- (CMacroExpr PtrRep UPD_FRAME_UPDATEE [CAddr sp_rel]))
- `thenC`
-
- -- stomp all over it with the new constructor
- inPlaceAllocDynClosure closure_info temp (CReg CurCostCentre) stuff
- `thenC`
-
- -- set Node to point to the closure being returned
- -- (can't be done earlier: node might conflict with amodes)
- absC (CAssign (CReg node) temp) `thenC`
-
- -- pop the update frame off the stack, and do the proper
- -- return.
- let new_sp = args_sp - updateFrameSize in
- setEndOfBlockInfo (EndOfBlockInfo new_sp (OnStack new_sp)) $
- performReturn (AbsCNop) (mkStaticAlgReturnCode con)
-
- where
- (closure_info, stuff) = layOutDynConstr con getAmodeRep amodes
-
other_sequel -- The usual case
| isUnboxedTupleCon con -> returnUnboxedTuple amodes
| otherwise -> build_it_then (mkStaticAlgReturnCode con)
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}