From 8e346b863084d46a87251cae1d8a71de7bf1fd0f Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 14 Sep 1999 12:16:39 +0000 Subject: [PATCH] [project @ 1999-09-14 12:16:36 by simonmar] A couple of fixes and cleanups to ticky-ticky profiling: - remove UPD_EXISTING (doesn't make sense) - add UPD_CON_IN_PLACE, now that we have in-place updates - clean up the output a little. --- ghc/compiler/codeGen/CgCon.lhs | 4 ++++ ghc/includes/StgTicky.h | 18 ++++++++++++------ ghc/rts/Ticky.c | 30 +++++++++++++++++------------- ghc/rts/Updates.hc | 37 ++++++++----------------------------- 4 files changed, 41 insertions(+), 48 deletions(-) diff --git a/ghc/compiler/codeGen/CgCon.lhs b/ghc/compiler/codeGen/CgCon.lhs index 5ab41b1..5fa258b 100644 --- a/ghc/compiler/codeGen/CgCon.lhs +++ b/ghc/compiler/codeGen/CgCon.lhs @@ -328,6 +328,10 @@ cgReturnDataCon con amodes all_zero_size_args uniq = getUnique con temp = CTemp uniq PtrRep in + + profCtrC SLIT("TICK_UPD_CON_IN_PLACE") + [mkIntCLit (length amodes)] `thenC` + getSpRelOffset args_sp `thenFC` \ sp_rel -> absC (CAssign temp (CMacroExpr PtrRep UPD_FRAME_UPDATEE [CAddr sp_rel])) diff --git a/ghc/includes/StgTicky.h b/ghc/includes/StgTicky.h index dc0a478..cf68671 100644 --- a/ghc/includes/StgTicky.h +++ b/ghc/includes/StgTicky.h @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- - * $Id: StgTicky.h,v 1.5 1999/06/24 13:10:31 simonmar Exp $ + * $Id: StgTicky.h,v 1.6 1999/09/14 12:16:39 simonmar Exp $ * * (c) The AQUA project, Glasgow University, 1994-1997 * (c) The GHC Team, 1998-1999 @@ -239,11 +239,10 @@ extern struct ent_counter *ticky_entry_ctrs; Macro Where ----------------------- -------------------------------------------- - TICK_UPD_EXISTING Updating with an indirection to something - already in the heap TICK_UPD_SQUEEZED Same as UPD_EXISTING but because of stack-squeezing TICK_UPD_CON_IN_NEW Allocating a new CON + TICK_UPD_CON_IN_PLACE Updating with a PAP in place TICK_UPD_PAP_IN_NEW Allocating a new PAP TICK_UPD_PAP_IN_PLACE Updating with a PAP in place @@ -254,12 +253,14 @@ extern struct ent_counter *ticky_entry_ctrs; __idx = (n); \ UPD_##categ##_hst[((__idx > 8) ? 8 : __idx)] += 1;} -#define TICK_UPD_EXISTING() UPD_EXISTING_ctr++ #define TICK_UPD_SQUEEZED() UPD_SQUEEZED_ctr++ #define TICK_UPD_CON_IN_NEW(n) UPD_CON_IN_NEW_ctr++ ; \ TICK_UPD_HISTO(CON_IN_NEW,n) +#define TICK_UPD_CON_IN_PLACE(n) UPD_CON_IN_PLACE_ctr++; \ + TICK_UPD_HISTO(CON_IN_PLACE,n) + #define TICK_UPD_PAP_IN_NEW(n) UPD_PAP_IN_NEW_ctr++ ; \ TICK_UPD_HISTO(PAP_IN_NEW,n) @@ -495,9 +496,9 @@ EXTERN unsigned long CATCHF_PUSHED_ctr INIT(0); EXTERN unsigned long UPDF_RCC_PUSHED_ctr INIT(0); EXTERN unsigned long UPDF_RCC_OMITTED_ctr INIT(0); -EXTERN unsigned long UPD_EXISTING_ctr INIT(0); EXTERN unsigned long UPD_SQUEEZED_ctr INIT(0); EXTERN unsigned long UPD_CON_IN_NEW_ctr INIT(0); +EXTERN unsigned long UPD_CON_IN_PLACE_ctr INIT(0); EXTERN unsigned long UPD_PAP_IN_NEW_ctr INIT(0); EXTERN unsigned long UPD_PAP_IN_PLACE_ctr INIT(0); @@ -506,6 +507,11 @@ EXTERN unsigned long UPD_CON_IN_NEW_hst[9] = {0,0,0,0,0,0,0,0,0} #endif ; +EXTERN unsigned long UPD_CON_IN_PLACE_hst[9] +#ifdef TICKY_C + = {0,0,0,0,0,0,0,0,0} +#endif +; EXTERN unsigned long UPD_PAP_IN_NEW_hst[9] #ifdef TICKY_C = {0,0,0,0,0,0,0,0,0} @@ -583,9 +589,9 @@ EXTERN unsigned long GC_WORDS_COPIED_ctr INIT(0); #define TICK_UPDF_RCC_PUSHED() #define TICK_UPDF_RCC_OMITTED() -#define TICK_UPD_EXISTING() #define TICK_UPD_SQUEEZED() #define TICK_UPD_CON_IN_NEW(n) +#define TICK_UPD_CON_IN_PLACE(n) #define TICK_UPD_PAP_IN_NEW(n) #define TICK_UPD_PAP_IN_PLACE() diff --git a/ghc/rts/Ticky.c b/ghc/rts/Ticky.c index 1828aa8..81bad57 100644 --- a/ghc/rts/Ticky.c +++ b/ghc/rts/Ticky.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Ticky.c,v 1.8 1999/06/24 13:10:32 simonmar Exp $ + * $Id: Ticky.c,v 1.9 1999/09/14 12:16:36 simonmar Exp $ * * (c) The AQUA project, Glasgow University, 1992-1997 * (c) The GHC Team, 1998-1999 @@ -81,9 +81,10 @@ PrintTickyInfo(void) unsigned long tot_returns_of_new = RET_NEW_ctr; + unsigned long con_updates = UPD_CON_IN_NEW_ctr + UPD_CON_IN_PLACE_ctr; unsigned long pap_updates = UPD_PAP_IN_NEW_ctr + UPD_PAP_IN_PLACE_ctr; - unsigned long tot_updates = UPD_EXISTING_ctr + UPD_SQUEEZED_ctr + pap_updates; + unsigned long tot_updates = UPD_SQUEEZED_ctr + pap_updates + con_updates; unsigned long tot_new_updates = UPD_NEW_IND_ctr + UPD_NEW_PERM_IND_ctr; unsigned long tot_old_updates = UPD_OLD_IND_ctr + UPD_OLD_PERM_IND_ctr; @@ -241,30 +242,33 @@ PrintTickyInfo(void) UPDF_RCC_OMITTED_ctr); fprintf(tf,"\nUPDATES: %ld\n", tot_updates); - fprintf(tf,"%7ld (%5.1f%%) data values\n", - UPD_CON_IN_NEW_ctr, - PC(INTAVG(UPD_CON_IN_NEW_ctr,tot_updates))); + fprintf(tf,"%7ld (%5.1f%%) data values\n\t\t [%ld in place, %ld allocated new space]\n", + con_updates, + PC(INTAVG(con_updates,tot_updates)), + UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr); fprintf(tf,"%7ld (%5.1f%%) partial applications\n\t\t [%ld in place, %ld allocated new space]\n", pap_updates, PC(INTAVG(pap_updates,tot_updates)), UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr); - fprintf(tf,"%7ld (%5.1f%%) updates to existing heap objects (%ld by squeezing)\n", - UPD_EXISTING_ctr + UPD_SQUEEZED_ctr, - PC(INTAVG(UPD_EXISTING_ctr + UPD_SQUEEZED_ctr, tot_updates)), - UPD_SQUEEZED_ctr); + fprintf(tf,"%7ld (%5.1f%%) updates by squeezing\n", + UPD_SQUEEZED_ctr, + PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates))); - fprintf(tf, "UPD_CON_IN_NEW: %7ld: ", UPD_CON_IN_NEW_ctr); + fprintf(tf, "\nUPD_CON_IN_NEW: %7ld: ", UPD_CON_IN_NEW_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_NEW_hst[i]); } fprintf(tf, "\n"); + fprintf(tf, "UPD_CON_IN_PLACE: %7ld: ", UPD_CON_IN_PLACE_ctr); + for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_PLACE_hst[i]); } + fprintf(tf, "\n"); fprintf(tf, "UPD_PAP_IN_NEW: %7ld: ", UPD_PAP_IN_NEW_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_PAP_IN_NEW_hst[i]); } fprintf(tf, "\n"); if (tot_gengc_updates != 0) { - fprintf(tf,"\nNEW GEN UPDATES: %ld (%5.1f%%)\n", + fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n", tot_new_updates, PC(INTAVG(tot_new_updates,tot_gengc_updates))); - fprintf(tf,"\nOLD GEN UPDATES: %ld (%5.1f%%)\n", + fprintf(tf,"OLD GEN UPDATES: %9ld (%5.1f%%)\n", tot_old_updates, PC(INTAVG(tot_old_updates,tot_gengc_updates))); } @@ -488,9 +492,9 @@ PrintTickyInfo(void) PR_CTR(UPDF_RCC_PUSHED_ctr); PR_CTR(UPDF_RCC_OMITTED_ctr); - PR_CTR(UPD_EXISTING_ctr); PR_CTR(UPD_SQUEEZED_ctr); PR_CTR(UPD_CON_IN_NEW_ctr); + PR_CTR(UPD_CON_IN_PLACE_ctr); PR_CTR(UPD_PAP_IN_NEW_ctr); PR_CTR(UPD_PAP_IN_PLACE_ctr); diff --git a/ghc/rts/Updates.hc b/ghc/rts/Updates.hc index 5c64e4d..aad6dc1 100644 --- a/ghc/rts/Updates.hc +++ b/ghc/rts/Updates.hc @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Updates.hc,v 1.18 1999/07/06 16:40:28 sewardj Exp $ + * $Id: Updates.hc,v 1.19 1999/09/14 12:16:36 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -52,11 +52,14 @@ { \ StgClosure *updatee; \ FB_ \ - /* tick - ToDo: check this is right */ \ - TICK_UPD_EXISTING(); \ \ updatee = ((StgUpdateFrame *)Sp)->updatee; \ - \ + \ + /* Tick - it must be a con, all the paps are handled \ + * in stg_upd_PAP and PAP_entry below \ + */ \ + TICK_UPD_CON_IN_NEW(sizeW_fromITBL(get_itbl(updatee))); \ + \ /* update the updatee with an indirection to the return value */\ UPD_IND(updatee,R1.p); \ \ @@ -70,31 +73,7 @@ FE_ \ } -//UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_entry,ENTRY_CODE(Sp[0])); - STGFUN(Upd_frame_entry); - STGFUN(Upd_frame_entry) - { - StgClosure *updatee; - FB_ - /* tick - ToDo: check this is right */ - TICK_UPD_EXISTING(); - - updatee = ((StgUpdateFrame *)Sp)->updatee; - - /* update the updatee with an indirection to the return value */ - UPD_IND(updatee,R1.p); - - /* reset Su to the next update frame */ - Su = ((StgUpdateFrame *)Sp)->link; - - /* remove the update frame from the stack */ - Sp += sizeofW(StgUpdateFrame); - - JMP_(ENTRY_CODE(Sp[0])); - FE_ - } - - +UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_entry,ENTRY_CODE(Sp[0])); UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_0_entry,RET_VEC(Sp[0],0)); UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_1_entry,RET_VEC(Sp[0],1)); UPD_FRAME_ENTRY_TEMPLATE(Upd_frame_2_entry,RET_VEC(Sp[0],2)); -- 1.7.10.4