Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
changeset 257:f5b110414453 Common_Ancestor
fix coding standard to work with -std=gnu99 -Wall
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 25 Sep 2012 16:11:15 +0200 |
| parents | 2bcf37fd50c6 |
| children | aa79134dbc88 |
| files | AnimationMaster.c CoreController.c HW_Dependent_Primitives/VMS__HW_measurement.c HW_Dependent_Primitives/VMS__HW_measurement.h HW_Dependent_Primitives/VMS__primitives.c HW_Dependent_Primitives/VMS__primitives.h Services_Offered_by_VMS/Lang_Constructs/VMS_Lang.h Services_Offered_by_VMS/Measurement_and_Stats/probes.c Services_Offered_by_VMS/Memory_Handling/vmalloc.c VMS.h VMS__PI.c VMS__WL.c VMS__int.c VMS__startup_and_shutdown.c |
| diffstat | 14 files changed, 69 insertions(+), 56 deletions(-) [+] |
line diff
1.1 --- a/AnimationMaster.c Mon Sep 10 01:26:51 2012 -0700 1.2 +++ b/AnimationMaster.c Tue Sep 25 16:11:15 2012 +0200 1.3 @@ -11,7 +11,8 @@ 1.4 1.5 #include "VMS.h" 1.6 1.7 - 1.8 +#include <unistd.h> 1.9 +ssize_t read(int fd, void *buf, size_t count); 1.10 1.11 /*The animationMaster embodies most of the animator of the language. The 1.12 * animator is what emodies the behavior of language constructs.
2.1 --- a/CoreController.c Mon Sep 10 01:26:51 2012 -0700 2.2 +++ b/CoreController.c Tue Sep 25 16:11:15 2012 +0200 2.3 @@ -14,13 +14,16 @@ 2.4 #include <pthread.h> 2.5 #include <sched.h> 2.6 2.7 +#include <unistd.h> 2.8 +ssize_t read(int fd, void *buf, size_t count); 2.9 + 2.10 //===================== Functions local to this file ======================= 2.11 void *terminateCoreController(SlaveVP *currSlv); 2.12 2.13 -inline void 2.14 +void 2.15 doBackoff_for_TooLongToGetLock( int32 numTriesToGetLock, uint32 *seed1, 2.16 uint32 *seed2 ); 2.17 -inline void 2.18 +void 2.19 doBackoff_for_TooLongWithNoWork( int32 numRepsWithNoWork, uint32 *seed1, 2.20 uint32 *seed2 ); 2.21 2.22 @@ -81,7 +84,9 @@ 2.23 cpu_set_t coreMask; //used during pinning pthread to CPU core 2.24 int32 errorCode; 2.25 //Variables used during measurements 2.26 +#ifdef MEAS__TURN_ON_SYSTEM_MEAS 2.27 TSCountLowHigh endSusp; 2.28 +#endif 2.29 //Variables used in random-backoff, for master-lock and waiting for work 2.30 uint32_t seed1 = rand()%1000; // init random number generator for backoffs 2.31 uint32_t seed2 = rand()%1000; 2.32 @@ -120,7 +125,7 @@ 2.33 2.34 HOLISTIC__CoreCtrl_Setup; 2.35 2.36 - DEBUG__printf1(TRUE, "started coreCtrlr", thisCoresIdx ); 2.37 + DEBUG__printf1(TRUE, "started coreCtrlr on core %d", thisCoresIdx ); 2.38 2.39 //====================== The Core Controller ====================== 2.40 while(1) //An endless loop is just one way of doing the control structure 2.41 @@ -222,7 +227,7 @@ 2.42 pthread_exit( NULL ); 2.43 } 2.44 2.45 -inline uint32_t 2.46 +uint32_t 2.47 randomNumber() 2.48 { 2.49 _VMSMasterEnv->seed1 = (uint32)(36969 * (_VMSMasterEnv->seed1 & 65535) + 2.50 @@ -237,7 +242,7 @@ 2.51 /*Busy-wait for a random number of cycles -- chooses number of cycles 2.52 * differently than for the too-many-tries-to-get-lock backoff 2.53 */ 2.54 -inline void 2.55 +void 2.56 doBackoff_for_TooLongWithNoWork( int32 numRepsWithNoWork, uint32 *seed1, 2.57 uint32 *seed2 ) 2.58 { int32 i, waitIterations; 2.59 @@ -256,7 +261,7 @@ 2.60 /*Busy-waits for a random number of cycles -- chooses number of cycles 2.61 * differently than for the no-work backoff 2.62 */ 2.63 -inline void 2.64 +void 2.65 doBackoff_for_TooLongToGetLock( int32 numTriesToGetLock, uint32 *seed1, 2.66 uint32 *seed2 ) 2.67 { int32 i, waitIterations;
3.1 --- a/HW_Dependent_Primitives/VMS__HW_measurement.c Mon Sep 10 01:26:51 2012 -0700 3.2 +++ b/HW_Dependent_Primitives/VMS__HW_measurement.c Tue Sep 25 16:11:15 2012 +0200 3.3 @@ -4,6 +4,7 @@ 3.4 #include <linux/perf_event.h> 3.5 #include <errno.h> 3.6 #include <sys/syscall.h> 3.7 +#include <sys/prctl.h> 3.8 #include <linux/prctl.h> 3.9 3.10 #include "../VMS.h"
4.1 --- a/HW_Dependent_Primitives/VMS__HW_measurement.h Mon Sep 10 01:26:51 2012 -0700 4.2 +++ b/HW_Dependent_Primitives/VMS__HW_measurement.h Tue Sep 25 16:11:15 2012 +0200 4.3 @@ -50,7 +50,7 @@ 4.4 /* clobber */ : "%eax", "%edx" \ 4.5 ); 4.6 4.7 -inline TSCount getTSCount(); 4.8 + TSCount getTSCount(); 4.9 4.10 4.11 //For code that calculates normalization-offset between TSC counts of
5.1 --- a/HW_Dependent_Primitives/VMS__primitives.c Mon Sep 10 01:26:51 2012 -0700 5.2 +++ b/HW_Dependent_Primitives/VMS__primitives.c Tue Sep 25 16:11:15 2012 +0200 5.3 @@ -17,7 +17,7 @@ 5.4 * some wrapper-libraries (but only "int" version, to warn users to check 5.5 * carefully that it's safe) 5.6 */ 5.7 -inline void 5.8 +void 5.9 VMS_int__reset_slaveVP_to_TopLvlFn( SlaveVP *slaveVP, TopLevelFnPtr fnPtr, 5.10 void *dataParam) 5.11 { void *stackPtr; 5.12 @@ -61,7 +61,7 @@ 5.13 * 5.14 *This preserves the stack state existed at time slave was suspended. 5.15 */ 5.16 -inline void 5.17 +void 5.18 VMS_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr, 5.19 void *param) 5.20 { void *stackPtr; 5.21 @@ -102,7 +102,7 @@ 5.22 * 5.23 *This preserves the stack state existed at time slave was suspended. 5.24 */ 5.25 -inline void 5.26 +void 5.27 VMS_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr, 5.28 void *param1, void *param2) 5.29 { void *stackPtr;
6.1 --- a/HW_Dependent_Primitives/VMS__primitives.h Mon Sep 10 01:26:51 2012 -0700 6.2 +++ b/HW_Dependent_Primitives/VMS__primitives.h Tue Sep 25 16:11:15 2012 +0200 6.3 @@ -43,11 +43,11 @@ 6.4 void 6.5 VMS_int__return_to_addr_in_ptd_to_loc(void *ptdToLoc); 6.6 6.7 -inline void 6.8 +void 6.9 VMS_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr, 6.10 void *param); 6.11 6.12 -inline void 6.13 +void 6.14 VMS_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr, 6.15 void *param1, void *param2); 6.16
7.1 --- a/Services_Offered_by_VMS/Lang_Constructs/VMS_Lang.h Mon Sep 10 01:26:51 2012 -0700 7.2 +++ b/Services_Offered_by_VMS/Lang_Constructs/VMS_Lang.h Tue Sep 25 16:11:15 2012 +0200 7.3 @@ -16,27 +16,27 @@ 7.4 *Such constructs are used in application code, mixed-in with calls to 7.5 * constructs of the VMS-based language. 7.6 */ 7.7 -inline void 7.8 +void 7.9 handleMalloc( SSRSemReq *semReq, SlaveVP *requestingSlv, SSRSemEnv *semEnv); 7.10 -inline void 7.11 +void 7.12 handleFree( SSRSemReq *semReq, SlaveVP *requestingSlv, SSRSemEnv *semEnv ); 7.13 -inline void 7.14 +void 7.15 handleTransEnd(SSRSemReq *semReq, SlaveVP *requestingSlv, SSRSemEnv*semEnv); 7.16 -inline void 7.17 +void 7.18 handleTransStart( SSRSemReq *semReq, SlaveVP *requestingSlv, 7.19 SSRSemEnv *semEnv ); 7.20 -inline void 7.21 +void 7.22 handleAtomic( SSRSemReq *semReq, SlaveVP *requestingSlv, SSRSemEnv *semEnv); 7.23 -inline void 7.24 +void 7.25 handleStartFnSingleton( SSRSemReq *semReq, SlaveVP *reqstingSlv, 7.26 SSRSemEnv *semEnv ); 7.27 -inline void 7.28 +void 7.29 handleEndFnSingleton( SSRSemReq *semReq, SlaveVP *requestingSlv, 7.30 SSRSemEnv *semEnv ); 7.31 -inline void 7.32 +void 7.33 handleStartDataSingleton( SSRSemReq *semReq, SlaveVP *reqstingSlv, 7.34 SSRSemEnv *semEnv ); 7.35 -inline void 7.36 +void 7.37 handleEndDataSingleton( SSRSemReq *semReq, SlaveVP *requestingSlv, 7.38 SSRSemEnv *semEnv ); 7.39
8.1 --- a/Services_Offered_by_VMS/Measurement_and_Stats/probes.c Mon Sep 10 01:26:51 2012 -0700 8.2 +++ b/Services_Offered_by_VMS/Measurement_and_Stats/probes.c Tue Sep 25 16:11:15 2012 +0200 8.3 @@ -32,7 +32,7 @@ 8.4 */ 8.5 8.6 //============================ Helpers =========================== 8.7 -inline void 8.8 +void 8.9 doNothing() 8.10 { 8.11 }
9.1 --- a/Services_Offered_by_VMS/Memory_Handling/vmalloc.c Mon Sep 10 01:26:51 2012 -0700 9.2 +++ b/Services_Offered_by_VMS/Memory_Handling/vmalloc.c Tue Sep 25 16:11:15 2012 +0200 9.3 @@ -421,7 +421,7 @@ 9.4 MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE - sizeof(MallocProlog)); 9.5 firstChunk->nextChunkInFreeList = NULL; 9.6 //previous element in the queue is the container 9.7 - firstChunk->prevChunkInFreeList = &freeLists->bigChunks[container-2]; 9.8 + firstChunk->prevChunkInFreeList = (MallocProlog*) &freeLists->bigChunks[container-2]; 9.9 9.10 freeLists->bigChunks[container-2] = firstChunk; 9.11 //Insert into bit search list
10.1 --- a/VMS.h Mon Sep 10 01:26:51 2012 -0700 10.2 +++ b/VMS.h Tue Sep 25 16:11:15 2012 +0200 10.3 @@ -282,7 +282,7 @@ 10.4 10.5 //============== =============== 10.6 10.7 -inline SlaveVP * 10.8 +SlaveVP * 10.9 VMS_int__create_slaveVP( TopLevelFnPtr fnPtr, void *dataParam ); 10.10 #define VMS_PI__create_slaveVP VMS_int__create_slaveVP 10.11 #define VMS_WL__create_slaveVP VMS_int__create_slaveVP 10.12 @@ -292,19 +292,19 @@ 10.13 SlaveVP * 10.14 VMS_ext__create_slaveVP( TopLevelFnPtr fnPtr, void *dataParam ); 10.15 10.16 -inline SlaveVP * 10.17 +SlaveVP * 10.18 VMS_int__create_slaveVP_helper( SlaveVP *newSlv, TopLevelFnPtr fnPtr, 10.19 void *dataParam, void *stackLocs ); 10.20 10.21 -inline void 10.22 +void 10.23 VMS_int__reset_slaveVP_to_TopLvlFn( SlaveVP *slaveVP, TopLevelFnPtr fnPtr, 10.24 void *dataParam); 10.25 10.26 -inline void 10.27 +void 10.28 VMS_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr, 10.29 void *param); 10.30 10.31 -inline void 10.32 +void 10.33 VMS_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr, 10.34 void *param1, void *param2); 10.35 10.36 @@ -330,12 +330,12 @@ 10.37 //No WL version -- not safe! if use in WL, be sure data rd & wr is stable 10.38 10.39 10.40 -inline void 10.41 +void 10.42 VMS_int__get_master_lock(); 10.43 10.44 #define VMS_int__release_master_lock() _VMSMasterEnv->masterLock = UNLOCKED 10.45 10.46 -inline uint32_t 10.47 +uint32_t 10.48 VMS_int__randomNumber(); 10.49 10.50 //============== Request Related =============== 10.51 @@ -343,30 +343,30 @@ 10.52 void 10.53 VMS_int__suspend_slaveVP_and_send_req( SlaveVP *callingSlv ); 10.54 10.55 -inline void 10.56 +void 10.57 VMS_WL__add_sem_request_in_mallocd_VMSReqst( void *semReqData, SlaveVP *callingSlv ); 10.58 10.59 -inline void 10.60 +void 10.61 VMS_WL__send_sem_request( void *semReqData, SlaveVP *callingSlv ); 10.62 10.63 void 10.64 VMS_WL__send_create_slaveVP_req( void *semReqData, SlaveVP *reqstingSlv ); 10.65 10.66 -void inline 10.67 +void 10.68 VMS_WL__send_dissipate_req( SlaveVP *prToDissipate ); 10.69 10.70 -inline void 10.71 +void 10.72 VMS_WL__send_VMSSem_request( void *semReqData, SlaveVP *callingSlv ); 10.73 10.74 VMSReqst * 10.75 VMS_PI__take_next_request_out_of( SlaveVP *slaveWithReq ); 10.76 //#define VMS_PI__take_next_request_out_of( slave ) slave->requests 10.77 10.78 -//inline void * 10.79 +//void * 10.80 //VMS_PI__take_sem_reqst_from( VMSReqst *req ); 10.81 #define VMS_PI__take_sem_reqst_from( req ) req->semReqData 10.82 10.83 -void inline 10.84 +void 10.85 VMS_PI__handle_VMSSemReq( VMSReqst *req, SlaveVP *requestingSlv, void *semEnv, 10.86 ResumeSlvFnPtr resumeSlvFnPtr ); 10.87 10.88 @@ -378,7 +378,7 @@ 10.89 10.90 10.91 //========================= Utilities ======================= 10.92 -inline char * 10.93 +char * 10.94 VMS_int__strDup( char *str ); 10.95 10.96
11.1 --- a/VMS__PI.c Mon Sep 10 01:26:51 2012 -0700 11.2 +++ b/VMS__PI.c Tue Sep 25 16:11:15 2012 +0200 11.3 @@ -23,10 +23,10 @@ 11.4 */ 11.5 11.6 //========================= Local Declarations ======================== 11.7 -void inline 11.8 +void 11.9 handleMakeProbe( VMSSemReq *semReq, void *semEnv, ResumeSlvFnPtr resumeFn ); 11.10 11.11 -void inline 11.12 +void 11.13 handleThrowException( VMSSemReq *semReq, void *semEnv, ResumeSlvFnPtr resumeFn ); 11.14 //======================================================================= 11.15 11.16 @@ -49,7 +49,7 @@ 11.17 * 11.18 *Turn function into macro that just accesses the request field 11.19 * 11.20 -inline void * 11.21 + void * 11.22 VMS_PI__take_sem_reqst_from( VMSReqst *req ) 11.23 { 11.24 return req->semReqData; 11.25 @@ -71,7 +71,7 @@ 11.26 * VMS-core steer the request to appropriate plugin 11.27 * Do the same for OS calls -- look later at it.. 11.28 */ 11.29 -void inline 11.30 +void 11.31 VMS_PI__handle_VMSSemReq( VMSReqst *req, SlaveVP *requestingSlv, void *semEnv, 11.32 ResumeSlvFnPtr resumeFn ) 11.33 { VMSSemReq *semReq; 11.34 @@ -84,6 +84,8 @@ 11.35 break; 11.36 case throw_excp: handleThrowException( semReq, semEnv, resumeFn); 11.37 break; 11.38 + default: 11.39 + break; 11.40 } 11.41 } 11.42
12.1 --- a/VMS__WL.c Mon Sep 10 01:26:51 2012 -0700 12.2 +++ b/VMS__WL.c Tue Sep 25 16:11:15 2012 +0200 12.3 @@ -94,7 +94,7 @@ 12.4 * 12.5 *The request handler has to call VMS_int__free_VMSReq for any of these 12.6 */ 12.7 -inline void 12.8 +void 12.9 VMS_WL__add_sem_request_in_mallocd_VMSReqst( void *semReqData, 12.10 SlaveVP *callingSlv ) 12.11 { VMSReqst *req; 12.12 @@ -111,7 +111,7 @@ 12.13 * to plugin 12.14 *Then it does suspend, to cause request to be sent. 12.15 */ 12.16 -inline void 12.17 +void 12.18 VMS_WL__send_sem_request( void *semReqData, SlaveVP *callingSlv ) 12.19 { VMSReqst req; 12.20 12.21 @@ -127,7 +127,7 @@ 12.22 /*May 2012 Not sure what this is.. looks like old idea for VMS semantic 12.23 * request 12.24 */ 12.25 -inline void 12.26 +void 12.27 VMS_WL__send_VMSSem_request( void *semReqData, SlaveVP *callingSlv ) 12.28 { VMSReqst req; 12.29
13.1 --- a/VMS__int.c Mon Sep 10 01:26:51 2012 -0700 13.2 +++ b/VMS__int.c Tue Sep 25 16:11:15 2012 +0200 13.3 @@ -11,8 +11,12 @@ 13.4 #include <inttypes.h> 13.5 #include <sys/time.h> 13.6 13.7 +#include <sched.h> 13.8 + 13.9 #include "VMS.h" 13.10 13.11 +#include <unistd.h> 13.12 +ssize_t read(int fd, void *buf, size_t count); 13.13 13.14 /* MEANING OF WL PI SS int 13.15 * These indicate which places the function is safe to use. They stand for: 13.16 @@ -23,7 +27,7 @@ 13.17 */ 13.18 13.19 13.20 -inline SlaveVP * 13.21 +SlaveVP * 13.22 VMS_int__create_slaveVP( TopLevelFnPtr fnPtr, void *dataParam ) 13.23 { SlaveVP *newSlv; 13.24 void *stackLocs; 13.25 @@ -42,7 +46,7 @@ 13.26 * be called from main thread or other thread -- never from code animated by 13.27 * a VMS virtual processor. 13.28 */ 13.29 -inline SlaveVP * 13.30 +SlaveVP * 13.31 VMS_ext__create_slaveVP( TopLevelFnPtr fnPtr, void *dataParam ) 13.32 { SlaveVP *newSlv; 13.33 char *stackLocs; 13.34 @@ -173,7 +177,7 @@ 13.35 /* 13.36 * 13.37 */ 13.38 -inline SlaveVP * 13.39 +SlaveVP * 13.40 VMS_int__create_slaveVP_helper( SlaveVP *newSlv, TopLevelFnPtr fnPtr, 13.41 void *dataParam, void *stackLocs ) 13.42 { 13.43 @@ -212,7 +216,7 @@ 13.44 } 13.45 13.46 13.47 -inline char * 13.48 +char * 13.49 VMS_int__strDup( char *str ) 13.50 { char *retStr; 13.51 13.52 @@ -224,12 +228,12 @@ 13.53 } 13.54 13.55 13.56 -inline void 13.57 +void 13.58 VMS_int__backoff_for_TooLongToGetLock( int32 numTriesToGetLock ); 13.59 13.60 -inline void 13.61 +void 13.62 VMS_int__get_master_lock() 13.63 - { int32 *addrOfMasterLock; 13.64 + { volatile int32 *addrOfMasterLock; 13.65 13.66 addrOfMasterLock = &(_VMSMasterEnv->masterLock); 13.67 13.68 @@ -246,7 +250,7 @@ 13.69 } 13.70 if( numTriesToGetLock > MASTERLOCK_RETRIES_BEFORE_YIELD ) 13.71 { numTriesToGetLock = 0; 13.72 - pthread_yield(); 13.73 + sched_yield(); 13.74 } 13.75 13.76 //try to get the lock 13.77 @@ -260,7 +264,7 @@ 13.78 * system rand because it takes much too long. 13.79 *Note, are passing pointers to the seeds, which are then modified 13.80 */ 13.81 -inline uint32_t 13.82 +uint32_t 13.83 VMS_int__randomNumber() 13.84 { 13.85 _VMSMasterEnv->seed1 = 36969 * (_VMSMasterEnv->seed1 & 65535) + 13.86 @@ -274,7 +278,7 @@ 13.87 /*Busy-waits for a random number of cycles -- chooses number of cycles 13.88 * differently than for the no-work backoff 13.89 */ 13.90 -inline void 13.91 +void 13.92 VMS_int__backoff_for_TooLongToGetLock( int32 numTriesToGetLock ) 13.93 { int32 i, waitIterations; 13.94 volatile double fakeWorkVar; //busy-wait fake work
14.1 --- a/VMS__startup_and_shutdown.c Mon Sep 10 01:26:51 2012 -0700 14.2 +++ b/VMS__startup_and_shutdown.c Tue Sep 25 16:11:15 2012 +0200 14.3 @@ -408,7 +408,7 @@ 14.4 { _VMSMasterEnv->slaveAssigner = animAssigner; 14.5 } 14.6 14.7 -VMS_SS__register_semantic_env( void *semanticEnv ) 14.8 +void VMS_SS__register_semantic_env( void *semanticEnv ) 14.9 { _VMSMasterEnv->semanticEnv = semanticEnv; 14.10 } 14.11
