%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
-% $Id: CgClosure.lhs,v 1.24 1999/03/02 14:34:36 sof Exp $
+% $Id: CgClosure.lhs,v 1.25 1999/03/11 11:32:25 simonm Exp $
%
\section[CgClosure]{Code generation for closures}
cgTopRhsClosure :: Id
-> CostCentreStack -- Optional cost centre annotation
-> StgBinderInfo
- -> SRT
-> [Id] -- Args
-> StgExpr
-> LambdaFormInfo
-> FCode (Id, CgIdInfo)
-cgTopRhsClosure id ccs binder_info srt args body lf_info
+cgTopRhsClosure id ccs binder_info args body lf_info
= -- LAY OUT THE OBJECT
let
closure_info = layOutStaticNoFVClosure name lf_info
`thenC`
-- GENERATE THE INFO TABLE (IF NECESSARY)
- forkClosureBody (closureCodeBody binder_info srt closure_info
+ forkClosureBody (closureCodeBody binder_info closure_info
ccs args body)
) `thenC`
:: Id
-> CostCentreStack -- Optional cost centre annotation
-> StgBinderInfo
- -> SRT -- SRT info
-> [Id] -- Free vars
-> [Id] -- Args
-> StgExpr
-> [StgArg] -- payload
-> FCode (Id, CgIdInfo)
-cgStdRhsClosure binder cc binder_info srt fvs args body lf_info payload
+cgStdRhsClosure binder cc binder_info fvs args body lf_info payload
-- AHA! A STANDARD-FORM THUNK
= (
-- LAY OUT THE OBJECT
cgRhsClosure :: Id
-> CostCentreStack -- Optional cost centre annotation
-> StgBinderInfo
- -> SRT -- SRT info
-> [Id] -- Free vars
-> [Id] -- Args
-> StgExpr
-> LambdaFormInfo
-> FCode (Id, CgIdInfo)
-cgRhsClosure binder cc binder_info srt fvs args body lf_info
+cgRhsClosure binder cc binder_info fvs args body lf_info
= (
-- LAY OUT THE OBJECT
--
nopC) `thenC`
-- Compile the body
- closureCodeBody binder_info srt closure_info cc args body
+ closureCodeBody binder_info closure_info cc args body
) `thenC`
-- BUILD THE OBJECT
\begin{code}
closureCodeBody :: StgBinderInfo
- -> SRT
-> ClosureInfo -- Lots of information about this closure
-> CostCentreStack -- Optional cost centre attached to closure
-> [Id]
are the same.
\begin{code}
-closureCodeBody binder_info srt closure_info cc [] body
+closureCodeBody binder_info closure_info cc [] body
= -- thunks cannot have a primitive type!
getAbsC body_code `thenFC` \ body_absC ->
moduleName `thenFC` \ mod_name ->
- getSRTLabel `thenFC` \ srt_label ->
absC (CClosureInfoAndCode closure_info body_absC Nothing
- (srt_label, srt) (cl_descr mod_name))
+ (cl_descr mod_name))
where
cl_descr mod_name = closureDescription mod_name (closureName closure_info)
Node points to closure is available. -- HWL
\begin{code}
-closureCodeBody binder_info srt closure_info cc all_args body
+closureCodeBody binder_info closure_info cc all_args body
= getEntryConvention name lf_info
(map idPrimRep all_args) `thenFC` \ entry_conv ->
`thenFC` \ slow_abs_c ->
forkAbsC fast_entry_code `thenFC` \ fast_abs_c ->
moduleName `thenFC` \ mod_name ->
- getSRTLabel `thenFC` \ srt_label ->
-- Now either construct the info table, or put the fast code in alone
-- (We never have slow code without an info table)
absC (
if info_table_needed then
CClosureInfoAndCode closure_info slow_abs_c (Just fast_abs_c)
- (srt_label, srt) (cl_descr mod_name)
+ (cl_descr mod_name)
else
CCodeBlock fast_label fast_abs_c
)