| rev |
line source |
|
Me@0
|
1 /*
|
|
Me@0
|
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
|
|
Me@0
|
3 * Licensed under GNU General Public License version 2
|
|
Me@0
|
4 *
|
|
Me@0
|
5 * Author: seanhalle@yahoo.com
|
|
Me@0
|
6 *
|
|
Me@0
|
7 */
|
|
Me@0
|
8
|
|
Me@0
|
9 #ifndef _VMS_H
|
|
Me@0
|
10 #define _VMS_H
|
|
Me@0
|
11
|
|
Me@0
|
12 #include "VMS_primitive_data_types.h"
|
|
Me@0
|
13 #include "Queue_impl/BlockingQueue.h"
|
|
Me@0
|
14
|
|
Me@0
|
15 //This value is the number of hardware threads in the shared memory
|
|
Me@5
|
16 // machine -- make double that number scheduling slots, plus extra for master
|
|
Me@5
|
17 #define NUM_WORKERS 4
|
|
Me@5
|
18 #define NUM_SCHED_SLOTS 9
|
|
Me@0
|
19
|
|
Me@0
|
20 #define SUCCESS 0
|
|
Me@0
|
21
|
|
Me@0
|
22 #define thdAttrs NULL
|
|
Me@0
|
23
|
|
Me@5
|
24 typedef struct _WorkUnit WorkUnit;
|
|
Me@5
|
25 typedef struct _VirtProcr VirtProcr;
|
|
Me@5
|
26 typedef struct _SlaveReqst SlaveReqst;
|
|
Me@5
|
27 typedef struct _SchedSlot SchedSlot;
|
|
Me@0
|
28
|
|
Me@5
|
29 typedef bool8 (*SlaveScheduler) ( SchedSlot *, void * );
|
|
Me@0
|
30 typedef void (*RequestHandler) ( SlaveReqst * );
|
|
Me@5
|
31 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * );
|
|
Me@5
|
32 typedef void VirtProcrFn( void *, VirtProcr * );
|
|
Me@0
|
33
|
|
Me@0
|
34 typedef struct
|
|
Me@0
|
35 {
|
|
Me@0
|
36 QueueStruc *workQ;
|
|
Me@0
|
37 unsigned int id;
|
|
Me@0
|
38 }
|
|
Me@0
|
39 ThdParams;
|
|
Me@0
|
40
|
|
Me@5
|
41 struct _SchedSlot
|
|
Me@5
|
42 {
|
|
Me@5
|
43 int workIsDone;
|
|
Me@5
|
44 int needsProcrAssigned;
|
|
Me@5
|
45 VirtProcr *procrAssignedToSlot;
|
|
Me@5
|
46 };
|
|
Me@5
|
47
|
|
Me@5
|
48
|
|
Me@5
|
49 struct _VirtProcr
|
|
Me@5
|
50 {
|
|
Me@5
|
51 void *stackPtr;
|
|
Me@5
|
52 void *framePtr;
|
|
Me@5
|
53 void *nextInstrPt;
|
|
Me@5
|
54 void *coreLoopStartPt; //allows proto-runtime to be linked later
|
|
Me@5
|
55
|
|
Me@5
|
56 void *initialData;
|
|
Me@5
|
57
|
|
Me@5
|
58 SchedSlot *schedSlot;
|
|
Me@5
|
59 SlaveReqst *requests;
|
|
Me@5
|
60
|
|
Me@5
|
61 void *semanticData;
|
|
Me@5
|
62 };
|
|
Me@5
|
63
|
|
Me@5
|
64
|
|
Me@5
|
65 //When optimize make a separate flat array in here for each flag in SchedSlot
|
|
Me@5
|
66 //So that polling done flags is fast.. not sure even worth it, though..
|
|
Me@0
|
67 typedef struct
|
|
Me@0
|
68 {
|
|
Me@5
|
69 SlaveScheduler slaveScheduler;
|
|
Me@5
|
70 RequestHandler requestHandler;
|
|
Me@0
|
71
|
|
Me@5
|
72 SchedSlot **schedSlots;
|
|
Me@5
|
73 SchedSlot **filledSlots;
|
|
Me@5
|
74 int numFilled;
|
|
Me@5
|
75
|
|
Me@0
|
76 int stillRunning;
|
|
Me@0
|
77
|
|
Me@5
|
78 VirtProcr *masterVirtPr;
|
|
Me@0
|
79 void *semanticEnv;
|
|
Me@5
|
80 void *OSEventStruc; //for future, when add I/O to BLIS
|
|
Me@0
|
81 }
|
|
Me@0
|
82 MasterEnv;
|
|
Me@0
|
83
|
|
Me@0
|
84
|
|
Me@5
|
85
|
|
Me@5
|
86 struct _SlaveReqst
|
|
Me@0
|
87 {
|
|
Me@5
|
88 VirtProcr *slaveFrom;
|
|
Me@5
|
89 int reqType; //for future when have I/O and OS services
|
|
Me@5
|
90 void *semReqData;
|
|
Me@0
|
91
|
|
Me@0
|
92 SlaveReqst *nextRequest;
|
|
Me@0
|
93 };
|
|
Me@0
|
94
|
|
Me@0
|
95
|
|
Me@0
|
96
|
|
Me@0
|
97 void * coreLoop( void *paramsIn ); //standard PThreads fn prototype
|
|
Me@0
|
98
|
|
Me@0
|
99
|
|
Me@0
|
100 //===================== Global Vars ===================
|
|
Me@0
|
101
|
|
Me@5
|
102
|
|
Me@0
|
103 pthread_t coreLoopThds[ NUM_WORKERS ]; // std struc, holds thread info
|
|
Me@0
|
104 ThdParams thdParams[ NUM_WORKERS ];
|
|
Me@0
|
105
|
|
Me@5
|
106 volatile MasterEnv *_VMSMasterEnv;
|
|
Me@5
|
107
|
|
Me@5
|
108 //workQ is global, static, and volatile so that core loop has its location
|
|
Me@5
|
109 // hard coded, and reloads every time through the loop -- that way don't
|
|
Me@5
|
110 // need to save any regs used by core loop (will see if this really works)
|
|
Me@5
|
111 volatile QueueStruc *_VMSWorkQ;
|
|
Me@0
|
112
|
|
Me@0
|
113
|
|
Me@0
|
114 #endif /* _VMS_H */
|
|
Me@0
|
115
|