Commit 155d943c authored by nfrisby's avatar nfrisby

added ticky counters for heap and stack checks

parent 27cf625a
......@@ -570,10 +570,11 @@ do_checks mb_stk_hwm checkYield mb_alloc_lit do_gc = do
case mb_stk_hwm of
Nothing -> return ()
Just stk_hwm -> emit =<< mkCmmIfGoto (sp_oflo stk_hwm) gc_id
Just stk_hwm -> tickyStackCheck >> (emit =<< mkCmmIfGoto (sp_oflo stk_hwm) gc_id)
if (isJust mb_alloc_lit)
then do
tickyHeapCheck
emitAssign hpReg bump_hp
emit =<< mkCmmIfThen hp_oflo (alloc_n <*> mkBranch gc_id)
else do
......
......@@ -70,9 +70,12 @@ module StgCmmTicky (
tickyDynAlloc,
tickyAllocHeap,
tickyAllocPrim,
tickyAllocThunk,
tickyAllocPAP,
tickyHeapCheck,
tickyStackCheck,
tickyUnknownCall, tickyDirectCall,
......@@ -481,6 +484,12 @@ tickyAllocPAP _goods _slop = ifTicky $ do
bumpTickyCounterByE (fsLit "ALLOC_PAP_gds") _goods
bumpTickyCounterByE (fsLit "ALLOC_PAP_slp") _slop
tickyHeapCheck :: FCode ()
tickyHeapCheck = ifTicky $ bumpTickyCounter (fsLit "HEAP_CHK_ctr")
tickyStackCheck :: FCode ()
tickyStackCheck = ifTicky $ bumpTickyCounter (fsLit "STK_CHK_ctr")
-- -----------------------------------------------------------------------------
-- Ticky utils
......
......@@ -373,6 +373,7 @@
CCCS_ALLOC(bytes);
#define HEAP_CHECK(bytes,failure) \
TICK_BUMP(HEAP_CHK_ctr); \
Hp = Hp + (bytes); \
if (Hp > HpLim) { HpAlloc = (bytes); failure; } \
TICK_ALLOC_HEAP_NOCTR(bytes);
......@@ -476,6 +477,7 @@
}
#define STK_CHK(n, fun) \
TICK_BUMP(STK_CHK_ctr); \
if (Sp - (n) < SpLim) { \
GC_PRIM(fun) \
}
......
......@@ -111,6 +111,9 @@ EXTERN StgInt UPD_PAP_IN_PLACE_ctr INIT(0);
EXTERN StgInt ALLOC_HEAP_ctr INIT(0);
EXTERN StgInt ALLOC_HEAP_tot INIT(0);
EXTERN StgInt HEAP_CHK_ctr INIT(0);
EXTERN StgInt STK_CHK_ctr INIT(0);
EXTERN StgInt ALLOC_RTS_ctr INIT(0);
EXTERN StgInt ALLOC_RTS_tot INIT(0);
......
......@@ -958,6 +958,8 @@ typedef struct _RtsSymbolVal {
SymI_HasProto(UPD_PAP_IN_PLACE_ctr) \
SymI_HasProto(ALLOC_HEAP_ctr) \
SymI_HasProto(ALLOC_HEAP_tot) \
SymI_HasProto(HEAP_CHK_ctr) \
SymI_HasProto(STK_CHK_ctr) \
SymI_HasProto(ALLOC_RTS_ctr) \
SymI_HasProto(ALLOC_RTS_tot) \
SymI_HasProto(ALLOC_FUN_ctr) \
......
......@@ -330,6 +330,9 @@ PrintTickyInfo(void)
PR_CTR(ALLOC_HEAP_ctr);
PR_CTR(ALLOC_HEAP_tot);
PR_CTR(HEAP_CHK_ctr);
PR_CTR(STK_CHK_ctr);
PR_CTR(ALLOC_RTS_ctr);
PR_CTR(ALLOC_RTS_tot);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment