1 /* --------------------------------------------------------------------------
2 Time-stamp: <Wed Mar 29 2000 19:10:29 Stardate: [-30]4578.78 hwloidl>
3 $Id: ParallelRts.h,v 1.3 2000/03/31 03:09:37 hwloidl Exp $
5 Variables and functions specific to the parallel RTS (i.e. GUM or GranSim)
6 ----------------------------------------------------------------------- */
11 #if defined(GRAN) || defined(PAR)
16 extern nat tot_packets, tot_packet_size, tot_cuts, tot_thunks;
19 rtsPackBuffer *PackNearbyGraph(StgClosure* closure, StgTSO* tso,
21 rtsPackBuffer *PackOneNode(StgClosure* closure, StgTSO* tso,
23 rtsPackBuffer *PackTSO(StgTSO *tso, nat *packBufferSize);
24 rtsPackBuffer *PackStkO(StgPtr stko, nat *packBufferSize);
25 void PackFetchMe(StgClosure *closure);
28 StgClosure* UnpackGraph(rtsPackBuffer* buffer);
29 void InitPendingGABuffer(nat size);
32 StgClosure *convertToRBH(StgClosure *closure);
33 void convertFromRBH(StgClosure *closure);
36 rtsFetchReturnCode blockFetch(StgTSO* tso, PEs proc, StgClosure* bh);
37 void blockThread(StgTSO *tso);
39 /* General closure predicates */
41 {Parallel.h}Daq ngoqvam vIroQpu'
43 StgInfoTable *get_closure_info(StgClosure* node, nat *size, nat *ptrs, nat *nonptrs, nat *vhs, char *info_hdr_ty);
44 rtsBool IS_BLACK_HOLE(StgClosure* node);
45 StgClosure *IS_INDIRECTION(StgClosure* node);
46 rtsBool IS_THUNK(StgClosure* closure);
53 rtsPackBuffer *PackNearbyGraph(StgClosure* closure, StgTSO* tso,
57 void CommonUp(StgClosure *src, StgClosure *dst);
58 StgClosure *UnpackGraph(rtsPackBuffer *buffer, globalAddr **gamap,
62 StgClosure *convertToRBH(StgClosure *closure);
63 void convertToFetchMe(StgRBH *rbh, globalAddr *ga);
66 void blockFetch(StgBlockedFetch *bf, StgClosure *bh);
67 void blockThread(StgTSO *tso);
70 void GALAdeprecate(globalAddr *ga);
72 /* General closure predicates */
74 {Parallel.h}Daq ngoqvam vIroQpu'
76 StgInfoTable *get_closure_info(StgClosure* node, nat *size, nat *ptrs, nat *nonptrs, nat *vhs, char *info_hdr_ty);
77 rtsBool IS_BLACK_HOLE(StgClosure* node);
78 StgClosure *IS_INDIRECTION(StgClosure* node);
79 rtsBool IS_THUNK(StgClosure* closure);
84 /* this routine should be moved to a more general module; currently in Pack.c
85 StgInfoTable* get_closure_info(StgClosure* node,
86 nat *size, nat *ptrs, nat *nonptrs, nat *vhs,
89 void doGlobalGC(void);
91 //@node GC routines, Debugging routines, Spark handling routines
92 //@subsection GC routines
96 void freeRemoteGA(int pe, globalAddr *ga);
97 void sendFreeMessages(void);
100 void markLocalGAs(rtsBool full);
101 void RebuildGAtables(rtsBool full);
102 void RebuildLAGAtable(void);
105 //@node Debugging routines, Generating .gr profiles, GC routines
106 //@subsection Debugging routines
109 void printGA (globalAddr *ga);
110 void printGALA (GALA *gala);
111 void printLAGAtable(void);
113 rtsBool isOnLiveIndTable(globalAddr *ga);
114 rtsBool isOnRemoteGATable(globalAddr *ga);
115 void checkFreeGALAList(void);
116 void checkFreeIndirectionsList(void);
119 //@node Generating .gr profiles, Index, Debugging routines
120 //@subsection Generating .gr profiles
122 #define STATS_FILENAME_MAXLEN 128
124 /* Where to write the log file */
126 //@cindex gr_filename
127 extern FILE *gr_file;
128 extern char gr_filename[STATS_FILENAME_MAXLEN];
130 //@cindex init_gr_stats
131 //@cindex init_gr_simulation
132 //@cindex end_gr_simulation
133 void init_gr_stats (void);
134 void init_gr_simulation(int rts_argc, char *rts_argv[],
135 int prog_argc, char *prog_argv[]);
136 void end_gr_simulation(void);
138 // TODO: move fcts in here (as static inline)
139 StgInfoTable* get_closure_info(StgClosure* node, nat *size, nat *ptrs, nat *nonptrs, nat *vhs, char *info_hdr_ty);
140 rtsBool IS_BLACK_HOLE(StgClosure* node);
141 StgClosure *IS_INDIRECTION(StgClosure* node) ;
142 StgClosure *UNWIND_IND (StgClosure *closure);
145 #endif /* defined(PAR) || defined(GRAN) */
147 //@node Common macros, Index, Generating .gr profiles
148 //@subsection Common macros
150 #define LOOKS_LIKE_PTR(r) \
151 (LOOKS_LIKE_STATIC_CLOSURE(r) || \
152 ((HEAP_ALLOCED(r) && Bdescr((P_)r)->free != (void *)-1)))
154 /* see Sanity.c for this kind of test; doing this in these basic fcts
155 is paranoid (nuke it after debugging!)
158 /* pathetic version of the check whether p can be a closure */
159 #define LOOKS_LIKE_COOL_CLOSURE(p) 1
161 //LOOKS_LIKE_GHC_INFO(get_itbl(p))
163 /* Is it a static closure (i.e. in the data segment)? */ \
165 #define LOOKS_LIKE_COOL_CLOSURE(p) \
166 ((LOOKS_LIKE_STATIC(p)) ? \
168 : !closure_STATIC(p) && LOOKS_LIKE_PTR(p))
171 #endif /* PARALLEL_RTS_H */
173 //@node Index, , Index
177 //* IS_BLACK_HOLE:: @cindex\s-+IS_BLACK_HOLE
178 //* IS_INDIRECTION:: @cindex\s-+IS_INDIRECTION
179 //* end_gr_simulation:: @cindex\s-+end_gr_simulation
180 //* get_closure_info:: @cindex\s-+get_closure_info
181 //* gr_file:: @cindex\s-+gr_file
182 //* gr_filename:: @cindex\s-+gr_filename
183 //* init_gr_simulation:: @cindex\s-+init_gr_simulation
184 //* unwindInd:: @cindex\s-+unwindInd