-\subsection[layOutDynClosure]{Lay out a dynamic closure}
-%* *
-%************************************************************************
-
-\begin{code}
-layOutDynClosure, layOutStaticClosure
- :: Name -- STG identifier of this closure
- -> (a -> PrimRep) -- how to get a PrimRep for the fields
- -> [a] -- the "things" being layed out
- -> LambdaFormInfo -- what sort of closure it is
- -> (ClosureInfo, -- info about the closure
- [(a, VirtualHeapOffset)]) -- things w/ offsets pinned on them
-
-layOutDynClosure name kind_fn things lf_info
- = (MkClosureInfo name lf_info sm_rep,
- things_w_offsets)
- where
- (tot_wds, -- #ptr_wds + #nonptr_wds
- ptr_wds, -- #ptr_wds
- things_w_offsets) = mkVirtHeapOffsets kind_fn things
- sm_rep = chooseDynSMRep lf_info tot_wds ptr_wds
-\end{code}
-
-A wrapper for when used with data constructors:
-
-\begin{code}
-layOutDynCon :: DataCon
- -> (a -> PrimRep)
- -> [a]
- -> (ClosureInfo, [(a,VirtualHeapOffset)])
-
-layOutDynCon con kind_fn args
- = layOutDynClosure (dataConName con) kind_fn args (mkConLFInfo con)
-\end{code}
-
-%************************************************************************
-%* *
-\subsection[layOutStaticClosure]{Lay out a static closure}
-%* *
-%************************************************************************
-
-layOutStaticClosure is only used for laying out static constructors at
-the moment.
-
-Static closures for functions are laid out using
-layOutStaticNoFVClosure.
-
-\begin{code}
-layOutStaticClosure name kind_fn things lf_info
- = (MkClosureInfo name lf_info
- (GenericRep is_static ptr_wds (tot_wds - ptr_wds) closure_type),
- things_w_offsets)
- where
- (tot_wds, -- #ptr_wds + #nonptr_wds
- ptr_wds, -- #ptr_wds
- things_w_offsets) = mkVirtHeapOffsets kind_fn things
-
- -- constructors with no pointer fields will definitely be NOCAF things.
- -- this is a compromise until we can generate both kinds of constructor
- -- (a normal static kind and the NOCAF_STATIC kind).
- closure_type = getClosureType is_static tot_wds ptr_wds lf_info
- is_static = True
-
- bot = panic "layoutStaticClosure"
-
-layOutStaticNoFVClosure :: Name -> LambdaFormInfo -> ClosureInfo
-layOutStaticNoFVClosure name lf_info
- = MkClosureInfo name lf_info (GenericRep is_static 0 0 (getClosureType is_static 0 0 lf_info))
- where
- is_static = True
-\end{code}
-
-%************************************************************************
-%* *