- stmts = [CmmCall stg_gc_gen_target [] [] safety,
- CmmJump fun_expr actuals]
- stg_gc_gen_target =
- CmmForeignCall (CmmLit (CmmLabel stg_gc_gen)) CmmCallConv
- actuals = map (\x -> (CmmReg (CmmLocal x), NoHint)) formals
- fun_expr = CmmLit (CmmLabel fun_label)
-
-make_gc_check stack_use gc_block =
- [CmmCondBranch
- (CmmMachOp (MO_U_Lt $ cmmRegRep spReg)
- [CmmReg stack_use, CmmReg spLimReg])
- gc_block]
-
-force_gc_block old_info stack_use block_id fun_label formals =
- case old_info of
- CmmNonInfo (Just existing) -> (old_info, [], make_gc_check stack_use existing)
- CmmInfo _ (Just existing) _ _ -> (old_info, [], make_gc_check stack_use existing)
- CmmNonInfo Nothing
- -> (CmmNonInfo (Just block_id),
- [make_gc_block block_id fun_label formals (CmmSafe NoC_SRT)],
- make_gc_check stack_use block_id)
- CmmInfo prof Nothing type_tag type_info
- -> (CmmInfo prof (Just block_id) type_tag type_info,
- [make_gc_block block_id fun_label formals (CmmSafe srt)],
- make_gc_check stack_use block_id)
- where
- srt = case type_info of
- ConstrInfo _ _ _ -> NoC_SRT
- FunInfo _ srt' _ _ _ _ -> srt'
- ThunkInfo _ srt' -> srt'
- ThunkSelectorInfo _ srt' -> srt'
- ContInfo _ srt' -> srt'
+ check_stmts =
+ case info of
+ -- If we are given a stack check handler,
+ -- then great, well check the stack.
+ CmmInfo (Just gc_block) _ _
+ -> [CmmCondBranch
+ (CmmMachOp (MO_U_Lt $ cmmRegRep spReg)
+ [CmmReg stack_use, CmmReg spLimReg])
+ gc_block]
+ -- If we aren't given a stack check handler,
+ -- then humph! we just won't check the stack for them.
+ CmmInfo Nothing _ _
+ -> []