5 #include "runtime_arch.h"
7 /*void * m_calloc(int m, int size) {
8 void * p = malloc(m*size);
10 for(i = 0; i < size; ++i) {
16 void * mycalloc(int m, int size) {
18 int isize = size; //2*BAMBOO_CACHE_LINE_SIZE-4+(size-1)&(~BAMBOO_CACHE_LINE_MASK);
19 BAMBOO_START_CRITICAL_SECTION_MEM();
20 p = BAMBOO_LOCAL_MEM_CALLOC(m, isize); // calloc(m, isize);
24 BAMBOO_CLOSE_CRITICAL_SECTION_MEM();
25 //return (void *)(BAMBOO_CACHE_LINE_SIZE+((int)p-1)&(~BAMBOO_CACHE_LINE_MASK));
29 void * mycalloc_share(int m, int size) {
31 int isize = 2*BAMBOO_CACHE_LINE_SIZE-4+(size-1)&(~BAMBOO_CACHE_LINE_MASK);
32 BAMBOO_START_CRITICAL_SECTION_MEM();
33 p = BAMBOO_SHARE_MEM_CALLOC_I(m, isize); // calloc(m, isize);
37 BAMBOO_CLOSE_CRITICAL_SECTION_MEM();
38 return (void *)(BAMBOO_CACHE_LINE_SIZE+((int)p-1)&(~BAMBOO_CACHE_LINE_MASK));
41 void * mycalloc_i(int m, int size) {
43 int isize = size; //2*BAMBOO_CACHE_LINE_SIZE-4+(size-1)&(~BAMBOO_CACHE_LINE_MASK);
44 p = BAMBOO_LOCAL_MEM_CALLOC(m, isize); // calloc(m, isize);
49 //return (void *)(BAMBOO_CACHE_LINE_SIZE+((int)p-1)&(~BAMBOO_CACHE_LINE_MASK));
52 void myfree(void * ptr) {
53 BAMBOO_LOCAL_MEM_FREE(ptr);