From: simonmar Date: Fri, 14 Jan 2000 14:56:40 +0000 (+0000) Subject: [project @ 2000-01-14 14:56:40 by simonmar] X-Git-Tag: Approximately_9120_patches~5285 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=7c1923545f7ea643a03ff37084dcb9a92695133e;p=ghc-hetmet.git [project @ 2000-01-14 14:56:40 by simonmar] Move closure type printing stuff to Printer.c, since it's generally useful. --- diff --git a/ghc/rts/Printer.c b/ghc/rts/Printer.c index 600d0a2..c8059ab 100644 --- a/ghc/rts/Printer.c +++ b/ghc/rts/Printer.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- - * $Id: Printer.c,v 1.19 2000/01/13 14:34:04 hwloidl Exp $ + * $Id: Printer.c,v 1.20 2000/01/14 14:56:40 simonmar Exp $ * - * Copyright (c) 1994-1999. + * (c) The GHC Team, 1994-2000. * * Heap printer * @@ -475,6 +475,95 @@ void printTSO( StgTSO *tso ) /* printStackChunk( tso->sp, tso->stack+tso->stack_size); */ } +/* ----------------------------------------------------------------------------- + Closure types + + NOTE: must be kept in sync with the closure types in includes/ClosureTypes.h + -------------------------------------------------------------------------- */ + +static char *closure_type_names[] = { + "INVALID_OBJECT", /* 0 */ + "CONSTR", /* 1 */ + "CONSTR_1_0", /* 2 */ + "CONSTR_0_1", /* 3 */ + "CONSTR_2_0", /* 4 */ + "CONSTR_1_1", /* 5 */ + "CONSTR_0_2", /* 6 */ + "CONSTR_INTLIKE", /* 7 */ + "CONSTR_CHARLIKE", /* 8 */ + "CONSTR_STATIC", /* 9 */ + "CONSTR_NOCAF_STATIC", /* 10 */ + "FUN", /* 11 */ + "FUN_1_0", /* 12 */ + "FUN_0_1", /* 13 */ + "FUN_2_0", /* 14 */ + "FUN_1_1", /* 15 */ + "FUN_0_2", /* 16 */ + "FUN_STATIC", /* 17 */ + "THUNK", /* 18 */ + "THUNK_1_0", /* 19 */ + "THUNK_0_1", /* 20 */ + "THUNK_2_0", /* 21 */ + "THUNK_1_1", /* 22 */ + "THUNK_0_2", /* 23 */ + "THUNK_STATIC", /* 24 */ + "THUNK_SELECTOR", /* 25 */ + "BCO", /* 26 */ + "AP_UPD", /* 27 */ + "PAP", /* 28 */ + "IND", /* 29 */ + "IND_OLDGEN", /* 30 */ + "IND_PERM", /* 31 */ + "IND_OLDGEN_PERM", /* 32 */ + "IND_STATIC", /* 33 */ + "CAF_UNENTERED", /* 34 */ + "CAF_ENTERED", /* 35 */ + "CAF_BLACKHOLE", /* 36 */ + "RET_BCO", /* 37 */ + "RET_SMALL", /* 38 */ + "RET_VEC_SMALL", /* 39 */ + "RET_BIG", /* 40 */ + "RET_VEC_BIG", /* 41 */ + "RET_DYN", /* 42 */ + "UPDATE_FRAME", /* 43 */ + "CATCH_FRAME", /* 44 */ + "STOP_FRAME", /* 45 */ + "SEQ_FRAME", /* 46 */ + "BLACKHOLE", /* 47 */ + "BLACKHOLE_BQ", /* 48 */ + "SE_BLACKHOLE", /* 49 */ + "SE_CAF_BLACKHOLE", /* 50 */ + "MVAR", /* 51 */ + "ARR_WORDS", /* 52 */ + "MUT_ARR_PTRS", /* 53 */ + "MUT_ARR_PTRS_FROZEN", /* 54 */ + "MUT_VAR", /* 55 */ + "WEAK", /* 56 */ + "FOREIGN", /* 57 */ + "STABLE_NAME", /* 58 */ + "TSO", /* 59 */ + "BLOCKED_FETCH", /* 60 */ + "FETCH_ME", /* 61 */ + "EVACUATED", /* 62 */ + "N_CLOSURE_TYPES", /* 63 */ + "FETCH_ME_BQ", /* 64 */ + "RBH" /* 65 */ +}; + +char * +info_type(StgClosure *closure){ + return closure_type_names[get_itbl(closure)->type]; +} + +char * +info_type_by_ip(StgInfoTable *ip){ + return closure_type_names[ip->type]; +} + +void +info_hdr_type(StgClosure *closure, char *res){ + strcpy(res,closure_type_names[get_itbl(closure)->type]); +} /* -------------------------------------------------------------------------- * Address printing code @@ -698,7 +787,7 @@ static void printZcoded( const char *raw ) /* Causing linking trouble on Win32 plats, so I'm disabling this for now. */ -#if defined(HAVE_BFD_H) && !defined(_WIN32) && defined(USE_BSD) +#if defined(HAVE_BFD_H) && !defined(_WIN32) #include @@ -797,7 +886,7 @@ extern void DEBUG_LoadSymbols( char *name ) #else /* HAVE_BFD_H */ -extern void DEBUG_LoadSymbols( char *name ) +extern void DEBUG_LoadSymbols( char *name STG_UNUSED ) { /* nothing, yet */ } diff --git a/ghc/rts/Printer.h b/ghc/rts/Printer.h index b44847e..0e3977a 100644 --- a/ghc/rts/Printer.h +++ b/ghc/rts/Printer.h @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- - * $Id: Printer.h,v 1.4 1999/06/29 13:04:40 panne Exp $ + * $Id: Printer.h,v 1.5 2000/01/14 14:56:40 simonmar Exp $ * - * (c) The GHC Team, 1998-1999 + * (c) The GHC Team, 1998-2000 * * Prototypes for functions in Printer.c * @@ -18,6 +18,9 @@ extern void printStack ( StgStackPtr sp, StgStackPtr spLim, StgUpdateFrame* su ); extern void printTSO ( StgTSO *tso ); +void info_hdr_type ( StgClosure *closure, char *res ); +char * info_type ( StgClosure *closure ); +char * info_type_by_ip ( StgInfoTable *ip ); extern void DEBUG_LoadSymbols( char *name ); diff --git a/ghc/rts/parallel/ParallelDebug.c b/ghc/rts/parallel/ParallelDebug.c index f9dbb19..8d467d5 100644 --- a/ghc/rts/parallel/ParallelDebug.c +++ b/ghc/rts/parallel/ParallelDebug.c @@ -32,6 +32,7 @@ Various debugging routines for GranSim and GUM #include "GranSimRts.h" #include "ParallelRts.h" #include "StgMiscClosures.h" +#include "Printer.h" # if defined(DEBUG) # include "ParallelDebug.h" # endif @@ -45,77 +46,6 @@ rtsBool isFixed(globalAddr *ga); //@node Constants and Variables, Closures, Prototypes, Debugging routines for GranSim and GUM //@subsection Constants and Variables -/* Names as strings; needed by get_closure_info in ClosureMacros.h -- HWL */ -static char *closure_type_names[] = { - "INVALID_OBJECT", /* 0 */ - "CONSTR", /* 1 */ - "CONSTR_1_0", /* 2 */ - "CONSTR_0_1", /* 3 */ - "CONSTR_2_0", /* 4 */ - "CONSTR_1_1", /* 5 */ - "CONSTR_0_2", /* 6 */ - "CONSTR_INTLIKE", /* 7 */ - "CONSTR_CHARLIKE", /* 8 */ - "CONSTR_STATIC", /* 9 */ - "CONSTR_NOCAF_STATIC", /* 10 */ - "FUN", /* 11 */ - "FUN_1_0", /* 12 */ - "FUN_0_1", /* 13 */ - "FUN_2_0", /* 14 */ - "FUN_1_1", /* 15 */ - "FUN_0_2", /* 16 */ - "FUN_STATIC", /* 17 */ - "THUNK", /* 18 */ - "THUNK_1_0", /* 19 */ - "THUNK_0_1", /* 20 */ - "THUNK_2_0", /* 21 */ - "THUNK_1_1", /* 22 */ - "THUNK_0_2", /* 23 */ - "THUNK_STATIC", /* 24 */ - "THUNK_SELECTOR", /* 25 */ - "BCO", /* 26 */ - "AP_UPD", /* 27 */ - "PAP", /* 28 */ - "IND", /* 29 */ - "IND_OLDGEN", /* 30 */ - "IND_PERM", /* 31 */ - "IND_OLDGEN_PERM", /* 32 */ - "IND_STATIC", /* 33 */ - "CAF_UNENTERED", /* 34 */ - "CAF_ENTERED", /* 35 */ - "CAF_BLACKHOLE", /* 36 */ - "RET_BCO", /* 37 */ - "RET_SMALL", /* 38 */ - "RET_VEC_SMALL", /* 39 */ - "RET_BIG", /* 40 */ - "RET_VEC_BIG", /* 41 */ - "RET_DYN", /* 42 */ - "UPDATE_FRAME", /* 43 */ - "CATCH_FRAME", /* 44 */ - "STOP_FRAME", /* 45 */ - "SEQ_FRAME", /* 46 */ - "BLACKHOLE", /* 47 */ - "BLACKHOLE_BQ", /* 48 */ - "SE_BLACKHOLE", /* 49 */ - "SE_CAF_BLACKHOLE", /* 50 */ - "MVAR", /* 51 */ - "ARR_WORDS", /* 52 */ - "MUT_ARR_PTRS", /* 53 */ - "MUT_ARR_PTRS_FROZEN", /* 54 */ - "MUT_VAR", /* 55 */ - "WEAK", /* 56 */ - "FOREIGN", /* 57 */ - "STABLE_NAME", /* 58 */ - "TSO", /* 59 */ - "BLOCKED_FETCH", /* 60 */ - "FETCH_ME", /* 61 */ - "EVACUATED", /* 62 */ - "N_CLOSURE_TYPES", /* 63 */ - "FETCH_ME_BQ", /* 64 */ - "RBH" /* 65 */ -}; - - #if defined(GRAN) && defined(GRAN_CHECK) //@node Closures, Threads, Constants and Variables, Debugging routines for GranSim and GUM //@subsection Closures @@ -810,21 +740,6 @@ char *str; return(str); } -char * -info_type(StgClosure *closure){ - return closure_type_names[get_itbl(closure)->type]; -} - -char * -info_type_by_ip(StgInfoTable *ip){ - return closure_type_names[ip->type]; -} - -void -info_hdr_type(StgClosure *closure, char *res){ - strcpy(res,closure_type_names[get_itbl(closure)->type]); -} - /* PrintPacket is in Pack.c because it makes use of closure queues */ @@ -1387,26 +1302,5 @@ PrintGraph(StgClosure *p, int indent_level) #endif /* GRAN || PAR */ -#if !defined(GRAN) && !defined(PAR) -// just dummy defs in this setup -#include "Rts.h" -#include "ParallelDebug.h" - -char * -info_type(StgClosure *closure){ - return "petaQ"; -} - -char * -info_type_by_ip(StgInfoTable *ip){ - return "petaQ"; -} - -void -info_hdr_type(StgClosure *closure, char *res){ - strcpy(res,"petaQ"); -} -#endif /* GRAN || PAR */ - //@node End of File, , Printing Packet Contents, Debugging routines for GranSim and GUM //@subsection End of File diff --git a/ghc/rts/parallel/ParallelDebug.h b/ghc/rts/parallel/ParallelDebug.h index ad573c1..427b892 100644 --- a/ghc/rts/parallel/ParallelDebug.h +++ b/ghc/rts/parallel/ParallelDebug.h @@ -37,21 +37,10 @@ void GIT(StgPtr node); #if defined(GRAN) || defined(PAR) char *display_info_type(StgClosure *closure, char *str); -void info_hdr_type(StgClosure *closure, char *res); -char *info_type(StgClosure *closure); -char *info_type_by_ip(StgInfoTable *ip); void PrintPacket(rtsPackBuffer *buffer); void PrintGraph(StgClosure *p, int indent_level); #endif /* GRAN || PAR */ -#if !defined(GRAN) && !defined(PAR) - -void info_hdr_type(StgClosure *closure, char *res); -char *info_type(StgClosure *closure); -char *info_type_by_ip(StgInfoTable *ip); - -#endif - #endif /* PARALLEL_DEBUG_H */