Add code for change the cache policy for the mutator. In each round of gc, decide...
[IRC.git] / Robust / src / Runtime / bamboo / multicoreruntime.h
1 #ifndef MULTICORE_RUNTIME
2 #define MULTICORE_RUNTIME
3
4 #ifndef INLINE
5 #define INLINE    inline __attribute__((always_inline))
6 #endif
7
8 #ifndef bool
9 #define bool int
10 #define true 1
11 #define false 0
12 #endif
13
14 ////////////////////////////////////////////////////////////////
15 // global variables                                          //
16 ///////////////////////////////////////////////////////////////
17
18 // record the starting time
19 unsigned long long bamboo_start_time;
20
21 // data structures for msgs
22 #define BAMBOO_OUT_BUF_LENGTH 3000
23 #define BAMBOO_MSG_BUF_LENGTH 3000
24 int msgdata[BAMBOO_MSG_BUF_LENGTH];
25 volatile int msgdataindex;
26 volatile int msgdatalast;
27 int msglength;
28 volatile bool msgdatafull;
29 int outmsgdata[BAMBOO_OUT_BUF_LENGTH];
30 int outmsgindex;
31 int outmsglast;
32 int outmsgleft;
33 volatile bool isMsgHanging;
34 //volatile bool isMsgSending;
35
36 #define MSG_INDEXINC_I() \
37   msgdataindex = (msgdataindex + 1) % (BAMBOO_MSG_BUF_LENGTH)
38
39 #define MSG_LASTINDEXINC_I() \
40   msgdatalast = (msgdatalast + 1) % (BAMBOO_MSG_BUF_LENGTH)
41
42 #define MSG_CACHE_I(n) \
43   msgdata[msgdatalast] = (n); \
44   MSG_LASTINDEXINC_I()
45
46 // NOTE: if msgdataindex == msgdatalast, it always means that the buffer if
47 //       full. In the case that the buffer is empty, should never call this
48 //       MACRO
49 #define MSG_REMAINSIZE_I(s) \
50   if(msgdataindex < msgdatalast) { \
51     (*(int*)s) = msgdatalast - msgdataindex; \
52   } else if((msgdataindex == msgdatalast) && (!msgdatafull)) { \
53     (*(int*)s) = 0; \
54   }       else { \
55     (*(int*)s) = (BAMBOO_MSG_BUF_LENGTH) -msgdataindex + msgdatalast; \
56   }
57
58 #define OUTMSG_INDEXINC() \
59   outmsgindex = (outmsgindex + 1) % (BAMBOO_OUT_BUF_LENGTH)
60
61 #define OUTMSG_LASTINDEXINC() \
62   outmsglast = (outmsglast + 1) % (BAMBOO_OUT_BUF_LENGTH); \
63   if(outmsglast == outmsgindex) { \
64     BAMBOO_EXIT(0xdd01); \
65   }
66
67 #define OUTMSG_CACHE(n) \
68   outmsgdata[outmsglast] = (n); \
69   OUTMSG_LASTINDEXINC();
70
71 #define MAX_PACKET_WORDS 5
72
73 /* Message format:
74  *      type + Msgbody
75  * type: 1 -- transfer object
76  *       2 -- transfer stall msg
77  *       3 -- lock request
78  *       4 -- lock grount
79  *       5 -- lock deny
80  *       6 -- lock release
81  *       // add for profile info
82  *       7 -- transfer profile output msg
83  *       8 -- transfer profile output finish msg
84  *       // add for alias lock strategy
85  *       9 -- redirect lock request
86  *       a -- lock grant with redirect info
87  *       b -- lock deny with redirect info
88  *       c -- lock release with redirect info
89  *       d -- status confirm request
90  *       e -- status report msg
91  *       f -- terminate
92  *      10 -- requiring for new memory
93  *      11 -- response for new memory request
94  *      12 -- GC init phase start
95  *      13 -- GC start
96  *      14 -- compact phase start
97  *      15 -- flush phase start
98  *      16 -- init phase finish
99  *      17 -- mark phase finish
100  *      18 -- compact phase finish
101  *      19 -- flush phase finish
102  *      1a -- GC finish
103  *      1b -- marked phase finish confirm request
104  *      1c -- marked phase finish confirm response
105  *      1d -- markedObj msg
106  *      1e -- start moving objs msg
107  *      1f -- ask for mapping info of a markedObj
108  *      20 -- mapping info of a markedObj
109  *      21 -- large objs info request
110  *      22 -- large objs info response
111  *      23 -- large objs mapping info
112  *
113  * ObjMsg: 1 + size of msg + obj's address + (task index + param index)+
114  * StallMsg: 2 + corenum + sendobjs + receiveobjs
115  *             (size is always 4 * sizeof(int))
116  * LockMsg: 3 + lock type + obj pointer + lock + request core
117  *            (size is always 5 * sizeof(int))
118  *          4/5/6 + lock type + obj pointer + lock
119  *            (size is always 4 * sizeof(int))
120  *          9 + lock type + obj pointer +  redirect lock + root request core
121  *            + request core
122  *            (size is always 6 * sizeof(int))
123  *          a/b + lock type + obj pointer + redirect lock
124  *              (size is always 4 * sizeof(int))
125  *          c + lock type + lock + redirect lock
126  *            (size is always 4 * sizeof(int))
127  *          lock type: 0 -- read; 1 -- write
128  * ProfileMsg: 7 + totalexetime
129  *               (size is always 2 * sizeof(int))
130  *             8 + corenum
131  *               (size is always 2 * sizeof(int))
132  * StatusMsg: d (size is always 1 * sizeof(int))
133  *            e + status + corenum + sendobjs + receiveobjs
134  *              (size is always 5 * sizeof(int))
135  *            status: 0 -- stall; 1 -- busy
136  * TerminateMsg: f (size is always 1 * sizeof(int)
137  * MemoryMsg: 10 + size + corenum
138  *              (size is always 3 * sizeof(int))
139  *           11 + base_va + size
140  *              (size is always 3 * sizeof(int))
141  * GCMsg: 12/13 (size is always 1 * sizeof(int))
142  *        14 + size of msg + (num of objs to move + (start address
143  *           + end address + dst core + start dst)+)?
144  *           + (num of incoming objs + (start dst + orig core)+)?
145  *           + (num of large obj lists + (start address + lenght
146  *           + start dst)+)?
147  *        15 (size is always 1 * sizeof(int))
148  *        16 + corenum
149  *           (size is always 2 * sizeof(int))
150  *        17 + corenum + gcsendobjs + gcreceiveobjs
151  *           (size if always 4 * sizeof(int))
152  *        18 + corenum + fulfilled blocks num + (finish compact(1) + current
153  *           heap top)/(need mem(0) + mem need)
154  *           size is always 5 * sizeof(int))
155  *        19 + corenum
156  *              (size is always 2 * sizeof(int))
157  *        1a (size is always 1 * sizeof(int))
158  *        1b (size if always 1 * sizeof(int))
159  *        1c + size of msg + corenum + gcsendobjs + gcreceiveobjs
160  *           (size is always 5 * sizeof(int))
161  *        1d + obj's address + request core
162  *           (size is always 3 * sizeof(int))
163  *        1e + corenum + start addr + end addr
164  *           (size if always 4 * sizeof(int))
165  *        1f + obj's address + corenum
166  *           (size is always 3 * sizeof(int))
167  *        20 + obj's address + dst address
168  *           (size if always 3 * sizeof(int))
169  *        21 (size is always 1 * sizeof(int))
170  *        22 + size of msg + corenum + current heap size
171  *           + (num of large obj lists + (start address + length)+)?
172  *        23 + orig large obj ptr + new large obj ptr
173  *            (size is always 3 * sizeof(int))
174  */
175 typedef enum {
176   MSGSTART = 0xD0,       // 0xD0
177   TRANSOBJ,              // 0xD1
178   TRANSTALL,             // 0xD2
179   LOCKREQUEST,           // 0xD3
180   LOCKGROUNT,            // 0xD4
181   LOCKDENY,              // 0xD5
182   LOCKRELEASE,           // 0xD6
183   PROFILEOUTPUT,         // 0xD7
184   PROFILEFINISH,         // 0xD8
185   REDIRECTLOCK,          // 0xD9
186   REDIRECTGROUNT,        // 0xDa
187   REDIRECTDENY,          // 0xDb
188   REDIRECTRELEASE,       // 0xDc
189   STATUSCONFIRM,         // 0xDd
190   STATUSREPORT,          // 0xDe
191   TERMINATE,             // 0xDf
192   MEMREQUEST,            // 0xE0
193   MEMRESPONSE,           // 0xE1
194 #ifdef MULTICORE_GC
195   GCSTARTPRE,            // 0xE2
196   GCSTARTINIT,           // 0xE3
197   GCSTART,               // 0xE4
198   GCSTARTCOMPACT,        // 0xE5
199   GCSTARTMAPINFO,        // 0xE6
200   GCSTARTFLUSH,          // 0xE7
201   GCFINISHPRE,           // 0xE8
202   GCFINISHINIT,          // 0xE9
203   GCFINISHMARK,          // 0xEa
204   GCFINISHCOMPACT,       // 0xEb
205   GCFINISHMAPINFO,       // 0xEc
206   GCFINISHFLUSH,         // 0xEd
207   GCFINISH,              // 0xEe
208   GCMARKCONFIRM,         // 0xEf
209   GCMARKREPORT,          // 0xF0
210   GCMARKEDOBJ,           // 0xF1
211   GCMOVESTART,           // 0xF2
212   GCMAPREQUEST,          // 0xF3
213   GCMAPINFO,             // 0xF4
214   GCMAPTBL,              // 0xF5
215   GCLOBJREQUEST,         // 0xF6
216   GCLOBJINFO,            // 0xF7
217   GCLOBJMAPPING,         // 0xF8
218 #ifdef GC_PROFILE
219   GCPROFILES,            // 0xF9
220 #endif
221 #ifdef GC_CACHE_ADAPT
222   GCSTARTPOSTINIT,       // 0xFa
223   GCSTARTPREF,           // 0xFb
224   GCFINISHPOSTINIT,      // 0xFc
225   GCFINISHPREF,          // 0xFd
226 #endif // GC_CACHE_ADAPT
227 #endif
228   MSGEND
229 } MSGTYPE;
230
231 /////////////////////////////////////////////////////////////////////////////////
232 // NOTE: BAMBOO_TOTALCORE -- number of the available cores in the processor.
233 //                           No greater than the number of all the cores in
234 //                           the processor
235 //       NUMCORES -- number of cores chosen to deploy the application. It can
236 //                   be greater than that required to fully parallelize the
237 //                   application. The same as NUMCORES.
238 //       NUMCORESACTIVE -- number of cores that really execute the
239 //                         application. No greater than NUMCORES
240 //       NUMCORES4GC -- number of cores for gc. No greater than NUMCORES.
241 //                      NOTE: currently only support ontinuous cores as gc
242 //                            cores, i.e. 0~NUMCORES4GC-1
243 ////////////////////////////////////////////////////////////////////////////////
244 // data structures of status for termination
245 // only check working cores
246 volatile int corestatus[NUMCORESACTIVE]; // records status of each core
247                                          // 1: running tasks
248                                          // 0: stall
249 volatile int numsendobjs[NUMCORESACTIVE]; // records how many objects a core
250                                           // has sent out
251 volatile int numreceiveobjs[NUMCORESACTIVE]; // records how many objects a
252                                              // core has received
253 volatile int numconfirm;
254 volatile bool waitconfirm;
255 bool busystatus;
256 int self_numsendobjs;
257 int self_numreceiveobjs;
258
259 // get rid of lock msgs for GC version
260 #ifndef MULTICORE_GC
261 // data structures for locking
262 struct RuntimeHash locktable;
263 static struct RuntimeHash* locktbl = &locktable;
264 struct RuntimeHash * lockRedirectTbl;
265 struct RuntimeHash * objRedirectLockTbl;
266 #endif
267 struct LockValue {
268   int redirectlock;
269   int value;
270 };
271 int lockobj;
272 int lock2require;
273 int lockresult;
274 bool lockflag;
275
276 // data structures for waiting objs
277 struct Queue objqueue;
278 struct Queue * totransobjqueue; // queue to hold objs to be transferred
279                                 // should be cleared whenever enter a task
280
281 // data structures for shared memory allocation
282 #ifdef TILERA_BME
283 #define BAMBOO_BASE_VA 0xd000000
284 #elif defined TILERA_ZLINUX
285 #ifdef MULTICORE_GC
286 #define BAMBOO_BASE_VA 0xd000000
287 #endif // MULTICORE_GC
288 #endif // TILERA_BME
289
290 #ifdef BAMBOO_MEMPROF
291 #define GC_BAMBOO_NUMCORES 56
292 #else
293 #define GC_BAMBOO_NUMCORES 62
294 #endif
295
296 #ifdef GC_DEBUG
297 #include "structdefs.h"
298 #define BAMBOO_NUM_PAGES (NUMCORES4GC*(2+1)+3)
299 #define BAMBOO_PAGE_SIZE (64 * 64)
300 #define BAMBOO_SMEM_SIZE (64 * 64) // (BAMBOO_PAGE_SIZE)
301 #define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_PAGE_SIZE) *(BAMBOO_NUM_PAGES))
302 #else
303 #ifdef GC_LARGESHAREDHEAP
304 #define BAMBOO_NUM_PAGES ((GC_BAMBOO_NUMCORES)*(2+2))
305 #elif defined GC_LARGESHAREDHEAP2
306 #define BAMBOO_NUM_PAGES ((GC_BAMBOO_NUMCORES)*(2+2))
307 #else
308 #define BAMBOO_NUM_PAGES ((GC_BAMBOO_NUMCORES)*(2+3)) //(15 * 1024) //(64 * 4 * 0.75) //(1024 * 1024 * 3.5)  3G
309 #endif
310 #ifdef GC_LARGEPAGESIZE
311 #define BAMBOO_PAGE_SIZE (4 * 1024 * 1024)  // (4096)
312 #define BAMBOO_SMEM_SIZE (4 * 1024 * 1024)
313 #elif defined GC_SMALLPAGESIZE
314 #define BAMBOO_PAGE_SIZE (256 * 1024)  // (4096)
315 #define BAMBOO_SMEM_SIZE (256 * 1024)
316 #elif defined GC_SMALLPAGESIZE2
317 #define BAMBOO_PAGE_SIZE (64 * 1024)  // (4096)
318 #define BAMBOO_SMEM_SIZE (64 * 1024)
319 #else
320 #define BAMBOO_PAGE_SIZE (1024 * 1024)  // (4096)
321 #define BAMBOO_SMEM_SIZE (1024 * 1024)
322 #endif // GC_LARGEPAGESIZE
323 #define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_PAGE_SIZE) * (BAMBOO_NUM_PAGES)) //(1024 * 1024 * 240)
324 //((unsigned long long int)(3.0 * 1024 * 1024 * 1024)) // 3G 
325 #endif // GC_DEBUG
326
327 #ifdef MULTICORE_GC
328 volatile bool gc_localheap_s;
329 #endif
330
331 #ifdef MULTICORE_GC
332 #include "multicoregarbage.h"
333
334 typedef enum {
335   SMEMLOCAL = 0x0,// 0x0, using local mem only
336   SMEMFIXED,      // 0x1, use local mem in lower address space(1 block only)
337                   //      and global mem in higher address space
338   SMEMMIXED,      // 0x2, like FIXED mode but use a threshold to control
339   SMEMGLOBAL,     // 0x3, using global mem only
340   SMEMEND
341 } SMEMSTRATEGY;
342
343 SMEMSTRATEGY bamboo_smem_mode; //-DSMEML: LOCAL; -DSMEMF: FIXED;
344                                //-DSMEMM: MIXED; -DSMEMG: GLOBAL;
345
346 struct freeMemItem {
347   INTPTR ptr;
348   int size;
349   int startblock;
350   int endblock;
351   struct freeMemItem * next;
352 };
353
354 struct freeMemList {
355   struct freeMemItem * head;
356   struct freeMemItem * backuplist; // hold removed freeMemItem for reuse;
357                                    // only maintain 1 freemMemItem
358 };
359
360 // table recording the number of allocated bytes on each block
361 // Note: this table resides on the bottom of the shared heap for all cores
362 //       to access
363 volatile int * bamboo_smemtbl;
364 volatile int bamboo_free_block;
365 //bool bamboo_smem_flushed;
366 //struct freeMemList * bamboo_free_mem_list;
367 int bamboo_reserved_smem; // reserved blocks on the top of the shared heap
368                           // e.g. 20% of the heap and should not be allocated
369                           // otherwise gc is invoked
370 volatile INTPTR bamboo_smem_zero_top;
371 #define BAMBOO_SMEM_ZERO_UNIT_SIZE (4 * 1024) // 4KB
372
373 #ifdef GC_CACHE_ADAPT
374 typedef union
375 {
376   unsigned int word;
377   struct
378   {
379     // policy type
380     unsigned int cache_mode   : 2;
381         // Reserved.
382     unsigned int __reserved_0 : 6;
383         // Location Override Target Y
384     unsigned int lotar_y      : 4;
385     // Reserved.
386     unsigned int __reserved_1 : 4;
387     // Location Override Target X
388     unsigned int lotar_x      : 4;
389     // Reserved.
390     unsigned int __reserved_2 : 12;
391   };
392 } bamboo_cache_policy_t;
393 #endif // GC_CACHE_ADAPT
394 #else
395 //volatile mspace bamboo_free_msp;
396 INTPTR bamboo_free_smemp;
397 int bamboo_free_smem_size;
398 #endif
399 volatile bool smemflag;
400 volatile INTPTR bamboo_cur_msp;
401 volatile int bamboo_smem_size;
402
403 // for test TODO
404 int total_num_t6;
405
406 // data structures for profile mode
407 #ifdef PROFILE
408
409 #define TASKINFOLENGTH 3000 // 0
410 #ifdef PROFILE_INTERRUPT
411 #define INTERRUPTINFOLENGTH 50 //0
412 #endif // PROFILE_INTERRUPT
413
414 bool stall;
415 //bool isInterrupt;
416 int totalexetime;
417 //unsigned long long interrupttime;
418
419 typedef struct task_info {
420   char* taskName;
421   unsigned long long startTime;
422   unsigned long long endTime;
423   unsigned long long exitIndex;
424   struct Queue * newObjs;
425 } TaskInfo;
426
427 TaskInfo * taskInfoArray[TASKINFOLENGTH];
428 int taskInfoIndex;
429 bool taskInfoOverflow;
430 #ifdef PROFILE_INTERRUPT
431 typedef struct interrupt_info {
432   unsigned long long startTime;
433   unsigned long long endTime;
434 } InterruptInfo;
435
436 InterruptInfo * interruptInfoArray[INTERRUPTINFOLENGTH];
437 int interruptInfoIndex;
438 bool interruptInfoOverflow;
439 #endif // PROFILE_INTERUPT
440 volatile int profilestatus[NUMCORESACTIVE]; // records status of each core
441                                             // 1: running tasks
442                                             // 0: stall
443 #endif // #ifdef PROFILE
444
445 #ifndef INTERRUPT
446 bool reside;
447 #endif
448 /////////////////////////////////////////////////////////////
449
450 ////////////////////////////////////////////////////////////
451 // these are functions should be implemented in           //
452 // multicore runtime for any multicore processors         //
453 ////////////////////////////////////////////////////////////
454 #ifdef TASK
455 #ifdef MULTICORE
456 INLINE void initialization(void);
457 INLINE void initCommunication(void);
458 INLINE void fakeExecution(void);
459 INLINE void terminate(void);
460 INLINE void initlock(struct ___Object___ * v);
461 #ifdef BAMBOO_MEMPROF
462 INLINE void terminatememprof(void);
463 #endif
464
465 // lock related functions
466 bool getreadlock(void* ptr);
467 void releasereadlock(void* ptr);
468 bool getwritelock(void* ptr);
469 void releasewritelock(void* ptr);
470 bool getwritelock_I(void* ptr);
471 void releasewritelock_I(void * ptr);
472 #ifndef MULTICORE_GC
473 void releasewritelock_r(void * lock, void * redirectlock);
474 #endif
475 /* this function is to process lock requests.
476  * can only be invoked in receiveObject() */
477 // if return -1: the lock request is redirected
478 //            0: the lock request is approved
479 //            1: the lock request is denied
480 INLINE int processlockrequest(int locktype,
481                               int lock,
482                               int obj,
483                               int requestcore,
484                               int rootrequestcore,
485                               bool cache);
486 INLINE void processlockrelease(int locktype,
487                                int lock,
488                                int redirectlock,
489                                bool redirect);
490
491 // msg related functions
492 INLINE void send_hanging_msg(bool isInterrupt);
493 INLINE void send_msg_1(int targetcore,
494                        unsigned long n0,
495                                            bool isInterrupt);
496 INLINE void send_msg_2(int targetcore,
497                        unsigned long n0,
498                        unsigned long n1,
499                                            bool isInterrupt);
500 INLINE void send_msg_3(int targetcore,
501                        unsigned long n0,
502                        unsigned long n1,
503                        unsigned long n2,
504                                            bool isInterrupt);
505 INLINE void send_msg_4(int targetcore,
506                        unsigned long n0,
507                        unsigned long n1,
508                        unsigned long n2,
509                        unsigned long n3,
510                                            bool isInterrupt);
511 INLINE void send_msg_5(int targetcore,
512                        unsigned long n0,
513                        unsigned long n1,
514                        unsigned long n2,
515                        unsigned long n3,
516                        unsigned long n4,
517                                            bool isInterrupt);
518 INLINE void send_msg_6(int targetcore,
519                        unsigned long n0,
520                        unsigned long n1,
521                        unsigned long n2,
522                        unsigned long n3,
523                        unsigned long n4,
524                        unsigned long n5,
525                                            bool isInterrupt);
526 INLINE void cache_msg_1(int targetcore,
527                         unsigned long n0);
528 INLINE void cache_msg_2(int targetcore,
529                         unsigned long n0,
530                         unsigned long n1);
531 INLINE void cache_msg_3(int targetcore,
532                         unsigned long n0,
533                         unsigned long n1,
534                         unsigned long n2);
535 INLINE void cache_msg_4(int targetcore,
536                         unsigned long n0,
537                         unsigned long n1,
538                         unsigned long n2,
539                         unsigned long n3);
540 INLINE void cache_msg_5(int targetcore,
541                         unsigned long n0,
542                         unsigned long n1,
543                         unsigned long n2,
544                         unsigned long n3,
545                         unsigned long n4);
546 INLINE void cache_msg_6(int targetcore,
547                         unsigned long n0,
548                         unsigned long n1,
549                         unsigned long n2,
550                         unsigned long n3,
551                         unsigned long n4,
552                         unsigned long n5);
553 INLINE void transferObject(struct transObjInfo * transObj);
554 INLINE int receiveMsg(uint32_t send_port_pending);
555
556 #ifdef MULTICORE_GC
557 INLINE void transferMarkResults();
558 #endif
559
560 #ifdef PROFILE
561 INLINE void profileTaskStart(char * taskname);
562 INLINE void profileTaskEnd(void);
563 void outputProfileData();
564 #endif  // #ifdef PROFILE
565 ///////////////////////////////////////////////////////////
566
567 /////////////////////////////////////////////////////////////////////////////
568 // For each version of BAMBOO runtime, there should be a header file named //
569 // runtim_arch.h defining following MARCOS:                                //
570 // BAMBOO_NUM_OF_CORE: the # of current residing core                      //
571 // BAMBOO_GET_NUM_OF_CORE(): compute the # of current residing core        //
572 // BAMBOO_COORDS(c, x, y): convert the cpu # to coords (*x, *y)            //
573 // BAMBOO_DEBUGPRINT(x): print out integer x                               //
574 // BAMBOO_DEBUGPRINT_REG(x): print out value of variable x                 //
575 // BAMBOO_EXIT_APP(x): exit the whole application                          //
576 // BAMBOO_EXIT(x): error exit routine with error #                         //
577 // BAMBOO_DIE(x): error exit routine with error msg                        //
578 // BAMBOO_GET_EXE_TIME(): rountine to get current clock cycle number       //
579 // BAMBOO_MSG_AVAIL(): checking if there are msgs coming in                //
580 // BAMBOO_GCMSG_AVAIL(): checking if there are gcmsgs coming in            //
581 // BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(): change to runtime mode from    //
582 //                                          client mode                    //
583 // BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(): change to client mode from     //
584 //                                          runtime mode                   //
585 // BAMBOO_ENTER_SEND_MODE_FROM_CLIENT(): change to send mode from          //
586 //                                       client mode                       //
587 // BAMBOO_ENTER_CLIENT_MODE_FROM_SEND(): change to client mode from        //
588 //                                       send mode                         //
589 // BAMBOO_ENTER_RUNTIME_MODE_FROM_SEND(): change to runtime mode from      //
590 //                                        send mode                        //
591 // BAMBOO_ENTER_SEND_MODE_FROM_RUNTIME(): change to send mode from         //
592 //                                        runtime mode                     //
593 // BAMBOO_WAITING_FOR_LOCK(): routine executed while waiting for lock      //
594 //                            request response                             //
595 // BAMBOO_LOCAL_MEM_CALLOC(x, y): allocate an array of x elements each of  //
596 //                                whose size in bytes is y on local memory //
597 //                                which is given by the hypervisor         //
598 // BAMBOO_LOCAL_MEM_FREE(x): free space with ptr x on local memory         //
599 // BAMBOO_LOCAL_MEM_CLOSE(): close the local heap                          //
600 // BAMBOO_LOCAL_MEM_CALLOC_S(x, y): allocate an array of x elements each of//
601 //                                  whose size in bytes is y on local      //
602 //                                  memory which is not from the hypervisor//
603 //                                  but is allocated from the free memory  //
604 // BAMBOO_LOCAL_MEM_FREE_S(x): free space with ptr x on self-allocated     //
605 //                             local memory                                //
606 // BAMBOO_LOCAL_MEM_CLOSE_S(): close the self-allocated local heap        //
607 // BAMBOO_SHARE_MEM_CALLOC_I(x, y): allocate an array of x elements each of//
608 //                                whose size in bytes is y on shared memory//
609 // BAMBOO_SHARE_MEM_CLOSE(): close the shared heap                         //
610 // BAMBOO_CACHE_LINE_SIZE: the cache line size                             //
611 // BAMBOO_CACHE_LINE_MASK: mask for a cache line                           //
612 // BAMBOO_CACHE_FLUSH_RANGE(x, y): flush cache lines started at x with     //
613 //                                 length y                                //
614 // BAMBOO_CACHE_FLUSH_ALL(): flush the whole cache of a core if necessary  //
615 // BAMBOO_MEMSET_WH(x, y, z): memset the specified region of memory (start //
616 //                            address x, size z) to value y with write     //
617 //                            hint, the processor will not fetch the       //
618 //                            current content of the memory and directly   //
619 //                            write                                        //
620 // BAMBOO_CLEAN_DTLB(): zero-out all the dtlb entries                      //
621 // BAMBOO_CACHE_FLUSH_L2(): Flush the contents of this tile's L2 back to   //
622 //                          main memory                                    //
623 // BAMBOO_CACHE_FLUSH_RANGE_NO_FENCE(x, y): flush a range of mem without   //
624 //                                          mem fence                      //
625 // BAMBOO_CACHE_MEM_FENCE_INCOHERENT(): fence to guarantee visibility of   //
626 //                                      stores to incoherent memory        //
627 /////////////////////////////////////////////////////////////////////////////
628
629 #endif  // #ifdef MULTICORE
630 #endif  // #ifdef TASK
631 #endif  // #ifndef MULTICORE_RUNTIME