diff VCilk.h @ 6:58d0c2b1d6a4

removed warnings
author Merten Sach <msach@mailbox.tu-berlin.de>
date Wed, 11 May 2011 16:11:06 +0200
parents 5494943ed3a4
children 5131f941f42c
line diff
     1.1 --- a/VCilk.h	Wed May 11 15:29:58 2011 +0200
     1.2 +++ b/VCilk.h	Wed May 11 16:11:06 2011 +0200
     1.3 @@ -1,200 +1,200 @@
     1.4 -/*
     1.5 - *  Copyright 2009 OpenSourceStewardshipFoundation.org
     1.6 - *  Licensed under GNU General Public License version 2
     1.7 - *
     1.8 - * Author: seanhalle@yahoo.com
     1.9 - *
    1.10 - */
    1.11 -
    1.12 -#ifndef _VCilk_H
    1.13 -#define	_VCilk_H
    1.14 -
    1.15 -#include "VMS/Queue_impl/PrivateQueue.h"
    1.16 -#include "VMS/Hash_impl/PrivateHash.h"
    1.17 -#include "VMS/VMS.h"
    1.18 -
    1.19 -
    1.20 -
    1.21 -/*This header defines everything specific to the VCilk semantic plug-in
    1.22 - */
    1.23 -
    1.24 -//===========================================================================
    1.25 -#define NUM_STRUCS_IN_SEM_ENV 1000
    1.26 -
    1.27 -//===========================================================================
    1.28 -typedef struct _VCilkSemReq   VCilkSemReq;
    1.29 -typedef void  (*PtrToAtomicFn )   ( void * ); //executed atomically in master
    1.30 -
    1.31 -//===========================================================================
    1.32 -
    1.33 -
    1.34 -/*WARNING: assembly hard-codes position of endInstrAddr as first field
    1.35 - */
    1.36 -typedef struct
    1.37 - {
    1.38 -   void           *endInstrAddr;
    1.39 -   int32           hasBeenStarted;
    1.40 -   int32           hasFinished;
    1.41 -   PrivQueueStruc *waitQ;
    1.42 - }
    1.43 -VCilkSingleton;
    1.44 -
    1.45 -/*Semantic layer-specific data sent inside a request from lib called in app
    1.46 - * to request handler called in MasterLoop
    1.47 - */
    1.48 -enum VCilkReqType
    1.49 - {
    1.50 -   syncReq = 1,
    1.51 -   mallocReq,
    1.52 -   freeReq,
    1.53 -   singleton_fn_start,
    1.54 -   singleton_fn_end,
    1.55 -   singleton_data_start,
    1.56 -   singleton_data_end,
    1.57 -   atomic,
    1.58 -   trans_start,
    1.59 -   trans_end
    1.60 - };
    1.61 -
    1.62 -struct _VCilkSemReq
    1.63 - { enum VCilkReqType    reqType;
    1.64 -   VirtProcr           *requestingPr;
    1.65 -   
    1.66 -   int32                sizeToMalloc;
    1.67 -   void                *ptrToFree;
    1.68 -   
    1.69 -   VirtProcrFnPtr       fnPtr;
    1.70 -   void                *initData;
    1.71 -   int32                coreToSpawnOnto;
    1.72 -
    1.73 -   int32              singletonID;
    1.74 -   VCilkSingleton     **singletonPtrAddr;
    1.75 -
    1.76 -   PtrToAtomicFn      fnToExecInMaster;
    1.77 -   void              *dataForFn;
    1.78 -
    1.79 -   int32              transID;
    1.80 - }
    1.81 -/* VCilkSemReq */;
    1.82 -
    1.83 -typedef struct
    1.84 - {
    1.85 -   VirtProcr      *VPCurrentlyExecuting;
    1.86 -   PrivQueueStruc *waitingVPQ;
    1.87 - }
    1.88 -VCilkTrans;
    1.89 -
    1.90 -typedef struct
    1.91 - {
    1.92 -   PrivQueueStruc **readyVPQs;
    1.93 -   HashTable       *commHashTbl;
    1.94 -   int32            numVirtPr;
    1.95 -   int32            nextCoreToGetNewPr;
    1.96 -   int32            primitiveStartTime;
    1.97 -
    1.98 -                       //fix limit on num with dynArray
    1.99 -   VCilkSingleton     fnSingletons[NUM_STRUCS_IN_SEM_ENV];
   1.100 -   VCilkTrans       transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
   1.101 - }
   1.102 -VCilkSemEnv;
   1.103 -
   1.104 -typedef struct _TransListElem TransListElem;
   1.105 -struct _TransListElem
   1.106 - {
   1.107 -   int32          transID;
   1.108 -   TransListElem *nextTrans;
   1.109 - };
   1.110 -//TransListElem
   1.111 -
   1.112 -typedef struct
   1.113 - {
   1.114 -   int32          syncPending;
   1.115 -   int32          numLiveChildren;
   1.116 -   VirtProcr     *parentPr;
   1.117 -   
   1.118 -   int32          highestTransEntered;
   1.119 -   TransListElem *lastTransEntered;
   1.120 - }
   1.121 -VCilkSemData;
   1.122 -
   1.123 -//===========================================================================
   1.124 -
   1.125 -void
   1.126 -VCilk__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
   1.127 -
   1.128 -int32
   1.129 -VCilk__giveMinWorkUnitCycles( float32 percentOverhead );
   1.130 -
   1.131 -void inline
   1.132 -VCilk__start_primitive();
   1.133 -
   1.134 -int32 inline
   1.135 -VCilk__end_primitive_and_give_cycles();
   1.136 -
   1.137 -int32
   1.138 -VCilk__giveIdealNumWorkUnits();
   1.139 -
   1.140 -//=======================
   1.141 -
   1.142 -void
   1.143 -VCilk__init();
   1.144 -
   1.145 -void
   1.146 -VCilk__cleanup_at_end_of_shutdown();
   1.147 -
   1.148 -//=======================
   1.149 -
   1.150 -void inline
   1.151 -VCilk__spawn( int32  coreToSpawnOnto, VirtProcrFnPtr  fnPtr,
   1.152 -              void  *initData,        VirtProcr      *creatingPr );
   1.153 -
   1.154 -int32
   1.155 -VCilk__give_number_of_cores_to_spawn_onto();
   1.156 -
   1.157 -void
   1.158 -VCilk__sync( VirtProcr *animatingPr );
   1.159 -
   1.160 -void *
   1.161 -VCilk__malloc( int32 sizeToMalloc, VirtProcr *animPr );
   1.162 -
   1.163 -void
   1.164 -VCilk__free( void *ptrToFree, VirtProcr *animPr );
   1.165 -
   1.166 -void
   1.167 -VCilk__dissipate_procr( VirtProcr *procrToDissipate );
   1.168 -
   1.169 -
   1.170 -//======================= Concurrency Stuff ======================
   1.171 -void
   1.172 -VCilk__start_fn_singleton( int32 singletonID, VirtProcr *animPr );
   1.173 -
   1.174 -void
   1.175 -VCilk__end_fn_singleton( int32 singletonID, VirtProcr *animPr );
   1.176 -
   1.177 -void
   1.178 -VCilk__start_data_singleton( VCilkSingleton **singeltonAddr, VirtProcr *animPr );
   1.179 -
   1.180 -void
   1.181 -VCilk__end_data_singleton( VCilkSingleton **singletonAddr, VirtProcr *animPr );
   1.182 -
   1.183 -void
   1.184 -VCilk__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
   1.185 -                                      void *data, VirtProcr *animPr );
   1.186 -
   1.187 -void
   1.188 -VCilk__start_transaction( int32 transactionID, VirtProcr *animPr );
   1.189 -
   1.190 -void
   1.191 -VCilk__end_transaction( int32 transactionID, VirtProcr *animPr );
   1.192 -
   1.193 -
   1.194 -//=========================  Internal use only  =============================
   1.195 -void
   1.196 -VCilk__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
   1.197 -
   1.198 -VirtProcr *
   1.199 -VCilk__schedule_virt_procr( void *_semEnv, int coreNum );
   1.200 -
   1.201 -
   1.202 -#endif	/* _VCilk_H */
   1.203 -
   1.204 +/*
   1.205 + *  Copyright 2009 OpenSourceStewardshipFoundation.org
   1.206 + *  Licensed under GNU General Public License version 2
   1.207 + *
   1.208 + * Author: seanhalle@yahoo.com
   1.209 + *
   1.210 + */
   1.211 +
   1.212 +#ifndef _VCilk_H
   1.213 +#define	_VCilk_H
   1.214 +
   1.215 +#include "VMS/Queue_impl/PrivateQueue.h"
   1.216 +#include "VMS/Hash_impl/PrivateHash.h"
   1.217 +#include "VMS/VMS.h"
   1.218 +
   1.219 +
   1.220 +
   1.221 +/*This header defines everything specific to the VCilk semantic plug-in
   1.222 + */
   1.223 +
   1.224 +//===========================================================================
   1.225 +#define NUM_STRUCS_IN_SEM_ENV 1000
   1.226 +
   1.227 +//===========================================================================
   1.228 +typedef struct _VCilkSemReq   VCilkSemReq;
   1.229 +typedef void  (*PtrToAtomicFn )   ( void * ); //executed atomically in master
   1.230 +
   1.231 +//===========================================================================
   1.232 +
   1.233 +
   1.234 +/*WARNING: assembly hard-codes position of endInstrAddr as first field
   1.235 + */
   1.236 +typedef struct
   1.237 + {
   1.238 +   void           *endInstrAddr;
   1.239 +   int32           hasBeenStarted;
   1.240 +   int32           hasFinished;
   1.241 +   PrivQueueStruc *waitQ;
   1.242 + }
   1.243 +VCilkSingleton;
   1.244 +
   1.245 +/*Semantic layer-specific data sent inside a request from lib called in app
   1.246 + * to request handler called in MasterLoop
   1.247 + */
   1.248 +enum VCilkReqType
   1.249 + {
   1.250 +   syncReq = 1,
   1.251 +   mallocReq,
   1.252 +   freeReq,
   1.253 +   singleton_fn_start,
   1.254 +   singleton_fn_end,
   1.255 +   singleton_data_start,
   1.256 +   singleton_data_end,
   1.257 +   atomic,
   1.258 +   trans_start,
   1.259 +   trans_end
   1.260 + };
   1.261 +
   1.262 +struct _VCilkSemReq
   1.263 + { enum VCilkReqType    reqType;
   1.264 +   VirtProcr           *requestingPr;
   1.265 +   
   1.266 +   int32                sizeToMalloc;
   1.267 +   void                *ptrToFree;
   1.268 +   
   1.269 +   VirtProcrFnPtr       fnPtr;
   1.270 +   void                *initData;
   1.271 +   int32                coreToSpawnOnto;
   1.272 +
   1.273 +   int32              singletonID;
   1.274 +   VCilkSingleton     **singletonPtrAddr;
   1.275 +
   1.276 +   PtrToAtomicFn      fnToExecInMaster;
   1.277 +   void              *dataForFn;
   1.278 +
   1.279 +   int32              transID;
   1.280 + }
   1.281 +/* VCilkSemReq */;
   1.282 +
   1.283 +typedef struct
   1.284 + {
   1.285 +   VirtProcr      *VPCurrentlyExecuting;
   1.286 +   PrivQueueStruc *waitingVPQ;
   1.287 + }
   1.288 +VCilkTrans;
   1.289 +
   1.290 +typedef struct
   1.291 + {
   1.292 +   PrivQueueStruc **readyVPQs;
   1.293 +   HashTable       *commHashTbl;
   1.294 +   int32            numVirtPr;
   1.295 +   int32            nextCoreToGetNewPr;
   1.296 +   int32            primitiveStartTime;
   1.297 +
   1.298 +                       //fix limit on num with dynArray
   1.299 +   VCilkSingleton     fnSingletons[NUM_STRUCS_IN_SEM_ENV];
   1.300 +   VCilkTrans       transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
   1.301 + }
   1.302 +VCilkSemEnv;
   1.303 +
   1.304 +typedef struct _TransListElem TransListElem;
   1.305 +struct _TransListElem
   1.306 + {
   1.307 +   int32          transID;
   1.308 +   TransListElem *nextTrans;
   1.309 + };
   1.310 +//TransListElem
   1.311 +
   1.312 +typedef struct
   1.313 + {
   1.314 +   int32          syncPending;
   1.315 +   int32          numLiveChildren;
   1.316 +   VirtProcr     *parentPr;
   1.317 +   
   1.318 +   int32          highestTransEntered;
   1.319 +   TransListElem *lastTransEntered;
   1.320 + }
   1.321 +VCilkSemData;
   1.322 +
   1.323 +//===========================================================================
   1.324 +
   1.325 +void
   1.326 +VCilk__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
   1.327 +
   1.328 +int32
   1.329 +VCilk__giveMinWorkUnitCycles( float32 percentOverhead );
   1.330 +
   1.331 +void inline
   1.332 +VCilk__start_primitive();
   1.333 +
   1.334 +int32 inline
   1.335 +VCilk__end_primitive_and_give_cycles();
   1.336 +
   1.337 +int32
   1.338 +VCilk__giveIdealNumWorkUnits();
   1.339 +
   1.340 +//=======================
   1.341 +
   1.342 +void
   1.343 +VCilk__init();
   1.344 +
   1.345 +void
   1.346 +VCilk__cleanup_at_end_of_shutdown();
   1.347 +
   1.348 +//=======================
   1.349 +
   1.350 +void inline
   1.351 +VCilk__spawn( int32  coreToSpawnOnto, VirtProcrFnPtr  fnPtr,
   1.352 +              void  *initData,        VirtProcr      *creatingPr );
   1.353 +
   1.354 +int32
   1.355 +VCilk__give_number_of_cores_to_spawn_onto();
   1.356 +
   1.357 +void
   1.358 +VCilk__sync( VirtProcr *animatingPr );
   1.359 +
   1.360 +void *
   1.361 +VCilk__malloc( int32 sizeToMalloc, VirtProcr *animPr );
   1.362 +
   1.363 +void
   1.364 +VCilk__free( void *ptrToFree, VirtProcr *animPr );
   1.365 +
   1.366 +void
   1.367 +VCilk__dissipate_procr( VirtProcr *procrToDissipate );
   1.368 +
   1.369 +
   1.370 +//======================= Concurrency Stuff ======================
   1.371 +void
   1.372 +VCilk__start_fn_singleton( int32 singletonID, VirtProcr *animPr );
   1.373 +
   1.374 +void
   1.375 +VCilk__end_fn_singleton( int32 singletonID, VirtProcr *animPr );
   1.376 +
   1.377 +void
   1.378 +VCilk__start_data_singleton( VCilkSingleton **singeltonAddr, VirtProcr *animPr );
   1.379 +
   1.380 +void
   1.381 +VCilk__end_data_singleton( VCilkSingleton **singletonAddr, VirtProcr *animPr );
   1.382 +
   1.383 +void
   1.384 +VCilk__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
   1.385 +                                      void *data, VirtProcr *animPr );
   1.386 +
   1.387 +void
   1.388 +VCilk__start_transaction( int32 transactionID, VirtProcr *animPr );
   1.389 +
   1.390 +void
   1.391 +VCilk__end_transaction( int32 transactionID, VirtProcr *animPr );
   1.392 +
   1.393 +
   1.394 +//=========================  Internal use only  =============================
   1.395 +void
   1.396 +VCilk__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
   1.397 +
   1.398 +VirtProcr *
   1.399 +VCilk__schedule_virt_procr( void *_semEnv, int coreNum );
   1.400 +
   1.401 +
   1.402 +#endif	/* _VCilk_H */
   1.403 +