11 #define _POSIX_SOURCE 1
17 #include "omDerivedConfig.h"
22 #if SIZEOF_SYSTEM_PAGE > 4096
23 #define MIN_BIN_BLOCKS 8
26 #define MIN_BIN_BLOCKS 4
31 #define OM_MAX_BLOCK_SIZE ((SIZEOF_OM_BIN_PAGE / MIN_BIN_BLOCKS) & ~(SIZEOF_STRICT_ALIGNMENT - 1))
39 80, 96, 112, 128, 144,
65 void OutputSize2Bin(
size_t *binSize,
size_t max_block_size,
int track)
68 printf(
"omBin om_Size2%sBin[/*%ld*/] = {\n",
69 (track?
"Track" :
""), (
long)(max_block_size / SIZEOF_OM_ALIGNMENT));
71 j=SIZEOF_OM_ALIGNMENT;
72 while (
j < max_block_size)
74 printf(
"&om_Static%sBin[%ld], /* %ld */ \n", (track?
"Track" :
""),
i,
j);
75 if (binSize[
i] ==
j)
i++;
76 j += SIZEOF_OM_ALIGNMENT;
78 printf(
"&om_Static%sBin[%ld] /* %ld */};\n\n", (track?
"Track" :
""),
i,
j);
86 fprintf(stderr,
"OM_MAX_BLOCK_SIZE == %d not divisible by 8\n",
OM_MAX_BLOCK_SIZE);fflush(stdout);
89 printf(
"omBin om_Size2%sBin[/*%ld*/] = {\n",
90 (track ?
"Track" :
"Aligned"), (
long)(max_block_size / SIZEOF_OM_ALIGNMENT));
92 while (binSize[
i] % SIZEOF_STRICT_ALIGNMENT != 0)
i++;
93 j=SIZEOF_OM_ALIGNMENT;
94 while (
j < max_block_size)
96 printf(
"&om_Static%sBin[%ld], /* %ld */ \n", (track ?
"Track" :
""),
i,
j);
100 while (binSize[
i] % SIZEOF_STRICT_ALIGNMENT != 0)
i++;
102 j += SIZEOF_OM_ALIGNMENT;
104 printf(
"&om_Static%sBin[%ld] /* %ld */};\n\n", (track ?
"Track" :
""),
i,
j);
110 printf(
"omBin_t om_Static%sBin[/*%d*/] = {\n", (track ?
"Track" :
""), max_bin_index+1);
112 for (
i=0;
i< max_bin_index;
i++)
114 printf(
"{om_ZeroPage, NULL, NULL, %ld, %ld, 0},\n",
115 (
long)(binSize[
i] / SIZEOF_LONG),
118 printf(
"{om_ZeroPage, NULL, NULL, %ld, %ld, 0}\n};\n\n",
119 (
long)(binSize[
i] / SIZEOF_LONG),
132 printf(
"error");fflush(stdout);
138 size_t size, align_size = SIZEOF_OM_ALIGNMENT;
140 #ifdef OM_ALIGNMENT_NEEDS_WORK
150 #ifdef OM_ALIGNMENT_NEEDS_WORK
151 if (
size >= n && align_size != SIZEOF_STRICT_ALIGNMENT)
153 align_size = SIZEOF_STRICT_ALIGNMENT;
165 int main(
int argc,
char* argv[])
167 int max_bin_index = 0;
169 #ifdef OM_HAVE_DENSE_BIN_DISTRIBUTION
181 "#ifndef OM_TABLES_H\n"
182 "#define OM_TABLES_H\n"
183 "#define OM_MAX_BLOCK_SIZE %d\n"
184 "#define OM_MAX_BIN_INDEX %d\n"
185 "#define OM_SIZEOF_UNIQUE_MAX_BLOCK_THRESHOLD %d\n"
186 "#endif /* OM_TABLES_H */\n"
192 "#ifndef OM_TABLES_INC\n"
193 "#define OM_TABLES_INC\n"
201 #ifdef OM_ALIGNMENT_NEEDS_WORK
205 printf(
"\n#ifdef OM_HAVE_TRACK\n");
209 #ifdef OM_ALIGNMENT_NEEDS_WORK
214 printf(
"\n#endif /* OM_HAVE_TRACK */\n");
216 printf(
"\n#endif /* OM_TABLES_INC */\n");