# HG changeset patch # User Me@portablequad # Date 1329040173 28800 # Node ID 6db9e48989782723abae5587335831590b83c4e2 # Parent 37b06118011926b625a6395a785ba014e7d2253c VMS name chgs -- added "WL" "PI" and "int" and split vms.h up diff -r 37b061180119 -r 6db9e4898978 CoreLoop.c --- a/CoreLoop.c Sat Feb 11 21:43:43 2012 -0800 +++ b/CoreLoop.c Sun Feb 12 01:49:33 2012 -0800 @@ -6,7 +6,6 @@ #include "VMS.h" -#include "Queue_impl/BlockingQueue.h" #include "ProcrContext.h" #include @@ -16,7 +15,7 @@ #include #include -void *terminateCoreLoop(VirtProcr *currPr); +void *terminateCoreLoop(SlaveVP *currPr); /*This is the loop that runs in the OS Thread pinned to each core *Get virt procr from queue, @@ -35,9 +34,9 @@ { ThdParams *coreLoopThdParams; int thisCoresIdx; - VirtProcr *currPr; - VMSQueueStruc *readyToAnimateQ; - cpu_set_t coreMask; //has 1 in bit positions of allowed cores + SlaveVP *currPr; + VMSQueueStruc *readyToAnimateQ; + cpu_set_t coreMask; //has 1 in bit positions of allowed cores int errorCode; //work-stealing struc on stack to prevent false-sharing in cache-line @@ -101,13 +100,13 @@ while( gate.gateClosed ) /*busy wait*/; } - currPr = (VirtProcr *) readVMSQ( readyToAnimateQ ); + currPr = (SlaveVP *) readVMSQ( readyToAnimateQ ); //Set the coreloop's progress, so stealer can see it has made it out // of the protected area gate.exitProgress = gate.preGateProgress; #else - currPr = (VirtProcr *) readVMSQ( readyToAnimateQ ); + currPr = (SlaveVP *) readVMSQ( readyToAnimateQ ); #endif if( currPr != NULL ) _VMSMasterEnv->numMasterInARow[thisCoresIdx] = 0; @@ -159,10 +158,10 @@ void * -terminateCoreLoop(VirtProcr *currPr){ +terminateCoreLoop(SlaveVP *currPr){ //first free shutdown VP that jumped here -- it first restores the // coreloop's stack, so addr of currPr in stack frame is still correct - VMS__dissipate_procr( currPr ); + VMS_int__dissipate_procr( currPr ); pthread_exit( NULL ); } @@ -177,7 +176,7 @@ void * coreLoop_Seq( void *paramsIn ) { - VirtProcr *currPr; + SlaveVP *currPr; VMSQueueStruc *readyToAnimateQ; ThdParams *coreLoopThdParams; @@ -196,7 +195,7 @@ //_VMSWorkQ must be a global, static volatile var, so not kept in reg, // which forces reloading the pointer after each jmp to this point readyToAnimateQ = _VMSMasterEnv->readyToAnimateQs[thisCoresIdx]; - currPr = (VirtProcr *) readVMSQ( readyToAnimateQ ); + currPr = (SlaveVP *) readVMSQ( readyToAnimateQ ); if( currPr == NULL ) { if( _VMSMasterEnv->numMasterInARow[thisCoresIdx] > 1000 ) { printf("too many back to back MasterVP\n"); exit(1); } diff -r 37b061180119 -r 6db9e4898978 MasterLoop.c --- a/MasterLoop.c Sat Feb 11 21:43:43 2012 -0800 +++ b/MasterLoop.c Sun Feb 12 01:49:33 2012 -0800 @@ -16,7 +16,7 @@ //=========================================================================== void inline stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, - VirtProcr *masterPr ); + SlaveVP *masterPr ); //=========================================================================== @@ -71,10 +71,10 @@ * is case when other cores starved and one core's requests generate work * for them -- so keep max in queue to 3 or 4.. */ -void masterLoop( void *initData, VirtProcr *animatingPr ) +void masterLoop( void *initData, SlaveVP *animatingPr ) { int32 slotIdx, numSlotsFilled; - VirtProcr *schedVirtPr; + SlaveVP *schedVirtPr; SchedSlot *currSlot, **schedSlots; MasterEnv *masterEnv; VMSQueueStruc *readyToAnimateQ; @@ -84,11 +84,11 @@ void *semanticEnv; int32 thisCoresIdx; - VirtProcr *masterPr; - volatile VirtProcr *volatileMasterPr; + SlaveVP *masterPr; + volatile SlaveVP *volatileMasterPr; volatileMasterPr = animatingPr; - masterPr = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp + masterPr = (SlaveVP*)volatileMasterPr; //used to force re-define after jmp //First animation of each MasterVP will in turn animate this part // of setup code.. (VP creator sets up the stack as if this function @@ -120,7 +120,7 @@ masterEnv = (MasterEnv*)_VMSMasterEnv; //GCC may optimize so doesn't always re-define from frame-storage - masterPr = (VirtProcr*)volatileMasterPr; //just to make sure after jmp + masterPr = (SlaveVP*)volatileMasterPr; //just to make sure after jmp thisCoresIdx = masterPr->coreAnimatedBy; readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx]; schedSlots = masterEnv->allSchedSlots[thisCoresIdx]; @@ -202,9 +202,9 @@ */ void inline stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, - VirtProcr *masterPr ) + SlaveVP *masterPr ) { - VirtProcr *stolenPr; + SlaveVP *stolenPr; int32 coreIdx, i; VMSQueueStruc *currQ; @@ -306,9 +306,9 @@ void inline gateProtected_stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *myReadyToAnimateQ, - VirtProcr *masterPr ) + SlaveVP *masterPr ) { - VirtProcr *stolenPr; + SlaveVP *stolenPr; int32 coreIdx, i, haveAVictim, gotLock; VMSQueueStruc *victimsQ; diff -r 37b061180119 -r 6db9e4898978 ProcrContext.c --- a/ProcrContext.c Sat Feb 11 21:43:43 2012 -0800 +++ b/ProcrContext.c Sun Feb 12 01:49:33 2012 -0800 @@ -15,14 +15,14 @@ * animator state to return to -- * */ -inline VirtProcr * -create_procr_helper( VirtProcr *newPr, VirtProcrFnPtr fnPtr, +inline SlaveVP * +create_procr_helper( SlaveVP *newPr, VirtProcrFnPtr fnPtr, void *initialData, void *stackLocs ) { void *stackPtr; newPr->startOfStack = stackLocs; - newPr->procrID = _VMSMasterEnv->numProcrsCreated++; + newPr->procrID = _VMSMasterEnv->numVPsCreated++; newPr->initialData = initialData; newPr->requests = NULL; newPr->schedSlot = NULL; @@ -32,7 +32,7 @@ */ //instead of calling the function directly, call a wrapper function to fetch //arguments from stack - newPr->nextInstrPt = (VirtProcrFnPtr)&startVirtProcrFn; + newPr->nextInstrPt = (VirtProcrFnPtr)&startVPFn; //fnPtr takes two params -- void *initData & void *animProcr //alloc stack locations, make stackPtr be the highest addr minus room @@ -41,7 +41,7 @@ stackPtr = ( (void *)stackLocs + VIRT_PROCR_STACK_SIZE - 4*sizeof(void*)); //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp - *((VirtProcr**)stackPtr + 2 ) = newPr; //rightmost param + *((SlaveVP**)stackPtr + 2 ) = newPr; //rightmost param *((void**)stackPtr + 1 ) = initialData; //next param to left *((void**)stackPtr) = (void*)fnPtr; diff -r 37b061180119 -r 6db9e4898978 ProcrContext.h --- a/ProcrContext.h Sat Feb 11 21:43:43 2012 -0800 +++ b/ProcrContext.h Sun Feb 12 01:49:33 2012 -0800 @@ -12,21 +12,21 @@ void saveCoreLoopReturnAddr(void **returnAddress); -void switchToVP(VirtProcr *nextProcr); +void switchToVP(SlaveVP *nextProcr); -void switchToCoreLoop(VirtProcr *nextProcr); +void switchToCoreLoop(SlaveVP *nextProcr); -void masterSwitchToCoreLoop(VirtProcr *nextProcr); +void masterSwitchToCoreLoop(SlaveVP *nextProcr); -void startVirtProcrFn(); +void startVPFn(); -void *asmTerminateCoreLoop(VirtProcr *currPr); +void *asmTerminateCoreLoop(SlaveVP *currPr); #define flushRegisters() \ asm volatile ("":::"%rbx", "%r12", "%r13","%r14","%r15") -inline VirtProcr * -create_procr_helper( VirtProcr *newPr, VirtProcrFnPtr fnPtr, +inline SlaveVP * +create_procr_helper( SlaveVP *newPr, VirtProcrFnPtr fnPtr, void *initialData, void *stackLocs ); #endif /* _ProcrContext_H */ diff -r 37b061180119 -r 6db9e4898978 VMS.c --- a/VMS.c Sat Feb 11 21:43:43 2012 -0800 +++ b/VMS.c Sun Feb 12 01:49:33 2012 -0800 @@ -13,15 +13,13 @@ #include "VMS.h" #include "ProcrContext.h" -#include "Queue_impl/BlockingQueue.h" -#include "Histogram/Histogram.h" #define thdAttrs NULL //=========================================================================== void -shutdownFn( void *dummy, VirtProcr *dummy2 ); +shutdownFn( void *dummy, SlaveVP *dummy2 ); SchedSlot ** create_sched_slots(); @@ -36,7 +34,7 @@ create_free_list(); void -endOSThreadFn( void *initData, VirtProcr *animatingPr ); +endOSThreadFn( void *initData, SlaveVP *animatingPr ); pthread_mutex_t suspendLock = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t suspend_cond = PTHREAD_COND_INITIALIZER; @@ -72,7 +70,7 @@ * layer. */ void -VMS__init() +VMS_int__init() { create_masterEnv(); create_the_coreLoop_OS_threads(); @@ -83,7 +81,7 @@ /*To initialize the sequential version, just don't create the threads */ void -VMS__init_Seq() +VMS_int__init_Seq() { create_masterEnv(); } @@ -95,7 +93,7 @@ { MasterEnv *masterEnv; VMSQueueStruc **readyToAnimateQs; int coreIdx; - VirtProcr **masterVPs; + SlaveVP **masterVPs; SchedSlot ***allSchedSlots; //ptr to array of ptrs @@ -127,19 +125,19 @@ masterEnv = (MasterEnv*)_VMSMasterEnv; //Make a readyToAnimateQ for each core loop - readyToAnimateQs = VMS__malloc( NUM_CORES * sizeof(VMSQueueStruc *) ); - masterVPs = VMS__malloc( NUM_CORES * sizeof(VirtProcr *) ); + readyToAnimateQs = VMS_int__malloc( NUM_CORES * sizeof(VMSQueueStruc *) ); + masterVPs = VMS_int__malloc( NUM_CORES * sizeof(SlaveVP *) ); //One array for each core, 3 in array, core's masterVP scheds all - allSchedSlots = VMS__malloc( NUM_CORES * sizeof(SchedSlot *) ); + allSchedSlots = VMS_int__malloc( NUM_CORES * sizeof(SchedSlot *) ); - _VMSMasterEnv->numProcrsCreated = 0; //used by create procr + _VMSMasterEnv->numVPsCreated = 0; //used by create procr for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) { readyToAnimateQs[ coreIdx ] = makeVMSQ(); //Q: should give masterVP core-specific info as its init data? - masterVPs[ coreIdx ] = VMS__create_procr( (VirtProcrFnPtr)&masterLoop, (void*)masterEnv ); + masterVPs[ coreIdx ] = VMS_int__create_procr( (VirtProcrFnPtr)&masterLoop, (void*)masterEnv ); masterVPs[ coreIdx ]->coreAnimatedBy = coreIdx; allSchedSlots[ coreIdx ] = create_sched_slots(); //makes for one core _VMSMasterEnv->numMasterInARow[ coreIdx ] = 0; @@ -161,7 +159,7 @@ _VMSMasterEnv->dynIntervalProbesInfo = makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->intervalProbes), 200); - _VMSMasterEnv->probeNameHashTbl = makeHashTable( 1000, &VMS__free ); + _VMSMasterEnv->probeNameHashTbl = makeHashTable( 1000, &VMS_int__free ); //put creation time directly into master env, for fast retrieval struct timeval timeStamp; @@ -186,11 +184,11 @@ { SchedSlot **schedSlots; int i; - schedSlots = VMS__malloc( NUM_SCHED_SLOTS * sizeof(SchedSlot *) ); + schedSlots = VMS_int__malloc( NUM_SCHED_SLOTS * sizeof(SchedSlot *) ); for( i = 0; i < NUM_SCHED_SLOTS; i++ ) { - schedSlots[i] = VMS__malloc( sizeof(SchedSlot) ); + schedSlots[i] = VMS_int__malloc( sizeof(SchedSlot) ); //Set state to mean "handling requests done, slot needs filling" schedSlots[i]->workIsDone = FALSE; @@ -205,9 +203,9 @@ { int i; for( i = 0; i < NUM_SCHED_SLOTS; i++ ) { - VMS__free( schedSlots[i] ); + VMS_int__free( schedSlots[i] ); } - VMS__free( schedSlots ); + VMS_int__free( schedSlots ); } @@ -225,7 +223,7 @@ //Make the threads that animate the core loops for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ ) - { coreLoopThdParams[coreIdx] = VMS__malloc( sizeof(ThdParams) ); + { coreLoopThdParams[coreIdx] = VMS_int__malloc( sizeof(ThdParams) ); coreLoopThdParams[coreIdx]->coreNum = coreIdx; retCode = @@ -242,7 +240,7 @@ *This starts the core loops running then waits for them to exit. */ void -VMS__start_the_work_then_wait_until_done() +VMS_WL__start_the_work_then_wait_until_done() { int coreIdx; //Start the core loops running @@ -272,7 +270,7 @@ * the sequential version of VMS is VMS__init_Seq, this, and coreLoop_Seq. */ void -VMS__start_the_work_then_wait_until_done_Seq() +VMS_WL__start_the_work_then_wait_until_done_Seq() { //Instead of un-suspending threads, just call the one and only // core loop (sequential version), in the main thread. @@ -282,13 +280,13 @@ } #endif -inline VirtProcr * -VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData ) - { VirtProcr *newPr; +inline SlaveVP * +VMS_int__create_procr( VirtProcrFnPtr fnPtr, void *initialData ) + { SlaveVP *newPr; void *stackLocs; - newPr = VMS__malloc( sizeof(VirtProcr) ); - stackLocs = VMS__malloc( VIRT_PROCR_STACK_SIZE ); + newPr = VMS_int__malloc( sizeof(SlaveVP) ); + stackLocs = VMS_int__malloc( VIRT_PROCR_STACK_SIZE ); if( stackLocs == 0 ) { perror("VMS__malloc stack"); exit(1); } @@ -299,12 +297,12 @@ * be called from main thread or other thread -- never from code animated by * a VMS virtual processor. */ -inline VirtProcr * +inline SlaveVP * VMS_ext__create_procr( VirtProcrFnPtr fnPtr, void *initialData ) - { VirtProcr *newPr; + { SlaveVP *newPr; char *stackLocs; - newPr = malloc( sizeof(VirtProcr) ); + newPr = malloc( sizeof(SlaveVP) ); stackLocs = malloc( VIRT_PROCR_STACK_SIZE ); if( stackLocs == 0 ) { perror("malloc stack"); exit(1); } @@ -316,7 +314,7 @@ /*Anticipating multi-tasking */ void * -VMS__give_sem_env_for( VirtProcr *animPr ) +VMS_WL__give_sem_env_for( SlaveVP *animPr ) { return _VMSMasterEnv->semanticEnv; } @@ -331,7 +329,7 @@ * next work-unit for that procr. */ void -VMS__suspend_procr( VirtProcr *animatingPr ) +VMS_int__suspend_procr( SlaveVP *animatingPr ) { //The request to master will cause this suspended virt procr to get @@ -379,7 +377,7 @@ * to the plugin. */ void -VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr ) +VMS_WL__send_create_procr_req( void *semReqData, SlaveVP *reqstingPr ) { VMSReqst req; req.reqType = createReq; @@ -387,7 +385,7 @@ req.nextReqst = reqstingPr->requests; reqstingPr->requests = &req; - VMS__suspend_procr( reqstingPr ); + VMS_int__suspend_procr( reqstingPr ); } @@ -413,14 +411,14 @@ * pears -- making that suspend the last thing in the virt procr's trace. */ void -VMS__send_dissipate_req( VirtProcr *procrToDissipate ) +VMS_WL__send_dissipate_req( SlaveVP *procrToDissipate ) { VMSReqst req; req.reqType = dissipate; req.nextReqst = procrToDissipate->requests; procrToDissipate->requests = &req; - VMS__suspend_procr( procrToDissipate ); + VMS_int__suspend_procr( procrToDissipate ); } @@ -431,7 +429,7 @@ *Use this version to dissipate VPs created outside the VMS system. */ void -VMS_ext__dissipate_procr( VirtProcr *procrToDissipate ) +VMS_ext__dissipate_procr( SlaveVP *procrToDissipate ) { //NOTE: initialData was given to the processor, so should either have // been alloc'd with VMS__malloc, or freed by the level above animPr. @@ -456,11 +454,11 @@ *The request handler has to call VMS__free_VMSReq for any of these */ inline void -VMS__add_sem_request_in_mallocd_VMSReqst( void *semReqData, - VirtProcr *callingPr ) +VMS_WL__add_sem_request_in_mallocd_VMSReqst( void *semReqData, + SlaveVP *callingPr ) { VMSReqst *req; - req = VMS__malloc( sizeof(VMSReqst) ); + req = VMS_int__malloc( sizeof(VMSReqst) ); req->reqType = semantic; req->semReqData = semReqData; req->nextReqst = callingPr->requests; @@ -473,7 +471,7 @@ *Then it does suspend, to cause request to be sent. */ inline void -VMS__send_sem_request( void *semReqData, VirtProcr *callingPr ) +VMS_WL__send_sem_request( void *semReqData, SlaveVP *callingPr ) { VMSReqst req; req.reqType = semantic; @@ -481,12 +479,12 @@ req.nextReqst = callingPr->requests; callingPr->requests = &req; - VMS__suspend_procr( callingPr ); + VMS_int__suspend_procr( callingPr ); } inline void -VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr ) +VMS_WL__send_VMSSem_request( void *semReqData, SlaveVP *callingPr ) { VMSReqst req; req.reqType = VMSSemantic; @@ -494,14 +492,14 @@ req.nextReqst = callingPr->requests; //gab any other preceeding callingPr->requests = &req; - VMS__suspend_procr( callingPr ); + VMS_int__suspend_procr( callingPr ); } /* */ VMSReqst * -VMS__take_next_request_out_of( VirtProcr *procrWithReq ) +VMS_PI__take_next_request_out_of( SlaveVP *procrWithReq ) { VMSReqst *req; req = procrWithReq->requests; @@ -513,7 +511,7 @@ inline void * -VMS__take_sem_reqst_from( VMSReqst *req ) +VMS_PI__take_sem_reqst_from( VMSReqst *req ) { return req->semReqData; } @@ -535,15 +533,15 @@ * Do the same for OS calls -- look later at it.. */ void inline -VMS__handle_VMSSemReq( VMSReqst *req, VirtProcr *requestingPr, void *semEnv, - ResumePrFnPtr resumePrFnPtr ) +VMS_PI__handle_VMSSemReq( VMSReqst *req, SlaveVP *requestingPr, void *semEnv, + ResumeVPFnPtr resumePrFnPtr ) { VMSSemReq *semReq; IntervalProbe *newProbe; semReq = req->semReqData; - newProbe = VMS__malloc( sizeof(IntervalProbe) ); - newProbe->nameStr = VMS__strDup( semReq->nameStr ); + newProbe = VMS_int__malloc( sizeof(IntervalProbe) ); + newProbe->nameStr = VMS_int__strDup( semReq->nameStr ); newProbe->hist = NULL; newProbe->schedChoiceWasRecorded = FALSE; @@ -576,7 +574,7 @@ * of dis-owning it. */ void -VMS__dissipate_procr( VirtProcr *animatingPr ) +VMS_int__dissipate_procr( SlaveVP *animatingPr ) { //dis-own all locations owned by this processor, causing to be freed // any locations that it is (was) sole owner of @@ -589,8 +587,8 @@ // itself //Note, should not stack-allocate initial data -- no guarantee, in // general that creating processor will outlive ones it creates. - VMS__free( animatingPr->startOfStack ); - VMS__free( animatingPr ); + VMS_int__free( animatingPr->startOfStack ); + VMS_int__free( animatingPr ); } @@ -627,15 +625,15 @@ * point is it sure that all results have completed. */ void -VMS__shutdown() +VMS_int__shutdown() { int coreIdx; - VirtProcr *shutDownPr; + SlaveVP *shutDownPr; //create the shutdown processors, one for each core loop -- put them // directly into the Q -- each core will die when gets one for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ ) { //Note, this is running in the master - shutDownPr = VMS__create_procr( &endOSThreadFn, NULL ); + shutDownPr = VMS_int__create_procr( &endOSThreadFn, NULL ); writeVMSQ( shutDownPr, _VMSMasterEnv->readyToAnimateQs[coreIdx] ); } @@ -656,7 +654,7 @@ * processors). */ void -endOSThreadFn( void *initData, VirtProcr *animatingPr ) +endOSThreadFn( void *initData, SlaveVP *animatingPr ) { #ifdef SEQUENTIAL asmTerminateCoreLoopSeq(animatingPr); @@ -669,7 +667,7 @@ /*This is called from the startup & shutdown */ void -VMS__cleanup_at_end_of_shutdown() +VMS_int__cleanup_at_end_of_shutdown() { //unused //VMSQueueStruc **readyToAnimateQs; @@ -707,7 +705,7 @@ { freeVMSQ( readyToAnimateQs[ coreIdx ] ); //master VPs were created external to VMS, so use external free - VMS__dissipate_procr( masterVPs[ coreIdx ] ); + VMS_int__dissipate_procr( masterVPs[ coreIdx ] ); freeSchedSlots( allSchedSlots[ coreIdx ] ); } @@ -718,7 +716,7 @@ { freeVMSQ( readyToAnimateQs[ coreIdx ] ); //master VPs were created external to VMS, so use external free - VMS__dissipate_procr( masterVPs[ coreIdx ] ); + VMS_int__dissipate_procr( masterVPs[ coreIdx ] ); freeSchedSlots( allSchedSlots[ coreIdx ] ); } @@ -763,7 +761,7 @@ * the error message. */ void -VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData ) +VMS_PI__throw_exception( char *msgStr, SlaveVP *reqstPr, VMSExcp *excpData ) { printf("%s",msgStr); fflush(stdin); diff -r 37b061180119 -r 6db9e4898978 VMS.h --- a/VMS.h Sat Feb 11 21:43:43 2012 -0800 +++ b/VMS.h Sun Feb 12 01:49:33 2012 -0800 @@ -11,121 +11,47 @@ #define _GNU_SOURCE #include "VMS_primitive_data_types.h" -#include "../../C_Libraries/Queue_impl/PrivateQueue.h" -#include "../../C_Libraries/Histogram/Histogram.h" #include "../../C_Libraries/DynArray/DynArray.h" #include "../../C_Libraries/Hash_impl/PrivateHash.h" +#include "../../C_Libraries/Histogram/Histogram.h" +#include "../../C_Libraries/Queue_impl/PrivateQueue.h" #include "vmalloc.h" #include #include +//================= Defines: included from separate files ================= +// +// Note: ALL defines are in other files, none are in here +// +#include "VMS_defs.h" -//=============================== Debug =================================== + + +//================================ Typedefs ================================= // -//When SEQUENTIAL is defined, VMS does sequential exe in the main thread -// It still does co-routines and all the mechanisms are the same, it just -// has only a single thread and animates VPs one at a time -//#define SEQUENTIAL - -//#define USE_WORK_STEALING - -//turns on the probe-instrumentation in the application -- when not -// defined, the calls to the probe functions turn into comments -#define STATS__ENABLE_PROBES -//#define TURN_ON_DEBUG_PROBES - -//These defines turn types of bug messages on and off -// be sure debug messages are un-commented (next block of defines) -#define dbgAppFlow TRUE /* Top level flow of application code -- general*/ -#define dbgProbes FALSE /* for issues inside probes themselves*/ -#define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/ -#define dbgRqstHdlr FALSE /* in request handler code*/ - -//Comment or un- the substitute half to turn on/off types of debug message -#define DEBUG( bool, msg) \ -// if( bool){ printf(msg); fflush(stdin);} -#define DEBUG1( bool, msg, param) \ -// if(bool){printf(msg, param); fflush(stdin);} -#define DEBUG2( bool, msg, p1, p2) \ -// if(bool) {printf(msg, p1, p2); fflush(stdin);} - -#define ERROR(msg) printf(msg); -#define ERROR1(msg, param) printf(msg, param); -#define ERROR2(msg, p1, p2) printf(msg, p1, p2); - -//=========================== STATS ======================= - - //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and - // compiled-in that saves the low part of the time stamp count just before - // suspending a processor and just after resuming that processorsrc/VPThread_lib/VMS/VMS.h:322: warning: previous declaration of ‘VMS__create_procr’ was here. It is - // saved into a field added to VirtProcr. Have to sanity-check for - // rollover of low portion into high portion. -//#define MEAS__TIME_STAMP_SUSP -//#define MEAS__TIME_MASTER -#define MEAS__TIME_PLUGIN -#define MEAS__TIME_MALLOC -//#define MEAS__TIME_MASTER_LOCK -#define MEAS__NUM_TIMES_TO_RUN 100000 - - //For code that calculates normalization-offset between TSC counts of - // different cores. -#define NUM_TSC_ROUND_TRIPS 10 - - -//========================= Hardware related Constants ===================== - //This value is the number of hardware threads in the shared memory - // machine -//#define NUM_CORES 8 - - // tradeoff amortizing master fixed overhead vs imbalance potential - // when work-stealing, can make bigger, at risk of losing cache affinity -#define NUM_SCHED_SLOTS 5 - -#define MIN_WORK_UNIT_CYCLES 20000 - -#define MASTERLOCK_RETRIES 10000 - - // stack size in virtual processors created -#define VIRT_PROCR_STACK_SIZE 0x8000 /* 32K */ - - // memory for VMS__malloc -#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x10000000 /* 256M */ - -#define CACHE_LINE 64 -#define PAGE_SIZE 4096 - - -//============================== - -#define SUCCESS 0 - -#define writeVMSQ writePrivQ -#define readVMSQ readPrivQ -#define makeVMSQ makeVMSPrivQ -#define numInVMSQ numInPrivQ -#define VMSQueueStruc PrivQueueStruc - - - -//=========================================================================== typedef unsigned long long TSCount; +typedef union + { uint32 lowHigh[2]; + uint64 longVal; + } +TSCountLowHigh; typedef struct _SchedSlot SchedSlot; typedef struct _VMSReqst VMSReqst; -typedef struct _VirtProcr VirtProcr; +typedef struct _SlaveVP SlaveVP; typedef struct _IntervalProbe IntervalProbe; typedef struct _GateStruc GateStruc; -typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx -typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv -typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr -typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr -typedef void (*ResumePrFnPtr) ( VirtProcr *, void * ); +typedef SlaveVP * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx +typedef void (*RequestHandler) ( SlaveVP *, void * ); //prWReqst, semEnv +typedef void (*VirtProcrFnPtr) ( void *, SlaveVP * ); //initData, animPr +typedef void VirtProcrFn ( void *, SlaveVP * ); //initData, animPr +typedef void (*ResumeVPFnPtr) ( SlaveVP *, void * ); -//============= Requests =========== +//============= Request Related =========== // enum VMSReqstType //avoid starting enums at 0, for debug reasons @@ -154,7 +80,7 @@ typedef struct { enum VMSSemReqstType reqType; - VirtProcr *requestingPr; + SlaveVP *requestingPr; char *nameStr; //for create probe } VMSSemReq; @@ -166,14 +92,14 @@ { int workIsDone; int needsProcrAssigned; - VirtProcr *procrAssignedToSlot; + SlaveVP *procrAssignedToSlot; }; //SchedSlot /*WARNING: re-arranging this data structure could cause VP switching * assembly code to fail -- hard-codes offsets of fields */ -struct _VirtProcr +struct _SlaveVP { int procrID; //for debugging -- count up each time create int coreAnimatedBy; void *startOfStack; @@ -194,14 +120,19 @@ void *dataRetFromReq;//values returned from plugin to VP go here //=========== MEASUREMENT STUFF ========== - #ifdef MEAS__TIME_STAMP_SUSP - unsigned int preSuspTSCLow; - unsigned int postSuspTSCLow; - #endif - #ifdef MEAS__TIME_MASTER /* in VirtProcr because multiple masterVPs*/ - unsigned int startMasterTSCLow;USE_GNU - unsigned int endMasterTSCLow; - #endif + #ifdef MEAS__TIME_STAMP_SUSP + uint32 preSuspTSCLow; + uint32 postSuspTSCLow; + #endif + #ifdef MEAS__TIME_MASTER /* in VirtProcr because multiple masterVPs*/ + uint32 startMasterTSCLow;USE_GNU + uint32 endMasterTSCLow; + #endif + #ifdef MEAS__TIME_2011_SYS + TSCountLowHigh startSusp; + uint64 totalSuspCycles; + uint32 numGoodSusp; + #endif //======================================== float64 createPtInSecs; //have space but don't use on some configs @@ -215,49 +146,63 @@ */ typedef struct { + union{ //adds padding to put masterLock on its own cache-line to elim + // false sharing (masterLock is most-accessed var in VMS) + volatile int32 masterLock; + char padding[CACHELINE_SIZE]; + } masterLockUnion; SlaveScheduler slaveScheduler; RequestHandler requestHandler; SchedSlot ***allSchedSlots; VMSQueueStruc **readyToAnimateQs; - VirtProcr **masterVPs; + SlaveVP **masterVPs; void *semanticEnv; void *OSEventStruc; //for future, when add I/O to BLIS - MallocProlog *freeListHead; + MallocArrays *freeLists; int32 amtOfOutstandingMem; //total currently allocated void *coreLoopReturnPt;//addr to jump to to re-enter coreLoop int32 setupComplete; - volatile int32 masterLock; - - int32 numMasterInARow[NUM_CORES];//detect back-to-back masterVP + //int32 numMasterInARow[NUM_CORES];//detect back-to-back masterVP GateStruc *workStealingGates[ NUM_CORES ]; //concurrent work-steal int32 workStealingLock; - int32 numProcrsCreated; //gives ordering to processor creation + int32 numVPsCreated; //gives ordering to processor creation //=========== MEASUREMENT STUFF ============= - IntervalProbe **intervalProbes; - PrivDynArrayInfo *dynIntervalProbesInfo; - HashTable *probeNameHashTbl; - int32 masterCreateProbeID; - float64 createPtInSecs; - Histogram **measHists; - PrivDynArrayInfo *measHistsInfo; - #ifdef MEAS__TIME_PLUGIN - Histogram *reqHdlrLowTimeHist; - Histogram *reqHdlrHighTimeHist; - #endif - #ifdef MEAS__TIME_MALLOC - Histogram *mallocTimeHist; - Histogram *freeTimeHist; - #endif - #ifdef MEAS__TIME_MASTER_LOCK - Histogram *masterLockLowTimeHist; - Histogram *masterLockHighTimeHist; - #endif + IntervalProbe **intervalProbes; + PrivDynArrayInfo *dynIntervalProbesInfo; + HashTable *probeNameHashTbl; + int32 masterCreateProbeID; + float64 createPtInSecs; + Histogram **measHists; + PrivDynArrayInfo *measHistsInfo; + #ifdef MEAS__TIME_PLUGIN + Histogram *reqHdlrLowTimeHist; + Histogram *reqHdlrHighTimeHist; + #endif + #ifdef MEAS__TIME_MALLOC + Histogram *mallocTimeHist; + Histogram *freeTimeHist; + #endif + #ifdef MEAS__TIME_MASTER_LOCK + Histogram *masterLockLowTimeHist; + Histogram *masterLockHighTimeHist; + #endif + #ifdef MEAS__TIME_2011_SYS + TSCountLowHigh startMaster; + uint64 totalMasterCycles; + uint32 numMasterAnimations; + TSCountLowHigh startReqHdlr; + uint64 totalPluginCycles; + uint32 numPluginAnimations; + uint64 cyclesTillStartMasterLoop; + TSCountLowHigh endMasterLoop; + #endif + //========================================== } MasterEnv; @@ -281,7 +226,7 @@ void * coreLoop( void *paramsIn ); //standard PThreads fn prototype void * coreLoop_Seq( void *paramsIn ); //standard PThreads fn prototype -void masterLoop( void *initData, VirtProcr *masterPr ); +void masterLoop( void *initData, SlaveVP *masterVP ); typedef struct @@ -298,278 +243,93 @@ -//===================== Global Vars =================== +//============================= Global Vars ================================ -volatile MasterEnv *_VMSMasterEnv; +volatile MasterEnv *_VMSMasterEnv __align_to_cacheline__; -//=========================== Function Prototypes ========================= +//========================= Function Prototypes =========================== //========== Setup and shutdown ========== void -VMS__init(); +VMS_int__init(); void -VMS__init_Seq(); +VMS_int__init_Seq(); void -VMS__start_the_work_then_wait_until_done(); +VMS_WL__start_the_work_then_wait_until_done(); void -VMS__start_the_work_then_wait_until_done_Seq(); +VMS_WL__start_the_work_then_wait_until_done_Seq(); -inline VirtProcr * -VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData ); +inline SlaveVP * +VMS_int__create_procr( VirtProcrFnPtr fnPtr, void *initialData ); void -VMS__dissipate_procr( VirtProcr *procrToDissipate ); +VMS_int__dissipate_procr( SlaveVP *procrToDissipate ); //Use this to create processor inside entry point & other places outside // the VMS system boundary (IE, not run in slave nor Master) -VirtProcr * +SlaveVP * VMS_ext__create_procr( VirtProcrFnPtr fnPtr, void *initialData ); void -VMS_ext__dissipate_procr( VirtProcr *procrToDissipate ); +VMS_ext__dissipate_procr( SlaveVP *procrToDissipate ); void -VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData ); +VMS_PI__throw_exception( char *msgStr, SlaveVP *reqstPr, VMSExcp *excpData ); void -VMS__shutdown(); +VMS_int__shutdown(); void -VMS__cleanup_at_end_of_shutdown(); +VMS_int__cleanup_at_end_of_shutdown(); void * -VMS__give_sem_env_for( VirtProcr *animPr ); +VMS_WL__give_sem_env_for( SlaveVP *animPr ); //============== Request Related =============== void -VMS__suspend_procr( VirtProcr *callingPr ); +VMS_int__suspend_procr( SlaveVP *callingPr ); inline void -VMS__add_sem_request_in_mallocd_VMSReqst( void *semReqData, VirtProcr *callingPr ); +VMS_WL__add_sem_request_in_mallocd_VMSReqst( void *semReqData, SlaveVP *callingPr ); inline void -VMS__send_sem_request( void *semReqData, VirtProcr *callingPr ); +VMS_WL__send_sem_request( void *semReqData, SlaveVP *callingPr ); void -VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr ); +VMS_WL__send_create_procr_req( void *semReqData, SlaveVP *reqstingPr ); void inline -VMS__send_dissipate_req( VirtProcr *prToDissipate ); +VMS_WL__send_dissipate_req( SlaveVP *prToDissipate ); inline void -VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr ); +VMS_WL__send_VMSSem_request( void *semReqData, SlaveVP *callingPr ); VMSReqst * -VMS__take_next_request_out_of( VirtProcr *procrWithReq ); +VMS_PI__take_next_request_out_of( SlaveVP *procrWithReq ); inline void * -VMS__take_sem_reqst_from( VMSReqst *req ); +VMS_PI__take_sem_reqst_from( VMSReqst *req ); void inline -VMS__handle_VMSSemReq( VMSReqst *req, VirtProcr *requestingPr, void *semEnv, - ResumePrFnPtr resumePrFnPtr ); +VMS_PI__handle_VMSSemReq( VMSReqst *req, SlaveVP *requestingPr, void *semEnv, + ResumeVPFnPtr resumePrFnPtr ); -//======================== STATS ====================== +//======================== MEASUREMENT ====================== +uint64 +VMS_WL__give_num_plugin_cycles(); +uint32 +VMS_WL__give_num_plugin_animations(); -//===== RDTSC wrapper ===== //Also runs with x86_64 code -#define saveTimeStampCountInto(low, high) \ - asm volatile("RDTSC; \ - movl %%eax, %0; \ - movl %%edx, %1;" \ - /* outputs */ : "=m" (low), "=m" (high)\ - /* inputs */ : \ - /* clobber */ : "%eax", "%edx" \ - ); - -#define saveLowTimeStampCountInto(low) \ - asm volatile("RDTSC; \ - movl %%eax, %0;" \ - /* outputs */ : "=m" (low) \ - /* inputs */ : \ - /* clobber */ : "%eax", "%edx" \ - ); - -//==================== -#define makeAMeasHist( idx, name, numBins, startVal, binWidth ) \ - makeHighestDynArrayIndexBeAtLeast( _VMSMasterEnv->measHistsInfo, idx ); \ - _VMSMasterEnv->measHists[idx] = \ - makeFixedBinHist( numBins, startVal, binWidth, name ); - - -#define MEAS__SUB_CREATE /*turn on/off subtraction of create from plugin*/ - -#ifdef VPTHREAD - -//VPThread -#define createHistIdx 0 -#define mutexLockHistIdx 1 -#define mutexUnlockHistIdx 2 -#define condWaitHistIdx 3 -#define condSignalHistIdx 4 - -#define MakeTheMeasHists() \ - _VMSMasterEnv->measHistsInfo = \ - makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \ - makeAMeasHist( createHistIdx, "create", 250, 0, 100 ) \ - makeAMeasHist( mutexLockHistIdx, "mutex_lock", 50, 0, 100 ) \ - makeAMeasHist( mutexUnlockHistIdx, "mutex_unlock", 50, 0, 100 ) \ - makeAMeasHist( condWaitHistIdx, "cond_wait", 50, 0, 100 ) \ - makeAMeasHist( condSignalHistIdx, "cond_signal", 50, 0, 100 ) - -#endif - - -#ifdef VCILK - -//VCilk -#define spawnHistIdx 0 -#define syncHistIdx 1 - -#define MakeTheMeasHists() \ - _VMSMasterEnv->measHistsInfo = \ - makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \ - makeAMeasHist( spawnHistIdx, "Spawn", 50, 0, 200 ) \ - makeAMeasHist( syncHistIdx, "Sync", 50, 0, 200 ) - - -#endif - -#ifdef SSR - -//SSR -#define SendFromToHistIdx 0 -#define SendOfTypeHistIdx 1 -#define ReceiveFromToHistIdx 2 -#define ReceiveOfTypeHistIdx 3 - -#define MakeTheMeasHists() \ - _VMSMasterEnv->measHistsInfo = \ - makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \ - makeAMeasHist( SendFromToHistIdx, "SendFromTo", 50, 0, 100 ) \ - makeAMeasHist( SendOfTypeHistIdx, "SendOfType", 50, 0, 100 ) \ - makeAMeasHist( ReceiveFromToHistIdx,"ReceiveFromTo", 50, 0, 100 ) \ - makeAMeasHist( ReceiveOfTypeHistIdx,"ReceiveOfType", 50, 0, 100 ) - -#endif - -//=========================================================================== -//VPThread - - -#define Meas_startCreate \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endCreate \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ createHistIdx ] ); - -#define Meas_startMutexLock \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endMutexLock \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ mutexLockHistIdx ] ); - -#define Meas_startMutexUnlock \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endMutexUnlock \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ mutexUnlockHistIdx ] ); - -#define Meas_startCondWait \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endCondWait \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ condWaitHistIdx ] ); - -#define Meas_startCondSignal \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endCondSignal \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ condSignalHistIdx ] ); - -//=========================================================================== -// VCilk -#define Meas_startSpawn \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endSpawn \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ spawnHistIdx ] ); - -#define Meas_startSync \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endSync \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ syncHistIdx ] ); - -//=========================================================================== -// SSR -#define Meas_startSendFromTo \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endSendFromTo \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ SendFromToHistIdx ] ); - -#define Meas_startSendOfType \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endSendOfType \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ SendOfTypeHistIdx ] ); - -#define Meas_startReceiveFromTo \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endReceiveFromTo \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ ReceiveFromToHistIdx ] ); - -#define Meas_startReceiveOfType \ - int32 startStamp, endStamp; \ - saveLowTimeStampCountInto( startStamp ); \ - -#define Meas_endReceiveOfType \ - saveLowTimeStampCountInto( endStamp ); \ - addIntervalToHist( startStamp, endStamp, \ - _VMSMasterEnv->measHists[ReceiveOfTypeHistIdx ] ); - -//===== #include "ProcrContext.h" #include "probes.h" diff -r 37b061180119 -r 6db9e4898978 VMS_HW_specific_defs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VMS_HW_specific_defs.h Sun Feb 12 01:49:33 2012 -0800 @@ -0,0 +1,53 @@ +/* + * Copyright 2009 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + +#ifndef _VMS_HW_SPEC_DEFS_H +#define _VMS_HW_SPEC_DEFS_H +#define _GNU_SOURCE + +//=============================== Hardware ================================== +// This aligns the variable to a 256 byte boundary, therefore padding the gaps. +// This is apparently not true for data on the stack. Which is I guess not an +// issue because they are only used in the cores own coreloop +#define CACHELINE_SIZE 256 +#define __align_to_cacheline__ __attribute__ ((aligned(CACHELINE_SIZE))) +//aligns a pointer to cacheline. The memory area has to contain at least +//CACHELINE_SIZE bytes more then needed +#define __align_adress(ptr) ((void*)(((uintptr_t)(ptr))&((uintptr_t)(~0x0FF)))) + + //Frequency of TS counts -- have to do tests to verify + //NOTE: TURN OFF TURBO-BOOST and SPEED-STEP else this won't be constant +#define TSCOUNT_FREQ 3180000000 + + +//========================= Hardware related Constants ===================== + //This value is the number of hardware threads in the shared memory + // machine +//#define NUM_CORES 8 + + // tradeoff amortizing master fixed overhead vs imbalance potential + // when work-stealing, can make bigger, at risk of losing cache affinity +#define NUM_SCHED_SLOTS 3 + +#define MIN_WORK_UNIT_CYCLES 20000 + +#define MASTERLOCK_RETRIES 10000 + + // stack size in virtual processors created +#define VIRT_PROCR_STACK_SIZE 0x8000 /* 32K */ + + // memory for VMS__malloc +#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x40000000 /* 1G */ + +#define CACHE_LINE 64 +#define PAGE_SIZE 4096 + +//=========================================================================== + +#endif /* _VMS_DEFS_H */ + diff -r 37b061180119 -r 6db9e4898978 VMS_defs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VMS_defs.h Sun Feb 12 01:49:33 2012 -0800 @@ -0,0 +1,189 @@ +/* + * Copyright 2009 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + +#ifndef _VMS_DEFS_H +#define _VMS_DEFS_H +#define _GNU_SOURCE + +//=========================== VMS-wide defs =============================== +#include "VMS_primitive_data_types.h" + +#define SUCCESS 0 + + //only after macro-expansion are the defs of writePrivQ, aso looked up + // so these defs can be at the top, and writePrivQ defined later on.. +#define writeVMSQ writePrivQ +#define readVMSQ readPrivQ +#define makeVMSQ makeVMSPrivQ +#define numInVMSQ numInPrivQ +#define VMSQueueStruc PrivQueueStruc + + +//====================== Hardware Specific Defs ============================ +#include "VMS_HW_specific_defs.h" + +//========================= Debug Related Defs ============================= +// +//When SEQUENTIAL is defined, VMS does sequential exe in the main thread +// It still does co-routines and all the mechanisms are the same, it just +// has only a single thread and animates VPs one at a time +//#define SEQUENTIAL + +//#define USE_WORK_STEALING + +//turns on the probe-instrumentation in the application -- when not +// defined, the calls to the probe functions turn into comments +#define STATS__ENABLE_PROBES +//#define TURN_ON_DEBUG_PROBES + +//These defines turn types of bug messages on and off +// be sure debug messages are un-commented (next block of defines) +#define dbgAppFlow TRUE /* Top level flow of application code -- general*/ +#define dbgProbes FALSE /* for issues inside probes themselves*/ +#define dbgB2BMaster FALSE /* in coreloop, back to back master VPs*/ +#define dbgRqstHdlr FALSE /* in request handler code*/ + +//Comment or un- the substitute half to turn on/off types of debug message +#define DEBUG( bool, msg) \ +// if( bool){ printf(msg); fflush(stdin);} +#define DEBUG1( bool, msg, param) \ +// if(bool){printf(msg, param); fflush(stdin);} +#define DEBUG2( bool, msg, p1, p2) \ +// if(bool) {printf(msg, p1, p2); fflush(stdin);} + +#define ERROR(msg) printf(msg); +#define ERROR1(msg, param) printf(msg, param); +#define ERROR2(msg, p1, p2) printf(msg, p1, p2); + +//====================== Measurement Related Defs ========================== +// +// + //when STATS__TURN_ON_PROBES is defined allows using probes to measure + // time intervals. The probes are macros that only compile to something + // when STATS__TURN_ON_PROBES is defined. The probes are saved in the + // master env -- but only when this is defined. + //The TSC probes use RDTSC instr, can be unreliable, Dbl uses gettimeofday +#define STATS__TURN_ON_PROBES +//#define STATS__USE_TSC_PROBES +#define STATS__USE_DBL_PROBES + +//============================= Statistics ================================== + + +inline TSCount getTSCount(); + +//================== Turn Measurement Things on and off ==================== + +//#define MEAS__TIME_2011_SYS +//define this if any MEAS__... below are +//#define MAKE_HISTS_FOR_MEASUREMENTS + //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and + // compiled-in that saves the low part of the time stamp count just before + // suspending a processor and just after resuming that processor. It is + // saved into a field added to VirtProcr. Have to sanity-check for + // rollover of low portion into high portion. +//#define MEAS__TIME_STAMP_SUSP +//#define MEAS__TIME_MASTER +//#define MEAS__TIME_PLUGIN +//#define MEAS__TIME_MALLOC +//#define MEAS__TIME_MASTER_LOCK + + //For code that calculates normalization-offset between TSC counts of + // different cores. +//#define NUM_TSC_ROUND_TRIPS 10 + + + +//=================== Macros to Capture Measurements ====================== +// +//===== RDTSC wrapper ===== +//Also runs with x86_64 code +#define saveTSCLowHigh(lowHighIn) \ + asm volatile("RDTSC; \ + movl %%eax, %0; \ + movl %%edx, %1;" \ + /* outputs */ : "=m" (lowHighIn.lowHigh[0]), "=m" (lowHighIn.lowHigh[1])\ + /* inputs */ : \ + /* clobber */ : "%eax", "%edx" \ + ); + +#define saveTimeStampCountInto(low, high) \ + asm volatile("RDTSC; \ + movl %%eax, %0; \ + movl %%edx, %1;" \ + /* outputs */ : "=m" (low), "=m" (high)\ + /* inputs */ : \ + /* clobber */ : "%eax", "%edx" \ + ); + +#define saveLowTimeStampCountInto(low) \ + asm volatile("RDTSC; \ + movl %%eax, %0;" \ + /* outputs */ : "=m" (low) \ + /* inputs */ : \ + /* clobber */ : "%eax", "%edx" \ + ); + + +//================== Macros define types of meas want ===================== +#ifdef MEAS__TIME_PLUGIN + +#define Meas_startReqHdlr \ + int32 startStamp1, endStamp1; \ + saveLowTimeStampCountInto( startStamp1 ); + +#define Meas_endReqHdlr \ + saveLowTimeStampCountInto( endStamp1 ); \ + addIntervalToHist( startStamp1, endStamp1, \ + _VMSMasterEnv->reqHdlrLowTimeHist ); \ + addIntervalToHist( startStamp1, endStamp1, \ + _VMSMasterEnv->reqHdlrHighTimeHist ); + +#elif defined MEAS__TIME_2011_SYS +#define Meas_startMasterLoop \ + TSCountLowHigh startStamp1, endStamp1; \ + saveTSCLowHigh( endStamp1 ); \ + _VMSMasterEnv->cyclesTillStartMasterLoop = \ + endStamp1.longVal - masterVP->startSusp.longVal; + +#define Meas_startReqHdlr \ + saveTSCLowHigh( startStamp1 ); \ + _VMSMasterEnv->startReqHdlr.longVal = startStamp1.longVal; + +#define Meas_endReqHdlr + +#define Meas_endMasterLoop \ + saveTSCLowHigh( startStamp1 ); \ + _VMSMasterEnv->endMasterLoop.longVal = startStamp1.longVal; + +#else +#define Meas_startMasterLoop +#define Meas_startReqHdlr +#define Meas_endReqHdlr +#define Meas_endMasterLoop +#endif + +//====================== Histogram Macros -- Create ======================== +// +// +#ifdef MAKE_HISTS_FOR_MEASUREMENTS +#define makeAMeasHist( idx, name, numBins, startVal, binWidth ) \ + makeHighestDynArrayIndexBeAtLeast( _VMSMasterEnv->measHistsInfo, idx ); \ + _VMSMasterEnv->measHists[idx] = \ + makeFixedBinHist( numBins, startVal, binWidth, name ); +#else +#define makeAMeasHist( idx, name, numBins, startVal, binWidth ) +#endif + + +#define MEAS__SUB_CREATE /*turn on/off subtraction of create from plugin*/ + +#include "VMS_lang_specific_defs.h" + +#endif /* _VMS_DEFS_H */ + diff -r 37b061180119 -r 6db9e4898978 VMS_lang_specific_defs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VMS_lang_specific_defs.h Sun Feb 12 01:49:33 2012 -0800 @@ -0,0 +1,180 @@ +/* + * Copyright 2009 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + +#ifndef _VMS_LANG_SPEC_DEFS_H +#define _VMS_LANG_SPEC_DEFS_H + + + +//=================== Language-specific Measurement Stuff =================== +// +//TODO: Figure out way to move these into language dir.. +// wrap them in #ifdef MEAS__... +// + + +//=========================================================================== +//VPThread +#ifdef VTHREAD + +#define createHistIdx 1 //note: starts at 1 +#define mutexLockHistIdx 2 +#define mutexUnlockHistIdx 3 +#define condWaitHistIdx 4 +#define condSignalHistIdx 5 + +#define MakeTheMeasHists() \ + _VMSMasterEnv->measHistsInfo = \ + makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \ + makeAMeasHist( createHistIdx, "create", 250, 0, 100 ) \ + makeAMeasHist( mutexLockHistIdx, "mutex_lock", 50, 0, 100 ) \ + makeAMeasHist( mutexUnlockHistIdx, "mutex_unlock", 50, 0, 100 ) \ + makeAMeasHist( condWaitHistIdx, "cond_wait", 50, 0, 100 ) \ + makeAMeasHist( condSignalHistIdx, "cond_signal", 50, 0, 100 ) + + +#define Meas_startCreate \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endCreate \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ createHistIdx ] ); + +#define Meas_startMutexLock \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endMutexLock \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ mutexLockHistIdx ] ); + +#define Meas_startMutexUnlock \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endMutexUnlock \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ mutexUnlockHistIdx ] ); + +#define Meas_startCondWait \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endCondWait \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ condWaitHistIdx ] ); + +#define Meas_startCondSignal \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endCondSignal \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ condSignalHistIdx ] ); + +#endif + + + +//=========================================================================== +//VCilk + +#ifdef VCILK + +#define spawnHistIdx 1 //note: starts at 1 +#define syncHistIdx 2 + +#define MakeTheMeasHists() \ + _VMSMasterEnv->measHistsInfo = \ + makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \ + makeAMeasHist( spawnHistIdx, "Spawn", 50, 0, 200 ) \ + makeAMeasHist( syncHistIdx, "Sync", 50, 0, 200 ) + + +#define Meas_startSpawn \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endSpawn \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ spawnHistIdx ] ); + +#define Meas_startSync \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endSync \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ syncHistIdx ] ); +#endif + +//=========================================================================== +// SSR + +#ifdef SSR + +#define SendFromToHistIdx 1 //note: starts at 1 +#define SendOfTypeHistIdx 2 +#define ReceiveFromToHistIdx 3 +#define ReceiveOfTypeHistIdx 4 + +#define MakeTheMeasHists() \ + _VMSMasterEnv->measHistsInfo = \ + makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->measHists), 200); \ + makeAMeasHist( SendFromToHistIdx, "SendFromTo", 50, 0, 100 ) \ + makeAMeasHist( SendOfTypeHistIdx, "SendOfType", 50, 0, 100 ) \ + makeAMeasHist( ReceiveFromToHistIdx,"ReceiveFromTo", 50, 0, 100 ) \ + makeAMeasHist( ReceiveOfTypeHistIdx,"ReceiveOfType", 50, 0, 100 ) + +#define Meas_startSendFromTo \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endSendFromTo \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ SendFromToHistIdx ] ); + +#define Meas_startSendOfType \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endSendOfType \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ SendOfTypeHistIdx ] ); + +#define Meas_startReceiveFromTo \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endReceiveFromTo \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ ReceiveFromToHistIdx ] ); + +#define Meas_startReceiveOfType \ + int32 startStamp, endStamp; \ + saveLowTimeStampCountInto( startStamp ); \ + +#define Meas_endReceiveOfType \ + saveLowTimeStampCountInto( endStamp ); \ + addIntervalToHist( startStamp, endStamp, \ + _VMSMasterEnv->measHists[ReceiveOfTypeHistIdx ] ); +#endif /* SSR */ + +#endif /* _VMS_DEFS_H */ + diff -r 37b061180119 -r 6db9e4898978 __brch__HW__generic_x86_64_MC --- a/__brch__HW__generic_x86_64_MC Sat Feb 11 21:43:43 2012 -0800 +++ b/__brch__HW__generic_x86_64_MC Sun Feb 12 01:49:33 2012 -0800 @@ -1,10 +1,10 @@ A HW branch for: -generic MultiCore x86 64bit instructions set +generic MultiCore machines with x86 64bit instruction set This branch shouldn't be used, except as a lazy fall-back. Instead, try out other branches tuned to specific hardware platforms to find the one that performs best on your machine. Use the "exe_time_vs_task_size" project to generate curves of overhead, and compare result from various branches. -Note, if this branch is used, then vms_defs.h file has to be updated with the number of cores in your machine +Note, if this branch is used, then NUM_CORES in VMS_HW_specific_defs.h file has to be updated with the number of cores in your machine ======== Background on branch naming ========= diff -r 37b061180119 -r 6db9e4898978 probes.c --- a/probes.c Sat Feb 11 21:43:43 2012 -0800 +++ b/probes.c Sun Feb 12 01:49:33 2012 -0800 @@ -9,21 +9,6 @@ #include #include "VMS.h" -#include "Queue_impl/BlockingQueue.h" -#include "Histogram/Histogram.h" - - -//================================ STATS ==================================== - -inline TSCount getTSCount() - { unsigned int low, high; - TSCount out; - - saveTimeStampCountInto( low, high ); - out = high; - out = (out << 32) + low; - return out; - } @@ -108,14 +93,14 @@ * */ IntervalProbe * -create_generic_probe( char *nameStr, VirtProcr *animPr ) +create_generic_probe( char *nameStr, SlaveVP *animPr ) { VMSSemReq reqData; reqData.reqType = createProbe; reqData.nameStr = nameStr; - VMS__send_VMSSem_request( &reqData, animPr ); + VMS_WL__send_VMSSem_request( &reqData, animPr ); return animPr->dataRetFromReq; } @@ -146,13 +131,13 @@ void VMS_impl__free_probe( IntervalProbe *probe ) { if( probe->hist != NULL ) freeDblHist( probe->hist ); - if( probe->nameStr != NULL) VMS__free( probe->nameStr ); - VMS__free( probe ); + if( probe->nameStr != NULL) VMS_int__free( probe->nameStr ); + VMS_int__free( probe ); } int32 -VMS_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr) +VMS_impl__record_time_point_into_new_probe( char *nameStr, SlaveVP *animPr) { IntervalProbe *newProbe; struct timeval *startStamp; float64 startSecs; @@ -190,7 +175,7 @@ } int32 -VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr ) +VMS_impl__create_single_interval_probe( char *nameStr, SlaveVP *animPr ) { IntervalProbe *newProbe; newProbe = create_generic_probe( nameStr, animPr ); @@ -200,7 +185,7 @@ int32 VMS_impl__create_histogram_probe( int32 numBins, float64 startValue, - float64 binWidth, char *nameStr, VirtProcr *animPr ) + float64 binWidth, char *nameStr, SlaveVP *animPr ) { IntervalProbe *newProbe; DblHist *hist; @@ -212,7 +197,7 @@ } void -VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr ) +VMS_impl__index_probe_by_its_name( int32 probeID, SlaveVP *animPr ) { IntervalProbe *probe; //TODO: fix this To be in Master -- race condition @@ -222,7 +207,7 @@ } IntervalProbe * -VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr ) +VMS_impl__get_probe_by_name( char *probeName, SlaveVP *animPr ) { //TODO: fix this To be in Master -- race condition return getValueFromTable( probeName, _VMSMasterEnv->probeNameHashTbl ); @@ -233,7 +218,7 @@ * work locally, in the anim Pr */ void -VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animatingPr ) +VMS_impl__record_sched_choice_into_probe( int32 probeID, SlaveVP *animatingPr ) { IntervalProbe *probe; probe = _VMSMasterEnv->intervalProbes[ probeID ]; diff -r 37b061180119 -r 6db9e4898978 probes.h --- a/probes.h Sat Feb 11 21:43:43 2012 -0800 +++ b/probes.h Sun Feb 12 01:49:33 2012 -0800 @@ -14,15 +14,10 @@ #include +/*Note on order of include files: + * This file relies on #defines that appear in other files.. + */ - //when STATS__TURN_ON_PROBES is defined allows using probes to measure - // time intervals. The probes are macros that only compile to something - // when STATS__TURN_ON_PROBES is defined. The probes are saved in the - // master env -- but only when this is defined. - //The TSC probes use RDTSC instr, can be unreliable, Dbl uses gettimeofday -#define STATS__TURN_ON_PROBES -//#define STATS__USE_TSC_PROBES -#define STATS__USE_DBL_PROBES //typedef struct _IntervalProbe IntervalProbe; //in VMS.h @@ -50,21 +45,13 @@ }; -//============================= Statistics ================================== - - //Frequency of TS counts - //TODO: change freq for each machine -#define TSCOUNT_FREQ 3180000000 - -inline TSCount getTSCount(); - //======================== Probes ============================= // // Use macros to allow turning probes off with a #define switch #ifdef STATS__ENABLE_PROBES int32 -VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr); +VMS_impl__record_time_point_into_new_probe( char *nameStr,SlaveVP *animPr); #define VMS__record_time_point_into_new_probe( nameStr, animPr ) \ VMS_impl__record_time_point_in_new_probe( nameStr, animPr ) @@ -75,14 +62,14 @@ int32 -VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr ); +VMS_impl__create_single_interval_probe( char *nameStr, SlaveVP *animPr ); #define VMS__create_single_interval_probe( nameStr, animPr ) \ VMS_impl__create_single_interval_probe( nameStr, animPr ) int32 VMS_impl__create_histogram_probe( int32 numBins, float64 startValue, - float64 binWidth, char *nameStr, VirtProcr *animPr ); + float64 binWidth, char *nameStr, SlaveVP *animPr ); #define VMS__create_histogram_probe( numBins, startValue, \ binWidth, nameStr, animPr ) \ VMS_impl__create_histogram_probe( numBins, startValue, \ @@ -93,17 +80,17 @@ VMS_impl__free_probe( probe ) void -VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr ); +VMS_impl__index_probe_by_its_name( int32 probeID, SlaveVP *animPr ); #define VMS__index_probe_by_its_name( probeID, animPr ) \ VMS_impl__index_probe_by_its_name( probeID, animPr ) IntervalProbe * -VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr ); +VMS_impl__get_probe_by_name( char *probeName, SlaveVP *animPr ); #define VMS__get_probe_by_name( probeID, animPr ) \ VMS_impl__get_probe_by_name( probeName, animPr ) void -VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr ); +VMS_impl__record_sched_choice_into_probe( int32 probeID, SlaveVP *animPr ); #define VMS__record_sched_choice_into_probe( probeID, animPr ) \ VMS_impl__record_sched_choice_into_probe( probeID, animPr ) @@ -130,7 +117,7 @@ #else int32 -VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr); +VMS_impl__record_time_point_into_new_probe( char *nameStr,SlaveVP *animPr); #define VMS__record_time_point_into_new_probe( nameStr, animPr ) \ 0 /* do nothing */ @@ -141,30 +128,30 @@ int32 -VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr ); +VMS_impl__create_single_interval_probe( char *nameStr, SlaveVP *animPr ); #define VMS__create_single_interval_probe( nameStr, animPr ) \ 0 /* do nothing */ int32 VMS_impl__create_histogram_probe( int32 numBins, float64 startValue, - float64 binWidth, char *nameStr, VirtProcr *animPr ); + float64 binWidth, char *nameStr, SlaveVP *animPr ); #define VMS__create_histogram_probe( numBins, startValue, \ binWidth, nameStr, animPr ) \ 0 /* do nothing */ void -VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr ); +VMS_impl__index_probe_by_its_name( int32 probeID, SlaveVP *animPr ); #define VMS__index_probe_by_its_name( probeID, animPr ) \ /* do nothing */ IntervalProbe * -VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr ); +VMS_impl__get_probe_by_name( char *probeName, SlaveVP *animPr ); #define VMS__get_probe_by_name( probeID, animPr ) \ NULL /* do nothing */ void -VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr ); +VMS_impl__record_sched_choice_into_probe( int32 probeID, SlaveVP *animPr ); #define VMS__record_sched_choice_into_probe( probeID, animPr ) \ /* do nothing */ diff -r 37b061180119 -r 6db9e4898978 vmalloc.c --- a/vmalloc.c Sat Feb 11 21:43:43 2012 -0800 +++ b/vmalloc.c Sun Feb 12 01:49:33 2012 -0800 @@ -13,7 +13,7 @@ #include #include "VMS.h" -#include "Histogram/Histogram.h" +#include "../../C_Libraries/Histogram/Histogram.h" /*Helper function *Insert a newly generated free chunk into the first spot on the free list. @@ -45,9 +45,8 @@ *Shave off the extra and make it into a new free-list element, hook it in * then return the address of the found element plus size of prolog. * - *Will find a */ -void *VMS__malloc( size_t sizeRequested ) +void *VMS_int__malloc( size_t sizeRequested ) { MallocProlog *foundElem = NULL, *currElem, *newElem; ssize_t amountExtra, sizeConsumed,sizeOfFound; uint32 foundElemIsTopOfHeap; @@ -139,7 +138,7 @@ * aligned and padded to the size of a CACHE_LINE. Thus creating a new chunk * before the aligned chunk. */ -void *VMS__malloc_aligned( size_t sizeRequested ) +void *VMS_int__malloc_aligned( size_t sizeRequested ) { MallocProlog *foundElem = NULL, *currElem, *newElem; ssize_t amountExtra, sizeConsumed,sizeOfFound,prevAmount; uint32 foundElemIsTopOfHeap; @@ -266,7 +265,7 @@ * add this one to free-list. */ void -VMS__free( void *ptrToFree ) +VMS_int__free( void *ptrToFree ) { MallocProlog *elemToFree, *nextLowerElem, *nextHigherElem; size_t sizeOfElem; uint32 lowerExistsAndIsFree, higherExistsAndIsFree; diff -r 37b061180119 -r 6db9e4898978 vmalloc.h --- a/vmalloc.h Sat Feb 11 21:43:43 2012 -0800 +++ b/vmalloc.h Sun Feb 12 01:49:33 2012 -0800 @@ -33,13 +33,42 @@ FreeListHead; void * -VMS__malloc( size_t sizeRequested ); +VMS_int__malloc( size_t sizeRequested ); void * -VMS__malloc_aligned( size_t sizeRequested ); +VMS_int__malloc_aligned( size_t sizeRequested ); void -VMS__free( void *ptrToFree ); +VMS_int__free( void *ptrToFree ); + +#define VMS_PI__malloc VMS_int__malloc +#define VMS_PI__malloc_aligned VMS_int__malloc_aligned +#define VMS_PI__free VMS_int__free +/* For now, the PI is protected by master lock, so int malloc fine +void * +VMS_PI__malloc( size_t sizeRequested ); + +void * +VMS_PI__malloc_aligned( size_t sizeRequested ); + +void +VMS_PI__free( void *ptrToFree ); +*/ + +//TODO: protect WL malloc from concurrency!! shared freelist can be corrupted +#define VMS_WL__malloc VMS_int__malloc +#define VMS_WL__malloc_aligned VMS_int__malloc_aligned +#define VMS_WL__free VMS_int__free +/* +void * +VMS_WL__malloc( size_t sizeRequested ); + +void * +VMS_WL__malloc_aligned( size_t sizeRequested ); + +void +VMS_WL__free( void *ptrToFree ); +*/ /*Allocates memory from the external system -- higher overhead */ diff -r 37b061180119 -r 6db9e4898978 vutilities.c --- a/vutilities.c Sat Feb 11 21:43:43 2012 -0800 +++ b/vutilities.c Sun Feb 12 01:49:33 2012 -0800 @@ -14,10 +14,10 @@ inline char * -VMS__strDup( char *str ) +VMS_int__strDup( char *str ) { char *retStr; - retStr = VMS__malloc( strlen(str) + 1 ); + retStr = VMS_int__malloc( strlen(str) + 1 ); if( str == NULL ) return str; strcpy( retStr, str ); diff -r 37b061180119 -r 6db9e4898978 vutilities.h --- a/vutilities.h Sat Feb 11 21:43:43 2012 -0800 +++ b/vutilities.h Sun Feb 12 01:49:33 2012 -0800 @@ -15,6 +15,6 @@ #include "VMS_primitive_data_types.h" inline char * -VMS__strDup( char *str ); +VMS_int__strDup( char *str ); #endif