comparison VOMP.c @ 1:21cf36019f0d

Partially converted SSR to VOMP -- start of changes
author Some Random Person <seanhalle@yahoo.com>
date Thu, 24 May 2012 08:57:24 -0700
parents b311282ec174
children
comparison
equal deleted inserted replaced
0:d6c589a42ab4 1:f8f2806b5e21
9 #include <malloc.h> 9 #include <malloc.h>
10 10
11 #include "Queue_impl/PrivateQueue.h" 11 #include "Queue_impl/PrivateQueue.h"
12 #include "Hash_impl/PrivateHash.h" 12 #include "Hash_impl/PrivateHash.h"
13 13
14 #include "SSR.h" 14 #include "VOMP.h"
15 #include "SSR_Counter_Recording.h" 15 #include "VOMP_Counter_Recording.h"
16 16
17 //========================================================================== 17 //==========================================================================
18 18
19 void 19 void
20 SSR__init(); 20 VOMP__init();
21 21
22 void 22 void
23 SSR__init_Helper(); 23 VOMP__init_Helper();
24 //========================================================================== 24 //==========================================================================
25
26
27 /*TODO: Q: dealing with library f()s and DKU vs WT vs FoR
28 * (still want to do FoR, with time-lines as syntax, could be super cool)
29 * A: thinking pin the coreCtlrs for all of BLIS -- let Master arbitrate
30 * among library, DKU, WT, FoR -- all the patterns in terms of virtual
31 * processors (or equivalently work-units), so Master picks which virt procr
32 * from which portions of app (DKU, WT, FoR) onto which anim slots
33 *Might even do hierarchy of masters -- group of anim slots for each core
34 * has its own master, that keeps generated work local
35 * single-reader-single-writer sync everywhere -- no atomic primitives
36 * Might have the different assigners talk to each other, to negotiate
37 * larger-grain sharing of resources, according to predicted critical
38 * path, and expansion of work
39 */
40 25
41 26
42 27
43 //=========================================================================== 28 //===========================================================================
44 29
45 30
46 /*These are the library functions *called in the application* 31 /*These are the library functions *called in the application*
47 * 32 *
48 *There's a pattern for the outside sequential code to interact with the 33 *There's a pattern for the outside sequential code to interact with the
49 * VMS_HW code. 34 * language code.
50 *The VMS_HW system is inside a boundary.. every SSR system is in its 35 *The language system is inside a boundary.. every VOMP application is in its
51 * own directory that contains the functions for each of the processor types. 36 * own directory that contains the functions for each of the processor types.
52 * One of the processor types is the "seed" processor that starts the 37 * One of the processor types is the "seed" processor that starts the
53 * cascade of creating all the processors that do the work. 38 * cascade of creating all the processors that do the work.
54 *So, in the directory is a file called "EntryPoint.c" that contains the 39 *So, in the directory is a file called "EntryPoint.c" that contains the
55 * function, named appropriately to the work performed, that the outside 40 * function, named appropriately to the work performed, that the outside
56 * sequential code calls. This function follows a pattern: 41 * sequential code calls. This function follows a pattern:
57 *1) it calls SSR__init() 42 *1) it calls VOMP__init()
58 *2) it creates the initial data for the seed processor, which is passed 43 *2) it creates the initial data for the seed processor, which is passed
59 * in to the function 44 * in to the function
60 *3) it creates the seed SSR processor, with the data to start it with. 45 *3) it creates the seed VOMP processor, with the data to start it with.
61 *4) it calls startSSRThenWaitUntilWorkDone 46 *4) it calls startVOMPThenWaitUntilWorkDone
62 *5) it gets the returnValue from the transfer struc and returns that 47 *5) it gets the returnValue from the transfer struc and returns that
63 * from the function 48 * from the function
64 * 49 *
65 *For now, a new SSR system has to be created via SSR__init every 50 *For now, a new VOMP system has to be created via VOMP__init every
66 * time an entry point function is called -- later, might add letting the 51 * time an entry point function is called -- later, might add letting the
67 * SSR system be created once, and let all the entry points just reuse 52 * VOMP system be created once, and let all the entry points just reuse
68 * it -- want to be as simple as possible now, and see by using what makes 53 * it -- want to be as simple as possible now, and see by using what makes
69 * sense for later.. 54 * sense for later..
70 */ 55 */
71 56
72 57
85 * 70 *
86 *NOTE: no Threads should exist in the outside program that might touch 71 *NOTE: no Threads should exist in the outside program that might touch
87 * any of the data reachable from initData passed in to here 72 * any of the data reachable from initData passed in to here
88 */ 73 */
89 void 74 void
90 SSR__create_seed_procr_and_do_work( TopLevelFnPtr fnPtr, void *initData ) 75 VOMP__create_seed_procr_and_do_work( TopLevelFnPtr fnPtr, void *initData )
91 { SSRSemEnv *semEnv; 76 { VOMPSemEnv *semEnv;
92 SlaveVP *seedPr; 77 SlaveVP *seedPr;
93 78
94 SSR__init(); //normal multi-thd 79 VOMP__init(); //normal multi-thd
95 80
96 semEnv = _VMSMasterEnv->semanticEnv; 81 semEnv = _VMSMasterEnv->semanticEnv;
97 82
98 //SSR starts with one processor, which is put into initial environ, 83 //VOMP starts with one processor, which is put into initial environ,
99 // and which then calls create() to create more, thereby expanding work 84 // and which then calls create() to create more, thereby expanding work
100 seedPr = SSR__create_procr_helper( fnPtr, initData, 85 seedPr = VOMP__create_procr_helper( fnPtr, initData,
101 semEnv, semEnv->nextCoreToGetNewPr++ ); 86 semEnv, semEnv->nextCoreToGetNewPr++ );
102 87
103 resume_slaveVP( seedPr, semEnv ); 88 resume_slaveVP( seedPr, semEnv );
104 89
105 VMS_SS__start_the_work_then_wait_until_done(); //normal multi-thd 90 VMS_SS__start_the_work_then_wait_until_done(); //normal multi-thd
106 91
107 SSR__cleanup_after_shutdown(); 92 VOMP__cleanup_after_shutdown();
108 } 93 }
109 94
110 95
111 int32 96 int32
112 SSR__giveMinWorkUnitCycles( float32 percentOverhead ) 97 VOMP__giveMinWorkUnitCycles( float32 percentOverhead )
113 { 98 {
114 return MIN_WORK_UNIT_CYCLES; 99 return MIN_WORK_UNIT_CYCLES;
115 } 100 }
116 101
117 int32 102 int32
118 SSR__giveIdealNumWorkUnits() 103 VOMP__giveIdealNumWorkUnits()
119 { 104 {
120 return NUM_ANIM_SLOTS * NUM_CORES; 105 return NUM_ANIM_SLOTS * NUM_CORES;
121 } 106 }
122 107
123 int32 108 int32
124 SSR__give_number_of_cores_to_schedule_onto() 109 VOMP__give_number_of_cores_to_schedule_onto()
125 { 110 {
126 return NUM_CORES; 111 return NUM_CORES;
127 } 112 }
128 113
129 /*For now, use TSC -- later, make these two macros with assembly that first 114 /*For now, use TSC -- later, make these two macros with assembly that first
130 * saves jump point, and second jumps back several times to get reliable time 115 * saves jump point, and second jumps back several times to get reliable time
131 */ 116 */
132 void 117 void
133 SSR__start_primitive() 118 VOMP__start_primitive()
134 { saveLowTimeStampCountInto( ((SSRSemEnv *)(_VMSMasterEnv->semanticEnv))-> 119 { saveLowTimeStampCountInto( ((VOMPSemEnv *)(_VMSMasterEnv->semanticEnv))->
135 primitiveStartTime ); 120 primitiveStartTime );
136 } 121 }
137 122
138 /*Just quick and dirty for now -- make reliable later 123 /*Just quick and dirty for now -- make reliable later
139 * will want this to jump back several times -- to be sure cache is warm 124 * will want this to jump back several times -- to be sure cache is warm
140 * because don't want comm time included in calc-time measurement -- and 125 * because don't want comm time included in calc-time measurement -- and
141 * also to throw out any "weird" values due to OS interrupt or TSC rollover 126 * also to throw out any "weird" values due to OS interrupt or TSC rollover
142 */ 127 */
143 int32 128 int32
144 SSR__end_primitive_and_give_cycles() 129 VOMP__end_primitive_and_give_cycles()
145 { int32 endTime, startTime; 130 { int32 endTime, startTime;
146 //TODO: fix by repeating time-measurement 131 //TODO: fix by repeating time-measurement
147 saveLowTimeStampCountInto( endTime ); 132 saveLowTimeStampCountInto( endTime );
148 startTime =((SSRSemEnv*)(_VMSMasterEnv->semanticEnv))->primitiveStartTime; 133 startTime =((VOMPSemEnv*)(_VMSMasterEnv->semanticEnv))->primitiveStartTime;
149 return (endTime - startTime); 134 return (endTime - startTime);
150 } 135 }
151 136
152 //=========================================================================== 137 //===========================================================================
153 138
154 /*Initializes all the data-structures for a SSR system -- but doesn't 139 /*Initializes all the data-structures for a VOMP system -- but doesn't
155 * start it running yet! 140 * start it running yet!
156 * 141 *
157 *This runs in the main thread -- before VMS starts up 142 *This runs in the main thread -- before VMS starts up
158 * 143 *
159 *This sets up the semantic layer over the VMS system 144 *This sets up the semantic layer over the VMS system
160 * 145 *
161 *First, calls VMS_Setup, then creates own environment, making it ready 146 *First, calls VMS_Setup, then creates own environment, making it ready
162 * for creating the seed processor and then starting the work. 147 * for creating the seed processor and then starting the work.
163 */ 148 */
164 void 149 void
165 SSR__init() 150 VOMP__init()
166 { 151 {
167 VMS_SS__init(); 152 VMS_SS__init();
168 //masterEnv, a global var, now is partially set up by init_VMS 153 //masterEnv, a global var, now is partially set up by init_VMS
169 // after this, have VMS_int__malloc and VMS_int__free available 154 // after this, have VMS_int__malloc and VMS_int__free available
170 155
171 SSR__init_Helper(); 156 VOMP__init_Helper();
172 } 157 }
173 158
174 159
175 void idle_fn(void* data, SlaveVP *animatingSlv){ 160 void idle_fn(void* data, SlaveVP *animatingSlv){
176 while(1){ 161 while(1){
177 VMS_int__suspend_slaveVP_and_send_req(animatingSlv); 162 VMS_int__suspend_slaveVP_and_send_req(animatingSlv);
178 } 163 }
179 } 164 }
180 165
181 void 166 void
182 SSR__init_Helper() 167 VOMP__init_Helper()
183 { SSRSemEnv *semanticEnv; 168 { VOMPSemEnv *semanticEnv;
184 PrivQueueStruc **readyVPQs; 169 PrivQueueStruc **readyVPQs;
185 int coreIdx, i, j; 170 int coreIdx, i, j;
186 171
187 //Hook up the semantic layer's plug-ins to the Master virt procr 172 //Hook up the semantic layer's plug-ins to the Master virt procr
188 _VMSMasterEnv->requestHandler = &SSR__Request_Handler; 173 _VMSMasterEnv->requestHandler = &VOMP__Request_Handler;
189 _VMSMasterEnv->slaveAssigner = &SSR__assign_slaveVP_to_slot; 174 _VMSMasterEnv->slaveAssigner = &VOMP__assign_slaveVP_to_slot;
190 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS 175 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
191 _VMSMasterEnv->counterHandler = &SSR__counter_handler; 176 _VMSMasterEnv->counterHandler = &VOMP__counter_handler;
192 #endif 177 #endif
193 178
194 //create the semantic layer's environment (all its data) and add to 179 //create the semantic layer's environment (all its data) and add to
195 // the master environment 180 // the master environment
196 semanticEnv = VMS_int__malloc( sizeof( SSRSemEnv ) ); 181 semanticEnv = VMS_int__malloc( sizeof( VOMPSemEnv ) );
197 _VMSMasterEnv->semanticEnv = semanticEnv; 182 _VMSMasterEnv->semanticEnv = semanticEnv;
198 183
199 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS 184 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
200 SSR__init_counter_data_structs(); 185 VOMP__init_counter_data_structs();
201 #endif 186 #endif
202 semanticEnv->shutdownInitiated = FALSE; 187 semanticEnv->shutdownInitiated = FALSE;
203 for(i=0;i<NUM_CORES;++i){ 188 for(i=0;i<NUM_CORES;++i){
204 for(j=0;j<NUM_ANIM_SLOTS;++j){ 189 for(j=0;j<NUM_ANIM_SLOTS;++j){
205 semanticEnv->idlePr[i][j] = VMS_int__create_slaveVP(&idle_fn,NULL); 190 semanticEnv->idlePr[i][j] = VMS_int__create_slaveVP(&idle_fn,NULL);
248 semanticEnv->transactionStrucs[i].waitingVPQ = makeVMSQ(); 233 semanticEnv->transactionStrucs[i].waitingVPQ = makeVMSQ();
249 } 234 }
250 } 235 }
251 236
252 237
253 /*Frees any memory allocated by SSR__init() then calls VMS_int__shutdown 238 /*Frees any memory allocated by VOMP__init() then calls VMS_int__shutdown
254 */ 239 */
255 void 240 void
256 SSR__cleanup_after_shutdown() 241 VOMP__cleanup_after_shutdown()
257 { SSRSemEnv *semanticEnv; 242 { VOMPSemEnv *semanticEnv;
258 243
259 semanticEnv = _VMSMasterEnv->semanticEnv; 244 semanticEnv = _VMSMasterEnv->semanticEnv;
260 245
261 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC 246 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
262 //UCC 247 //UCC
388 //=========================================================================== 373 //===========================================================================
389 374
390 /* 375 /*
391 */ 376 */
392 SlaveVP * 377 SlaveVP *
393 SSR__create_procr_with( TopLevelFnPtr fnPtr, void *initData, 378 VOMP__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
394 SlaveVP *creatingPr ) 379 SlaveVP *creatingPr )
395 { SSRSemReq reqData; 380 { VOMPSemReq reqData;
396 381
397 //the semantic request data is on the stack and disappears when this 382 //the semantic request data is on the stack and disappears when this
398 // call returns -- it's guaranteed to remain in the VP's stack for as 383 // call returns -- it's guaranteed to remain in the VP's stack for as
399 // long as the VP is suspended. 384 // long as the VP is suspended.
400 reqData.reqType = 0; //know type because in a VMS create req 385 reqData.reqType = 0; //know type because in a VMS create req
407 392
408 return creatingPr->dataRetFromReq; 393 return creatingPr->dataRetFromReq;
409 } 394 }
410 395
411 SlaveVP * 396 SlaveVP *
412 SSR__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData, 397 VOMP__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
413 SlaveVP *creatingPr, int32 coreToAssignOnto ) 398 SlaveVP *creatingPr, int32 coreToAssignOnto )
414 { SSRSemReq reqData; 399 { VOMPSemReq reqData;
415 400
416 //the semantic request data is on the stack and disappears when this 401 //the semantic request data is on the stack and disappears when this
417 // call returns -- it's guaranteed to remain in the VP's stack for as 402 // call returns -- it's guaranteed to remain in the VP's stack for as
418 // long as the VP is suspended. 403 // long as the VP is suspended.
419 reqData.reqType = 0; //know type because in a VMS create req 404 reqData.reqType = 0; //know type because in a VMS create req
427 return creatingPr->dataRetFromReq; 412 return creatingPr->dataRetFromReq;
428 } 413 }
429 414
430 415
431 void 416 void
432 SSR__dissipate_procr( SlaveVP *procrToDissipate ) 417 VOMP__dissipate_procr( SlaveVP *procrToDissipate )
433 { 418 {
434 VMS_WL__send_dissipate_req( procrToDissipate ); 419 VMS_WL__send_dissipate_req( procrToDissipate );
435 } 420 }
436 421
437 422
438 //=========================================================================== 423 //===========================================================================
439 424
440 void * 425 void *
441 SSR__malloc_to( int32 sizeToMalloc, SlaveVP *owningPr ) 426 VOMP__malloc_to( int32 sizeToMalloc, SlaveVP *owningPr )
442 { SSRSemReq reqData; 427 { VOMPSemReq reqData;
443 428
444 reqData.reqType = malloc_req; 429 reqData.reqType = malloc_req;
445 reqData.sendPr = owningPr; 430 reqData.sendPr = owningPr;
446 reqData.sizeToMalloc = sizeToMalloc; 431 reqData.sizeToMalloc = sizeToMalloc;
447 432
452 437
453 438
454 /*Sends request to Master, which does the work of freeing 439 /*Sends request to Master, which does the work of freeing
455 */ 440 */
456 void 441 void
457 SSR__free( void *ptrToFree, SlaveVP *owningPr ) 442 VOMP__free( void *ptrToFree, SlaveVP *owningPr )
458 { SSRSemReq reqData; 443 { VOMPSemReq reqData;
459 444
460 reqData.reqType = free_req; 445 reqData.reqType = free_req;
461 reqData.sendPr = owningPr; 446 reqData.sendPr = owningPr;
462 reqData.ptrToFree = ptrToFree; 447 reqData.ptrToFree = ptrToFree;
463 448
464 VMS_WL__send_sem_request( &reqData, owningPr ); 449 VMS_WL__send_sem_request( &reqData, owningPr );
465 } 450 }
466 451
467 452
468 void 453 void
469 SSR__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerSlv, 454 VOMP__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerSlv,
470 SlaveVP *newOwnerPr ) 455 SlaveVP *newOwnerPr )
471 { 456 {
472 //TODO: put in the ownership system that automatically frees when no 457 //TODO: put in the ownership system that automatically frees when no
473 // owners of data left -- will need keeper for keeping data around when 458 // owners of data left -- will need keeper for keeping data around when
474 // future created processors might need it but don't exist yet 459 // future created processors might need it but don't exist yet
475 } 460 }
476 461
477 462
478 void 463 void
479 SSR__add_ownership_by_to( SlaveVP *newOwnerSlv, void *data ) 464 VOMP__add_ownership_by_to( SlaveVP *newOwnerSlv, void *data )
480 { 465 {
481 466
482 } 467 }
483 468
484 469
485 void 470 void
486 SSR__remove_ownership_by_from( SlaveVP *loserSlv, void *dataLosing ) 471 VOMP__remove_ownership_by_from( SlaveVP *loserSlv, void *dataLosing )
487 { 472 {
488 473
489 } 474 }
490 475
491 476
492 /*Causes the SSR system to remove internal ownership, so data won't be 477 /*Causes the VOMP system to remove internal ownership, so data won't be
493 * freed when SSR shuts down, and will persist in the external program. 478 * freed when VOMP shuts down, and will persist in the external program.
494 * 479 *
495 *Must be called from the processor that currently owns the data. 480 *Must be called from the processor that currently owns the data.
496 * 481 *
497 *IMPL: Transferring ownership touches two different virtual processor's 482 *IMPL: Transferring ownership touches two different virtual processor's
498 * state -- which means it has to be done carefully -- the VMS rules for 483 * state -- which means it has to be done carefully -- the VMS rules for
504 *However, in this case, the TO processor is the outside, and transfers 489 *However, in this case, the TO processor is the outside, and transfers
505 * are only allowed to be called by the giver-upper, so can mark caller of 490 * are only allowed to be called by the giver-upper, so can mark caller of
506 * this function as no longer owner, and return -- done. 491 * this function as no longer owner, and return -- done.
507 */ 492 */
508 void 493 void
509 SSR__transfer_ownership_to_outside( void *data ) 494 VOMP__transfer_ownership_to_outside( void *data )
510 { 495 {
511 //TODO: removeAllOwnersFrom( data ); 496 //TODO: removeAllOwnersFrom( data );
512 } 497 }
513 498
514 499
515 //=========================================================================== 500 //===========================================================================
516 501
517 void 502 void
518 SSR__send_of_type_to( SlaveVP *sendPr, void *msg, const int type, 503 VOMP__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
519 SlaveVP *receivePr) 504 SlaveVP *receivePr)
520 { SSRSemReq reqData; 505 { VOMPSemReq reqData;
521 506
522 reqData.receivePr = receivePr; 507 reqData.receivePr = receivePr;
523 reqData.sendPr = sendPr; 508 reqData.sendPr = sendPr;
524 reqData.reqType = send_type; 509 reqData.reqType = send_type;
525 reqData.msgType = type; 510 reqData.msgType = type;
535 //When come back from suspend, no longer own data reachable from msg 520 //When come back from suspend, no longer own data reachable from msg
536 //TODO: release ownership here 521 //TODO: release ownership here
537 } 522 }
538 523
539 void 524 void
540 SSR__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr ) 525 VOMP__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr )
541 { SSRSemReq reqData; 526 { VOMPSemReq reqData;
542 527
543 //hash on the receiver, 'cause always know it, but sometimes want to 528 //hash on the receiver, 'cause always know it, but sometimes want to
544 // receive from anonymous sender 529 // receive from anonymous sender
545 530
546 reqData.receivePr = receivePr; 531 reqData.receivePr = receivePr;
554 539
555 540
556 //=========================================================================== 541 //===========================================================================
557 542
558 void * 543 void *
559 SSR__receive_any_to( SlaveVP *receivePr ) 544 VOMP__receive_any_to( SlaveVP *receivePr )
560 { 545 {
561 546
562 } 547 }
563 548
564 void * 549 void *
565 SSR__receive_type_to( const int type, SlaveVP *receivePr ) 550 VOMP__receive_type_to( const int type, SlaveVP *receivePr )
566 { DEBUG__printf1(dbgRqstHdlr,"WL: receive type to: %d", receivePr->slaveID); 551 { DEBUG__printf1(dbgRqstHdlr,"WL: receive type to: %d", receivePr->slaveID);
567 SSRSemReq reqData; 552 VOMPSemReq reqData;
568 553
569 reqData.receivePr = receivePr; 554 reqData.receivePr = receivePr;
570 reqData.reqType = receive_type; 555 reqData.reqType = receive_type;
571 reqData.msgType = type; 556 reqData.msgType = type;
572 reqData.nextReqInHashEntry = NULL; 557 reqData.nextReqInHashEntry = NULL;
583 *The reason receivePr must call this is that it modifies the receivPr 568 *The reason receivePr must call this is that it modifies the receivPr
584 * loc structure directly -- and the VMS rules state a virtual processor 569 * loc structure directly -- and the VMS rules state a virtual processor
585 * loc structure can only be modified by itself. 570 * loc structure can only be modified by itself.
586 */ 571 */
587 void * 572 void *
588 SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receivePr ) 573 VOMP__receive_from_to( SlaveVP *sendPr, SlaveVP *receivePr )
589 { DEBUG__printf2(dbgRqstHdlr,"WL: receive from %d to: %d", sendPr->slaveID, receivePr->slaveID); 574 { DEBUG__printf2(dbgRqstHdlr,"WL: receive from %d to: %d", sendPr->slaveID, receivePr->slaveID);
590 SSRSemReq reqData; 575 VOMPSemReq reqData;
591 576
592 //hash on the receiver, 'cause always know it, but sometimes want to 577 //hash on the receiver, 'cause always know it, but sometimes want to
593 // receive from anonymous sender 578 // receive from anonymous sender
594 579
595 reqData.receivePr = receivePr; 580 reqData.receivePr = receivePr;
614 * times the data is given to the function, and no matter the timing of 599 * times the data is given to the function, and no matter the timing of
615 * trying to get the data through from different cores. 600 * trying to get the data through from different cores.
616 */ 601 */
617 602
618 /*asm function declarations*/ 603 /*asm function declarations*/
619 void asm_save_ret_to_singleton(SSRSingleton *singletonPtrAddr); 604 void asm_save_ret_to_singleton(VOMPSingleton *singletonPtrAddr);
620 void asm_write_ret_from_singleton(SSRSingleton *singletonPtrAddr); 605 void asm_write_ret_from_singleton(VOMPSingleton *singletonPtrAddr);
621 606
622 /*Fn singleton uses ID as index into array of singleton structs held in the 607 /*Fn singleton uses ID as index into array of singleton structs held in the
623 * semantic environment. 608 * semantic environment.
624 */ 609 */
625 void 610 void
626 SSR__start_fn_singleton( int32 singletonID, SlaveVP *animPr ) 611 VOMP__start_fn_singleton( int32 singletonID, SlaveVP *animPr )
627 { 612 {
628 SSRSemReq reqData; 613 VOMPSemReq reqData;
629 614
630 // 615 //
631 reqData.reqType = singleton_fn_start; 616 reqData.reqType = singleton_fn_start;
632 reqData.singletonID = singletonID; 617 reqData.singletonID = singletonID;
633 618
634 VMS_WL__send_sem_request( &reqData, animPr ); 619 VMS_WL__send_sem_request( &reqData, animPr );
635 if( animPr->dataRetFromReq ) //will be 0 or addr of label in end singleton 620 if( animPr->dataRetFromReq ) //will be 0 or addr of label in end singleton
636 { 621 {
637 SSRSemEnv *semEnv = VMS_int__give_sem_env_for( animPr ); 622 VOMPSemEnv *semEnv = VMS_int__give_sem_env_for( animPr );
638 asm_write_ret_from_singleton(&(semEnv->fnSingletons[ singletonID])); 623 asm_write_ret_from_singleton(&(semEnv->fnSingletons[ singletonID]));
639 } 624 }
640 } 625 }
641 626
642 /*Data singleton hands addr of loc holding a pointer to a singleton struct. 627 /*Data singleton hands addr of loc holding a pointer to a singleton struct.
643 * The start_data_singleton makes the structure and puts its addr into the 628 * The start_data_singleton makes the structure and puts its addr into the
644 * location. 629 * location.
645 */ 630 */
646 void 631 void
647 SSR__start_data_singleton( SSRSingleton **singletonAddr, SlaveVP *animPr ) 632 VOMP__start_data_singleton( VOMPSingleton **singletonAddr, SlaveVP *animPr )
648 { 633 {
649 SSRSemReq reqData; 634 VOMPSemReq reqData;
650 635
651 if( *singletonAddr && (*singletonAddr)->hasFinished ) 636 if( *singletonAddr && (*singletonAddr)->hasFinished )
652 goto JmpToEndSingleton; 637 goto JmpToEndSingleton;
653 638
654 reqData.reqType = singleton_data_start; 639 reqData.reqType = singleton_data_start;
671 * 656 *
672 *Note, this call cannot be inlined because the instr addr at the label 657 *Note, this call cannot be inlined because the instr addr at the label
673 * inside is shared by all invocations of a given singleton ID. 658 * inside is shared by all invocations of a given singleton ID.
674 */ 659 */
675 void 660 void
676 SSR__end_fn_singleton( int32 singletonID, SlaveVP *animPr ) 661 VOMP__end_fn_singleton( int32 singletonID, SlaveVP *animPr )
677 { 662 {
678 SSRSemReq reqData; 663 VOMPSemReq reqData;
679 664
680 //don't need this addr until after at least one singleton has reached 665 //don't need this addr until after at least one singleton has reached
681 // this function 666 // this function
682 SSRSemEnv *semEnv = VMS_int__give_sem_env_for( animPr ); 667 VOMPSemEnv *semEnv = VMS_int__give_sem_env_for( animPr );
683 asm_write_ret_from_singleton(&(semEnv->fnSingletons[ singletonID])); 668 asm_write_ret_from_singleton(&(semEnv->fnSingletons[ singletonID]));
684 669
685 reqData.reqType = singleton_fn_end; 670 reqData.reqType = singleton_fn_end;
686 reqData.singletonID = singletonID; 671 reqData.singletonID = singletonID;
687 672
690 EndSingletonInstrAddr: 675 EndSingletonInstrAddr:
691 return; 676 return;
692 } 677 }
693 678
694 void 679 void
695 SSR__end_data_singleton( SSRSingleton **singletonPtrAddr, SlaveVP *animPr ) 680 VOMP__end_data_singleton( VOMPSingleton **singletonPtrAddr, SlaveVP *animPr )
696 { 681 {
697 SSRSemReq reqData; 682 VOMPSemReq reqData;
698 683
699 //don't need this addr until after singleton struct has reached 684 //don't need this addr until after singleton struct has reached
700 // this function for first time 685 // this function for first time
701 //do assembly that saves the return addr of this fn call into the 686 //do assembly that saves the return addr of this fn call into the
702 // data singleton -- that data-singleton can only be given to exactly 687 // data singleton -- that data-singleton can only be given to exactly
722 *Only very short functions should be called this way -- for longer-running 707 *Only very short functions should be called this way -- for longer-running
723 * isolation, use transaction-start and transaction-end, which run the code 708 * isolation, use transaction-start and transaction-end, which run the code
724 * between as work-code. 709 * between as work-code.
725 */ 710 */
726 void 711 void
727 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster, 712 VOMP__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
728 void *data, SlaveVP *animPr ) 713 void *data, SlaveVP *animPr )
729 { 714 {
730 SSRSemReq reqData; 715 VOMPSemReq reqData;
731 716
732 // 717 //
733 reqData.reqType = atomic; 718 reqData.reqType = atomic;
734 reqData.fnToExecInMaster = ptrToFnToExecInMaster; 719 reqData.fnToExecInMaster = ptrToFnToExecInMaster;
735 reqData.dataForFn = data; 720 reqData.dataForFn = data;
750 * into queue in the struct. (At some point a holder will request 735 * into queue in the struct. (At some point a holder will request
751 * end-transaction, which will take this VP from the queue and resume it.) 736 * end-transaction, which will take this VP from the queue and resume it.)
752 *If NULL, then write requesting into the field and resume. 737 *If NULL, then write requesting into the field and resume.
753 */ 738 */
754 void 739 void
755 SSR__start_transaction( int32 transactionID, SlaveVP *animPr ) 740 VOMP__start_transaction( int32 transactionID, SlaveVP *animPr )
756 { 741 {
757 SSRSemReq reqData; 742 VOMPSemReq reqData;
758 743
759 // 744 //
760 reqData.sendPr = animPr; 745 reqData.sendPr = animPr;
761 reqData.reqType = trans_start; 746 reqData.reqType = trans_start;
762 reqData.transID = transactionID; 747 reqData.transID = transactionID;
772 *If it's empty, it sets VP_currently_executing field to NULL and resumes. 757 *If it's empty, it sets VP_currently_executing field to NULL and resumes.
773 *If something in, gets it, sets VP_currently_executing to that VP, then 758 *If something in, gets it, sets VP_currently_executing to that VP, then
774 * resumes both. 759 * resumes both.
775 */ 760 */
776 void 761 void
777 SSR__end_transaction( int32 transactionID, SlaveVP *animPr ) 762 VOMP__end_transaction( int32 transactionID, SlaveVP *animPr )
778 { 763 {
779 SSRSemReq reqData; 764 VOMPSemReq reqData;
780 765
781 // 766 //
782 reqData.sendPr = animPr; 767 reqData.sendPr = animPr;
783 reqData.reqType = trans_end; 768 reqData.reqType = trans_end;
784 reqData.transID = transactionID; 769 reqData.transID = transactionID;