# HG changeset patch # User Merten Sach # Date 1324406562 -3600 # Node ID cf5faa15cb4d32633c81addff92664a5a08e6843 # Parent de5e7c522f1ff03e34528b5dcf59ec6a33e54a11 moved more variable accesses to pointers, should be optimized out anyway diff -r de5e7c522f1f -r cf5faa15cb4d CoreLoop.c --- a/CoreLoop.c Tue Dec 20 19:17:11 2011 +0100 +++ b/CoreLoop.c Tue Dec 20 19:42:42 2011 +0100 @@ -41,7 +41,9 @@ int errorCode; TSCountLowHigh endSusp; uint64 numCycles; - int32 numMasterInARow = 0; + int32 numMasterInARow = 0; + volatile int32 *masterLock; + VirtProcr *masterVP; //work-stealing struc on stack to prevent false-sharing in cache-line volatile GateStruc gate; @@ -86,12 +88,15 @@ saveCoreLoopReturnAddr((void**)&(_VMSMasterEnv->coreLoopReturnPt)); - while(1){ - //Get virtual processor from queue //The Q 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]; + + masterLock = &(_VMSMasterEnv->masterLockUnion.masterLock); + masterVP = _VMSMasterEnv->masterVPs[thisCoresIdx]; + +while(1){ #ifdef USE_WORK_STEALING //Alg for work-stealing designed to make common case fast. Comment @@ -126,11 +131,11 @@ while( currVP == NULL ) //if queue was empty, enter get masterLock loop { //queue was empty, so get master lock - gotLock = __sync_bool_compare_and_swap(&(_VMSMasterEnv->masterLockUnion.masterLock), - UNLOCKED, LOCKED ); + gotLock = __sync_bool_compare_and_swap(masterLock, + UNLOCKED, LOCKED ); if( gotLock ) { //run own MasterVP -- jmps to coreLoops startPt when done - currVP = _VMSMasterEnv->masterVPs[thisCoresIdx]; + currVP = masterVP; if( numMasterInARow > 1000 ) { DEBUG( dbgB2BMaster,"Many back to back MasterVPs\n"); pthread_yield(); diff -r de5e7c522f1f -r cf5faa15cb4d VMS_defs.h --- a/VMS_defs.h Tue Dec 20 19:17:11 2011 +0100 +++ b/VMS_defs.h Tue Dec 20 19:42:42 2011 +0100 @@ -55,7 +55,7 @@ //=========================== MEASUREMENT ======================= -#define MEAS__TIME_2011_SYS +//#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