summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/codeGen/StgCmmHeap.hs3
-rw-r--r--compiler/codeGen/StgCmmTicky.hs9
-rw-r--r--includes/Cmm.h2
-rw-r--r--includes/stg/Ticky.h3
-rw-r--r--rts/Linker.c2
-rw-r--r--rts/Ticky.c3
6 files changed, 21 insertions, 1 deletions
diff --git a/compiler/codeGen/StgCmmHeap.hs b/compiler/codeGen/StgCmmHeap.hs
index 50fcfdc812..0a817030e5 100644
--- a/compiler/codeGen/StgCmmHeap.hs
+++ b/compiler/codeGen/StgCmmHeap.hs
@@ -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
diff --git a/compiler/codeGen/StgCmmTicky.hs b/compiler/codeGen/StgCmmTicky.hs
index 09938a6704..6427138639 100644
--- a/compiler/codeGen/StgCmmTicky.hs
+++ b/compiler/codeGen/StgCmmTicky.hs
@@ -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
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 7e051c1a30..89baaa0987 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -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) \
}
diff --git a/includes/stg/Ticky.h b/includes/stg/Ticky.h
index 32a7f2006d..182c99654f 100644
--- a/includes/stg/Ticky.h
+++ b/includes/stg/Ticky.h
@@ -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);
diff --git a/rts/Linker.c b/rts/Linker.c
index 3f66313b76..585d1e8451 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -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) \
diff --git a/rts/Ticky.c b/rts/Ticky.c
index 243897fbe4..0d33c43d79 100644
--- a/rts/Ticky.c
+++ b/rts/Ticky.c
@@ -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);