Skip to content

Commit

Permalink
A closure with void args only should be a function, not a thunk
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmar committed Aug 7, 2012
1 parent b534f42 commit 149e04b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions compiler/codeGen/StgCmmBind.hs
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,15 @@ closureCodeBody :: Bool -- whether this is a top-level binding
There info if Node points to closure is available. -- HWL -}

closureCodeBody top_lvl bndr cl_info cc args arity body fv_details
| length args == 0 -- No args i.e. thunk
| arity == 0 -- No args i.e. thunk
= emitClosureProcAndInfoTable top_lvl bndr lf_info info_tbl [] $
\(_, node, _) -> thunkCode cl_info fv_details cc node arity body
where
lf_info = closureLFInfo cl_info
info_tbl = mkCmmInfo cl_info

closureCodeBody top_lvl bndr cl_info _cc args arity body fv_details
= ASSERT( length args > 0 )
closureCodeBody top_lvl bndr cl_info cc args arity body fv_details
= -- Note: args may be [], if all args are Void
do { -- Allocate the global ticky counter,
-- and establish the ticky-counter
-- label for this block
Expand Down Expand Up @@ -464,7 +464,6 @@ mkSlowEntryCode :: ClosureInfo -> [LocalReg] -> FCode ()
-- If this function doesn't have a specialised ArgDescr, we need
-- to generate the function's arg bitmap and slow-entry code.
-- Here, we emit the slow-entry code.
mkSlowEntryCode _ [] = panic "entering a closure with no arguments?"
mkSlowEntryCode cl_info arg_regs -- function closure is already in `Node'
| Just (_, ArgGen _) <- closureFunInfo cl_info
= do dflags <- getDynFlags
Expand Down

0 comments on commit 149e04b

Please sign in to comment.