Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
changeset 243:227cd4d33d94 Common_Ancestor
fixed pointing slave to a TLF, added ones that don't trash stack fixed names
| author | Sean <seanhalle@yahoo.com> |
|---|---|
| date | Thu, 17 May 2012 20:39:44 +0200 |
| parents | b4f684e98d0b |
| children | 5e315ce69d82 |
| files | Defines/VMS_defs__turn_on_and_off.h HW_Dependent_Primitives/VMS__primitives.c HW_Dependent_Primitives/VMS__primitives.h HW_Dependent_Primitives/VMS__primitives_asm.s Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h Services_Offered_by_VMS/Memory_Handling/vmalloc.c Services_Offered_by_VMS/Memory_Handling/vmalloc.h VMS.h VMS__int.c VMS__startup_and_shutdown.c |
| diffstat | 10 files changed, 229 insertions(+), 50 deletions(-) [+] |
line diff
1.1 --- a/Defines/VMS_defs__turn_on_and_off.h Tue May 08 18:58:41 2012 +0200 1.2 +++ b/Defines/VMS_defs__turn_on_and_off.h Thu May 17 20:39:44 2012 +0200 1.3 @@ -15,7 +15,7 @@ 1.4 * It still does co-routines and all the mechanisms are the same, it just 1.5 * has only a single thread and animates Slvs one at a time 1.6 */ 1.7 -//#define DEBUG__TURN_ON_SEQUENTIAL_MODE 1.8 +#define DEBUG__TURN_ON_SEQUENTIAL_MODE 1.9 1.10 1.11 /*turns on the probe-instrumentation in the application -- when not 1.12 @@ -29,6 +29,7 @@ 1.13 #define dbgProbes FALSE /* for issues inside probes themselves*/ 1.14 #define dbgB2BMaster FALSE /* in coreloop, back to back master Slvs*/ 1.15 #define dbgRqstHdlr FALSE /* in request handler code*/ 1.16 +#define dbgSS FALSE /* in request handler code*/ 1.17 1.18 //#define DEBUG__TURN_ON_ERROR_MSGS 1.19 1.20 @@ -60,9 +61,9 @@ 1.21 /*turn on/off subtraction of create measurements from plugin meas*/ 1.22 //#define MEAS__TURN_ON_EXCLUDE_CREATION_TIME 1.23 1.24 -#define HOLISTIC__TURN_ON_PERF_COUNTERS 1.25 -#define HOLISTIC__TURN_ON_OBSERVE_UCC 1.26 -#define DETECT_LOOP_GRAPH 1.27 +//#define HOLISTIC__TURN_ON_PERF_COUNTERS 1.28 +//#define HOLISTIC__TURN_ON_OBSERVE_UCC 1.29 +//#define DETECT_LOOP_GRAPH 1.30 1.31 //=================== Turn on or off system options ======================= 1.32 //
2.1 --- a/HW_Dependent_Primitives/VMS__primitives.c Tue May 08 18:58:41 2012 +0200 2.2 +++ b/HW_Dependent_Primitives/VMS__primitives.c Thu May 17 20:39:44 2012 +0200 2.3 @@ -5,19 +5,20 @@ 2.4 2.5 #include "../VMS.h" 2.6 2.7 -/*Set up the stack with __cdecl structure on it 2.8 - * Except doing a trick for 64 bits, where put top-level fn pointer on 2.9 - * stack, then call an assembly helper that copies it into a reg and 2.10 +/*Reset the stack then set it up with __cdecl structure on it 2.11 + * Except doing a trick for 64 bits, where point slave to helper assembly 2.12 + * that copies the function pointer off stack and into a reg, then 2.13 * jumps to it. So, set the resumeInstrPtr to the helper-assembly. 2.14 - *No need to save registers on old stack frame, because there's no old 2.15 - * animator state to return to 2.16 + *This is for first-time startup of slave.. it trashes the stack. 2.17 + *No registers saved into old stack frame, and no animator state to 2.18 + * return to 2.19 * 2.20 *This was factored into separate function because it's used stand-alone in 2.21 * some wrapper-libraries (but only "int" version, to warn users to check 2.22 * carefully that it's safe) 2.23 */ 2.24 inline void 2.25 -VMS_int__point_slaveVP_to_Fn( SlaveVP *slaveVP, TopLevelFnPtr fnPtr, 2.26 +VMS_int__reset_slaveVP_to_TopLvlFn( SlaveVP *slaveVP, TopLevelFnPtr fnPtr, 2.27 void *dataParam) 2.28 { void *stackPtr; 2.29 2.30 @@ -28,9 +29,9 @@ 2.31 2.32 //fnPtr takes two params -- void *dataParam & void *animSlv 2.33 // Stack grows *down*, so start it at highest stack addr, minus room 2.34 - // for 2 params + return addr. 2.35 + // for 2 params + return addr. Do ptr arith in terms of bytes.. 2.36 stackPtr = 2.37 - (void *)slaveVP->startOfStack + VIRT_PROCR_STACK_SIZE - 4*sizeof(void*); 2.38 + (uint8 *)slaveVP->startOfStack + VIRT_PROCR_STACK_SIZE - 4*sizeof(void*); 2.39 2.40 //setup __cdecl on stack 2.41 //Normally, return Addr is in loc pointed to by stackPtr, but doing a 2.42 @@ -38,6 +39,7 @@ 2.43 // and set resumeInstrPtr to a helper-fn that copies the top-level 2.44 // fn ptr and params into registers. 2.45 //Then, dataParam is at stackPtr + 8 bytes, & animating SlaveVP above 2.46 + //Do ptr arith in terms of pointers 2.47 *((SlaveVP**)stackPtr + 2 ) = slaveVP; //rightmost param 2.48 *((void**)stackPtr + 1 ) = dataParam; //next param to left 2.49 *((void**)stackPtr) = (void*)fnPtr; //copied to reg by helper Fn 2.50 @@ -46,8 +48,90 @@ 2.51 // end of Hardware dependent part 2.52 2.53 //core controller will switch to stack & frame pointers stored in slave, 2.54 - // suspend will save processor's stack and frame into slave 2.55 + // can't use this fn if have state on stack that needs preserving. 2.56 slaveVP->stackPtr = stackPtr; 2.57 slaveVP->framePtr = stackPtr; 2.58 } 2.59 2.60 + 2.61 +/*Preserve the stack, pushing the __cdecl structure onto it 2.62 + * For 64 bits, params passed in regs, so point slave to helper assembly 2.63 + * that copies the arguments off stack and into regs, then 2.64 + * jumps to Fn. So, set the resumeInstrPtr to the helper-assembly. 2.65 + * 2.66 + *This preserves the stack state existed at time slave was suspended. 2.67 + */ 2.68 +inline void 2.69 +VMS_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr, 2.70 + void *param) 2.71 + { void *stackPtr; 2.72 + 2.73 +// Start of Hardware dependent part 2.74 + 2.75 + // Get the slave's current stack ptr, and make room for param + ret addr 2.76 + stackPtr = ((void **)slaveVP->stackPtr - 2); 2.77 + 2.78 + //save slave's current instr ptr as the return addr, so stack looks 2.79 + // just like it does after a call instr. 2.80 + //Put argument plus fn addr onto stack -- helper will copy into regs 2.81 + // then jump to the fn 2.82 + //fnPtr is just below top of stack, param is above at stackPtr + 8 bytes 2.83 + *((void**)stackPtr + 1 ) = param; 2.84 + *((void**)stackPtr) = slaveVP->resumeInstrPtr; //acts as return addr 2.85 + *((void**)stackPtr - 1) = (void*)fnPtr; //what helper jmps to 2.86 + 2.87 + //Set slave's instr pointer to a helper Fn that copies params from stack 2.88 + slaveVP->resumeInstrPtr = (TopLevelFnPtr)&jmpToOneParamFn; 2.89 + 2.90 +// end of Hardware dependent part 2.91 + 2.92 + //core controller will switch to stack & frame pointers stored in slave, 2.93 + // then jmp to helper Fn, which will then move param to register used 2.94 + // to pass argument and jmp to fnPtr saved on stack. 2.95 + //That fn should save the framePtr on stack and make room 2.96 + // for its own frame, as normal. So don't modify framePtr, only stack 2.97 + slaveVP->stackPtr = stackPtr; 2.98 + } 2.99 + 2.100 + 2.101 +/*Same as for one-parameter function, but puts two arguments on stack 2.102 + *Preserve the stack, pushing the __cdecl structure onto it 2.103 + * For 64 bits, params passed in regs, so point slave to helper assembly 2.104 + * that copies the arguments off stack and into regs, then 2.105 + * jumps to Fn. So, set the resumeInstrPtr to the helper-assembly. 2.106 + * 2.107 + *This preserves the stack state existed at time slave was suspended. 2.108 + */ 2.109 +inline void 2.110 +VMS_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr, 2.111 + void *param1, void *param2) 2.112 + { void *stackPtr; 2.113 + 2.114 +// Start of Hardware dependent part 2.115 + 2.116 + // Get the slave's current stack ptr, and make room for param + ret addr 2.117 + stackPtr = slaveVP->stackPtr - 3; 2.118 + 2.119 + //save slave's current instr ptr as the return addr, so stack looks 2.120 + // just like it does after a call instr. 2.121 + //Put argument plus fn addr onto stack -- helper will copy into regs 2.122 + // then jump to the fn 2.123 + //fnPtr is just below top of stack, param1 is above at stackPtr + 8 bytes 2.124 + *((void**)stackPtr + 2 ) = param2; 2.125 + *((void**)stackPtr + 1 ) = param1; 2.126 + *((void**)stackPtr) = slaveVP->resumeInstrPtr; //acts as return addr 2.127 + *((void**)stackPtr - 1) = (void*)fnPtr; //what helper jmps to 2.128 + 2.129 + //Set slave's instr pointer to a helper Fn that copies params from stack 2.130 + slaveVP->resumeInstrPtr = (TopLevelFnPtr)&jmpToTwoParamFn; 2.131 + 2.132 +// end of Hardware dependent part 2.133 + 2.134 + //core controller will switch to stack & frame pointers stored in slave, 2.135 + // then jmp to helper Fn, which will then move param to register used 2.136 + // to pass argument and jmp to fnPtr saved on stack. 2.137 + //That fn should save the framePtr on stack and make room 2.138 + // for its own frame, as normal. So don't modify framePtr, only stack 2.139 + slaveVP->stackPtr = stackPtr; 2.140 + } 2.141 +
3.1 --- a/HW_Dependent_Primitives/VMS__primitives.h Tue May 08 18:58:41 2012 +0200 3.2 +++ b/HW_Dependent_Primitives/VMS__primitives.h Thu May 17 20:39:44 2012 +0200 3.3 @@ -25,6 +25,12 @@ 3.4 void 3.5 startUpTopLevelFn(); 3.6 3.7 +void 3.8 +jmpToOneParamFn(); 3.9 + 3.10 +void 3.11 +jmpToTwoParamFn(); 3.12 + 3.13 void * 3.14 asmTerminateCoreCtlr(SlaveVP *currSlv); 3.15 3.16 @@ -37,5 +43,13 @@ 3.17 void 3.18 VMS_int__return_to_addr_in_ptd_to_loc(void *ptdToLoc); 3.19 3.20 +inline void 3.21 +VMS_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr, 3.22 + void *param); 3.23 + 3.24 +inline void 3.25 +VMS_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr, 3.26 + void *param1, void *param2); 3.27 + 3.28 #endif /* _VMS__HW_DEPENDENT_H */ 3.29
4.1 --- a/HW_Dependent_Primitives/VMS__primitives_asm.s Tue May 08 18:58:41 2012 +0200 4.2 +++ b/HW_Dependent_Primitives/VMS__primitives_asm.s Thu May 17 20:39:44 2012 +0200 4.3 @@ -21,6 +21,27 @@ 4.4 movq (%rsp) , %rax #get top-level function's addr from stack 4.5 jmp *%rax #jump to the top-level function 4.6 4.7 + 4.8 +//Args passed in regs in 64 bit arch. This copies args from stack into regs, 4.9 +// then does jmp to the function, whose addr is on stack. 4.10 +//For 64bit, %rdi is first arg, %rsi is second arg to function 4.11 +//The top of stack is a valid return addr (old value of slaveVP's instrPtr), 4.12 +// and the fnPtr is just below the top of stack (will be overwritten when 4.13 +// fn saves the frame ptr) 4.14 +.globl jmpToOneParamFn 4.15 +jmpToOneParamFn: 4.16 + movq 0x08(%rsp), %rdi #get the argument from stack 4.17 + movq -0x08(%rsp), %rax #get function's addr from stack 4.18 + jmp *%rax #jump to the function 4.19 + 4.20 +.globl jmpToTwoParamFn 4.21 +jmpToTwoParamFn: 4.22 + movq 0x10(%rsp), %rsi #get the second argument from stack 4.23 + movq 0x08(%rsp), %rdi #get the first argument from stack 4.24 + movq -0x08(%rsp), %rax #get function's addr from stack 4.25 + jmp *%rax #jump to the function 4.26 + 4.27 + 4.28 //Switches form CoreCtlr to either a normal Slv VP or the Master VP 4.29 //switch to VP's stack and frame ptr then jump to VP's next-instr-ptr 4.30 /* SlaveVP offsets:
5.1 --- a/Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h Tue May 08 18:58:41 2012 +0200 5.2 +++ b/Services_Offered_by_VMS/Measurement_and_Stats/MEAS__macros.h Thu May 17 20:39:44 2012 +0200 5.3 @@ -294,7 +294,7 @@ 5.4 5.5 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS 5.6 5.7 -#define MEAS__Insert_Counter_Handler \ 5.8 + #define MEAS__Insert_Counter_Handler \ 5.9 typedef void (*CounterHandler) (int,int,int,SlaveVP*,uint64,uint64,uint64); 5.10 5.11 enum eventType { 5.12 @@ -365,12 +365,13 @@ 5.13 int sndctr = tsc_offset_resp(sendCoresThdParams,0); \ 5.14 }*/ 5.15 5.16 -#define HOLISTIC__Record_last_work lastVPBeforeMaster = currVP; 5.17 5.18 #define HOLISTIC__Insert_Master_Global_Vars \ 5.19 int vpid,task; \ 5.20 CounterHandler counterHandler = masterEnv->counterHandler; 5.21 5.22 + #define HOLISTIC__Record_last_work lastVPBeforeMaster = currVP; 5.23 + 5.24 #define HOLISTIC__Record_AppResponderInvocation_start \ 5.25 uint64 cycles,instrs,cachem; \ 5.26 saveCyclesAndInstrs(thisCoresIdx,cycles, instrs,cachem); \ 5.27 @@ -467,6 +468,9 @@ 5.28 #define MEAS__Insert_Counter_Handler 5.29 #define MEAS__Insert_Counter_Meas_Fields_into_MasterEnv 5.30 #define HOLISTIC__Setup_Perf_Counters 5.31 + #define HOLISTIC__CoreCtrl_Setup 5.32 + #define HOLISTIC__Insert_Master_Global_Vars 5.33 + #define HOLISTIC__Record_last_work 5.34 #define HOLISTIC__Record_AppResponderInvocation_start 5.35 #define HOLISTIC__Record_AppResponder_start 5.36 #define HOLISTIC__Record_AppResponder_end
6.1 --- a/Services_Offered_by_VMS/Memory_Handling/vmalloc.c Tue May 08 18:58:41 2012 +0200 6.2 +++ b/Services_Offered_by_VMS/Memory_Handling/vmalloc.c Thu May 17 20:39:44 2012 +0200 6.3 @@ -202,6 +202,47 @@ 6.4 /* 6.5 * This is sequential code, meant to only be called from the Master, not from 6.6 * any slave Slvs. 6.7 + * 6.8 + *ToDo: Improve speed, by using built-in leading 1 detector to calc free-list 6.9 + * index. 6.10 + *Change to two separate arrays, one for free-lists of small fixed-size chunks 6.11 + * other for free lists of exponentially growing chunk sizes 6.12 + *Do simple compare to decide which array of lists to use 6.13 + *For small chunks, size the lists in increments of 16, up to, say, 128 (1024 6.14 + * is max if want less than 64 lists, which allows searching for first 6.15 + * occupied free-list using leading-1 detector on a bit-vector) 6.16 + *To find index, right-shift by 4 bits, and that's the index! (works because 6.17 + * compare says no 1's above 128 position ((bit 7)), and sizes are every 16, 6.18 + * so dividing by 16 equals exactly the position) 6.19 + *For large chunks, have 63 free lists, but split into even and odd indexes. 6.20 + *For even indexes, each list starts with chunks twice the size of previous 6.21 + * even index. 6.22 + *For odd indexes, each list starts with chunks of size half-way between those 6.23 + * of the even indexes on either side. 6.24 + * 6.25 + *To calc the free-list position of a requested size, get pos of leading 1 6.26 + * of the size, call this msbsP (most-significant-bit-set-position). Then 6.27 + * check bit to right of it (one-less-significant) 6.28 + *If it's 0 then use the even index: msbsP * 2, which is msbsP << 1. 6.29 + *If it's 1, then use the odd-index, which is msbsP << 1 + 1 6.30 + * 6.31 + *To find msbsP, use GCC builtin: "int __builtin_clzll (unsigned long long)" 6.32 + * which returns the number of zeros above (left of) msb set. Note, dies if 6.33 + * give it zero, but the compare used to choose between arrays makes sure 6.34 + * requested size given to it is not zero. 6.35 + * 6.36 + *This scheme keeps wastage small, while finding free element is O(1), and a 6.37 + * fast constant. 6.38 + *For large chunk sizes, if don't shave excess, then it ensures worst-case 6.39 + * wastage due to mis-match in size of chunk vs requested size is 33% 6.40 + * (invariant: take any even list.. it starts at a power of 2, and next list 6.41 + * up starts at 50% larger, so biggest chunk is 1.5 x smallest request, that's 6.42 + * 33% of total memory wasted. Then, for the odd index above, smallest chunk 6.43 + * is 2x for smallest request of 1.5x, for 25% total wasted memory) 6.44 + *For smallest size chunks, the pre-amble wastes quite a bit, but above that, 6.45 + * sizing in increments of 16 keeps wastage small. And, if always shave, then 6.46 + * wastage due to size mis-match is maximum 16 bytes for the large chunks. 6.47 + * 6.48 */ 6.49 void * 6.50 VMS_int__malloc( size_t sizeRequested ) 6.51 @@ -213,17 +254,17 @@ 6.52 6.53 //Return a small chunk if the requested size is smaller than 128B 6.54 if(sizeRequested <= LOWER_BOUND) 6.55 - { 6.56 - uint32 freeListIdx = (sizeRequested-1)/SMALL_CHUNK_SIZE; 6.57 - if(freeLists->smallChunks[freeListIdx] == NULL) 6.58 - foundChunk = searchChunk(freeLists, SMALL_CHUNK_SIZE*(freeListIdx+1), 0); 6.59 - else 6.60 - foundChunk = removeSmallChunk(freeLists, freeListIdx); 6.61 + { 6.62 + uint32 freeListIdx = (sizeRequested-1)/SMALL_CHUNK_SIZE; 6.63 + if(freeLists->smallChunks[freeListIdx] == NULL) 6.64 + foundChunk = searchChunk(freeLists, SMALL_CHUNK_SIZE*(freeListIdx+1), 0); 6.65 + else 6.66 + foundChunk = removeSmallChunk(freeLists, freeListIdx); 6.67 6.68 - //Mark as allocated 6.69 - foundChunk->prevChunkInFreeList = NULL; 6.70 - return foundChunk + 1; 6.71 - } 6.72 + //Mark as allocated 6.73 + foundChunk->prevChunkInFreeList = NULL; 6.74 + return foundChunk + 1; 6.75 + } 6.76 6.77 //Calculate the expected container. Start one higher to have a Chunk that's 6.78 //always big enough.
7.1 --- a/Services_Offered_by_VMS/Memory_Handling/vmalloc.h Tue May 08 18:58:41 2012 +0200 7.2 +++ b/Services_Offered_by_VMS/Memory_Handling/vmalloc.h Thu May 17 20:39:44 2012 +0200 7.3 @@ -55,8 +55,8 @@ 7.4 void * 7.5 VMS_int__malloc( size_t sizeRequested ); 7.6 #define VMS_PI__malloc VMS_int__malloc 7.7 -#define VMS_WL__malloc VMS_int__malloc /*TODO: Bug -- Not protected!! */ 7.8 -#define VMS_App__malloc VMS_int__malloc /*TODO: Bug -- Not protected!! */ 7.9 +#define VMS_WL__malloc VMS_int__malloc /*TODO: Bug -- get master lock */ 7.10 +#define VMS_App__malloc VMS_int__malloc /*TODO: Bug -- get master lock */ 7.11 7.12 void * 7.13 VMS_int__malloc_aligned( size_t sizeRequested );
8.1 --- a/VMS.h Tue May 08 18:58:41 2012 +0200 8.2 +++ b/VMS.h Thu May 17 20:39:44 2012 +0200 8.3 @@ -10,11 +10,12 @@ 8.4 #define _VMS_H 8.5 #define _GNU_SOURCE 8.6 8.7 -#include "VMS_primitive_data_types.h" 8.8 #include "DynArray/DynArray.h" 8.9 #include "Hash_impl/PrivateHash.h" 8.10 #include "Histogram/Histogram.h" 8.11 #include "Queue_impl/PrivateQueue.h" 8.12 + 8.13 +#include "VMS_primitive_data_types.h" 8.14 #include "Services_Offered_by_VMS/Memory_Handling/vmalloc.h" 8.15 8.16 #include <pthread.h> 8.17 @@ -49,8 +50,8 @@ 8.18 8.19 //============================ HW Dependent Fns ================================ 8.20 8.21 -#include "Hardware_Dependent/VMS__HW_measurement.h" 8.22 -#include "Hardware_Dependent/VMS__primitives.h" 8.23 +#include "HW_Dependent_Primitives/VMS__HW_measurement.h" 8.24 +#include "HW_Dependent_Primitives/VMS__primitives.h" 8.25 8.26 8.27 //============= Request Related =========== 8.28 @@ -156,9 +157,9 @@ 8.29 */ 8.30 typedef struct 8.31 { //The offsets of these fields are hard-coded into assembly 8.32 - void *coreCtlrReturnPt; //offset of field used in asm 8.33 + void *coreCtlrReturnPt; //offset to this field used in asm 8.34 int8 falseSharePad1[256 - sizeof(void*)]; 8.35 - int32 masterLock; //offset of field used in asm 8.36 + int32 masterLock; //offset to this field used in asm 8.37 int8 falseSharePad2[256 - sizeof(int32)]; 8.38 //============ below this, no fields are used in asm ============= 8.39 8.40 @@ -289,9 +290,17 @@ 8.41 void *dataParam, void *stackLocs ); 8.42 8.43 inline void 8.44 -VMS_int__point_slaveVP_to_Fn( SlaveVP *slaveVP, TopLevelFnPtr fnPtr, 8.45 +VMS_int__reset_slaveVP_to_TopLvlFn( SlaveVP *slaveVP, TopLevelFnPtr fnPtr, 8.46 void *dataParam); 8.47 8.48 +inline void 8.49 +VMS_int__point_slaveVP_to_OneParamFn( SlaveVP *slaveVP, void *fnPtr, 8.50 + void *param); 8.51 + 8.52 +inline void 8.53 +VMS_int__point_slaveVP_to_TwoParamFn( SlaveVP *slaveVP, void *fnPtr, 8.54 + void *param1, void *param2); 8.55 + 8.56 void 8.57 VMS_int__dissipate_slaveVP( SlaveVP *slaveToDissipate ); 8.58 #define VMS_PI__dissipate_slaveVP VMS_int__dissipate_slaveVP
9.1 --- a/VMS__int.c Tue May 08 18:58:41 2012 +0200 9.2 +++ b/VMS__int.c Thu May 17 20:39:44 2012 +0200 9.3 @@ -72,17 +72,22 @@ 9.4 VMS_int__suspend_slaveVP_and_send_req( SlaveVP *animatingSlv ) 9.5 { 9.6 9.7 - //The request to master will cause this suspended Slv to get 9.8 - // assigned again at some future point -- to resume, core ctlr jumps 9.9 - // to the resume point (below), which causes restore of saved regs and 9.10 - // "return" from this call. 9.11 - //animatingSlv->resumeInstrPtr = &&ResumePt; 9.12 + //This suspended Slv will get assigned by Master again at some 9.13 + // future point 9.14 9.15 //return ownership of the Slv and anim slot to Master virt pr 9.16 animatingSlv->animSlotAssignedTo->workIsDone = TRUE; 9.17 9.18 HOLISTIC__Record_HwResponderInvocation_start; 9.19 MEAS__Capture_Pre_Susp_Point; 9.20 + //This assembly function is a VMS primitive that first saves the 9.21 + // stack and frame pointer, plus an addr inside this assembly code. 9.22 + //When core ctlr later gets this slave out of a sched slot, it 9.23 + // restores the stack and frame and then jumps to the addr.. that 9.24 + // jmp causes return from this function. 9.25 + //So, in effect, this function takes a variable amount of wall-clock 9.26 + // time to complete -- the amount of time is determined by the 9.27 + // Master, which makes sure the memory is in a consistent state first. 9.28 switchToCoreCtlr(animatingSlv); 9.29 flushRegisters(); 9.30 MEAS__Capture_Post_Susp_Point; 9.31 @@ -176,10 +181,10 @@ 9.32 newSlv->slaveID = _VMSMasterEnv->numSlavesCreated++; 9.33 newSlv->requests = NULL; 9.34 newSlv->animSlotAssignedTo = NULL; 9.35 - newSlv->typeOfVP = Slave; 9.36 - newSlv->assignCount = 0; 9.37 + newSlv->typeOfVP = Slave; 9.38 + newSlv->assignCount = 0; 9.39 9.40 - VMS_int__point_slaveVP_to_Fn( newSlv, fnPtr, dataParam ); 9.41 + VMS_int__reset_slaveVP_to_TopLvlFn( newSlv, fnPtr, dataParam ); 9.42 9.43 //============================= MEASUREMENT STUFF ======================== 9.44 #ifdef PROBES__TURN_ON_STATS_PROBES 9.45 @@ -199,7 +204,7 @@ 9.46 VMS_int__strDup( char *str ) 9.47 { char *retStr; 9.48 9.49 - if( str == NULL ) return NULL; 9.50 + if( str == NULL ) return (char *)NULL; 9.51 retStr = (char *)VMS_int__malloc( strlen(str) + 1 ); 9.52 strcpy( retStr, str ); 9.53
10.1 --- a/VMS__startup_and_shutdown.c Tue May 08 18:58:41 2012 +0200 10.2 +++ b/VMS__startup_and_shutdown.c Thu May 17 20:39:44 2012 +0200 10.3 @@ -157,7 +157,7 @@ 10.4 10.5 /* 10.6 void 10.7 -VMS__start_VMS_running() 10.8 +VMS_App__start_VMS_running() 10.9 { 10.10 create_masterEnv(); 10.11 10.12 @@ -176,7 +176,7 @@ 10.13 */ 10.14 /* 10.15 VMSProcess * 10.16 -VMS__spawn_program_on_data_in_Lang( TopLevelFnPtr prog_seed_fn, void *data, 10.17 +VMS_App__spawn_program_on_data_in_Lang( TopLevelFnPtr prog_seed_fn, void *data, 10.18 LangInitFnPtr langInitFnPtr ) 10.19 { VMSProcess *newProcess; 10.20 newProcess = malloc( sizeof(VMSProcess) ); 10.21 @@ -217,7 +217,7 @@ 10.22 */ 10.23 /* 10.24 void * 10.25 -VMS__give_results_when_done_for( VMSProcess *process ) 10.26 +VMS_App__give_results_when_done_for( VMSProcess *process ) 10.27 { void *result; 10.28 10.29 pthread_mutex_lock( process->doneLock ); 10.30 @@ -247,7 +247,7 @@ 10.31 VMS_SS__shutdown(); //already defined -- look at it 10.32 10.33 void 10.34 -VMS__shutdown() 10.35 +VMS_App__shutdown() 10.36 { 10.37 for( cores ) 10.38 { slave = VMS_int__create_new_SlaveVP( endOSThreadFn, NULL ); 10.39 @@ -256,16 +256,16 @@ 10.40 } 10.41 */ 10.42 10.43 -/* VMS__start_VMS_running(); 10.44 +/* VMS_App__start_VMS_running(); 10.45 10.46 VMSProcess matrixMultProcess; 10.47 10.48 matrixMultProcess = 10.49 - VMS__spawn_program_on_data_in_Lang( &prog_seed_fn, data, Vthread_lang ); 10.50 + VMS_App__spawn_program_on_data_in_Lang( &prog_seed_fn, data, Vthread_lang ); 10.51 10.52 - resMatrix = VMS__give_results_when_done_for( matrixMultProcess ); 10.53 + resMatrix = VMS_App__give_results_when_done_for( matrixMultProcess ); 10.54 10.55 - VMS__shutdown(); 10.56 + VMS_App__shutdown(); 10.57 */ 10.58 10.59 void
