-\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
- -> C_SRT
- -> (ClosureInfo, -- info about the closure
- [(a, VirtualHeapOffset)]) -- things w/ offsets pinned on them
-
-layOutDynClosure name kind_fn things lf_info srt_info
- = (MkClosureInfo { closureName = name, closureLFInfo = lf_info,
- closureSMRep = sm_rep, closureSRT = srt_info },
- 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}
-
-Wrappers for when used with data constructors:
-
-\begin{code}
-layOutDynConstr, layOutStaticConstr
- :: Name -- Of the closure
- -> DataCon
- -> (a -> PrimRep) -> [a]
- -> (ClosureInfo, [(a,VirtualHeapOffset)])
-
-layOutDynConstr name data_con kind_fn args
- = layOutDynClosure name kind_fn args (mkConLFInfo data_con) NoC_SRT
-
-layOutStaticConstr name data_con kind_fn things
- = layOutStaticClosure name kind_fn things (mkConLFInfo data_con) NoC_SRT
-\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 srt_info
- = (MkClosureInfo { closureName = name, closureLFInfo = lf_info,
- closureSMRep = rep, closureSRT = srt_info },
- things_w_offsets)
- where
- rep = GenericRep is_static ptr_wds (tot_wds - ptr_wds) closure_type
-
- (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
-
-layOutStaticNoFVClosure :: Name -> LambdaFormInfo -> C_SRT -> ClosureInfo
-layOutStaticNoFVClosure name lf_info srt_info
- = MkClosureInfo { closureName = name, closureLFInfo = lf_info,
- closureSMRep = rep, closureSRT = srt_info }
- where
- rep = GenericRep is_static 0 0 (getClosureType is_static 0 0 lf_info)
- is_static = True
-\end{code}
-
-%************************************************************************
-%* *