4 #include "multicoreruntime.h"
5 #include "runtime_arch.h"
6 #include "GenericHashtable.h"
7 #include "structdefs.h"
8 #include "methodheaders.h"
16 #define INLINE inline __attribute__((always_inline))
17 #endif // #ifndef INLINE
19 extern int classsize[];
20 extern int typearray[];
21 extern int typearray2[];
22 extern int* supertypes[];
25 extern struct genhashtable * activetasks;
29 extern unsigned int gcmem_mixed_threshold;
30 extern unsigned int gcmem_mixed_usedmem;
32 #endif // MULTICORE_GC
39 int instanceofif(int otype, int type) {
46 int num = supertypes[otype][0];
47 for(int i = 1; i < num + 1; i++) {
48 int t = supertypes[otype][i];
49 if(instanceofif(t, type) == 1) {
56 int instanceof(struct ___Object___ *ptr, int type) {
61 if(instanceofif(i, type) == 1) {
68 i=typearray2[i-NUMCLASSES];
74 void initializeexithandler() {
77 /* This function inject failures */
79 void injectinstructionfailure() {
80 // not supported in MULTICORE version
84 #ifdef D___Double______nativeparsedouble____L___String___
85 double CALL01(___Double______nativeparsedouble____L___String___,struct ___String___ * ___str___) {
86 int length=VAR(___str___)->___count___;
87 int maxlength=(length>60) ? 60 : length;
88 char str[maxlength+1];
89 struct ArrayObject * chararray=VAR(___str___)->___value___;
91 int offset=VAR(___str___)->___offset___;
92 for(i=0; i<maxlength; i++) {
93 str[i]=((short *)(((char *)&chararray->___length___)+sizeof(int)))[i+offset];
96 double d=0.0; //atof(str); TODO Unimplemented nativeparsedoulbe
101 #ifdef D___Double______nativeparsedouble_____AR_B_I_I
102 double CALL23(___Double______nativeparsedouble_____AR_B_I_I, int start, int length,int start,int length,struct ArrayObject * ___str___) {
103 int maxlength=(length>60)?60:length;
104 char str[maxlength+1];
105 struct ArrayObject * bytearray=VAR(___str___);
107 for(i=0; i<maxlength; i++) {
108 str[i]=(((char *)&bytearray->___length___)+sizeof(int))[i+start];
111 double d=0.0; //atof(str); TODO Unimplemented nativeparsedouble
127 #ifdef D___Double______doubleToRawLongBits____D
128 long long CALL11(___Double______doubleToRawLongBits____D, double ___value___, double ___value___) {
132 #if defined(__IEEE_BYTES_LITTLE_ENDIAN)
133 /* On little endian ARM processors when using FPA, word order of
134 doubles is still big endian. So take that into account here. When
135 using VFP, word order of doubles follows byte order. */
137 #define SWAP_DOUBLE(a) (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
139 val.j = SWAP_DOUBLE(val.j);
146 #ifdef D___Double______longBitsToDouble____J
147 double CALL11(___Double______longBitsToDouble____J, long long ___bits___, long long ___bits___) {
151 #if defined(__IEEE_BYTES_LITTLE_ENDIAN)
153 #define SWAP_DOUBLE(a) (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
155 val.j = SWAP_DOUBLE(val.j);
162 #ifdef D___String______convertdoubletochar____D__AR_C
163 int CALL12(___String______convertdoubletochar____D__AR_C, double ___val___, double ___val___, struct ArrayObject * ___chararray___) {
164 int length=VAR(___chararray___)->___length___;
167 int num=snprintf(str, length, "%f",___val___);
170 for(i=0; i<length; i++) {
171 ((short *)(((char *)&VAR(___chararray___)->___length___)+sizeof(int)))[i]=(short)str[i];
176 int CALL12(___String______convertdoubletochar____D__AR_C, double ___val___, double ___val___, struct ArrayObject ___chararray___) {
181 #ifdef D___System______deepArrayCopy____L___Object____L___Object___
182 void deepArrayCopy(struct ___Object___ * dst, struct ___Object___ * src) {
183 int dsttype=((int *)dst)[0];
184 int srctype=((int *)src)[0];
185 if (dsttype<NUMCLASSES||srctype<NUMCLASSES||srctype!=dsttype)
187 struct ArrayObject *aodst=(struct ArrayObject *)dst;
188 struct ArrayObject *aosrc=(struct ArrayObject *)src;
189 int dstlength=aodst->___length___;
190 int srclength=aosrc->___length___;
191 if (dstlength!=srclength)
193 unsigned INTPTR *pointer=pointerarray[srctype];
195 int elementsize=classsize[srctype];
196 int size=srclength*elementsize;
198 memcpy(((char *)&aodst->___length___)+sizeof(int) , ((char *)&aosrc->___length___)+sizeof(int), size);
202 for(i=0;i<srclength;i++) {
203 struct ___Object___ * ptr=((struct ___Object___**)(((char*) &aosrc->___length___)+sizeof(int)))[i];
204 int ptrtype=((int *)ptr)[0];
205 if (ptrtype>=NUMCLASSES) {
206 struct ___Object___ * dstptr=((struct ___Object___**)(((char*) &aodst->___length___)+sizeof(int)))[i];
207 deepArrayCopy(dstptr,ptr);
210 ((struct ___Object___ **)(((char*) &aodst->___length___)+sizeof(int)))[i]=ptr;
216 void CALL02(___System______deepArrayCopy____L___Object____L___Object___, struct ___Object___ * ___dst___, struct ___Object___ * ___src___) {
217 deepArrayCopy(VAR(___dst___), VAR(___src___));
221 #ifdef D___System______arraycopy____L___Object____I_L___Object____I_I
222 void arraycopy(struct ___Object___ *src, int srcPos, struct ___Object___ *dst, int destPos, int length) {
223 int dsttype=((int *)dst)[0];
224 int srctype=((int *)src)[0];
226 //not an array or type mismatch
227 if (dsttype<NUMCLASSES||srctype<NUMCLASSES/*||srctype!=dsttype*/)
230 struct ArrayObject *aodst=(struct ArrayObject *)dst;
231 struct ArrayObject *aosrc=(struct ArrayObject *)src;
232 int dstlength=aodst->___length___;
233 int srclength=aosrc->___length___;
237 if (srcPos+length>srclength)
239 if (destPos+length>dstlength)
242 unsigned INTPTR *pointer=pointerarray[srctype];
244 int elementsize=classsize[srctype];
245 int size=length*elementsize;
247 memcpy(((char *)&aodst->___length___)+sizeof(int)+destPos*elementsize, ((char *)&aosrc->___length___)+sizeof(int)+srcPos*elementsize, size);
251 for(i=0;i<length;i++) {
252 struct ___Object___ * ptr=((struct ___Object___**)(((char*) &aosrc->___length___)+sizeof(int)))[i+srcPos];
253 int ptrtype=((int *)ptr)[0];
255 ((struct ___Object___ **)(((char*) &aodst->___length___)+sizeof(int)))[i+destPos]=ptr;
260 void CALL35(___System______arraycopy____L___Object____I_L___Object____I_I, int ___srcPos___, int ___destPos___, int ___length___, struct ___Object___ * ___src___, int ___srcPos___, struct ___Object___ * ___dst___, int ___destPos___, int ___length___) {
261 arraycopy(VAR(___src___), ___srcPos___, VAR(___dst___), ___destPos___, ___length___);
265 void CALL11(___System______exit____I,int ___status___, int ___status___) {
266 BAMBOO_EXIT(___status___);
269 #ifdef D___Vector______removeElement_____AR_L___Object____I_I
270 void CALL23(___Vector______removeElement_____AR_L___Object____I_I, int ___index___, int ___size___, struct ArrayObject * ___array___, int ___index___, int ___size___) {
271 char* offset=((char *)(&VAR(___array___)->___length___))+sizeof(unsigned int)+sizeof(void *)*___index___;
272 memmove(offset, offset+sizeof(void *),(___size___-___index___-1)*sizeof(void *));
276 void CALL11(___System______printI____I,int ___status___, int ___status___) {
277 BAMBOO_DEBUGPRINT(0x1111);
278 BAMBOO_DEBUGPRINT_REG(___status___);
281 long long CALL00(___System______currentTimeMillis____) {
282 // not supported in MULTICORE version
286 void CALL01(___System______printString____L___String___,struct ___String___ * ___s___) {
289 struct ArrayObject * chararray=VAR(___s___)->___value___;
291 int offset=VAR(___s___)->___offset___;
293 for(i=0; i<VAR(___s___)->___count___; i++) {
295 ((short *)(((char *)&chararray->___length___)+sizeof(int)))[i+offset];
302 /* Object allocation function */
305 void * allocate_new(void * ptr, int type) {
306 struct ___Object___ * v=
307 (struct ___Object___*)FREEMALLOC((struct garbagelist*) ptr,classsize[type]);
316 extern unsigned int gc_num_obj;
322 /* Array allocation function */
324 struct ArrayObject * allocate_newarray(void * ptr, int type, int length) {
325 struct ArrayObject * v=(struct ArrayObject *)
326 FREEMALLOC((struct garbagelist*)ptr,
327 sizeof(struct ArrayObject)+length*classsize[type]);
336 v->___length___=length;
339 extern unsigned int gc_num_obj;
346 void * allocate_new(int type) {
347 struct ___Object___ * v=FREEMALLOC(classsize[type]);
357 /* Array allocation function */
359 struct ArrayObject * allocate_newarray(int type, int length) {
360 struct ArrayObject * v=
361 FREEMALLOC(sizeof(struct ArrayObject)+length*classsize[type]);
367 v->___length___=length;
374 /* Converts C character arrays into Java strings */
376 struct ___String___ * NewString(void * ptr, const char *str,int length) {
378 struct ___String___ * NewString(const char *str,int length) {
382 struct ArrayObject * chararray=
383 allocate_newarray((struct garbagelist *)ptr, CHARARRAYTYPE, length);
384 int ptrarray[]={1, (int) ptr, (int) chararray};
385 struct ___String___ * strobj=
386 allocate_new((struct garbagelist *) &ptrarray, STRINGTYPE);
387 chararray=(struct ArrayObject *) ptrarray[2];
389 struct ArrayObject * chararray=allocate_newarray(CHARARRAYTYPE, length);
390 struct ___String___ * strobj=allocate_new(STRINGTYPE);
392 strobj->___value___=chararray;
393 strobj->___count___=length;
394 strobj->___offset___=0;
396 for(i=0; i<length; i++) {
397 ((short*)(((char*)&chararray->___length___)+sizeof(int)))[i]=(short)str[i];
402 /* Generated code calls this if we fail a bounds check */
404 void failedboundschk() {
406 printf("Array out of bounds\n");
416 printf("Array out of bounds\n");
417 longjmp(error_handler,2);
424 /* Abort task call */
428 printf("Aborting\n");
429 longjmp(error_handler,4);
432 printf("Aborting\n");
437 INLINE void initruntimedata() {
439 // initialize the arrays
440 if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
441 // startup core to initialize corestatus[]
442 for(i = 0; i < NUMCORESACTIVE; ++i) {
445 numreceiveobjs[i] = 0;
448 gcnumsendobjs[0][i] = gcnumsendobjs[1][i] = 0;
449 gcnumreceiveobjs[0][i] = gcnumreceiveobjs[1][i] = 0;
451 } // for(i = 0; i < NUMCORESACTIVE; ++i)
453 for(i = 0; i < NUMCORES4GC; ++i) {
455 gcrequiredmems[i] = 0;
457 gcfilledblocks[i] = 0;
458 } // for(i = 0; i < NUMCORES4GC; ++i)
461 gc_infoOverflow = false;
462 gc_num_livespace = 0;
463 gc_num_freespace = 0;
471 self_numsendobjs = 0;
472 self_numreceiveobjs = 0;
474 for(i = 0; i < BAMBOO_MSG_BUF_LENGTH; ++i) {
479 msglength = BAMBOO_MSG_BUF_LENGTH;
481 for(i = 0; i < BAMBOO_OUT_BUF_LENGTH; ++i) {
487 isMsgHanging = false;
490 bamboo_cur_msp = NULL;
491 bamboo_smem_size = 0;
494 bamboo_smem_zero_top = NULL;
496 gcprocessing = false;
497 gcphase = FINISHPHASE;
500 gcself_numsendobjs = 0;
501 gcself_numreceiveobjs = 0;
502 gcmarkedptrbound = 0;
503 #ifdef LOCALHASHTBL_TEST
504 gcpointertbl = allocateRuntimeHash_I(20);
506 gcpointertbl = mgchashCreate_I(2000, 0.75);
508 gcforwardobjtbl = allocateMGCHash_I(20, 3);
519 if(BAMBOO_NUM_OF_CORE < NUMCORES4GC) {
520 int t_size = ((BAMBOO_RMSP_SIZE)-sizeof(mgcsharedhashtbl_t)*2
521 -128*sizeof(size_t))/sizeof(mgcsharedhashlistnode_t)-2;
523 unsigned int tmp_k = 1 << (sizeof(int)*8 -1);
524 while(((t_size & tmp_k) == 0) && (kk < sizeof(int)*8)) {
525 t_size = t_size << 1;
528 t_size = tmp_k >> kk;
529 gcsharedptbl = mgcsharedhashCreate_I(t_size,0.30);
533 BAMBOO_MEMSET_WH(gcrpointertbls, 0,
534 sizeof(mgcsharedhashtbl_t *)*NUMCORES4GC);
536 gcmem_mixed_threshold = (unsigned int)((BAMBOO_SHARED_MEM_SIZE
537 -bamboo_reserved_smem*BAMBOO_SMEM_SIZE)*0.8);
538 gcmem_mixed_usedmem = 0;
543 gc_num_forwardobj = 0;
544 gc_num_profiles = NUMCORESACTIVE - 1;
547 gc_num_flush_dtlb = 0;
549 gc_localheap_s = false;
550 #ifdef GC_CACHE_ADAPT
551 gccachestage = false;
552 #endif // GC_CACHE_ADAPT
553 #endif // MULTICORE_GC
560 bamboo_current_thread = NULL;
568 INLINE void disruntimedata() {
570 #ifdef LOCALHASHTBL_TEST
571 freeRuntimeHash(gcpointertbl);
573 mgchashDelete(gcpointertbl);
575 freeMGCHash(gcforwardobjtbl);
576 #endif // MULTICORE_GC
580 BAMBOO_LOCAL_MEM_CLOSE();
581 BAMBOO_SHARE_MEM_CLOSE();
584 INLINE void checkCoreStatus() {
585 bool allStall = false;
589 (waitconfirm && (numconfirm == 0))) {
590 BAMBOO_DEBUGPRINT(0xee04);
591 BAMBOO_DEBUGPRINT_REG(waitconfirm);
592 BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
593 BAMBOO_DEBUGPRINT(0xf001);
594 corestatus[BAMBOO_NUM_OF_CORE] = 0;
595 numsendobjs[BAMBOO_NUM_OF_CORE] = self_numsendobjs;
596 numreceiveobjs[BAMBOO_NUM_OF_CORE] = self_numreceiveobjs;
597 // check the status of all cores
599 BAMBOO_DEBUGPRINT_REG(NUMCORESACTIVE);
600 for(i = 0; i < NUMCORESACTIVE; ++i) {
601 BAMBOO_DEBUGPRINT(0xe000 + corestatus[i]);
602 if(corestatus[i] != 0) {
606 } // for(i = 0; i < NUMCORESACTIVE; ++i)
608 // check if the sum of send objs and receive obj are the same
609 // yes->check if the info is the latest; no->go on executing
611 for(i = 0; i < NUMCORESACTIVE; ++i) {
612 sumsendobj += numsendobjs[i];
613 BAMBOO_DEBUGPRINT(0xf000 + numsendobjs[i]);
614 } // for(i = 0; i < NUMCORESACTIVE; ++i)
615 for(i = 0; i < NUMCORESACTIVE; ++i) {
616 sumsendobj -= numreceiveobjs[i];
617 BAMBOO_DEBUGPRINT(0xf000 + numreceiveobjs[i]);
618 } // for(i = 0; i < NUMCORESACTIVE; ++i)
619 if(0 == sumsendobj) {
621 // the first time found all cores stall
622 // send out status confirm msg to all other cores
623 // reset the corestatus array too
624 BAMBOO_DEBUGPRINT(0xee05);
625 corestatus[BAMBOO_NUM_OF_CORE] = 1;
627 numconfirm = NUMCORESACTIVE - 1;
628 BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
629 for(i = 1; i < NUMCORESACTIVE; ++i) {
631 // send status confirm msg to core i
632 send_msg_1(i, STATUSCONFIRM, false);
633 } // for(i = 1; i < NUMCORESACTIVE; ++i)
636 // all the core status info are the latest
637 // terminate; for profiling mode, send request to all
638 // other cores to pour out profiling data
639 BAMBOO_DEBUGPRINT(0xee06);
642 totalexetime = BAMBOO_GET_EXE_TIME() - bamboo_start_time;
645 BAMBOO_PRINT(BAMBOO_GET_EXE_TIME() - bamboo_start_time);
646 //BAMBOO_DEBUGPRINT_REG(total_num_t6); // TODO for test
648 BAMBOO_PRINT_REG(gc_num_flush_dtlb);
650 #ifndef BAMBOO_MEMPROF
651 BAMBOO_PRINT(0xbbbbbbbb);
654 // profile mode, send msgs to other cores to request pouring
655 // out progiling data
657 BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
658 BAMBOO_DEBUGPRINT(0xf000);
659 for(i = 1; i < NUMCORESACTIVE; ++i) {
660 // send profile request msg to core i
661 send_msg_2(i, PROFILEOUTPUT, totalexetime, false);
662 } // for(i = 1; i < NUMCORESACTIVE; ++i)
664 // pour profiling data on startup core
668 BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
669 BAMBOO_DEBUGPRINT(0xf001);
670 profilestatus[BAMBOO_NUM_OF_CORE] = 0;
671 // check the status of all cores
673 BAMBOO_DEBUGPRINT_REG(NUMCORESACTIVE);
674 for(i = 0; i < NUMCORESACTIVE; ++i) {
675 BAMBOO_DEBUGPRINT(0xe000 + profilestatus[i]);
676 if(profilestatus[i] != 0) {
680 } // for(i = 0; i < NUMCORESACTIVE; ++i)
683 BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
684 BAMBOO_DEBUGPRINT(0xf000);
688 BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
694 // gc_profile mode, output gc prfiling data
696 #ifdef GC_CACHE_ADAPT
697 bamboo_mask_timer_intr(); // disable the TILE_TIMER interrupt
698 #endif // GC_CACHE_ADAPT
700 gc_outputProfileData();
701 #endif // #ifdef GC_PROFILE
702 #endif // #ifdef MULTICORE_GC
704 BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
705 terminate(); // All done.
706 } // if(!waitconfirm)
708 // still some objects on the fly on the network
709 // reset the waitconfirm and numconfirm
710 BAMBOO_DEBUGPRINT(0xee07);
713 } // if(0 == sumsendobj)
715 // not all cores are stall, keep on waiting
716 BAMBOO_DEBUGPRINT(0xee08);
720 BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
721 BAMBOO_DEBUGPRINT(0xf000);
722 } // if((!waitconfirm) ||
725 // main function for each core
726 inline void run(int argc, char** argv) {
728 bool sendStall = false;
730 bool tocontinue = false;
732 corenum = BAMBOO_GET_NUM_OF_CORE();
733 BAMBOO_DEBUGPRINT(0xeeee);
734 BAMBOO_DEBUGPRINT_REG(corenum);
735 BAMBOO_DEBUGPRINT(STARTUPCORE);
737 // initialize runtime data structures
740 // other architecture related initialization
744 #ifdef GC_CACHE_ADAPT
745 // enable the timer interrupt
746 #ifdef GC_CACHE_SAMPLING
747 bamboo_tile_timer_set_next_event(GC_TILE_TIMER_EVENT_SETTING); // TODO
748 bamboo_unmask_timer_intr();
749 bamboo_dtlb_sampling_process();
750 #endif // GC_CACHE_SAMPLING
751 #endif // GC_CACHE_ADAPT
753 initializeexithandler();
755 // main process of the execution module
756 if(BAMBOO_NUM_OF_CORE > NUMCORESACTIVE - 1) {
758 // non-executing cores, only processing communications
764 /* Create queue of active tasks */
766 genallocatehashtable((unsigned int (*)(void *)) &hashCodetpd,
767 (int (*)(void *,void *)) &comparetpd);
769 /* Process task information */
772 if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
773 /* Create startup object */
774 createstartupobject(argc, argv);
777 BAMBOO_DEBUGPRINT(0xee00);
780 if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
782 // run the initStaticAndGlobal method to initialize the static blocks and
784 initStaticAndGlobal();
786 // run the main method in the specified mainclass
787 mgc_main(argc, argv);
794 // check if need to do GC
798 #endif // MULTICORE_GC
801 // check if there are new active tasks can be executed
808 while(receiveObject() != -1) {
812 BAMBOO_DEBUGPRINT(0xee01);
814 // check if there are some pending objects,
815 // if yes, enqueue them and executetasks again
816 tocontinue = checkObjQueue();
818 tocontinue = trystartthread();
826 if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
828 BAMBOO_DEBUGPRINT(0xee03);
834 BAMBOO_DEBUGPRINT(0xee09);
839 // wait for some time
841 BAMBOO_DEBUGPRINT(0xee0a);
846 // send StallMsg to startup core
847 BAMBOO_DEBUGPRINT(0xee0b);
849 send_msg_4(STARTUPCORE, TRANSTALL, BAMBOO_NUM_OF_CORE,
850 self_numsendobjs, self_numreceiveobjs, false);
861 BAMBOO_DEBUGPRINT(0xee0c);
863 } // if(STARTUPCORE == BAMBOO_NUM_OF_CORE)
866 } // if(BAMBOO_NUM_OF_CORE > NUMCORESACTIVE - 1)
870 INLINE int checkMsgLength_I(int size) {
872 BAMBOO_DEBUGPRINT(0xcccc);
874 int type = msgdata[msgdataindex];
887 #ifdef GC_CACHE_ADAPT
889 #endif // GC_CACHE_ADAPT
890 #endif // MULTICORE_GC
904 case GCFINISHMAPINFO:
906 #ifdef GC_CACHE_ADAPT
908 #endif // GC_CACHE_ADAPT
909 #endif // MULTICORE_GC
935 case REDIRECTRELEASE:
955 case GCFINISHCOMPACT:
972 case TRANSOBJ: // nonfixed size
979 msglength = msgdata[(msgdataindex+1)&(BAMBOO_MSG_BUF_MASK)];
988 BAMBOO_DEBUGPRINT_REG(type);
989 BAMBOO_DEBUGPRINT_REG(size);
990 BAMBOO_DEBUGPRINT_REG(msgdataindex);
991 BAMBOO_DEBUGPRINT_REG(msgdatalast);
992 BAMBOO_DEBUGPRINT_REG(msgdatafull);
995 BAMBOO_DEBUGPRINT(msgdata[msgdataindex+i]);
1002 BAMBOO_DEBUGPRINT_REG(msgdata[msgdataindex]);
1003 BAMBOO_DEBUGPRINT(0xffff);
1008 INLINE void processmsg_transtall_I() {
1009 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1010 // non startup core can not receive stall msg
1012 BAMBOO_DEBUGPRINT_REG(msgdata[msgdataindex] /*[1]*/);
1014 BAMBOO_EXIT(0xe006);
1016 int num_core = msgdata[msgdataindex]; //[1]
1018 int data2 = msgdata[msgdataindex]; //[2];
1020 int data3 = msgdata[msgdataindex]; //[3];
1022 if(num_core < NUMCORESACTIVE) {
1024 BAMBOO_DEBUGPRINT(0xe881);
1026 corestatus[num_core] = 0;
1027 numsendobjs[num_core] = data2; //[2];
1028 numreceiveobjs[num_core] = data3; //[3];
1032 INLINE void processmsg_statusconfirm_I() {
1033 if((BAMBOO_NUM_OF_CORE == STARTUPCORE)
1034 || (BAMBOO_NUM_OF_CORE > NUMCORESACTIVE - 1)) {
1035 // wrong core to receive such msg
1036 BAMBOO_EXIT(0xe011);
1038 // send response msg
1040 BAMBOO_DEBUGPRINT(0xe887);
1042 // cache the msg first
1043 if(BAMBOO_CHECK_SEND_MODE()) {
1044 cache_msg_5(STARTUPCORE, STATUSREPORT,
1045 busystatus ? 1 : 0, BAMBOO_NUM_OF_CORE,
1046 self_numsendobjs, self_numreceiveobjs);
1048 send_msg_5(STARTUPCORE, STATUSREPORT, busystatus?1:0,
1049 BAMBOO_NUM_OF_CORE, self_numsendobjs,
1050 self_numreceiveobjs, true);
1055 INLINE void processmsg_statusreport_I() {
1056 int data1 = msgdata[msgdataindex];
1058 int data2 = msgdata[msgdataindex];
1060 int data3 = msgdata[msgdataindex];
1062 int data4 = msgdata[msgdataindex];
1064 // receive a status confirm info
1065 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1066 // wrong core to receive such msg
1068 BAMBOO_DEBUGPRINT_REG(data2);
1070 BAMBOO_EXIT(0xe012);
1073 BAMBOO_DEBUGPRINT(0xe888);
1078 corestatus[data2] = data1;
1079 numsendobjs[data2] = data3;
1080 numreceiveobjs[data2] = data4;
1084 INLINE void processmsg_terminate_I() {
1086 BAMBOO_DEBUGPRINT(0xe889);
1090 #ifdef GC_CACHE_ADAPT
1091 bamboo_mask_timer_intr(); // disable the TILE_TIMER interrupt
1092 #endif // GC_CACHE_ADAPT
1093 #endif // MULTICORE_GC
1097 INLINE void processmsg_memrequest_I() {
1098 int data1 = msgdata[msgdataindex];
1100 int data2 = msgdata[msgdataindex];
1102 // receive a shared memory request msg
1103 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1104 // wrong core to receive such msg
1106 BAMBOO_DEBUGPRINT_REG(data2);
1108 BAMBOO_EXIT(0xe013);
1111 BAMBOO_DEBUGPRINT(0xe88a);
1117 // is currently doing gc, dump this msg
1118 if(INITPHASE == gcphase) {
1119 // if still in the initphase of gc, send a startinit msg again,
1120 // cache the msg first
1121 if(BAMBOO_CHECK_SEND_MODE()) {
1122 cache_msg_1(data2, GCSTARTINIT);
1124 send_msg_1(data2, GCSTARTINIT, true);
1129 mem = smemalloc_I(data2, data1, &allocsize);
1131 // send the start_va to request core, cache the msg first
1132 if(BAMBOO_CHECK_SEND_MODE()) {
1133 cache_msg_3(data2, MEMRESPONSE, mem, allocsize);
1135 send_msg_3(data2, MEMRESPONSE, mem, allocsize, true);
1138 // if mem == NULL, the gcflag of the startup core has been set
1139 // and all the other cores have been informed to start gc
1146 INLINE void processmsg_memresponse_I() {
1147 int data1 = msgdata[msgdataindex];
1149 int data2 = msgdata[msgdataindex];
1151 // receive a shared memory response msg
1153 BAMBOO_DEBUGPRINT(0xe88b);
1156 // if is currently doing gc, dump this msg
1160 bamboo_smem_size = 0;
1163 bamboo_smem_zero_top = 0;
1167 // fill header to store the size of this mem block
1168 BAMBOO_MEMSET_WH(data1, '\0', BAMBOO_CACHE_LINE_SIZE);
1169 (*((int*)data1)) = data2;
1170 bamboo_smem_size = data2 - BAMBOO_CACHE_LINE_SIZE;
1171 bamboo_cur_msp = data1 + BAMBOO_CACHE_LINE_SIZE;
1172 bamboo_smem_zero_top = bamboo_cur_msp;
1174 bamboo_smem_size = data2;
1175 bamboo_cur_msp =(void*)(data1);
1185 INLINE void processmsg_gcstartpre_I() {
1187 // already stall for gc
1188 // send a update pregc information msg to the master core
1189 if(BAMBOO_CHECK_SEND_MODE()) {
1190 cache_msg_4(STARTUPCORE, GCFINISHPRE, BAMBOO_NUM_OF_CORE,
1191 self_numsendobjs, self_numreceiveobjs);
1193 send_msg_4(STARTUPCORE, GCFINISHPRE, BAMBOO_NUM_OF_CORE,
1194 self_numsendobjs, self_numreceiveobjs, true);
1197 // the first time to be informed to start gc
1200 // is waiting for response of mem request
1201 // let it return NULL and start gc
1202 bamboo_smem_size = 0;
1203 bamboo_cur_msp = NULL;
1205 bamboo_smem_zero_top = NULL;
1210 INLINE void processmsg_gcstartinit_I() {
1211 gcphase = INITPHASE;
1214 INLINE void processmsg_gcstart_I() {
1216 BAMBOO_DEBUGPRINT(0xe88c);
1219 gcphase = MARKPHASE;
1222 INLINE void processmsg_gcstartcompact_I() {
1223 gcblock2fill = msgdata[msgdataindex];
1224 MSG_INDEXINC_I(); //msgdata[1];
1225 gcphase = COMPACTPHASE;
1228 INLINE void processmsg_gcstartmapinfo_I() {
1232 INLINE void processmsg_gcstartflush_I() {
1233 gcphase = FLUSHPHASE;
1236 INLINE void processmsg_gcfinishpre_I() {
1237 int data1 = msgdata[msgdataindex];
1239 int data2 = msgdata[msgdataindex];
1241 int data3 = msgdata[msgdataindex];
1243 // received a init phase finish msg
1244 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1245 // non startup core can not receive this msg
1247 BAMBOO_DEBUGPRINT_REG(data1);
1249 BAMBOO_EXIT(0xe014);
1251 // All cores should do init GC
1255 gccorestatus[data1] = 0;
1256 gcnumsendobjs[0][data1] = data2;
1257 gcnumreceiveobjs[0][data1] = data3;
1260 INLINE void processmsg_gcfinishinit_I() {
1261 int data1 = msgdata[msgdataindex];
1263 // received a init phase finish msg
1264 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1265 // non startup core can not receive this msg
1267 BAMBOO_DEBUGPRINT_REG(data1);
1269 BAMBOO_EXIT(0xe015);
1272 BAMBOO_DEBUGPRINT(0xe88c);
1273 BAMBOO_DEBUGPRINT_REG(data1);
1275 // All cores should do init GC
1276 if(data1 < NUMCORESACTIVE) {
1277 gccorestatus[data1] = 0;
1281 INLINE void processmsg_gcfinishmark_I() {
1282 int data1 = msgdata[msgdataindex];
1284 int data2 = msgdata[msgdataindex];
1286 int data3 = msgdata[msgdataindex];
1288 // received a mark phase finish msg
1289 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1290 // non startup core can not receive this msg
1292 BAMBOO_DEBUGPRINT_REG(data1);
1294 BAMBOO_EXIT(0xe016);
1296 // all cores should do mark
1297 if(data1 < NUMCORESACTIVE) {
1298 gccorestatus[data1] = 0;
1299 int entry_index = 0;
1302 entry_index = (gcnumsrobjs_index == 0) ? 1 : 0;
1305 entry_index = gcnumsrobjs_index;
1307 gcnumsendobjs[entry_index][data1] = data2;
1308 gcnumreceiveobjs[entry_index][data1] = data3;
1312 INLINE void processmsg_gcfinishcompact_I() {
1313 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1314 // non startup core can not receive this msg
1317 BAMBOO_DEBUGPRINT_REG(msgdata[msgdataindex] /*[1]*/);
1319 BAMBOO_EXIT(0xe017);
1321 int cnum = msgdata[msgdataindex];
1322 MSG_INDEXINC_I(); //msgdata[1];
1323 int filledblocks = msgdata[msgdataindex];
1324 MSG_INDEXINC_I(); //msgdata[2];
1325 int heaptop = msgdata[msgdataindex];
1326 MSG_INDEXINC_I(); //msgdata[3];
1327 int data4 = msgdata[msgdataindex];
1328 MSG_INDEXINC_I(); //msgdata[4];
1329 // only gc cores need to do compact
1330 if(cnum < NUMCORES4GC) {
1331 if(COMPACTPHASE == gcphase) {
1332 gcfilledblocks[cnum] = filledblocks;
1333 gcloads[cnum] = heaptop;
1340 if(gcfindSpareMem_I(&startaddr, &tomove, &dstcore, data4, cnum)) {
1341 // cache the msg first
1342 if(BAMBOO_CHECK_SEND_MODE()) {
1343 cache_msg_4(cnum, GCMOVESTART, dstcore, startaddr, tomove);
1345 send_msg_4(cnum, GCMOVESTART, dstcore, startaddr, tomove, true);
1349 gccorestatus[cnum] = 0;
1351 } // if(cnum < NUMCORES4GC)
1354 INLINE void processmsg_gcfinishmapinfo_I() {
1355 int data1 = msgdata[msgdataindex];
1357 // received a map phase finish msg
1358 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1359 // non startup core can not receive this msg
1361 BAMBOO_DEBUGPRINT_REG(data1);
1363 BAMBOO_EXIT(0xe018);
1365 // all cores should do flush
1366 if(data1 < NUMCORES4GC) {
1367 gccorestatus[data1] = 0;
1372 INLINE void processmsg_gcfinishflush_I() {
1373 int data1 = msgdata[msgdataindex];
1375 // received a flush phase finish msg
1376 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1377 // non startup core can not receive this msg
1379 BAMBOO_DEBUGPRINT_REG(data1);
1381 BAMBOO_EXIT(0xe019);
1383 // all cores should do flush
1384 if(data1 < NUMCORESACTIVE) {
1385 gccorestatus[data1] = 0;
1389 INLINE void processmsg_gcmarkconfirm_I() {
1390 if((BAMBOO_NUM_OF_CORE == STARTUPCORE)
1391 || (BAMBOO_NUM_OF_CORE > NUMCORESACTIVE - 1)) {
1392 // wrong core to receive such msg
1393 BAMBOO_EXIT(0xe01a);
1395 // send response msg, cahce the msg first
1396 if(BAMBOO_CHECK_SEND_MODE()) {
1397 cache_msg_5(STARTUPCORE, GCMARKREPORT, BAMBOO_NUM_OF_CORE,
1398 gcbusystatus, gcself_numsendobjs,
1399 gcself_numreceiveobjs);
1401 send_msg_5(STARTUPCORE, GCMARKREPORT, BAMBOO_NUM_OF_CORE,
1402 gcbusystatus, gcself_numsendobjs,
1403 gcself_numreceiveobjs, true);
1408 INLINE void processmsg_gcmarkreport_I() {
1409 int data1 = msgdata[msgdataindex];
1411 int data2 = msgdata[msgdataindex];
1413 int data3 = msgdata[msgdataindex];
1415 int data4 = msgdata[msgdataindex];
1417 // received a marked phase finish confirm response msg
1418 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1419 // wrong core to receive such msg
1421 BAMBOO_DEBUGPRINT_REG(data2);
1423 BAMBOO_EXIT(0xe01b);
1425 int entry_index = 0;
1429 entry_index = (gcnumsrobjs_index == 0) ? 1 : 0;
1431 // can never reach here
1433 entry_index = gcnumsrobjs_index;
1435 gccorestatus[data1] = data2;
1436 gcnumsendobjs[entry_index][data1] = data3;
1437 gcnumreceiveobjs[entry_index][data1] = data4;
1441 INLINE void processmsg_gcmarkedobj_I() {
1442 int data1 = msgdata[msgdataindex];
1444 // received a markedObj msg
1445 if(((int *)data1)[BAMBOOMARKBIT] == INIT) {
1446 // this is the first time that this object is discovered,
1447 // set the flag as DISCOVERED
1448 ((int *)data1)[BAMBOOMARKBIT] = DISCOVERED;
1449 gc_enqueue_I(data1);
1451 // set the remote flag
1452 ((int *)data1)[BAMBOOMARKBIT] |= REMOTEM;
1453 gcself_numreceiveobjs++;
1454 gcbusystatus = true;
1457 INLINE void processmsg_gcmovestart_I() {
1459 gcdstcore = msgdata[msgdataindex];
1460 MSG_INDEXINC_I(); //msgdata[1];
1461 gcmovestartaddr = msgdata[msgdataindex];
1462 MSG_INDEXINC_I(); //msgdata[2];
1463 gcblock2fill = msgdata[msgdataindex];
1464 MSG_INDEXINC_I(); //msgdata[3];
1467 INLINE void processmsg_gcmaprequest_I() {
1468 void * dstptr = NULL;
1469 int data1 = msgdata[msgdataindex];
1471 int data2 = msgdata[msgdataindex];
1473 #ifdef LOCALHASHTBL_TEST
1474 RuntimeHashget(gcpointertbl, data1, &dstptr);
1476 dstptr = mgchashSearch(gcpointertbl, data1);
1478 if(NULL == dstptr) {
1479 // no such pointer in this core, something is wrong
1481 BAMBOO_DEBUGPRINT_REG(data1);
1482 BAMBOO_DEBUGPRINT_REG(data2);
1484 BAMBOO_EXIT(0xe01c);
1486 // send back the mapping info, cache the msg first
1487 if(BAMBOO_CHECK_SEND_MODE()) {
1488 cache_msg_3(data2, GCMAPINFO, data1, (int)dstptr);
1490 send_msg_3(data2, GCMAPINFO, data1, (int)dstptr, true);
1495 INLINE void processmsg_gcmapinfo_I() {
1496 int data1 = msgdata[msgdataindex];
1498 gcmappedobj = msgdata[msgdataindex]; // [2]
1500 #ifdef LOCALHASHTBL_TEST
1501 RuntimeHashadd_I(gcpointertbl, data1, gcmappedobj);
1503 mgchashInsert_I(gcpointertbl, data1, gcmappedobj);
1505 if(data1 == gcobj2map) {
1510 INLINE void processmsg_gcmaptbl_I() {
1511 int data1 = msgdata[msgdataindex];
1513 int data2 = msgdata[msgdataindex];
1515 gcrpointertbls[data2] = (mgcsharedhashtbl_t *)data1;
1518 INLINE void processmsg_gclobjinfo_I() {
1521 int data1 = msgdata[msgdataindex];
1523 int data2 = msgdata[msgdataindex];
1525 if(BAMBOO_NUM_OF_CORE > NUMCORES4GC - 1) {
1527 BAMBOO_DEBUGPRINT_REG(data2);
1529 BAMBOO_EXIT(0xe01d);
1531 // store the mark result info
1533 gcloads[cnum] = msgdata[msgdataindex];
1534 MSG_INDEXINC_I(); // msgdata[3];
1535 int data4 = msgdata[msgdataindex];
1537 if(gcheaptop < data4) {
1540 // large obj info here
1541 for(int k = 5; k < data1; k+=2) {
1542 int lobj = msgdata[msgdataindex];
1543 MSG_INDEXINC_I(); //msgdata[k++];
1544 int length = msgdata[msgdataindex];
1545 MSG_INDEXINC_I(); //msgdata[k++];
1546 gc_lobjenqueue_I(lobj, length, cnum);
1548 } // for(int k = 5; k < msgdata[1];)
1551 INLINE void processmsg_gclobjmapping_I() {
1552 int data1 = msgdata[msgdataindex];
1554 int data2 = msgdata[msgdataindex];
1556 #ifdef LOCALHASHTBL_TEST
1557 RuntimeHashadd_I(gcpointertbl, data1, data2);
1559 mgchashInsert_I(gcpointertbl, data1, data2);
1561 mgcsharedhashInsert_I(gcsharedptbl, data1, data2);
1565 INLINE void processmsg_gcprofiles_I() {
1566 int data1 = msgdata[msgdataindex];
1568 int data2 = msgdata[msgdataindex];
1570 int data3 = msgdata[msgdataindex];
1572 gc_num_obj += data1;
1573 gc_num_liveobj += data2;
1574 gc_num_forwardobj += data3;
1577 #endif // GC_PROFILE
1579 #ifdef GC_CACHE_ADAPT
1580 INLINE void processmsg_gcstartpref_I() {
1581 gcphase = PREFINISHPHASE;
1584 INLINE void processmsg_gcfinishpref_I() {
1585 int data1 = msgdata[msgdataindex];
1587 // received a flush phase finish msg
1588 if(BAMBOO_NUM_OF_CORE != STARTUPCORE) {
1589 // non startup core can not receive this msg
1591 BAMBOO_DEBUGPRINT_REG(data1);
1593 BAMBOO_EXIT(0xe01e);
1595 // all cores should do flush
1596 if(data1 < NUMCORESACTIVE) {
1597 gccorestatus[data1] = 0;
1600 #endif // GC_CACHE_ADAPT
1601 #endif // #ifdef MULTICORE_GC
1603 // receive object transferred from other cores
1604 // or the terminate message from other cores
1605 // Should be invoked in critical sections!!
1606 // NOTICE: following format is for threadsimulate version only
1607 // RAW version please see previous description
1608 // format: type + object
1609 // type: -1--stall msg
1611 // return value: 0--received an object
1612 // 1--received nothing
1613 // 2--received a Stall Msg
1614 // 3--received a lock Msg
1615 // RAW version: -1 -- received nothing
1616 // otherwise -- received msg type
1617 int receiveObject(int send_port_pending) {
1619 #ifdef PROFILE_INTERRUPT
1620 if(!interruptInfoOverflow) {
1621 InterruptInfo* intInfo = RUNMALLOC_I(sizeof(struct interrupt_info));
1622 interruptInfoArray[interruptInfoIndex] = intInfo;
1623 intInfo->startTime = BAMBOO_GET_EXE_TIME();
1624 intInfo->endTime = -1;
1626 #endif // PROFILE_INTERRUPT
1629 // get the incoming msgs
1630 if(receiveMsg(send_port_pending) == -1) {
1634 // processing received msgs
1636 MSG_REMAINSIZE_I(&size);
1637 if((size == 0) || (checkMsgLength_I(size) == -1)) {
1639 // have new coming msg
1640 if((BAMBOO_MSG_AVAIL() != 0) && !msgdatafull) {
1647 if(msglength <= size) {
1648 // have some whole msg
1650 type = msgdata[msgdataindex]; //[0]
1652 msgdatafull = false;
1656 // receive a object transfer msg
1657 processmsg_transobj_I();
1663 // receive a stall msg
1664 processmsg_transtall_I();
1669 // GC version have no lock msgs
1670 #ifndef MULTICORE_GC
1672 // receive lock request msg, handle it right now
1673 processmsg_lockrequest_I();
1675 } // case LOCKREQUEST
1678 // receive lock grount msg
1679 processmsg_lockgrount_I();
1681 } // case LOCKGROUNT
1684 // receive lock deny msg
1685 processmsg_lockdeny_I();
1690 processmsg_lockrelease_I();
1692 } // case LOCKRELEASE
1693 #endif // #ifndef MULTICORE_GC
1696 case PROFILEOUTPUT: {
1697 // receive an output profile data request msg
1698 processmsg_profileoutput_I();
1700 } // case PROFILEOUTPUT
1702 case PROFILEFINISH: {
1703 // receive a profile output finish msg
1704 processmsg_profilefinish_I();
1706 } // case PROFILEFINISH
1707 #endif // #ifdef PROFILE
1709 // GC version has no lock msgs
1710 #ifndef MULTICORE_GC
1711 case REDIRECTLOCK: {
1712 // receive a redirect lock request msg, handle it right now
1713 processmsg_redirectlock_I();
1715 } // case REDIRECTLOCK
1717 case REDIRECTGROUNT: {
1718 // receive a lock grant msg with redirect info
1719 processmsg_redirectgrount_I();
1721 } // case REDIRECTGROUNT
1723 case REDIRECTDENY: {
1724 // receive a lock deny msg with redirect info
1725 processmsg_redirectdeny_I();
1727 } // case REDIRECTDENY
1729 case REDIRECTRELEASE: {
1730 // receive a lock release msg with redirect info
1731 processmsg_redirectrelease_I();
1733 } // case REDIRECTRELEASE
1734 #endif // #ifndef MULTICORE_GC
1737 case STATUSCONFIRM: {
1738 // receive a status confirm info
1739 processmsg_statusconfirm_I();
1741 } // case STATUSCONFIRM
1743 case STATUSREPORT: {
1744 processmsg_statusreport_I();
1746 } // case STATUSREPORT
1749 // receive a terminate msg
1750 processmsg_terminate_I();
1755 processmsg_memrequest_I();
1757 } // case MEMREQUEST
1760 processmsg_memresponse_I();
1762 } // case MEMRESPONSE
1767 processmsg_gcstartpre_I();
1769 } // case GCSTARTPRE
1772 processmsg_gcstartinit_I();
1774 } // case GCSTARTINIT
1777 // receive a start GC msg
1778 processmsg_gcstart_I();
1782 case GCSTARTCOMPACT: {
1783 // a compact phase start msg
1784 processmsg_gcstartcompact_I();
1786 } // case GCSTARTCOMPACT
1788 case GCSTARTMAPINFO: {
1789 // received a flush phase start msg
1790 processmsg_gcstartmapinfo_I();
1792 } // case GCSTARTFLUSH
1794 case GCSTARTFLUSH: {
1795 // received a flush phase start msg
1796 processmsg_gcstartflush_I();
1798 } // case GCSTARTFLUSH
1801 processmsg_gcfinishpre_I();
1803 } // case GCFINISHPRE
1805 case GCFINISHINIT: {
1806 processmsg_gcfinishinit_I();
1808 } // case GCFINISHINIT
1810 case GCFINISHMARK: {
1811 processmsg_gcfinishmark_I();
1813 } // case GCFINISHMARK
1815 case GCFINISHCOMPACT: {
1816 // received a compact phase finish msg
1817 processmsg_gcfinishcompact_I();
1819 } // case GCFINISHCOMPACT
1821 case GCFINISHMAPINFO: {
1822 processmsg_gcfinishmapinfo_I();
1824 } // case GCFINISHMAPINFO
1826 case GCFINISHFLUSH: {
1827 processmsg_gcfinishflush_I();
1829 } // case GCFINISHFLUSH
1832 // received a GC finish msg
1833 gcphase = FINISHPHASE;
1837 case GCMARKCONFIRM: {
1838 // received a marked phase finish confirm request msg
1839 // all cores should do mark
1840 processmsg_gcmarkconfirm_I();
1842 } // case GCMARKCONFIRM
1844 case GCMARKREPORT: {
1845 processmsg_gcmarkreport_I();
1847 } // case GCMARKREPORT
1850 processmsg_gcmarkedobj_I();
1852 } // case GCMARKEDOBJ
1855 // received a start moving objs msg
1856 processmsg_gcmovestart_I();
1858 } // case GCMOVESTART
1860 case GCMAPREQUEST: {
1861 // received a mapping info request msg
1862 processmsg_gcmaprequest_I();
1864 } // case GCMAPREQUEST
1867 // received a mapping info response msg
1868 processmsg_gcmapinfo_I();
1873 // received a mapping tbl response msg
1874 processmsg_gcmaptbl_I();
1878 case GCLOBJREQUEST: {
1879 // received a large objs info request msg
1880 transferMarkResults_I();
1882 } // case GCLOBJREQUEST
1885 // received a large objs info response msg
1886 processmsg_gclobjinfo_I();
1888 } // case GCLOBJINFO
1890 case GCLOBJMAPPING: {
1891 // received a large obj mapping info msg
1892 processmsg_gclobjmapping_I();
1894 } // case GCLOBJMAPPING
1898 // received a gcprofiles msg
1899 processmsg_gcprofiles_I();
1902 #endif // GC_PROFILE
1904 #ifdef GC_CACHE_ADAPT
1906 // received a gcstartpref msg
1907 processmsg_gcstartpref_I();
1911 case GCFINISHPREF: {
1912 // received a gcfinishpref msg
1913 processmsg_gcfinishpref_I();
1916 #endif // GC_CACHE_ADAPT
1917 #endif // #ifdef MULTICORE_GC
1922 msglength = BAMBOO_MSG_BUF_LENGTH;
1924 if((msgdataindex != msgdatalast) || (msgdatafull)) {
1925 // still have available msg
1929 BAMBOO_DEBUGPRINT(0xe88d);
1932 // have new coming msg
1933 if(BAMBOO_MSG_AVAIL() != 0) {
1938 #ifdef PROFILE_INTERRUPT
1939 if(!interruptInfoOverflow) {
1940 interruptInfoArray[interruptInfoIndex]->endTime=BAMBOO_GET_EXE_TIME();
1941 interruptInfoIndex++;
1942 if(interruptInfoIndex == INTERRUPTINFOLENGTH) {
1943 interruptInfoOverflow = true;
1952 BAMBOO_DEBUGPRINT(0xe88e);