1 #ifndef BAMBOO_MULTICORE_MSG_H
2 #define BAMBOO_MULTICORE_MSG_H
5 // data structures for msgs
6 #define BAMBOO_OUT_BUF_LENGTH 2048
7 #define BAMBOO_OUT_BUF_MASK (0x7FF)
8 #define BAMBOO_MSG_BUF_LENGTH 2048
9 #define BAMBOO_MSG_BUF_MASK (0x7FF)
10 int msgdata[BAMBOO_MSG_BUF_LENGTH];
11 volatile int msgdataindex;
12 volatile int msgdatalast;
13 volatile bool msgdatafull;
14 int outmsgdata[BAMBOO_OUT_BUF_LENGTH];
18 volatile bool isMsgHanging;
20 #define MSG_INDEXINC_I() \
21 msgdataindex = (msgdataindex + 1) & (BAMBOO_MSG_BUF_MASK)
23 #define MSG_LASTINDEXINC_I() \
24 msgdatalast = (msgdatalast + 1) & (BAMBOO_MSG_BUF_MASK)
26 #define MSG_CACHE_I(n) \
27 msgdata[msgdatalast] = (n); \
30 #define MSG_REMAINSIZE_I(s) \
31 if(msgdataindex < msgdatalast) { \
32 (*(int*)s) = msgdatalast - msgdataindex; \
33 } else if((msgdataindex == msgdatalast) && (!msgdatafull)) { \
36 (*(int*)s) = (BAMBOO_MSG_BUF_LENGTH) - msgdataindex + msgdatalast; \
39 #define OUTMSG_INDEXINC() \
40 outmsgindex = (outmsgindex + 1) & (BAMBOO_OUT_BUF_MASK)
42 #define OUTMSG_LASTINDEXINC() \
43 outmsglast = (outmsglast + 1) & (BAMBOO_OUT_BUF_MASK); \
44 if(outmsglast == outmsgindex) { \
48 #define OUTMSG_CACHE(n) \
49 outmsgdata[outmsglast] = (n); \
50 OUTMSG_LASTINDEXINC();
54 * type: 1 -- transfer object
55 * 2 -- transfer stall msg
60 * // add for profile info
61 * 7 -- transfer profile output msg
62 * 8 -- transfer profile output finish msg
63 * // add for alias lock strategy
64 * 9 -- redirect lock request
65 * a -- lock grant with redirect info
66 * b -- lock deny with redirect info
67 * c -- lock release with redirect info
68 * d -- status confirm request
69 * e -- status report msg
71 * 10 -- requiring for new memory
72 * 11 -- response for new memory request
73 * 12 -- GC init phase start
75 * 14 -- compact phase start
76 * 15 -- flush phase start
77 * 16 -- init phase finish
78 * 17 -- mark phase finish
79 * 18 -- compact phase finish
80 * 19 -- flush phase finish
82 * 1b -- marked phase finish confirm request
83 * 1c -- marked phase finish confirm response
85 * 1e -- start moving objs msg
86 * 1f -- ask for mapping info of a markedObj
87 * 20 -- mapping info of a markedObj
88 * 21 -- large objs info request
89 * 22 -- large objs info response
90 * 23 -- large objs mapping info
92 * ObjMsg: 1 + size of msg + obj's address + (task index + param index)+
93 * StallMsg: 2 + corenum + sendobjs + receiveobjs
94 * (size is always 4 * sizeof(int))
95 * LockMsg: 3 + lock type + obj pointer + lock + request core
96 * (size is always 5 * sizeof(int))
97 * 4/5/6 + lock type + obj pointer + lock
98 * (size is always 4 * sizeof(int))
99 * 9 + lock type + obj pointer + redirect lock + root request core
101 * (size is always 6 * sizeof(int))
102 * a/b + lock type + obj pointer + redirect lock
103 * (size is always 4 * sizeof(int))
104 * c + lock type + lock + redirect lock
105 * (size is always 4 * sizeof(int))
106 * lock type: 0 -- read; 1 -- write
107 * ProfileMsg: 7 + totalexetime
108 * (size is always 2 * sizeof(int))
110 * (size is always sizeof(int))
111 * StatusMsg: d (size is always 1 * sizeof(int))
112 * e + status + corenum + sendobjs + receiveobjs
113 * (size is always 5 * sizeof(int))
114 * status: 0 -- stall; 1 -- busy
115 * TerminateMsg: f (size is always 1 * sizeof(int)
116 * MemoryMsg: 10 + size + corenum
117 * (size is always 3 * sizeof(int))
118 * 11 + base_va + size
119 * (size is always 3 * sizeof(int))
120 * GCMsg: 12/13 (size is always 1 * sizeof(int))
121 * 14 + size of msg + (num of objs to move + (start address
122 * + end address + dst core + start dst)+)?
123 * + (num of incoming objs + (start dst + orig core)+)?
124 * + (num of large obj lists + (start address + lenght
126 * 15 (size is always 1 * sizeof(int))
128 * (size is always 2 * sizeof(int))
129 * 17 + corenum + gcsendobjs + gcreceiveobjs
130 * (size if always 4 * sizeof(int))
131 * 18 + corenum + fulfilled blocks num + (finish compact(1) + current
132 * heap top)/(need mem(0) + mem need)
133 * size is always 5 * sizeof(int))
135 * (size is always 2 * sizeof(int))
136 * 1a (size is always 1 * sizeof(int))
137 * 1b (size if always 1 * sizeof(int))
138 * 1c + size of msg + corenum + gcsendobjs + gcreceiveobjs
139 * (size is always 5 * sizeof(int))
140 * 1d + obj's address + request core
141 * (size is always 3 * sizeof(int))
142 * 1e + corenum + start addr + end addr
143 * (size if always 4 * sizeof(int))
144 * 1f + obj's address + corenum
145 * (size is always 3 * sizeof(int))
146 * 20 + obj's address + dst address
147 * (size if always 3 * sizeof(int))
148 * 21 (size is always 1 * sizeof(int))
149 * 22 + size of msg + corenum + current heap size
150 * + (num of large obj lists + (start address + length)+)?
151 * 23 + orig large obj ptr + new large obj ptr
152 * (size is always 3 * sizeof(int))
155 MSGSTART = 0x0, // 0xD0
162 PROFILEOUTPUT, // 0xD7
163 PROFILEFINISH, // 0xD8
164 REDIRECTLOCK, // 0xD9
165 REDIRECTGROUNT, // 0xDa
166 REDIRECTDENY, // 0xDb
167 REDIRECTRELEASE, // 0xDc
168 STATUSCONFIRM, // 0xDd
169 STATUSREPORT, // 0xDe
177 GCSTARTCOMPACT, // 0xE5
178 GCSTARTFLUSH, // 0xE6
180 GCFINISHINIT, // 0xE8
181 GCFINISHMARK, // 0xE9
182 GCFINISHCOMPACT, // 0xEa
183 GCFINISHFLUSH, // 0xEb
185 GCMARKCONFIRM, // 0xEd
186 GCMARKREPORT, // 0xEe
189 GCLOBJREQUEST, // 0xF1
194 #ifdef GC_CACHE_ADAPT
196 GCFINISHPREF, // 0xF5
197 #endif // GC_CACHE_ADAPT
198 #endif // MULTICORE_GC
202 // msg related functions
203 void send_msg_1(int targetcore,unsigned long n0);
204 void send_msg_2(int targetcore,unsigned long n0,unsigned long n1);
205 void send_msg_3(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2);
206 void send_msg_4(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2,unsigned long n3);
207 void send_msg_5(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2,unsigned long n3,unsigned long n4);
208 void send_msg_6(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2,unsigned long n3,unsigned long n4,unsigned long n5);
209 void send_msg_1_I(int targetcore,unsigned long n0);
210 void send_msg_2_I(int targetcore,unsigned long n0,unsigned long n1);
211 void send_msg_3_I(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2);
212 void send_msg_4_I(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2,unsigned long n3);
213 void send_msg_5_I(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2,unsigned long n3,unsigned long n4);
214 void send_msg_6_I(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2,unsigned long n3,unsigned long n4,unsigned long n5);
215 void cache_msg_1_I(int targetcore,unsigned long n0);
216 void cache_msg_2_I(int targetcore,unsigned long n0,unsigned long n1);
217 void cache_msg_3_I(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2);
218 void cache_msg_4_I(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2,unsigned long n3);
219 void cache_msg_5_I(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2,unsigned long n3,unsigned long n4);
220 void cache_msg_6_I(int targetcore,unsigned long n0,unsigned long n1,unsigned long n2,unsigned long n3,unsigned long n4,unsigned long n5);
223 void transferObject(struct transObjInfo * transObj);
227 void transferMarkResults();
231 #endif // BAMBOO_MULTICORE_MSG_H