11#define _POSIX_SOURCE 1
16#include "omalloc/omConfig.h"
17#include "omalloc/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,
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;
165int main(
int argc,
char* argv[])
167 int max_bin_index = 0;
169#ifdef OM_HAVE_DENSE_BIN_DISTRIBUTION
179"#ifndef OM_TABLES_INC\n"
180"#define OM_TABLES_INC\n"
188#ifdef OM_ALIGNMENT_NEEDS_WORK
192 printf(
"\n#ifdef OM_HAVE_TRACK\n");
196#ifdef OM_ALIGNMENT_NEEDS_WORK
201 printf(
"\n#endif /* OM_HAVE_TRACK */\n");
203 printf(
"\n#endif /* OM_TABLES_INC */\n");
#define SIZEOF_OM_BIN_PAGE
void OutputSize2Bin(size_t *binSize, size_t max_block_size, int track)
int GetMaxBlockThreshold()
void OutputStaticBin(size_t *binSize, int max_bin_index, int track)
size_t om_BinSize[SIZEOF_OM_BIN_PAGE/MIN_BIN_BLOCKS]
void OutputSize2AlignedBin(size_t *binSize, size_t max_block_size, int track)
#define OM_MAX_BLOCK_SIZE