- [MagicId] -- Its register assignments
- -- (possibly empty)
-
-getEntryConvention :: Name -- Function being applied
- -> LambdaFormInfo -- Its info
- -> [PrimRep] -- Available arguments
- -> FCode EntryConvention
-
-getEntryConvention name lf_info arg_kinds
- = nodeMustPointToIt lf_info `thenFC` \ node_points ->
- returnFC (
-
- -- if we're parallel, then we must always enter via node. The reason
- -- is that the closure may have been fetched since we allocated it.
-
- if (node_points && opt_Parallel) then ViaNode else
-
- -- Commented out by SDM after futher thoughts:
- -- - the only closure type that can be blackholed is a thunk
- -- - we already enter thunks via node (unless the closure is
- -- non-updatable, in which case why is it being re-entered...)
-
- case lf_info of
-
- LFReEntrant _ _ arity _ ->
- if arity == 0 || (length arg_kinds) < arity then
- StdEntry (mkStdEntryLabel name)
- else
- DirectEntry (mkFastEntryLabel name arity) arity arg_regs
- where
- (arg_regs, _) = assignRegs live_regs (take arity arg_kinds)
- live_regs = if node_points then [node] else []
-
- LFCon con True{-zero_arity-}
- -- a real constructor. Don't bother entering it, just jump
- -- to the constructor entry code directly.
- -> --false:ASSERT (null arg_kinds)
- -- Should have no args (meaning what?)
- StdEntry (mkStaticConEntryLabel (dataConName con))
-
- LFCon con False{-non-zero_arity-}
- -> --false:ASSERT (null arg_kinds)
- -- Should have no args (meaning what?)
- StdEntry (mkConEntryLabel (dataConName con))
-
- LFTuple tup zero_arity
- -> --false:ASSERT (null arg_kinds)
- -- Should have no args (meaning what?)
- StdEntry (mkConEntryLabel (dataConName tup))
-
- LFThunk _ _ _ updatable std_form_info
- -> if updatable
- then ViaNode
- else StdEntry (thunkEntryLabel name std_form_info updatable)
-
- LFArgument -> ViaNode
- LFImported -> ViaNode
- LFBlackHole -> ViaNode -- Presumably the black hole has by now
- -- been updated, but we don't know with
- -- what, so we enter via Node
-
- LFLetNoEscape 0
- -> StdEntry (mkReturnPtLabel (nameUnique name))
-
- LFLetNoEscape arity
- -> ASSERT(arity == length arg_kinds)
- DirectEntry (mkReturnPtLabel (nameUnique name)) arity arg_regs
- where
- (arg_regs, _) = assignRegs [] arg_kinds
- -- node never points to a LetNoEscape, see above --SDM
- --live_regs = if node_points then [node] else []
- )