My Project
Loading...
Searching...
No Matches
Macros | Functions | Variables
omTables1.c File Reference
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "omalloc/omConfig.h"
#include "omalloc/omDerivedConfig.h"
#include "omalloc/omStructs.h"
#include "omalloc/omAllocPrivate.h"

Go to the source code of this file.

Macros

#define MH_TABLES_C
 
#define _POSIX_SOURCE   1
 
#define MIN_BIN_BLOCKS   4
 
#define INCR_FACTOR   1
 
#define OM_MAX_BLOCK_SIZE   ((SIZEOF_OM_BIN_PAGE / MIN_BIN_BLOCKS) & ~(SIZEOF_STRICT_ALIGNMENT - 1))
 

Functions

int GetMaxBlockThreshold ()
 
void CreateDenseBins ()
 
int main (int argc, char *argv[])
 

Variables

size_t om_BinSize [SIZEOF_OM_BIN_PAGE/MIN_BIN_BLOCKS]
 

Macro Definition Documentation

◆ _POSIX_SOURCE

#define _POSIX_SOURCE   1

Definition at line 11 of file omTables1.c.

◆ INCR_FACTOR

#define INCR_FACTOR   1

Definition at line 27 of file omTables1.c.

◆ MH_TABLES_C

#define MH_TABLES_C

Definition at line 9 of file omTables1.c.

◆ MIN_BIN_BLOCKS

#define MIN_BIN_BLOCKS   4

Definition at line 26 of file omTables1.c.

◆ OM_MAX_BLOCK_SIZE

#define OM_MAX_BLOCK_SIZE   ((SIZEOF_OM_BIN_PAGE / MIN_BIN_BLOCKS) & ~(SIZEOF_STRICT_ALIGNMENT - 1))

Definition at line 31 of file omTables1.c.

Function Documentation

◆ CreateDenseBins()

void CreateDenseBins ( )

Definition at line 78 of file omTables1.c.

79{
80 size_t size, align_size = SIZEOF_OM_ALIGNMENT;
81 int i = 1;
82#ifdef OM_ALIGNMENT_NEEDS_WORK
83 int n = GetMaxBlockThreshold();
84#endif
85
86 size = align_size;
87 om_BinSize[0] = align_size;
88 i = 1;
89 while (size < OM_MAX_BLOCK_SIZE)
90 {
91 size += align_size;
92#ifdef OM_ALIGNMENT_NEEDS_WORK
93 if (size >= n && align_size != SIZEOF_STRICT_ALIGNMENT)
94 {
95 align_size = SIZEOF_STRICT_ALIGNMENT;
96 size= OM_STRICT_ALIGN_SIZE(size);
97 }
98#endif
99 om_BinSize[i] = size;
100 if ((SIZEOF_OM_BIN_PAGE / (size + align_size)) < (SIZEOF_OM_BIN_PAGE /size))
101 {
102 i++;
103 }
104 }
105}
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
int i
Definition: cfEzgcd.cc:132
#define SIZEOF_OM_BIN_PAGE
int GetMaxBlockThreshold()
Definition: omTables1.c:65
size_t om_BinSize[SIZEOF_OM_BIN_PAGE/MIN_BIN_BLOCKS]
Definition: omTables1.c:50
#define OM_MAX_BLOCK_SIZE
Definition: omTables1.c:31

◆ GetMaxBlockThreshold()

int GetMaxBlockThreshold ( )

Definition at line 65 of file omTables1.c.

66{
67 int i;
68 for (i=SIZEOF_OM_ALIGNMENT; i < OM_MAX_BLOCK_SIZE; i += SIZEOF_OM_ALIGNMENT)
69 {
70 if ((SIZEOF_OM_BIN_PAGE/i) == SIZEOF_OM_BIN_PAGE/(i + SIZEOF_OM_ALIGNMENT))
71 return i;
72 }
73 /* should never get here */
74 printf("error");fflush(stdout);
75 _exit(1);
76}

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 107 of file omTables1.c.

108{
109 int max_bin_index = 0;
110 /* determine max_bin_index */
111#ifdef OM_HAVE_DENSE_BIN_DISTRIBUTION
113#endif
114 for(;;)
115 {
116 max_bin_index++;
117 if (om_BinSize[max_bin_index] == OM_MAX_BLOCK_SIZE) break;
118 }
119 {
120 /* output what goes into omTables.h */
121 printf(
122"#ifndef OM_TABLES_H\n"
123"#define OM_TABLES_H\n"
124"#define OM_MAX_BLOCK_SIZE %d\n"
125"#define OM_MAX_BIN_INDEX %d\n"
126"#define OM_SIZEOF_UNIQUE_MAX_BLOCK_THRESHOLD %d\n"
127"#endif /* OM_TABLES_H */\n"
128, OM_MAX_BLOCK_SIZE, max_bin_index, GetMaxBlockThreshold());
129 return 0;
130 }
131}
void CreateDenseBins()
Definition: omTables1.c:78

Variable Documentation

◆ om_BinSize

size_t om_BinSize[SIZEOF_OM_BIN_PAGE/MIN_BIN_BLOCKS]
Initial value:
=
{ 8, 12, 16, 20,
24, 28, 32,
40, 48, 56, 64,
80, 96, 112, 128,
160, 192, 224,
((SIZEOF_OM_BIN_PAGE / (MIN_BIN_BLOCKS + INCR_FACTOR*9)) / SIZEOF_STRICT_ALIGNMENT)*SIZEOF_STRICT_ALIGNMENT,
((SIZEOF_OM_BIN_PAGE / (MIN_BIN_BLOCKS + INCR_FACTOR*6)) / SIZEOF_STRICT_ALIGNMENT)*SIZEOF_STRICT_ALIGNMENT,
((SIZEOF_OM_BIN_PAGE / (MIN_BIN_BLOCKS + INCR_FACTOR*4)) / SIZEOF_STRICT_ALIGNMENT)*SIZEOF_STRICT_ALIGNMENT,
((SIZEOF_OM_BIN_PAGE / (MIN_BIN_BLOCKS + INCR_FACTOR*2)) / SIZEOF_STRICT_ALIGNMENT)*SIZEOF_STRICT_ALIGNMENT,
((SIZEOF_OM_BIN_PAGE / (MIN_BIN_BLOCKS + INCR_FACTOR)) / SIZEOF_STRICT_ALIGNMENT)*SIZEOF_STRICT_ALIGNMENT,
#define MIN_BIN_BLOCKS
Definition: omTables1.c:26
#define INCR_FACTOR
Definition: omTables1.c:27

Definition at line 50 of file omTables1.c.