comparison MasterLoop.c @ 132:dbfc8382d546

distributed memory allocation interface - unfinished
author Merten Sach <msach@mailbox.tu-berlin.de>
date Fri, 16 Sep 2011 14:25:49 +0200
parents 24466227d8bb
children a9b72021f053
comparison
equal deleted inserted replaced
34:6934c81bbc98 38:645c2879e577
92 VirtProcr *masterPr; 92 VirtProcr *masterPr;
93 volatile VirtProcr *volatileMasterPr; 93 volatile VirtProcr *volatileMasterPr;
94 94
95 volatileMasterPr = animatingPr; 95 volatileMasterPr = animatingPr;
96 masterPr = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp 96 masterPr = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp
97 masterEnv = (MasterEnv*)_VMSMasterEnv;
97 98
98 //First animation of each MasterVP will in turn animate this part 99 //First animation of each MasterVP will in turn animate this part
99 // of setup code.. (VP creator sets up the stack as if this function 100 // of setup code.. (VP creator sets up the stack as if this function
100 // was called normally, but actually get here by jmp) 101 // was called normally, but actually get here by jmp)
101 102
102 //Sept 2011 103 //Sept 2011
103 //Old code jumped directly to this point, but doesn't work on x64 104 //Old code jumped directly to this point, but doesn't work on x64
104 // So, just make this an endless loop, and do assembly function at end 105 // So, just make this an endless loop, and do assembly function at end
105 // that saves its own return addr, then jumps to core_loop. 106 // that saves its own return addr, then jumps to core_loop.
106 while(1) 107 while(1)
107 { 108 {
108
109 //============================= MEASUREMENT STUFF ======================== 109 //============================= MEASUREMENT STUFF ========================
110 #ifdef MEAS__TIME_MASTER 110 #ifdef MEAS__TIME_MASTER
111 //Total Master time includes one coreloop time -- just assume the core 111 //Total Master time includes one coreloop time -- just assume the core
112 // loop time is same for Master as is for AppVPs, even though it may be 112 // loop time is same for Master as is for AppVPs, even though it may be
113 // smaller due to higher predictability of the fixed jmp. 113 // smaller due to higher predictability of the fixed jmp.
114 saveLowTimeStampCountInto( masterPr->startMasterTSCLow ); 114 saveLowTimeStampCountInto( masterPr->startMasterTSCLow );
115 #endif 115 #endif
116 //======================================================================== 116 //========================================================================
117 117
118 masterEnv = (MasterEnv*)_VMSMasterEnv; 118 //GCC may optimize so doesn't always re-define from frame-storage
119
120 //GCC may optimize so doesn't always re-define from frame-storage
121 masterPr = (VirtProcr*)volatileMasterPr; //on stack, reload after jmp
122 thisCoresIdx = masterPr->coreAnimatedBy; 119 thisCoresIdx = masterPr->coreAnimatedBy;
120 masterEnv->currentMasterProcrID = thisCoresIdx;
123 readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx]; 121 readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx];
124 schedSlots = masterEnv->allSchedSlots[thisCoresIdx]; 122 schedSlots = masterEnv->allSchedSlots[thisCoresIdx];
125 123
126 requestHandler = masterEnv->requestHandler; 124 requestHandler = masterEnv->requestHandler;
127 slaveScheduler = masterEnv->slaveScheduler; 125 slaveScheduler = masterEnv->slaveScheduler;
172 (*slaveScheduler)( semanticEnv, thisCoresIdx ); 170 (*slaveScheduler)( semanticEnv, thisCoresIdx );
173 171
174 if( schedVirtPr != NULL ) 172 if( schedVirtPr != NULL )
175 { currSlot->procrAssignedToSlot = schedVirtPr; 173 { currSlot->procrAssignedToSlot = schedVirtPr;
176 schedVirtPr->schedSlot = currSlot; 174 schedVirtPr->schedSlot = currSlot;
175 schedVirtPr->coreAnimatedBy = thisCoresIdx;
177 currSlot->needsProcrAssigned = FALSE; 176 currSlot->needsProcrAssigned = FALSE;
178 numSlotsFilled += 1; 177 numSlotsFilled += 1;
179 178
180 writeVMSQ( schedVirtPr, readyToAnimateQ ); 179 writeVMSQ( schedVirtPr, readyToAnimateQ );
181 } 180 }