comparison VMS.h @ 18:734c665500e4

Kinda have test working -- assembly looks right for saving core loop frame and stack and restoring them But have a bug that looks timing-related, so thinking maybe some threads are going to completion? The whole test isn't quite right yet -- it throws exception because the suspended virtual processors never have a continuation put back into the workQ (is this right? Is that why it throws exception?) Want to move to full code to finish debugging
author Me
date Tue, 22 Jun 2010 12:37:43 -0700
parents 4b58b9a2527b
children aa634ef7cc35
comparison
equal deleted inserted replaced
3:b0496ae7a130 4:e7bf3c53c3a4
21 21
22 #define SUCCESS 0 22 #define SUCCESS 0
23 23
24 //#define thdAttrs NULL //For PThreads 24 //#define thdAttrs NULL //For PThreads
25 25
26 typedef struct _WorkUnit WorkUnit; 26 typedef struct _SchedSlot SchedSlot;
27 typedef struct _SlaveReqst SlaveReqst;
27 typedef struct _VirtProcr VirtProcr; 28 typedef struct _VirtProcr VirtProcr;
28 typedef struct _SlaveReqst SlaveReqst;
29 typedef struct _SchedSlot SchedSlot;
30 29
31 typedef bool8 (*SlaveScheduler) ( SchedSlot *, void * ); 30 typedef bool8 (*SlaveScheduler) ( SchedSlot *, void * );
32 typedef void (*RequestHandler) ( SlaveReqst * ); 31 typedef void (*RequestHandler) ( SlaveReqst * );
33 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); 32 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * );
34 typedef void VirtProcrFn( void *, VirtProcr * ); 33 typedef void VirtProcrFn( void *, VirtProcr * );
35 34
35
36 typedef struct 36 typedef struct
37 { 37 {
38 void *endThdPt; 38 void *endThdPt;
39 unsigned int coreNum; 39 unsigned int coreNum;
40 // void *framePtr;
41 // void *stackPtr;
40 } 42 }
41 ThdParams; 43 ThdParams;
44
42 45
43 struct _SchedSlot 46 struct _SchedSlot
44 { 47 {
45 int workIsDone; 48 int workIsDone;
46 int needsProcrAssigned; 49 int needsProcrAssigned;
47 VirtProcr *procrAssignedToSlot; 50 VirtProcr *procrAssignedToSlot;
48 }; 51 };
52 //SchedSlot
53
49 54
55 struct _SlaveReqst
56 {
57 VirtProcr *slaveFrom;
58 int reqType; //for future when have I/O and OS services
59 void *semReqData;
60
61 SlaveReqst *nextRequest;
62 };
63 //SlaveReqst
50 64
51 struct _VirtProcr 65 struct _VirtProcr
52 { int procrID; //for debugging -- count up each time create 66 { int procrID; //for debugging -- count up each time create
67 int coreAnimatedBy;
53 void *stackPtr; 68 void *stackPtr;
54 void *framePtr; 69 void *framePtr;
55 void *nextInstrPt; 70 void *nextInstrPt;
71
56 void *coreLoopStartPt; //allows proto-runtime to be linked later 72 void *coreLoopStartPt; //allows proto-runtime to be linked later
73 void *coreLoopFramePtr; //restore before jmp back to core loop
74 void *coreLoopStackPtr; //restore before jmp back to core loop
57 75
58 void *initialData; 76 void *initialData;
59 77
60 SchedSlot *schedSlot; 78 SchedSlot *schedSlot;
61 SlaveReqst *requests; 79 SlaveReqst *requests;
62 80
63 void *semanticData; 81 void *semanticData;
64 }; 82 };
83 //VirtProcr
65 84
66 85
67 //When optimize make a separate flat array in here for each flag in SchedSlot 86
68 //So that polling done flags is fast.. not sure even worth it, though..
69 typedef struct 87 typedef struct
70 { 88 {
71 SlaveScheduler slaveScheduler; 89 SlaveScheduler slaveScheduler;
72 RequestHandler requestHandler; 90 RequestHandler requestHandler;
73 91
78 int stillRunning; 96 int stillRunning;
79 97
80 VirtProcr *masterVirtPr; 98 VirtProcr *masterVirtPr;
81 void *semanticEnv; 99 void *semanticEnv;
82 void *OSEventStruc; //for future, when add I/O to BLIS 100 void *OSEventStruc; //for future, when add I/O to BLIS
101
102 void *coreLoopShutDownPt; //addr to jump to to shut down a coreLoop
83 } 103 }
84 MasterEnv; 104 MasterEnv;
85 105
86 106
87 107 //==========================================================
88 struct _SlaveReqst
89 {
90 VirtProcr *slaveFrom;
91 int reqType; //for future when have I/O and OS services
92 void *semReqData;
93
94 SlaveReqst *nextRequest;
95 };
96
97 108
98 DWORD WINAPI coreLoop( LPVOID paramsIn ); 109 DWORD WINAPI coreLoop( LPVOID paramsIn );
99 //void * coreLoop( void *paramsIn ); //standard PThreads fn prototype 110 //void * coreLoop( void *paramsIn ); //standard PThreads fn prototype
100 void masterLoop( void *initData, VirtProcr *masterPr ); 111 void masterLoop( void *initData, VirtProcr *masterPr );
101 112