5 #include "runtime_arch.h"
11 BAMBOO_START_CRITICAL_SECTION_MEM();
12 p = BAMBOO_LOCAL_MEM_CALLOC(m, isize); // calloc(m, isize);
16 BAMBOO_CLOSE_CRITICAL_SECTION_MEM();
21 void * mycalloc_share(struct garbagelist * stackptr,
25 int isize = 2*BAMBOO_CACHE_LINE_SIZE-4+(size-1)&(~BAMBOO_CACHE_LINE_MASK);
28 BAMBOO_START_CRITICAL_SECTION_MEM();
29 p = BAMBOO_SHARE_MEM_CALLOC_I(m, isize); // calloc(m, isize);
31 tprintf("new obj in shared mem: %x, %x \n", p, isize);
34 // no more global shared memory
35 BAMBOO_CLOSE_CRITICAL_SECTION_MEM();
41 // no more global shared memory
45 // try to malloc again
48 BAMBOO_CLOSE_CRITICAL_SECTION_MEM();
50 (void *)(BAMBOO_CACHE_LINE_SIZE+((int)p-1)&(~BAMBOO_CACHE_LINE_MASK));
51 memset(p, -2, (alignedp - p));
52 memset(alignedp + size, -2, p + isize - alignedp - size);
56 void * mycalloc_share(int m,
59 int isize = 2*BAMBOO_CACHE_LINE_SIZE-4+(size-1)&(~BAMBOO_CACHE_LINE_MASK);
60 BAMBOO_START_CRITICAL_SECTION_MEM();
61 p = BAMBOO_SHARE_MEM_CALLOC_I(m, isize); // calloc(m, isize);
63 // no more global shared memory
66 BAMBOO_CLOSE_CRITICAL_SECTION_MEM();
68 (void *)(BAMBOO_CACHE_LINE_SIZE+((int)p-1)&(~BAMBOO_CACHE_LINE_MASK));
72 void * mycalloc_i(int m,
76 p = BAMBOO_LOCAL_MEM_CALLOC(m, isize); // calloc(m, isize);
83 void myfree(void * ptr) {
84 BAMBOO_LOCAL_MEM_FREE(ptr);