| rev |
line source |
|
Me@0
|
1 /*
|
|
Me@38
|
2 * Copyright 2010 OpenSourceStewardshipFoundation
|
|
Me@0
|
3 *
|
|
Me@0
|
4 * Licensed under BSD
|
|
Me@0
|
5 */
|
|
Me@0
|
6
|
|
Me@0
|
7 #include <stdio.h>
|
|
Me@0
|
8 #include <stdlib.h>
|
|
Me@50
|
9 #include <string.h>
|
|
Me@0
|
10 #include <malloc.h>
|
|
msach@76
|
11 #include <inttypes.h>
|
|
Me@50
|
12 #include <sys/time.h>
|
|
Me@0
|
13
|
|
Me@0
|
14 #include "VMS.h"
|
|
msach@77
|
15 #include "ProcrContext.h"
|
|
Me@0
|
16 #include "Queue_impl/BlockingQueue.h"
|
|
Me@38
|
17 #include "Histogram/Histogram.h"
|
|
Me@0
|
18
|
|
Me@0
|
19
|
|
Me@26
|
20 #define thdAttrs NULL
|
|
Me@26
|
21
|
|
Me@22
|
22 //===========================================================================
|
|
Me@22
|
23 void
|
|
Me@22
|
24 shutdownFn( void *dummy, VirtProcr *dummy2 );
|
|
Me@22
|
25
|
|
Me@31
|
26 SchedSlot **
|
|
Me@31
|
27 create_sched_slots();
|
|
Me@22
|
28
|
|
Me@28
|
29 void
|
|
Me@28
|
30 create_masterEnv();
|
|
Me@28
|
31
|
|
Me@28
|
32 void
|
|
Me@28
|
33 create_the_coreLoop_OS_threads();
|
|
Me@28
|
34
|
|
Me@50
|
35 MallocProlog *
|
|
Me@50
|
36 create_free_list();
|
|
Me@50
|
37
|
|
Me@53
|
38 void
|
|
Me@53
|
39 endOSThreadFn( void *initData, VirtProcr *animatingPr );
|
|
Me@50
|
40
|
|
Me@26
|
41 pthread_mutex_t suspendLock = PTHREAD_MUTEX_INITIALIZER;
|
|
Me@26
|
42 pthread_cond_t suspend_cond = PTHREAD_COND_INITIALIZER;
|
|
Me@26
|
43
|
|
Me@22
|
44 //===========================================================================
|
|
Me@22
|
45
|
|
Me@0
|
46 /*Setup has two phases:
|
|
Me@0
|
47 * 1) Semantic layer first calls init_VMS, which creates masterEnv, and puts
|
|
Me@8
|
48 * the master virt procr into the work-queue, ready for first "call"
|
|
Me@8
|
49 * 2) Semantic layer then does its own init, which creates the seed virt
|
|
Me@8
|
50 * procr inside the semantic layer, ready to schedule it when
|
|
Me@0
|
51 * asked by the first run of the masterLoop.
|
|
Me@0
|
52 *
|
|
Me@0
|
53 *This part is bit weird because VMS really wants to be "always there", and
|
|
Me@0
|
54 * have applications attach and detach.. for now, this VMS is part of
|
|
Me@0
|
55 * the app, so the VMS system starts up as part of running the app.
|
|
Me@0
|
56 *
|
|
Me@8
|
57 *The semantic layer is isolated from the VMS internals by making the
|
|
Me@8
|
58 * semantic layer do setup to a state that it's ready with its
|
|
Me@8
|
59 * initial virt procrs, ready to schedule them to slots when the masterLoop
|
|
Me@0
|
60 * asks. Without this pattern, the semantic layer's setup would
|
|
Me@8
|
61 * have to modify slots directly to assign the initial virt-procrs, and put
|
|
Me@31
|
62 * them into the readyToAnimateQ itself, breaking the isolation completely.
|
|
Me@0
|
63 *
|
|
Me@0
|
64 *
|
|
Me@8
|
65 *The semantic layer creates the initial virt procr(s), and adds its
|
|
Me@8
|
66 * own environment to masterEnv, and fills in the pointers to
|
|
Me@0
|
67 * the requestHandler and slaveScheduler plug-in functions
|
|
Me@8
|
68 */
|
|
Me@8
|
69
|
|
Me@8
|
70 /*This allocates VMS data structures, populates the master VMSProc,
|
|
Me@0
|
71 * and master environment, and returns the master environment to the semantic
|
|
Me@0
|
72 * layer.
|
|
Me@0
|
73 */
|
|
Me@8
|
74 void
|
|
Me@8
|
75 VMS__init()
|
|
Me@28
|
76 {
|
|
Me@28
|
77 create_masterEnv();
|
|
Me@28
|
78 create_the_coreLoop_OS_threads();
|
|
Me@28
|
79 }
|
|
Me@28
|
80
|
|
msach@71
|
81 #ifdef SEQUENTIAL
|
|
msach@71
|
82
|
|
Me@28
|
83 /*To initialize the sequential version, just don't create the threads
|
|
Me@28
|
84 */
|
|
Me@28
|
85 void
|
|
Me@28
|
86 VMS__init_Seq()
|
|
Me@28
|
87 {
|
|
Me@28
|
88 create_masterEnv();
|
|
Me@28
|
89 }
|
|
Me@28
|
90
|
|
msach@71
|
91 #endif
|
|
msach@71
|
92
|
|
Me@28
|
93 void
|
|
Me@28
|
94 create_masterEnv()
|
|
Me@31
|
95 { MasterEnv *masterEnv;
|
|
Me@55
|
96 VMSQueueStruc **readyToAnimateQs;
|
|
Me@31
|
97 int coreIdx;
|
|
Me@31
|
98 VirtProcr **masterVPs;
|
|
Me@31
|
99 SchedSlot ***allSchedSlots; //ptr to array of ptrs
|
|
Me@53
|
100
|
|
Me@53
|
101
|
|
Me@31
|
102 //Make the master env, which holds everything else
|
|
Me@1
|
103 _VMSMasterEnv = malloc( sizeof(MasterEnv) );
|
|
Me@53
|
104
|
|
Me@53
|
105 //Very first thing put into the master env is the free-list, seeded
|
|
Me@53
|
106 // with a massive initial chunk of memory.
|
|
Me@53
|
107 //After this, all other mallocs are VMS__malloc.
|
|
msach@132
|
108 int i;
|
|
msach@132
|
109 for(i=0; i<NUM_CORES; i++)
|
|
msach@132
|
110 {
|
|
msach@132
|
111 _VMSMasterEnv->freeListHead[i] = VMS_ext__create_free_list();
|
|
msach@132
|
112 }
|
|
Me@53
|
113
|
|
Me@65
|
114
|
|
Me@65
|
115 //============================= MEASUREMENT STUFF ========================
|
|
Me@65
|
116 #ifdef MEAS__TIME_MALLOC
|
|
msach@84
|
117 _VMSMasterEnv->mallocTimeHist = makeFixedBinHistExt( 100, 0, 100,
|
|
msach@79
|
118 "malloc_time_hist");
|
|
msach@84
|
119 _VMSMasterEnv->freeTimeHist = makeFixedBinHistExt( 80, 0, 100,
|
|
msach@79
|
120 "free_time_hist");
|
|
Me@65
|
121 #endif
|
|
Me@68
|
122 #ifdef MEAS__TIME_PLUGIN
|
|
msach@84
|
123 _VMSMasterEnv->reqHdlrLowTimeHist = makeFixedBinHistExt( 1000, 0, 100,
|
|
msach@79
|
124 "plugin_low_time_hist");
|
|
msach@84
|
125 _VMSMasterEnv->reqHdlrHighTimeHist = makeFixedBinHistExt( 1000, 0, 100,
|
|
msach@79
|
126 "plugin_high_time_hist");
|
|
Me@68
|
127 #endif
|
|
Me@65
|
128 //========================================================================
|
|
Me@65
|
129
|
|
Me@53
|
130 //===================== Only VMS__malloc after this ====================
|
|
msach@69
|
131 masterEnv = (MasterEnv*)_VMSMasterEnv;
|
|
Me@31
|
132
|
|
Me@31
|
133 //Make a readyToAnimateQ for each core loop
|
|
Me@55
|
134 readyToAnimateQs = VMS__malloc( NUM_CORES * sizeof(VMSQueueStruc *) );
|
|
Me@53
|
135 masterVPs = VMS__malloc( NUM_CORES * sizeof(VirtProcr *) );
|
|
Me@0
|
136
|
|
Me@31
|
137 //One array for each core, 3 in array, core's masterVP scheds all
|
|
Me@53
|
138 allSchedSlots = VMS__malloc( NUM_CORES * sizeof(SchedSlot *) );
|
|
Me@0
|
139
|
|
Me@53
|
140 _VMSMasterEnv->numProcrsCreated = 0; //used by create procr
|
|
Me@31
|
141 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@53
|
142 {
|
|
Me@55
|
143 readyToAnimateQs[ coreIdx ] = makeVMSQ();
|
|
Me@31
|
144
|
|
Me@50
|
145 //Q: should give masterVP core-specific info as its init data?
|
|
msach@76
|
146 masterVPs[ coreIdx ] = VMS__create_procr( (VirtProcrFnPtr)&masterLoop, (void*)masterEnv );
|
|
Me@31
|
147 masterVPs[ coreIdx ]->coreAnimatedBy = coreIdx;
|
|
Me@31
|
148 allSchedSlots[ coreIdx ] = create_sched_slots(); //makes for one core
|
|
Me@53
|
149 _VMSMasterEnv->numMasterInARow[ coreIdx ] = 0;
|
|
Me@55
|
150 _VMSMasterEnv->workStealingGates[ coreIdx ] = NULL;
|
|
Me@31
|
151 }
|
|
Me@31
|
152 _VMSMasterEnv->readyToAnimateQs = readyToAnimateQs;
|
|
Me@31
|
153 _VMSMasterEnv->masterVPs = masterVPs;
|
|
Me@50
|
154 _VMSMasterEnv->masterLock = UNLOCKED;
|
|
Me@31
|
155 _VMSMasterEnv->allSchedSlots = allSchedSlots;
|
|
Me@55
|
156 _VMSMasterEnv->workStealingLock = UNLOCKED;
|
|
Me@28
|
157
|
|
Me@12
|
158
|
|
Me@31
|
159 //Aug 19, 2010: no longer need to place initial masterVP into queue
|
|
Me@31
|
160 // because coreLoop now controls -- animates its masterVP when no work
|
|
Me@31
|
161
|
|
Me@30
|
162
|
|
Me@50
|
163 //============================= MEASUREMENT STUFF ========================
|
|
Me@50
|
164 #ifdef STATS__TURN_ON_PROBES
|
|
Me@50
|
165 _VMSMasterEnv->dynIntervalProbesInfo =
|
|
msach@69
|
166 makePrivDynArrayOfSize( (void***)&(_VMSMasterEnv->intervalProbes), 200);
|
|
Me@30
|
167
|
|
Me@53
|
168 _VMSMasterEnv->probeNameHashTbl = makeHashTable( 1000, &VMS__free );
|
|
Me@53
|
169
|
|
Me@53
|
170 //put creation time directly into master env, for fast retrieval
|
|
Me@50
|
171 struct timeval timeStamp;
|
|
Me@50
|
172 gettimeofday( &(timeStamp), NULL);
|
|
Me@50
|
173 _VMSMasterEnv->createPtInSecs =
|
|
Me@50
|
174 timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0);
|
|
Me@50
|
175 #endif
|
|
Me@65
|
176 #ifdef MEAS__TIME_MASTER_LOCK
|
|
Me@65
|
177 _VMSMasterEnv->masterLockLowTimeHist = makeFixedBinHist( 50, 0, 2,
|
|
Me@65
|
178 "master lock low time hist");
|
|
Me@68
|
179 _VMSMasterEnv->masterLockHighTimeHist = makeFixedBinHist( 50, 0, 100,
|
|
Me@65
|
180 "master lock high time hist");
|
|
Me@65
|
181 #endif
|
|
Me@68
|
182
|
|
msach@76
|
183 MakeTheMeasHists();
|
|
Me@50
|
184 //========================================================================
|
|
Me@38
|
185
|
|
Me@0
|
186 }
|
|
Me@0
|
187
|
|
Me@31
|
188 SchedSlot **
|
|
Me@31
|
189 create_sched_slots()
|
|
Me@31
|
190 { SchedSlot **schedSlots;
|
|
Me@0
|
191 int i;
|
|
Me@0
|
192
|
|
Me@53
|
193 schedSlots = VMS__malloc( NUM_SCHED_SLOTS * sizeof(SchedSlot *) );
|
|
Me@8
|
194
|
|
Me@1
|
195 for( i = 0; i < NUM_SCHED_SLOTS; i++ )
|
|
Me@0
|
196 {
|
|
Me@53
|
197 schedSlots[i] = VMS__malloc( sizeof(SchedSlot) );
|
|
Me@8
|
198
|
|
Me@1
|
199 //Set state to mean "handling requests done, slot needs filling"
|
|
Me@8
|
200 schedSlots[i]->workIsDone = FALSE;
|
|
Me@8
|
201 schedSlots[i]->needsProcrAssigned = TRUE;
|
|
Me@0
|
202 }
|
|
Me@31
|
203 return schedSlots;
|
|
Me@31
|
204 }
|
|
Me@31
|
205
|
|
Me@31
|
206
|
|
Me@31
|
207 void
|
|
Me@31
|
208 freeSchedSlots( SchedSlot **schedSlots )
|
|
Me@31
|
209 { int i;
|
|
Me@31
|
210 for( i = 0; i < NUM_SCHED_SLOTS; i++ )
|
|
Me@31
|
211 {
|
|
Me@53
|
212 VMS__free( schedSlots[i] );
|
|
Me@31
|
213 }
|
|
Me@53
|
214 VMS__free( schedSlots );
|
|
Me@0
|
215 }
|
|
Me@0
|
216
|
|
Me@8
|
217
|
|
Me@28
|
218 void
|
|
Me@28
|
219 create_the_coreLoop_OS_threads()
|
|
Me@28
|
220 {
|
|
Me@28
|
221 //========================================================================
|
|
Me@28
|
222 // Create the Threads
|
|
Me@28
|
223 int coreIdx, retCode;
|
|
Me@28
|
224
|
|
Me@28
|
225 //Need the threads to be created suspended, and wait for a signal
|
|
Me@28
|
226 // before proceeding -- gives time after creating to initialize other
|
|
Me@28
|
227 // stuff before the coreLoops set off.
|
|
Me@28
|
228 _VMSMasterEnv->setupComplete = 0;
|
|
Me@28
|
229
|
|
Me@28
|
230 //Make the threads that animate the core loops
|
|
Me@28
|
231 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@53
|
232 { coreLoopThdParams[coreIdx] = VMS__malloc( sizeof(ThdParams) );
|
|
Me@28
|
233 coreLoopThdParams[coreIdx]->coreNum = coreIdx;
|
|
Me@28
|
234
|
|
Me@28
|
235 retCode =
|
|
Me@28
|
236 pthread_create( &(coreLoopThdHandles[coreIdx]),
|
|
Me@28
|
237 thdAttrs,
|
|
Me@28
|
238 &coreLoop,
|
|
Me@28
|
239 (void *)(coreLoopThdParams[coreIdx]) );
|
|
Me@50
|
240 if(retCode){printf("ERROR creating thread: %d\n", retCode); exit(1);}
|
|
Me@28
|
241 }
|
|
Me@28
|
242 }
|
|
Me@28
|
243
|
|
Me@0
|
244 /*Semantic layer calls this when it want the system to start running..
|
|
Me@0
|
245 *
|
|
Me@24
|
246 *This starts the core loops running then waits for them to exit.
|
|
Me@0
|
247 */
|
|
Me@12
|
248 void
|
|
Me@24
|
249 VMS__start_the_work_then_wait_until_done()
|
|
Me@12
|
250 { int coreIdx;
|
|
Me@24
|
251 //Start the core loops running
|
|
Me@25
|
252
|
|
Me@25
|
253 //tell the core loop threads that setup is complete
|
|
Me@25
|
254 //get lock, to lock out any threads still starting up -- they'll see
|
|
Me@25
|
255 // that setupComplete is true before entering while loop, and so never
|
|
Me@25
|
256 // wait on the condition
|
|
Me@26
|
257 pthread_mutex_lock( &suspendLock );
|
|
Me@25
|
258 _VMSMasterEnv->setupComplete = 1;
|
|
Me@26
|
259 pthread_mutex_unlock( &suspendLock );
|
|
Me@26
|
260 pthread_cond_broadcast( &suspend_cond );
|
|
Me@25
|
261
|
|
Me@25
|
262
|
|
Me@24
|
263 //wait for all to complete
|
|
Me@8
|
264 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@8
|
265 {
|
|
Me@25
|
266 pthread_join( coreLoopThdHandles[coreIdx], NULL );
|
|
Me@24
|
267 }
|
|
Me@25
|
268
|
|
Me@24
|
269 //NOTE: do not clean up VMS env here -- semantic layer has to have
|
|
Me@24
|
270 // a chance to clean up its environment first, then do a call to free
|
|
Me@24
|
271 // the Master env and rest of VMS locations
|
|
Me@8
|
272 }
|
|
Me@0
|
273
|
|
msach@70
|
274 #ifdef SEQUENTIAL
|
|
Me@28
|
275 /*Only difference between version with an OS thread pinned to each core and
|
|
Me@28
|
276 * the sequential version of VMS is VMS__init_Seq, this, and coreLoop_Seq.
|
|
Me@28
|
277 */
|
|
Me@28
|
278 void
|
|
Me@28
|
279 VMS__start_the_work_then_wait_until_done_Seq()
|
|
Me@28
|
280 {
|
|
Me@28
|
281 //Instead of un-suspending threads, just call the one and only
|
|
Me@28
|
282 // core loop (sequential version), in the main thread.
|
|
Me@28
|
283 coreLoop_Seq( NULL );
|
|
msach@75
|
284 flushRegisters();
|
|
Me@28
|
285
|
|
Me@28
|
286 }
|
|
msach@70
|
287 #endif
|
|
Me@28
|
288
|
|
Me@50
|
289 inline VirtProcr *
|
|
Me@50
|
290 VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData )
|
|
Me@50
|
291 { VirtProcr *newPr;
|
|
msach@76
|
292 void *stackLocs;
|
|
Me@50
|
293
|
|
Me@50
|
294 newPr = VMS__malloc( sizeof(VirtProcr) );
|
|
Me@50
|
295 stackLocs = VMS__malloc( VIRT_PROCR_STACK_SIZE );
|
|
Me@50
|
296 if( stackLocs == 0 )
|
|
Me@50
|
297 { perror("VMS__malloc stack"); exit(1); }
|
|
Me@50
|
298
|
|
msach@69
|
299 return create_procr_helper( newPr, fnPtr, initialData, stackLocs );
|
|
Me@50
|
300 }
|
|
Me@50
|
301
|
|
Me@50
|
302 /* "ext" designates that it's for use outside the VMS system -- should only
|
|
Me@50
|
303 * be called from main thread or other thread -- never from code animated by
|
|
Me@50
|
304 * a VMS virtual processor.
|
|
Me@50
|
305 */
|
|
Me@50
|
306 inline VirtProcr *
|
|
Me@50
|
307 VMS_ext__create_procr( VirtProcrFnPtr fnPtr, void *initialData )
|
|
Me@50
|
308 { VirtProcr *newPr;
|
|
Me@50
|
309 char *stackLocs;
|
|
Me@50
|
310
|
|
Me@50
|
311 newPr = malloc( sizeof(VirtProcr) );
|
|
Me@50
|
312 stackLocs = malloc( VIRT_PROCR_STACK_SIZE );
|
|
Me@50
|
313 if( stackLocs == 0 )
|
|
Me@50
|
314 { perror("malloc stack"); exit(1); }
|
|
Me@50
|
315
|
|
msach@69
|
316 return create_procr_helper( newPr, fnPtr, initialData, stackLocs );
|
|
Me@50
|
317 }
|
|
Me@50
|
318
|
|
Me@8
|
319
|
|
Me@64
|
320 /*Anticipating multi-tasking
|
|
Me@64
|
321 */
|
|
Me@64
|
322 void *
|
|
Me@64
|
323 VMS__give_sem_env_for( VirtProcr *animPr )
|
|
Me@64
|
324 {
|
|
Me@64
|
325 return _VMSMasterEnv->semanticEnv;
|
|
Me@64
|
326 }
|
|
Me@64
|
327 //===========================================================================
|
|
Me@26
|
328 /*there is a label inside this function -- save the addr of this label in
|
|
Me@0
|
329 * the callingPr struc, as the pick-up point from which to start the next
|
|
Me@0
|
330 * work-unit for that procr. If turns out have to save registers, then
|
|
Me@0
|
331 * save them in the procr struc too. Then do assembly jump to the CoreLoop's
|
|
Me@0
|
332 * "done with work-unit" label. The procr struc is in the request in the
|
|
Me@0
|
333 * slave that animated the just-ended work-unit, so all the state is saved
|
|
Me@0
|
334 * there, and will get passed along, inside the request handler, to the
|
|
Me@0
|
335 * next work-unit for that procr.
|
|
Me@0
|
336 */
|
|
Me@8
|
337 void
|
|
Me@38
|
338 VMS__suspend_procr( VirtProcr *animatingPr )
|
|
Me@55
|
339 {
|
|
Me@30
|
340
|
|
Me@30
|
341 //The request to master will cause this suspended virt procr to get
|
|
Me@30
|
342 // scheduled again at some future point -- to resume, core loop jumps
|
|
Me@30
|
343 // to the resume point (below), which causes restore of saved regs and
|
|
Me@30
|
344 // "return" from this call.
|
|
msach@71
|
345 //animatingPr->nextInstrPt = &&ResumePt;
|
|
Me@30
|
346
|
|
Me@30
|
347 //return ownership of the virt procr and sched slot to Master virt pr
|
|
Me@38
|
348 animatingPr->schedSlot->workIsDone = TRUE;
|
|
Me@1
|
349
|
|
Me@41
|
350 //=========================== Measurement stuff ========================
|
|
Me@38
|
351 #ifdef MEAS__TIME_STAMP_SUSP
|
|
Me@41
|
352 //record time stamp: compare to time-stamp recorded below
|
|
Me@38
|
353 saveLowTimeStampCountInto( animatingPr->preSuspTSCLow );
|
|
Me@38
|
354 #endif
|
|
Me@41
|
355 //=======================================================================
|
|
Me@30
|
356
|
|
msach@71
|
357 switchToCoreLoop(animatingPr);
|
|
msach@71
|
358 flushRegisters();
|
|
Me@55
|
359
|
|
Me@55
|
360 //=======================================================================
|
|
Me@30
|
361
|
|
Me@38
|
362 #ifdef MEAS__TIME_STAMP_SUSP
|
|
Me@41
|
363 //NOTE: only take low part of count -- do sanity check when take diff
|
|
Me@38
|
364 saveLowTimeStampCountInto( animatingPr->postSuspTSCLow );
|
|
Me@38
|
365 #endif
|
|
Me@30
|
366
|
|
Me@0
|
367 return;
|
|
Me@0
|
368 }
|
|
Me@0
|
369
|
|
Me@22
|
370
|
|
Me@22
|
371
|
|
Me@50
|
372 /*For this implementation of VMS, it may not make much sense to have the
|
|
Me@50
|
373 * system of requests for creating a new processor done this way.. but over
|
|
Me@50
|
374 * the scope of single-master, multi-master, mult-tasking, OS-implementing,
|
|
Me@50
|
375 * distributed-memory, and so on, this gives VMS implementation a chance to
|
|
Me@50
|
376 * do stuff before suspend, in the AppVP, and in the Master before the plugin
|
|
Me@50
|
377 * is called, as well as in the lang-lib before this is called, and in the
|
|
Me@50
|
378 * plugin. So, this gives both VMS and language implementations a chance to
|
|
Me@50
|
379 * intercept at various points and do order-dependent stuff.
|
|
Me@50
|
380 *Having a standard VMSNewPrReqData struc allows the language to create and
|
|
Me@50
|
381 * free the struc, while VMS knows how to get the newPr if it wants it, and
|
|
Me@50
|
382 * it lets the lang have lang-specific data related to creation transported
|
|
Me@50
|
383 * to the plugin.
|
|
Me@50
|
384 */
|
|
Me@50
|
385 void
|
|
Me@50
|
386 VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr )
|
|
Me@50
|
387 { VMSReqst req;
|
|
Me@50
|
388
|
|
Me@50
|
389 req.reqType = createReq;
|
|
Me@50
|
390 req.semReqData = semReqData;
|
|
Me@50
|
391 req.nextReqst = reqstingPr->requests;
|
|
Me@50
|
392 reqstingPr->requests = &req;
|
|
Me@50
|
393
|
|
Me@50
|
394 VMS__suspend_procr( reqstingPr );
|
|
Me@50
|
395 }
|
|
Me@50
|
396
|
|
Me@22
|
397
|
|
Me@38
|
398 /*
|
|
Me@22
|
399 *This adds a request to dissipate, then suspends the processor so that the
|
|
Me@22
|
400 * request handler will receive the request. The request handler is what
|
|
Me@22
|
401 * does the work of freeing memory and removing the processor from the
|
|
Me@22
|
402 * semantic environment's data structures.
|
|
Me@22
|
403 *The request handler also is what figures out when to shutdown the VMS
|
|
Me@22
|
404 * system -- which causes all the core loop threads to die, and returns from
|
|
Me@22
|
405 * the call that started up VMS to perform the work.
|
|
Me@22
|
406 *
|
|
Me@22
|
407 *This form is a bit misleading to understand if one is trying to figure out
|
|
Me@22
|
408 * how VMS works -- it looks like a normal function call, but inside it
|
|
Me@22
|
409 * sends a request to the request handler and suspends the processor, which
|
|
Me@22
|
410 * jumps out of the VMS__dissipate_procr function, and out of all nestings
|
|
Me@22
|
411 * above it, transferring the work of dissipating to the request handler,
|
|
Me@22
|
412 * which then does the actual work -- causing the processor that animated
|
|
Me@22
|
413 * the call of this function to disappear and the "hanging" state of this
|
|
Me@22
|
414 * function to just poof into thin air -- the virtual processor's trace
|
|
Me@22
|
415 * never returns from this call, but instead the virtual processor's trace
|
|
Me@22
|
416 * gets suspended in this call and all the virt processor's state disap-
|
|
Me@22
|
417 * pears -- making that suspend the last thing in the virt procr's trace.
|
|
Me@8
|
418 */
|
|
Me@8
|
419 void
|
|
Me@53
|
420 VMS__send_dissipate_req( VirtProcr *procrToDissipate )
|
|
Me@50
|
421 { VMSReqst req;
|
|
Me@22
|
422
|
|
Me@50
|
423 req.reqType = dissipate;
|
|
Me@50
|
424 req.nextReqst = procrToDissipate->requests;
|
|
Me@50
|
425 procrToDissipate->requests = &req;
|
|
Me@50
|
426
|
|
Me@22
|
427 VMS__suspend_procr( procrToDissipate );
|
|
Me@50
|
428 }
|
|
Me@50
|
429
|
|
Me@50
|
430
|
|
Me@50
|
431 /* "ext" designates that it's for use outside the VMS system -- should only
|
|
Me@50
|
432 * be called from main thread or other thread -- never from code animated by
|
|
Me@50
|
433 * a VMS virtual processor.
|
|
Me@50
|
434 *
|
|
Me@50
|
435 *Use this version to dissipate VPs created outside the VMS system.
|
|
Me@50
|
436 */
|
|
Me@50
|
437 void
|
|
Me@50
|
438 VMS_ext__dissipate_procr( VirtProcr *procrToDissipate )
|
|
Me@50
|
439 {
|
|
Me@50
|
440 //NOTE: initialData was given to the processor, so should either have
|
|
Me@50
|
441 // been alloc'd with VMS__malloc, or freed by the level above animPr.
|
|
Me@50
|
442 //So, all that's left to free here is the stack and the VirtProcr struc
|
|
Me@50
|
443 // itself
|
|
Me@50
|
444 //Note, should not stack-allocate initial data -- no guarantee, in
|
|
Me@50
|
445 // general that creating processor will outlive ones it creates.
|
|
Me@50
|
446 free( procrToDissipate->startOfStack );
|
|
Me@50
|
447 free( procrToDissipate );
|
|
Me@50
|
448 }
|
|
Me@50
|
449
|
|
Me@22
|
450
|
|
Me@22
|
451
|
|
Me@53
|
452 /*This call's name indicates that request is malloc'd -- so req handler
|
|
Me@53
|
453 * has to free any extra requests tacked on before a send, using this.
|
|
Me@53
|
454 *
|
|
Me@53
|
455 * This inserts the semantic-layer's request data into standard VMS carrier
|
|
Me@53
|
456 * request data-struct that is mallocd. The sem request doesn't need to
|
|
Me@53
|
457 * be malloc'd if this is called inside the same call chain before the
|
|
Me@53
|
458 * send of the last request is called.
|
|
Me@53
|
459 *
|
|
Me@53
|
460 *The request handler has to call VMS__free_VMSReq for any of these
|
|
Me@22
|
461 */
|
|
Me@22
|
462 inline void
|
|
Me@53
|
463 VMS__add_sem_request_in_mallocd_VMSReqst( void *semReqData,
|
|
Me@53
|
464 VirtProcr *callingPr )
|
|
Me@53
|
465 { VMSReqst *req;
|
|
Me@22
|
466
|
|
Me@53
|
467 req = VMS__malloc( sizeof(VMSReqst) );
|
|
Me@53
|
468 req->reqType = semantic;
|
|
Me@53
|
469 req->semReqData = semReqData;
|
|
Me@53
|
470 req->nextReqst = callingPr->requests;
|
|
Me@53
|
471 callingPr->requests = req;
|
|
Me@22
|
472 }
|
|
Me@22
|
473
|
|
Me@50
|
474 /*This inserts the semantic-layer's request data into standard VMS carrier
|
|
Me@50
|
475 * request data-struct is allocated on stack of this call & ptr to it sent
|
|
Me@50
|
476 * to plugin
|
|
Me@50
|
477 *Then it does suspend, to cause request to be sent.
|
|
Me@50
|
478 */
|
|
Me@50
|
479 inline void
|
|
Me@50
|
480 VMS__send_sem_request( void *semReqData, VirtProcr *callingPr )
|
|
Me@50
|
481 { VMSReqst req;
|
|
Me@22
|
482
|
|
Me@50
|
483 req.reqType = semantic;
|
|
Me@50
|
484 req.semReqData = semReqData;
|
|
Me@50
|
485 req.nextReqst = callingPr->requests;
|
|
Me@50
|
486 callingPr->requests = &req;
|
|
Me@50
|
487
|
|
Me@50
|
488 VMS__suspend_procr( callingPr );
|
|
Me@50
|
489 }
|
|
Me@50
|
490
|
|
Me@50
|
491
|
|
Me@50
|
492 inline void
|
|
Me@50
|
493 VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr )
|
|
Me@50
|
494 { VMSReqst req;
|
|
Me@50
|
495
|
|
Me@50
|
496 req.reqType = VMSSemantic;
|
|
Me@50
|
497 req.semReqData = semReqData;
|
|
Me@50
|
498 req.nextReqst = callingPr->requests; //gab any other preceeding
|
|
Me@50
|
499 callingPr->requests = &req;
|
|
Me@50
|
500
|
|
Me@50
|
501 VMS__suspend_procr( callingPr );
|
|
Me@50
|
502 }
|
|
Me@50
|
503
|
|
Me@120
|
504 void inline
|
|
Me@120
|
505 VMS__send_inter_plugin_req( void *reqData, int32 targetMaster,
|
|
Me@120
|
506 VirtProcr *requestingMaster )
|
|
Me@120
|
507 { _VMSMasterEnv->interMasterRequestsFor[targetMaster] =
|
|
Me@120
|
508 (InterMasterReqst *) reqData;
|
|
Me@120
|
509 }
|
|
Me@120
|
510
|
|
Me@120
|
511 void inline
|
|
Me@120
|
512 VMS__send_inter_VMSCore_req( InterVMSCoreReqst *reqData,
|
|
Me@120
|
513 int32 targetMaster, VirtProcr *requestingMaster )
|
|
Me@120
|
514 { _VMSMasterEnv->interMasterRequestsFor[targetMaster] =
|
|
Me@120
|
515 (InterMasterReqst *) reqData;
|
|
Me@120
|
516 }
|
|
Me@50
|
517
|
|
Me@50
|
518 /*
|
|
Me@38
|
519 */
|
|
Me@24
|
520 VMSReqst *
|
|
Me@50
|
521 VMS__take_next_request_out_of( VirtProcr *procrWithReq )
|
|
Me@31
|
522 { VMSReqst *req;
|
|
Me@31
|
523
|
|
Me@31
|
524 req = procrWithReq->requests;
|
|
Me@38
|
525 if( req == NULL ) return NULL;
|
|
Me@31
|
526
|
|
Me@31
|
527 procrWithReq->requests = procrWithReq->requests->nextReqst;
|
|
Me@50
|
528 return req;
|
|
Me@24
|
529 }
|
|
Me@22
|
530
|
|
Me@24
|
531
|
|
Me@24
|
532 inline void *
|
|
Me@24
|
533 VMS__take_sem_reqst_from( VMSReqst *req )
|
|
Me@24
|
534 {
|
|
Me@24
|
535 return req->semReqData;
|
|
Me@24
|
536 }
|
|
Me@24
|
537
|
|
Me@24
|
538
|
|
Me@24
|
539
|
|
Me@50
|
540 /* This is for OS requests and VMS infrastructure requests, such as to create
|
|
Me@50
|
541 * a probe -- a probe is inside the heart of VMS-core, it's not part of any
|
|
Me@50
|
542 * language -- but it's also a semantic thing that's triggered from and used
|
|
Me@50
|
543 * in the application.. so it crosses abstractions.. so, need some special
|
|
Me@50
|
544 * pattern here for handling such requests.
|
|
Me@52
|
545 * Doing this just like it were a second language sharing VMS-core.
|
|
Me@52
|
546 *
|
|
Me@50
|
547 * This is called from the language's request handler when it sees a request
|
|
Me@50
|
548 * of type VMSSemReq
|
|
Me@52
|
549 *
|
|
Me@52
|
550 * TODO: Later change this, to give probes their own separate plugin & have
|
|
Me@52
|
551 * VMS-core steer the request to appropriate plugin
|
|
Me@52
|
552 * Do the same for OS calls -- look later at it..
|
|
Me@50
|
553 */
|
|
Me@50
|
554 void inline
|
|
Me@50
|
555 VMS__handle_VMSSemReq( VMSReqst *req, VirtProcr *requestingPr, void *semEnv,
|
|
Me@50
|
556 ResumePrFnPtr resumePrFnPtr )
|
|
Me@50
|
557 { VMSSemReq *semReq;
|
|
Me@50
|
558 IntervalProbe *newProbe;
|
|
Me@24
|
559
|
|
Me@50
|
560 semReq = req->semReqData;
|
|
Me@24
|
561
|
|
Me@50
|
562 newProbe = VMS__malloc( sizeof(IntervalProbe) );
|
|
Me@65
|
563 newProbe->nameStr = VMS__strDup( semReq->nameStr );
|
|
Me@50
|
564 newProbe->hist = NULL;
|
|
Me@50
|
565 newProbe->schedChoiceWasRecorded = FALSE;
|
|
Me@53
|
566
|
|
Me@53
|
567 //This runs in masterVP, so no race-condition worries
|
|
Me@50
|
568 newProbe->probeID =
|
|
Me@50
|
569 addToDynArray( newProbe, _VMSMasterEnv->dynIntervalProbesInfo );
|
|
Me@50
|
570
|
|
Me@53
|
571 requestingPr->dataRetFromReq = newProbe;
|
|
Me@50
|
572
|
|
Me@50
|
573 (*resumePrFnPtr)( requestingPr, semEnv );
|
|
Me@22
|
574 }
|
|
Me@22
|
575
|
|
Me@22
|
576
|
|
Me@22
|
577
|
|
Me@24
|
578 /*This must be called by the request handler plugin -- it cannot be called
|
|
Me@24
|
579 * from the semantic library "dissipate processor" function -- instead, the
|
|
Me@50
|
580 * semantic layer has to generate a request, and the plug-in calls this
|
|
Me@24
|
581 * function.
|
|
Me@24
|
582 *The reason is that this frees the virtual processor's stack -- which is
|
|
Me@24
|
583 * still in use inside semantic library calls!
|
|
Me@24
|
584 *
|
|
Me@24
|
585 *This frees or recycles all the state owned by and comprising the VMS
|
|
Me@24
|
586 * portion of the animating virtual procr. The request handler must first
|
|
Me@24
|
587 * free any semantic data created for the processor that didn't use the
|
|
Me@24
|
588 * VMS_malloc mechanism. Then it calls this, which first asks the malloc
|
|
Me@24
|
589 * system to disown any state that did use VMS_malloc, and then frees the
|
|
Me@24
|
590 * statck and the processor-struct itself.
|
|
Me@24
|
591 *If the dissipated processor is the sole (remaining) owner of VMS__malloc'd
|
|
Me@24
|
592 * state, then that state gets freed (or sent to recycling) as a side-effect
|
|
Me@24
|
593 * of dis-owning it.
|
|
Me@24
|
594 */
|
|
Me@24
|
595 void
|
|
Me@53
|
596 VMS__dissipate_procr( VirtProcr *animatingPr )
|
|
Me@24
|
597 {
|
|
Me@24
|
598 //dis-own all locations owned by this processor, causing to be freed
|
|
Me@24
|
599 // any locations that it is (was) sole owner of
|
|
Me@29
|
600 //TODO: implement VMS__malloc system, including "give up ownership"
|
|
Me@24
|
601
|
|
Me@24
|
602
|
|
Me@24
|
603 //NOTE: initialData was given to the processor, so should either have
|
|
Me@24
|
604 // been alloc'd with VMS__malloc, or freed by the level above animPr.
|
|
Me@24
|
605 //So, all that's left to free here is the stack and the VirtProcr struc
|
|
Me@24
|
606 // itself
|
|
Me@50
|
607 //Note, should not stack-allocate initial data -- no guarantee, in
|
|
Me@50
|
608 // general that creating processor will outlive ones it creates.
|
|
Me@50
|
609 VMS__free( animatingPr->startOfStack );
|
|
Me@50
|
610 VMS__free( animatingPr );
|
|
Me@24
|
611 }
|
|
Me@24
|
612
|
|
Me@24
|
613
|
|
Me@53
|
614 //TODO: look at architecting cleanest separation between request handler
|
|
Me@29
|
615 // and master loop, for dissipate, create, shutdown, and other non-semantic
|
|
Me@29
|
616 // requests. Issue is chain: one removes requests from AppVP, one dispatches
|
|
Me@29
|
617 // on type of request, and one handles each type.. but some types require
|
|
Me@29
|
618 // action from both request handler and master loop -- maybe just give the
|
|
Me@29
|
619 // request handler calls like: VMS__handle_X_request_type
|
|
Me@24
|
620
|
|
Me@29
|
621
|
|
Me@29
|
622 /*This is called by the semantic layer's request handler when it decides its
|
|
Me@29
|
623 * time to shut down the VMS system. Calling this causes the core loop OS
|
|
Me@29
|
624 * threads to exit, which unblocks the entry-point function that started up
|
|
Me@29
|
625 * VMS, and allows it to grab the result and return to the original single-
|
|
Me@29
|
626 * threaded application.
|
|
Me@22
|
627 *
|
|
Me@29
|
628 *The _VMSMasterEnv is needed by this shut down function, so the create-seed-
|
|
Me@29
|
629 * and-wait function has to free a bunch of stuff after it detects the
|
|
Me@29
|
630 * threads have all died: the masterEnv, the thread-related locations,
|
|
Me@29
|
631 * masterVP any AppVPs that might still be allocated and sitting in the
|
|
Me@29
|
632 * semantic environment, or have been orphaned in the _VMSWorkQ.
|
|
Me@29
|
633 *
|
|
Me@53
|
634 *NOTE: the semantic plug-in is expected to use VMS__malloc to get all the
|
|
Me@29
|
635 * locations it needs, and give ownership to masterVP. Then, they will be
|
|
Me@53
|
636 * automatically freed.
|
|
Me@22
|
637 *
|
|
Me@29
|
638 *In here,create one core-loop shut-down processor for each core loop and put
|
|
Me@31
|
639 * them all directly into the readyToAnimateQ.
|
|
Me@29
|
640 *Note, this function can ONLY be called after the semantic environment no
|
|
Me@29
|
641 * longer cares if AppVPs get animated after the point this is called. In
|
|
Me@29
|
642 * other words, this can be used as an abort, or else it should only be
|
|
Me@29
|
643 * called when all AppVPs have finished dissipate requests -- only at that
|
|
Me@29
|
644 * point is it sure that all results have completed.
|
|
Me@22
|
645 */
|
|
Me@22
|
646 void
|
|
Me@53
|
647 VMS__shutdown()
|
|
Me@8
|
648 { int coreIdx;
|
|
Me@14
|
649 VirtProcr *shutDownPr;
|
|
Me@22
|
650
|
|
Me@29
|
651 //create the shutdown processors, one for each core loop -- put them
|
|
Me@31
|
652 // directly into the Q -- each core will die when gets one
|
|
Me@8
|
653 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@50
|
654 { //Note, this is running in the master
|
|
Me@29
|
655 shutDownPr = VMS__create_procr( &endOSThreadFn, NULL );
|
|
Me@55
|
656 writeVMSQ( shutDownPr, _VMSMasterEnv->readyToAnimateQs[coreIdx] );
|
|
Me@8
|
657 }
|
|
Me@22
|
658
|
|
Me@12
|
659 }
|
|
Me@12
|
660
|
|
Me@12
|
661
|
|
Me@29
|
662 /*Am trying to be cute, avoiding IF statement in coreLoop that checks for
|
|
Me@29
|
663 * a special shutdown procr. Ended up with extra-complex shutdown sequence.
|
|
Me@29
|
664 *This function has the sole purpose of setting the stack and framePtr
|
|
Me@29
|
665 * to the coreLoop's stack and framePtr.. it does that then jumps to the
|
|
Me@29
|
666 * core loop's shutdown point -- might be able to just call Pthread_exit
|
|
Me@30
|
667 * from here, but am going back to the pthread's stack and setting everything
|
|
Me@29
|
668 * up just as if it never jumped out, before calling pthread_exit.
|
|
Me@29
|
669 *The end-point of core loop will free the stack and so forth of the
|
|
Me@29
|
670 * processor that animates this function, (this fn is transfering the
|
|
Me@29
|
671 * animator of the AppVP that is in turn animating this function over
|
|
Me@29
|
672 * to core loop function -- note that this slices out a level of virtual
|
|
Me@29
|
673 * processors).
|
|
Me@29
|
674 */
|
|
Me@29
|
675 void
|
|
Me@29
|
676 endOSThreadFn( void *initData, VirtProcr *animatingPr )
|
|
msach@71
|
677 {
|
|
msach@75
|
678 #ifdef SEQUENTIAL
|
|
msach@75
|
679 asmTerminateCoreLoopSeq(animatingPr);
|
|
msach@75
|
680 #else
|
|
msach@71
|
681 asmTerminateCoreLoop(animatingPr);
|
|
msach@75
|
682 #endif
|
|
Me@30
|
683 }
|
|
Me@29
|
684
|
|
Me@29
|
685
|
|
Me@53
|
686 /*This is called from the startup & shutdown
|
|
Me@24
|
687 */
|
|
Me@24
|
688 void
|
|
Me@53
|
689 VMS__cleanup_at_end_of_shutdown()
|
|
Me@31
|
690 {
|
|
msach@78
|
691 //unused
|
|
msach@78
|
692 //VMSQueueStruc **readyToAnimateQs;
|
|
msach@78
|
693 //int coreIdx;
|
|
msach@78
|
694 //VirtProcr **masterVPs;
|
|
msach@78
|
695 //SchedSlot ***allSchedSlots; //ptr to array of ptrs
|
|
Me@31
|
696
|
|
Me@65
|
697 //Before getting rid of everything, print out any measurements made
|
|
msach@69
|
698 forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&printHist );
|
|
msach@78
|
699 forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&saveHistToFile);
|
|
Me@68
|
700 //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, &freeHistExt );
|
|
Me@65
|
701 #ifdef MEAS__TIME_PLUGIN
|
|
Me@68
|
702 printHist( _VMSMasterEnv->reqHdlrLowTimeHist );
|
|
msach@84
|
703 saveHistToFile( _VMSMasterEnv->reqHdlrLowTimeHist );
|
|
Me@68
|
704 printHist( _VMSMasterEnv->reqHdlrHighTimeHist );
|
|
msach@79
|
705 saveHistToFile( _VMSMasterEnv->reqHdlrHighTimeHist );
|
|
Me@68
|
706 freeHistExt( _VMSMasterEnv->reqHdlrLowTimeHist );
|
|
Me@68
|
707 freeHistExt( _VMSMasterEnv->reqHdlrHighTimeHist );
|
|
Me@65
|
708 #endif
|
|
Me@65
|
709 #ifdef MEAS__TIME_MALLOC
|
|
Me@65
|
710 printHist( _VMSMasterEnv->mallocTimeHist );
|
|
msach@79
|
711 saveHistToFile( _VMSMasterEnv->mallocTimeHist );
|
|
Me@65
|
712 printHist( _VMSMasterEnv->freeTimeHist );
|
|
msach@79
|
713 saveHistToFile( _VMSMasterEnv->freeTimeHist );
|
|
Me@65
|
714 freeHistExt( _VMSMasterEnv->mallocTimeHist );
|
|
Me@65
|
715 freeHistExt( _VMSMasterEnv->freeTimeHist );
|
|
Me@65
|
716 #endif
|
|
Me@65
|
717 #ifdef MEAS__TIME_MASTER_LOCK
|
|
Me@65
|
718 printHist( _VMSMasterEnv->masterLockLowTimeHist );
|
|
Me@65
|
719 printHist( _VMSMasterEnv->masterLockHighTimeHist );
|
|
Me@65
|
720 #endif
|
|
Me@65
|
721 #ifdef MEAS__TIME_MASTER
|
|
Me@65
|
722 printHist( _VMSMasterEnv->pluginTimeHist );
|
|
Me@65
|
723 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@65
|
724 {
|
|
Me@65
|
725 freeVMSQ( readyToAnimateQs[ coreIdx ] );
|
|
Me@65
|
726 //master VPs were created external to VMS, so use external free
|
|
Me@65
|
727 VMS__dissipate_procr( masterVPs[ coreIdx ] );
|
|
Me@65
|
728
|
|
Me@65
|
729 freeSchedSlots( allSchedSlots[ coreIdx ] );
|
|
Me@65
|
730 }
|
|
Me@65
|
731 #endif
|
|
Me@65
|
732 #ifdef MEAS__TIME_STAMP_SUSP
|
|
Me@65
|
733 printHist( _VMSMasterEnv->pluginTimeHist );
|
|
Me@65
|
734 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@65
|
735 {
|
|
Me@65
|
736 freeVMSQ( readyToAnimateQs[ coreIdx ] );
|
|
Me@65
|
737 //master VPs were created external to VMS, so use external free
|
|
Me@65
|
738 VMS__dissipate_procr( masterVPs[ coreIdx ] );
|
|
Me@65
|
739
|
|
Me@65
|
740 freeSchedSlots( allSchedSlots[ coreIdx ] );
|
|
Me@65
|
741 }
|
|
Me@65
|
742 #endif
|
|
Me@65
|
743
|
|
Me@53
|
744 //All the environment data has been allocated with VMS__malloc, so just
|
|
Me@53
|
745 // free its internal big-chunk and all inside it disappear.
|
|
Me@53
|
746 /*
|
|
Me@31
|
747 readyToAnimateQs = _VMSMasterEnv->readyToAnimateQs;
|
|
Me@31
|
748 masterVPs = _VMSMasterEnv->masterVPs;
|
|
Me@31
|
749 allSchedSlots = _VMSMasterEnv->allSchedSlots;
|
|
Me@31
|
750
|
|
Me@31
|
751 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@24
|
752 {
|
|
Me@55
|
753 freeVMSQ( readyToAnimateQs[ coreIdx ] );
|
|
Me@50
|
754 //master VPs were created external to VMS, so use external free
|
|
Me@53
|
755 VMS__dissipate_procr( masterVPs[ coreIdx ] );
|
|
Me@31
|
756
|
|
Me@31
|
757 freeSchedSlots( allSchedSlots[ coreIdx ] );
|
|
Me@24
|
758 }
|
|
Me@31
|
759
|
|
Me@53
|
760 VMS__free( _VMSMasterEnv->readyToAnimateQs );
|
|
Me@53
|
761 VMS__free( _VMSMasterEnv->masterVPs );
|
|
Me@53
|
762 VMS__free( _VMSMasterEnv->allSchedSlots );
|
|
Me@50
|
763
|
|
Me@50
|
764 //============================= MEASUREMENT STUFF ========================
|
|
Me@50
|
765 #ifdef STATS__TURN_ON_PROBES
|
|
Me@53
|
766 freeDynArrayDeep( _VMSMasterEnv->dynIntervalProbesInfo, &VMS__free_probe);
|
|
Me@50
|
767 #endif
|
|
Me@50
|
768 //========================================================================
|
|
Me@53
|
769 */
|
|
Me@53
|
770 //These are the only two that use system free
|
|
Me@53
|
771 VMS_ext__free_free_list( _VMSMasterEnv->freeListHead );
|
|
Me@53
|
772 free( (void *)_VMSMasterEnv );
|
|
Me@24
|
773 }
|
|
Me@24
|
774
|
|
Me@54
|
775
|
|
Me@54
|
776 //================================
|
|
Me@54
|
777
|
|
Me@54
|
778
|
|
Me@54
|
779 /*Later, improve this -- for now, just exits the application after printing
|
|
Me@54
|
780 * the error message.
|
|
Me@54
|
781 */
|
|
Me@54
|
782 void
|
|
Me@54
|
783 VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData )
|
|
Me@54
|
784 {
|
|
msach@69
|
785 printf("%s",msgStr);
|
|
Me@54
|
786 fflush(stdin);
|
|
Me@54
|
787 exit(1);
|
|
Me@54
|
788 }
|
|
Me@54
|
789
|