diff Vthread.h @ 28:b3a881f25c5a

Nearly compiles with in-process common_ancestor vers of VMS
author Some Random Person <seanhalle@yahoo.com>
date Sun, 04 Mar 2012 14:29:42 -0800
parents e5d4d5871ac9
children b94dc57e4455
line diff
     1.1 --- a/Vthread.h	Thu Mar 01 13:20:51 2012 -0800
     1.2 +++ b/Vthread.h	Sun Mar 04 14:29:42 2012 -0800
     1.3 @@ -6,21 +6,24 @@
     1.4   *
     1.5   */
     1.6  
     1.7 -#ifndef _VPThread_H
     1.8 -#define	_VPThread_H
     1.9 +#ifndef _Vthread_H
    1.10 +#define	_Vthread_H
    1.11 +
    1.12 +#define _LANG_NAME_ "Vthread"
    1.13  
    1.14  #include "VMS_impl/VMS.h"
    1.15  #include "C_Libraries/Queue_impl/PrivateQueue.h"
    1.16  #include "C_Libraries/DynArray/DynArray.h"
    1.17  
    1.18  
    1.19 -/*This header defines everything specific to the VPThread semantic plug-in
    1.20 +/*This header defines everything specific to the Vthread semantic plug-in
    1.21   */
    1.22  
    1.23  
    1.24  //===========================================================================
    1.25     //turn on the counter measurements of language overhead -- comment to turn off
    1.26  #define MEAS__TURN_ON_LANG_MEAS
    1.27 +#include "Vthread_Overhead_Meas.h"
    1.28  
    1.29  #define INIT_NUM_MUTEX 10000
    1.30  #define INIT_NUM_COND  10000
    1.31 @@ -29,7 +32,7 @@
    1.32  //===========================================================================
    1.33  
    1.34  //===========================================================================
    1.35 -typedef struct _VPThreadSemReq   VPThdSemReq;
    1.36 +typedef struct _VthreadSemReq   VthdSemReq;
    1.37  typedef void  (*PtrToAtomicFn )   ( void * ); //executed atomically in master
    1.38  //===========================================================================
    1.39  
    1.40 @@ -38,17 +41,17 @@
    1.41   */
    1.42  typedef struct
    1.43   {
    1.44 -   void           *endInstrAddr;
    1.45 +   void           *savedRetAddr;
    1.46     int32           hasBeenStarted;
    1.47     int32           hasFinished;
    1.48     PrivQueueStruc *waitQ;
    1.49   }
    1.50 -VPThdSingleton;
    1.51 +VthdSingleton;
    1.52  
    1.53  /*Semantic layer-specific data sent inside a request from lib called in app
    1.54   * to request handler called in MasterLoop
    1.55   */
    1.56 -enum VPThreadReqType
    1.57 +enum VthreadReqType
    1.58   {
    1.59     make_mutex = 1,
    1.60     mutex_lock,
    1.61 @@ -56,7 +59,7 @@
    1.62     make_cond,
    1.63     cond_wait,
    1.64     cond_signal,
    1.65 -   make_procr,
    1.66 +   make_slaveVP,
    1.67     malloc_req,
    1.68     free_req,
    1.69     singleton_fn_start,
    1.70 @@ -68,9 +71,9 @@
    1.71     trans_end
    1.72   };
    1.73  
    1.74 -struct _VPThreadSemReq
    1.75 - { enum VPThreadReqType reqType;
    1.76 -   SlaveVP           *requestingVP;
    1.77 +struct _VthreadSemReq
    1.78 + { enum VthreadReqType reqType;
    1.79 +   SlaveVP           *requestingSlv;
    1.80     int32                mutexIdx;
    1.81     int32                condIdx;
    1.82  
    1.83 @@ -82,22 +85,22 @@
    1.84     void                *ptrToFree;
    1.85  
    1.86     int32              singletonID;
    1.87 -   VPThdSingleton     **singletonPtrAddr;
    1.88 +   VthdSingleton     *singleton;
    1.89  
    1.90     PtrToAtomicFn      fnToExecInMaster;
    1.91     void              *dataForFn;
    1.92  
    1.93     int32              transID;
    1.94   }
    1.95 -/* VPThreadSemReq */;
    1.96 +/* VthreadSemReq */;
    1.97  
    1.98  
    1.99  typedef struct
   1.100   {
   1.101 -   SlaveVP      *VPCurrentlyExecuting;
   1.102 -   PrivQueueStruc *waitingVPQ;
   1.103 +   SlaveVP      *SlvCurrentlyExecuting;
   1.104 +   PrivQueueStruc *waitingSlvQ;
   1.105   }
   1.106 -VPThdTrans;
   1.107 +VthdTrans;
   1.108  
   1.109  
   1.110  typedef struct
   1.111 @@ -106,16 +109,16 @@
   1.112     SlaveVP      *holderOfLock;
   1.113     PrivQueueStruc *waitingQueue;
   1.114   }
   1.115 -VPThdMutex;
   1.116 +VthdMutex;
   1.117  
   1.118  
   1.119  typedef struct
   1.120   {
   1.121     int32           condIdx;
   1.122     PrivQueueStruc *waitingQueue;
   1.123 -   VPThdMutex       *partnerMutex;
   1.124 +   VthdMutex       *partnerMutex;
   1.125   }
   1.126 -VPThdCond;
   1.127 +VthdCond;
   1.128  
   1.129  typedef struct _TransListElem TransListElem;
   1.130  struct _TransListElem
   1.131 @@ -130,130 +133,129 @@
   1.132     int32          highestTransEntered;
   1.133     TransListElem *lastTransEntered;
   1.134   }
   1.135 -VPThdSemData;
   1.136 +VthdSemData;
   1.137  
   1.138  
   1.139  typedef struct
   1.140   {
   1.141        //Standard stuff will be in most every semantic env
   1.142 -   PrivQueueStruc  **readyVPQs;
   1.143 -   int32             numVirtVP;
   1.144 -   int32             nextCoreToGetNewVP;
   1.145 +   PrivQueueStruc  **readySlvQs;
   1.146 +   int32             nextCoreToGetNewSlv;
   1.147     int32             primitiveStartTime;
   1.148  
   1.149        //Specific to this semantic layer
   1.150 -   VPThdMutex      **mutexDynArray;
   1.151 +   VthdMutex       **mutexDynArray;
   1.152     PrivDynArrayInfo *mutexDynArrayInfo;
   1.153  
   1.154 -   VPThdCond       **condDynArray;
   1.155 +   VthdCond        **condDynArray;
   1.156     PrivDynArrayInfo *condDynArrayInfo;
   1.157  
   1.158     void             *applicationGlobals;
   1.159  
   1.160                         //fix limit on num with dynArray
   1.161 -   VPThdSingleton     fnSingletons[NUM_STRUCS_IN_SEM_ENV];
   1.162 +   VthdSingleton    fnSingletons[NUM_STRUCS_IN_SEM_ENV];
   1.163  
   1.164 -   VPThdTrans        transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
   1.165 +   VthdTrans        transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
   1.166   }
   1.167 -VPThdSemEnv;
   1.168 +VthdSemEnv;
   1.169  
   1.170  
   1.171  //===========================================================================
   1.172  
   1.173  inline void
   1.174 -VPThread__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
   1.175 +Vthread__create_seed_slaveVP_and_do_work( TopLevelFnPtr fn, void *initData );
   1.176  
   1.177  //=======================
   1.178  
   1.179  inline SlaveVP *
   1.180 -VPThread__create_thread( TopLevelFnPtr fnPtr, void *initData,
   1.181 -                          SlaveVP *creatingVP );
   1.182 +Vthread__create_thread( TopLevelFnPtr fnPtr, void *initData,
   1.183 +                          SlaveVP *creatingSlv );
   1.184  
   1.185  inline SlaveVP *
   1.186 -VPThread__create_thread_with_affinity( TopLevelFnPtr fnPtr, void *initData,
   1.187 -                          SlaveVP *creatingVP,  int32  coreToScheduleOnto );
   1.188 +Vthread__create_thread_with_affinity( TopLevelFnPtr fnPtr, void *initData,
   1.189 +                          SlaveVP *creatingSlv,  int32  coreToScheduleOnto );
   1.190  
   1.191  inline void
   1.192 -VPThread__dissipate_thread( SlaveVP *procrToDissipate );
   1.193 +Vthread__dissipate_thread( SlaveVP *procrToDissipate );
   1.194  
   1.195  //=======================
   1.196  inline void
   1.197 -VPThread__set_globals_to( void *globals );
   1.198 +Vthread__set_globals_to( void *globals );
   1.199  
   1.200  inline void *
   1.201 -VPThread__give_globals();
   1.202 +Vthread__give_globals();
   1.203  
   1.204  //=======================
   1.205  inline int32
   1.206 -VPThread__make_mutex( SlaveVP *animVP );
   1.207 +Vthread__make_mutex( SlaveVP *animSlv );
   1.208  
   1.209  inline void
   1.210 -VPThread__mutex_lock( int32 mutexIdx, SlaveVP *acquiringVP );
   1.211 +Vthread__mutex_lock( int32 mutexIdx, SlaveVP *acquiringSlv );
   1.212                                                      
   1.213  inline void
   1.214 -VPThread__mutex_unlock( int32 mutexIdx, SlaveVP *releasingVP );
   1.215 +Vthread__mutex_unlock( int32 mutexIdx, SlaveVP *releasingSlv );
   1.216  
   1.217  
   1.218  //=======================
   1.219  inline int32
   1.220 -VPThread__make_cond( int32 ownedMutexIdx, SlaveVP *animPr);
   1.221 +Vthread__make_cond( int32 ownedMutexIdx, SlaveVP *animSlv);
   1.222  
   1.223  inline void
   1.224 -VPThread__cond_wait( int32 condIdx, SlaveVP *waitingPr);
   1.225 +Vthread__cond_wait( int32 condIdx, SlaveVP *waitingSlv);
   1.226  
   1.227  inline void *
   1.228 -VPThread__cond_signal( int32 condIdx, SlaveVP *signallingVP );
   1.229 +Vthread__cond_signal( int32 condIdx, SlaveVP *signallingSlv );
   1.230  
   1.231  
   1.232  //=======================
   1.233  void
   1.234 -VPThread__start_fn_singleton( int32 singletonID, SlaveVP *animVP );
   1.235 +Vthread__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
   1.236  
   1.237  void
   1.238 -VPThread__end_fn_singleton( int32 singletonID, SlaveVP *animVP );
   1.239 +Vthread__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
   1.240  
   1.241  void
   1.242 -VPThread__start_data_singleton( VPThdSingleton **singeltonAddr, SlaveVP *animVP );
   1.243 +Vthread__start_data_singleton( VthdSingleton *singelton, SlaveVP *animSlv );
   1.244  
   1.245  void
   1.246 -VPThread__end_data_singleton( VPThdSingleton **singletonAddr, SlaveVP *animVP );
   1.247 +Vthread__end_data_singleton( VthdSingleton *singleton, SlaveVP *animSlv );
   1.248  
   1.249  void
   1.250 -VPThread__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
   1.251 -                                         void *data, SlaveVP *animVP );
   1.252 +Vthread__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
   1.253 +                                         void *data, SlaveVP *animSlv );
   1.254  
   1.255  void
   1.256 -VPThread__start_transaction( int32 transactionID, SlaveVP *animVP );
   1.257 +Vthread__start_transaction( int32 transactionID, SlaveVP *animSlv );
   1.258  
   1.259  void
   1.260 -VPThread__end_transaction( int32 transactionID, SlaveVP *animVP );
   1.261 +Vthread__end_transaction( int32 transactionID, SlaveVP *animSlv );
   1.262  
   1.263  
   1.264  
   1.265  //=========================  Internal use only  =============================
   1.266  inline void
   1.267 -VPThread__Request_Handler( SlaveVP *requestingVP, void *_semEnv );
   1.268 +Vthread__Request_Handler( SlaveVP *requestingSlv, void *_semEnv );
   1.269  
   1.270  inline SlaveVP *
   1.271 -VPThread__schedule_virt_procr( void *_semEnv, int coreNum );
   1.272 +Vthread__schedule_slaveVP( void *_semEnv, int coreNum );
   1.273  
   1.274  //=======================
   1.275  inline void
   1.276 -VPThread__free_semantic_request( VPThdSemReq *semReq );
   1.277 +Vthread__free_semantic_request( VthdSemReq *semReq );
   1.278  
   1.279  //=======================
   1.280  
   1.281  void *
   1.282 -VPThread__malloc( size_t sizeToMalloc, SlaveVP *animVP );
   1.283 +Vthread__malloc( size_t sizeToMalloc, SlaveVP *animSlv );
   1.284  
   1.285  void
   1.286 -VPThread__init();
   1.287 +Vthread__init();
   1.288  
   1.289  void
   1.290 -VPThread__cleanup_after_shutdown();
   1.291 +Vthread__cleanup_after_shutdown();
   1.292  
   1.293  void inline
   1.294 -resume_procr( SlaveVP *procr, VPThdSemEnv *semEnv );
   1.295 +resume_slaveVP( SlaveVP *procr, VthdSemEnv *semEnv );
   1.296  
   1.297 -#endif	/* _VPThread_H */
   1.298 +#endif	/* _Vthread_H */
   1.299