7 #if defined(MULTICORE_GC)||defined(PMC_GC)
8 #include "multicoreruntime.h"
9 #include "bambooalign.h"
10 #include "runtime_arch.h"
11 #include "methodheaders.h"
15 #include "multicoremem.h"
16 #include "multicoregarbage.h"
19 #include "multicoregc.h"
20 #include "pmc_garbage.h"
23 #if defined(MULTICORE_GC)||defined(PMC_GC)
24 extern volatile bool gcflag;
25 void * mycalloc_share(struct garbagelist * stackptr, int size) {
27 int isize = ((size-1)&(~(ALIGNMENTSIZE-1)))+ALIGNMENTSIZE;
32 p = BAMBOO_SHARE_MEM_CALLOC(isize); // calloc(m, isize);
37 // no more global shared memory
45 // no more global shared memory
46 printf("Did %u collections without getting memory\n", hasgc);
50 if (loopcount>10000000)
51 tprintf("Loopcount in mycalloc_share hit %u\n",loopcount);
59 void * mycalloc_share(int size) {
60 int isize = ((size-1)&(~(BAMBOO_CACHE_LINE_MASK)))+(BAMBOO_CACHE_LINE_SIZE);
61 void * p = BAMBOO_SHARE_MEM_CALLOC(isize); // calloc(m, isize);
63 // no more global shared memory
66 return (void *)(BAMBOO_CACHE_LINE_SIZE+((int)p-1)&(~BAMBOO_CACHE_LINE_MASK));
70 void * mycalloc(int size, char * file, int line) {
71 BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
72 void * p = mycalloc_i(size, file, line);
73 BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
78 void * mycalloc_i(int size, char * file, int line) {
79 void * p = BAMBOO_LOCAL_MEM_CALLOC(size);
81 tprintf("mycalloc_i %s %d \n", file, line);
87 void myfree(void * ptr) {
88 BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
89 BAMBOO_LOCAL_MEM_FREE(ptr);
90 BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
94 void myfree_i(void * ptr) {
95 BAMBOO_LOCAL_MEM_FREE(ptr);