X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FGranSim.h;h=be5aa83a52a0b53a5900ec60fb4778ab10fdd90b;hb=5c67b7e313b2455ca65d5aa5970d86889145e97e;hp=88c6ad9b7d875c0af21f658f34d7827637855b21;hpb=1b28d4e1f43185ad8c8e7407c66413e1b358402b;p=ghc-hetmet.git diff --git a/ghc/includes/GranSim.h b/ghc/includes/GranSim.h index 88c6ad9..be5aa83 100644 --- a/ghc/includes/GranSim.h +++ b/ghc/includes/GranSim.h @@ -1,7 +1,4 @@ /* - Time-stamp: - $Id: GranSim.h,v 1.2 2000/01/13 14:34:00 hwloidl Exp $ - Headers for GranSim specific objects. Note that in GranSim we have one run-queue and blocking-queue for each @@ -9,14 +6,15 @@ run_queue_hd to be relative to CurrentProc. The main arrays of runnable and blocking queues are defined in Schedule.c. The important STG-called GranSim macros (e.g. for fetching nodes) are at the end of this - file. Usually they are just wrappers to proper C functions in GranSim.c. */ + file. Usually they are just wrappers to proper C functions in GranSim.c. +*/ #ifndef GRANSIM_H #define GRANSIM_H #if !defined(GRAN) -//Dummy definitions for basic GranSim macros (see GranSim.h) +/* Dummy definitions for basic GranSim macros called from STG land */ #define DO_GRAN_ALLOCATE(n) /* nothing */ #define DO_GRAN_UNALLOCATE(n) /* nothing */ #define DO_GRAN_FETCH(node) /* nothing */ @@ -28,33 +26,25 @@ #if defined(GRAN) /* whole file */ -extern StgTSO *CurrentTSOs[]; - -//@node Headers for GranSim specific objects, , , -//@section Headers for GranSim specific objects - -//@menu -//* Includes:: -//* Externs and prototypes:: -//* Run and blocking queues:: -//* Spark queues:: -//* Processor related stuff:: -//* GranSim costs:: -//* STG called GranSim functions:: -//* STG-called routines:: -//@end menu - -//@node Includes, Externs and prototypes, Headers for GranSim specific objects, Headers for GranSim specific objects -//@subsection Includes +extern StgTSO *CurrentTSO; /* -#include "Closures.h" -#include "TSO.h" -#include "Rts.h" -*/ - -//@node Externs and prototypes, Run and blocking queues, Includes, Headers for GranSim specific objects -//@subsection Externs and prototypes + * @node Headers for GranSim specific objects, , , + * @section Headers for GranSim specific objects + * + * @menu + * * Externs and prototypes:: + * * Run and blocking queues:: + * * Spark queues:: + * * Processor related stuff:: + * * GranSim costs:: + * * STG called GranSim functions:: + * * STG-called routines:: + * @end menu + * + * @node Externs and prototypes, Run and blocking queues, Includes, Headers for GranSim specific objects + * @subsection Externs and prototypes + */ /* Global constants */ extern char *gran_event_names[]; @@ -73,8 +63,10 @@ extern nat SparksAvail; /* How many sparks are available */ extern nat SurplusThreads; /* How many excess threads are there */ extern nat sparksIgnored, sparksCreated; -//@node Run and blocking queues, Spark queues, Externs and prototypes, Headers for GranSim specific objects -//@subsection Run and blocking queues +/* + * @node Run and blocking queues, Spark queues, Externs and prototypes, Headers for GranSim specific objects + * @subsection Run and blocking queues + */ /* declared in Schedule.c */ extern StgTSO *run_queue_hds[], *run_queue_tls[]; @@ -89,24 +81,26 @@ extern StgTSO *ccalling_threadss[]; #define pending_sparks_tl pending_sparks_tls[CurrentProc] #define ccalling_threads ccalling_threadss[CurrentProc] -//@node Spark queues, Processor related stuff, Run and blocking queues, Headers for GranSim specific objects -//@subsection Spark queues - /* -In GranSim we use a double linked list to represent spark queues. + * @node Spark queues, Processor related stuff, Run and blocking queues, Headers for GranSim specific objects + * @subsection Spark queues + */ -This is more flexible, but slower, than the array of pointers -representation used in GUM. We use the flexibility to define new fields in -the rtsSpark structure, representing e.g. granularity info (see HWL's PhD -thesis), or info about the parent of a spark. +/* + In GranSim we use a double linked list to represent spark queues. + + This is more flexible, but slower, than the array of pointers + representation used in GUM. We use the flexibility to define new fields in + the rtsSpark structure, representing e.g. granularity info (see HWL's PhD + thesis), or info about the parent of a spark. */ /* Sparks and spark queues */ typedef struct rtsSpark_ { StgClosure *node; - StgInt name, global; - StgInt gran_info; /* for granularity improvement mechanisms */ + nat name, global; + nat gran_info; /* for granularity improvement mechanisms */ PEs creator; /* PE that created this spark (unused) */ struct rtsSpark_ *prev, *next; } rtsSpark; @@ -120,24 +114,28 @@ extern rtsSparkQ pending_sparks_tls[]; /* Prototypes of those spark routines visible to compiler generated .hc */ /* Routines only used inside the RTS are defined in rts/parallel GranSimRts.h */ rtsSpark *newSpark(StgClosure *node, - StgInt name, StgInt gran_info, StgInt size_info, - StgInt par_info, StgInt local); -void add_to_spark_queue(rtsSpark *spark); + nat name, nat gran_info, nat size_info, + nat par_info, nat local); +/* void add_to_spark_queue(rtsSpark *spark); */ -//@node Processor related stuff, GranSim costs, Spark queues, Headers for GranSim specific objects -//@subsection Processor related stuff +/* + * @node Processor related stuff, GranSim costs, Spark queues, Headers for GranSim specific objects + * @subsection Processor related stuff + */ extern PEs CurrentProc; extern rtsTime CurrentTime[]; /* Maximum number of PEs that can be simulated */ -#define MAX_PROC 32 /* (BITS_IN(StgWord)) */ // ToDo: fix this!! -//#if MAX_PROC==16 -//#else -//#error MAX_PROC should be 32 on this architecture -//#endif +#define MAX_PROC 32 /* (BITS_IN(StgWord)) */ /* ToDo: fix this!! */ +/* +#if MAX_PROC==16 +#else +#error MAX_PROC should be 32 on this architecture +#endif +*/ -#define CurrentTSO CurrentTSOs[CurrentProc] +/* #define CurrentTSO CurrentTSOs[CurrentProc] */ /* Processor numbers to bitmasks and vice-versa */ #define MainProc 0 /* Id of main processor */ @@ -157,8 +155,10 @@ extern rtsTime CurrentTime[]; #define GRAN_TIME_SLICE 1000 /* max time between 2 ReSchedules */ -//@node GranSim costs, STG called GranSim functions, Processor related stuff, Headers for GranSim specific objects -//@subsection GranSim costs +/* + * @node GranSim costs, STG called GranSim functions, Processor related stuff, Headers for GranSim specific objects + * @subsection GranSim costs + */ /* Default constants for communication (see RtsFlags on how to change them) */ @@ -203,8 +203,10 @@ extern rtsTime CurrentTime[]; #define PRI_SPARK_OVERHEAD 5 #define PRI_SCHED_OVERHEAD 5 -//@node STG called GranSim functions, STG-called routines, GranSim costs, Headers for GranSim specific objects -//@subsection STG called GranSim functions +/* + * @node STG called GranSim functions, STG-called routines, GranSim costs, Headers for GranSim specific objects + * @subsection STG called GranSim functions + */ /* STG called GranSim functions */ void GranSimAllocate(StgInt n); @@ -217,8 +219,10 @@ void GranSimSparkAtAbs(rtsSpark *spark, PEs proc, StgInt identifier); void GranSimBlock(StgTSO *tso, PEs proc, StgClosure *node); -//@node STG-called routines, , STG called GranSim functions, Headers for GranSim specific objects -//@subsection STG-called routines +/* + * @node STG-called routines, , STG called GranSim functions, Headers for GranSim specific objects + * @subsection STG-called routines + */ /* Wrapped version of calls to GranSim-specific STG routines */ @@ -233,13 +237,13 @@ void GranSimBlock(StgTSO *tso, PEs proc, StgClosure *node); /* ToDo: Clean up this mess of GRAN macros!!! -- HWL */ -// DO_GRAN_FETCH((StgClosure*)R1.p); +/* DO_GRAN_FETCH((StgClosure*)R1.p); */ #define GRAN_FETCH() /* nothing */ #define GRAN_FETCH_AND_RESCHEDULE(liveness,reenter) \ DO_GRAN_FETCH((StgClosure*)R1.p); \ DO_GRAN_YIELD(liveness,ENTRY_CODE((D_)(*R1.p))); -// RESTORE_EVERYTHING is done implicitly before entering threaded world agian +/* RESTORE_EVERYTHING is done implicitly before entering threaded world again */ /* This is the only macro currently enabled; @@ -271,11 +275,11 @@ void GranSimBlock(StgTSO *tso, PEs proc, StgClosure *node); } -// YIELD(liveness,reenter) +/* YIELD(liveness,reenter) */ -// GRAN_YIELD(liveness_mask); +/* GRAN_YIELD(liveness_mask); */ -// GRAN_FETCH_AND_RESCHEDULE(liveness_mask,reenter) +/* GRAN_FETCH_AND_RESCHEDULE(liveness_mask,reenter) */ #define THREAD_CONTEXT_SWITCH(liveness_mask,reenter) \ do { \ @@ -310,7 +314,7 @@ void GranSimBlock(StgTSO *tso, PEs proc, StgClosure *node); #define GRAN_YIELD(ptrs) \ { \ - extern nat context_switch; \ + extern int context_switch; \ if ( (CurrentTime[CurrentProc]>=EndOfTimeSlice) || \ ((CurrentTime[CurrentProc]>=TimeOfNextEvent) && \ (TimeOfNextEvent!=0) && !IgnoreEvents )) { \