diff VMS.h @ 57:85b731b290f8

Merge between VCilk and SSR intermediate Nov 4
author Me
date Thu, 04 Nov 2010 18:27:27 -0700
parents 420a09d3f32a f8508572f3de
children 26d53313a8f2
line diff
     1.1 --- a/VMS.h	Thu Nov 04 17:57:39 2010 -0700
     1.2 +++ b/VMS.h	Thu Nov 04 18:27:27 2010 -0700
     1.3 @@ -22,6 +22,10 @@
     1.4  
     1.5  
     1.6  //===============================  Debug  ===================================
     1.7 +   //These defines turn types of bug messages on and off
     1.8 +#define dbgProbes FALSE
     1.9 +#define dbgAppFlow FALSE
    1.10 +
    1.11     //When SEQUENTIAL is defined, VMS does sequential exe in the main thread
    1.12     // It still does co-routines and all the mechanisms are the same, it just
    1.13     // has only a single thread and animates VPs one at a time
    1.14 @@ -32,7 +36,8 @@
    1.15  #define STATS__ENABLE_PROBES
    1.16  
    1.17  
    1.18 -#define PRINT_DEBUG(msg)// printf(msg); fflush(stdin);
    1.19 +#define DEBUG(msg)// printf(msg); fflush(stdin);
    1.20 +#define DEBUG_MSG( bool, msg) //if( bool){ printf(msg); fflush(stdin);}
    1.21  #define PRINT1_DEBUG(msg, param) //printf(msg, param); fflush(stdin);
    1.22  #define PRINT2_DEBUG(msg, p1, p2) //printf(msg, p1, p2); fflush(stdin);
    1.23  
    1.24 @@ -40,7 +45,6 @@
    1.25  #define PRINT1_ERROR(msg, param) printf(msg, param); fflush(stdin);
    1.26  #define PRINT2_ERROR(msg, p1, p2) printf(msg, p1, p2); fflush(stdin);
    1.27  
    1.28 -
    1.29  //===========================  STATS =======================
    1.30  
    1.31     //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and
    1.32 @@ -65,13 +69,13 @@
    1.33  
    1.34  #define MIN_WORK_UNIT_CYCLES 20000
    1.35  
    1.36 -#define READYTOANIMATE_RETRIES 10000
    1.37 +#define MASTERLOCK_RETRIES 10000
    1.38  
    1.39 -   // stack
    1.40 -#define VIRT_PROCR_STACK_SIZE 0x4000
    1.41 +   // stack size in virtual processors created
    1.42 +#define VIRT_PROCR_STACK_SIZE 0x4000 /* 16K */
    1.43  
    1.44 -   // memory for VMS__malloc -- 256M
    1.45 -#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x10000000
    1.46 +   // memory for VMS__malloc
    1.47 +#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x10000000 /* 256M */
    1.48  
    1.49  
    1.50  //==============================
    1.51 @@ -163,7 +167,7 @@
    1.52     VMSReqst   *requests;
    1.53  
    1.54     void       *semanticData; //this lives here for the life of VP
    1.55 -   void       *dataReturnedFromReq;//values returned from plugin to VP go here
    1.56 +   void       *dataRetFromReq;//values returned from plugin to VP go here
    1.57  
    1.58        //=========== MEASUREMENT STUFF ==========
    1.59     #ifdef MEAS__TIME_STAMP_SUSP
    1.60 @@ -205,14 +209,19 @@
    1.61  
    1.62        //=========== MEASUREMENT STUFF =============
    1.63     IntervalProbe  **intervalProbes;
    1.64 -   DynArrayInfo    *dynIntervalProbesInfo;
    1.65 +   PrivDynArrayInfo    *dynIntervalProbesInfo;
    1.66     HashTable       *probeNameHashTbl;
    1.67     int32            masterCreateProbeID;
    1.68     float64          createPtInSecs;
    1.69   }
    1.70  MasterEnv;
    1.71  
    1.72 +//=============================
    1.73 +typedef struct
    1.74 + {
    1.75  
    1.76 + }
    1.77 +VMSExcp;
    1.78  
    1.79  
    1.80  //=======================  OS Thread related  ===============================
    1.81 @@ -245,7 +254,8 @@
    1.82  
    1.83  //===========================  Function Prototypes  =========================
    1.84  
    1.85 -//============== Setup and shutdown =============
    1.86 +
    1.87 +//========== Setup and shutdown ==========
    1.88  void
    1.89  VMS__init();
    1.90  
    1.91 @@ -261,16 +271,25 @@
    1.92  VirtProcr *
    1.93  VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData );
    1.94  
    1.95 +void
    1.96 +VMS__dissipate_procr( VirtProcr *procrToDissipate );
    1.97 +
    1.98     //Use this to create processor inside entry point & other places outside
    1.99     // the VMS system boundary (IE, not run in slave nor Master)
   1.100  VirtProcr *
   1.101  VMS_ext__create_procr( VirtProcrFnPtr fnPtr, void *initialData );
   1.102  
   1.103 -VirtProcr *
   1.104 -VMS__create_the_shutdown_procr();
   1.105 +void
   1.106 +VMS_ext__dissipate_procr( VirtProcr *procrToDissipate );
   1.107  
   1.108  void
   1.109 -VMS__cleanup_after_shutdown();
   1.110 +VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData );
   1.111 +
   1.112 +void
   1.113 +VMS__shutdown();
   1.114 +
   1.115 +void
   1.116 +VMS__cleanup_at_end_of_shutdown();
   1.117  
   1.118  
   1.119  //==============  Request Related  ===============
   1.120 @@ -279,49 +298,29 @@
   1.121  VMS__suspend_procr( VirtProcr *callingPr );
   1.122  
   1.123  inline void
   1.124 -VMS__add_sem_request( void *semReqData, VirtProcr *callingPr );
   1.125 +VMS__add_sem_request_in_mallocd_VMSReqst( void *semReqData, VirtProcr *callingPr );
   1.126 +
   1.127 +inline void
   1.128 +VMS__send_sem_request( void *semReqData, VirtProcr *callingPr );
   1.129  
   1.130  void
   1.131  VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr );
   1.132  
   1.133 +void inline
   1.134 +VMS__send_dissipate_req( VirtProcr *prToDissipate );
   1.135 +
   1.136  inline void
   1.137  VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr );
   1.138  
   1.139 -void
   1.140 -VMS__free_request( VMSReqst *req );
   1.141 -
   1.142 -void
   1.143 -VMS__remove_and_free_top_request( VirtProcr *reqstingPr );
   1.144 -
   1.145  VMSReqst *
   1.146  VMS__take_next_request_out_of( VirtProcr *procrWithReq );
   1.147  
   1.148  inline void *
   1.149  VMS__take_sem_reqst_from( VMSReqst *req );
   1.150 -//
   1.151 -//VMSReqst *
   1.152 -//VMS__take_top_request_from( VirtProcr *reqstingPr );
   1.153 -//
   1.154 -//inline int
   1.155 -//VMS__isSemanticReqst( VMSReqst *req );
   1.156 -//
   1.157 -//inline int
   1.158 -//VMS__isDissipateReqst( VMSReqst *req );
   1.159 -//
   1.160 -//inline int
   1.161 -//VMS__isCreateReqst( VMSReqst *req );
   1.162  
   1.163 -//==========================
   1.164 +//======================== STATS ======================
   1.165  
   1.166 -void inline
   1.167 -VMS__send_dissipate_req( VirtProcr *prToDissipate );
   1.168 -
   1.169 -void
   1.170 -VMS__dissipate_procr( VirtProcr *procrToDissipate );
   1.171 -
   1.172 -
   1.173 -
   1.174 -//===================== RDTSC wrapper ==================
   1.175 +//===== RDTSC wrapper =====
   1.176  
   1.177  #define saveTimeStampCountInto(low, high) \
   1.178     asm volatile("RDTSC;                   \
   1.179 @@ -339,8 +338,7 @@
   1.180     /* inputs  */ :                        \
   1.181     /* clobber */ : "%eax", "%edx"         \
   1.182                  );
   1.183 -
   1.184 -//======================== STATS ======================
   1.185 +//=====
   1.186  
   1.187  #include "probes.h"
   1.188