My Project
Loading...
Searching...
No Matches
omAllocPrivate.h File Reference

Go to the source code of this file.

Data Structures

struct  omBinPage_t
 
struct  omBin_t
 
struct  omSpecBin_t
 

Macros

#define SIZEOF_OM_BIN_PAGE_HEADER   (5*SIZEOF_VOIDP + SIZEOF_LONG)
 
#define SIZEOF_OM_BIN_PAGE   (SIZEOF_SYSTEM_PAGE - SIZEOF_OM_BIN_PAGE_HEADER)
 
#define omGetTopBinOfPage(page)
 
#define omGetStickyOfPage(page)
 
#define omSetTopBinOfPage(page, bin)
 
#define omSetStickyOfPage(page, sticky)
 
#define omSetTopBinAndStickyOfPage(page, bin, sticky)
 
#define omGetTopBinOfAddr(addr)
 
#define omGetBinOfAddr(addr)
 
#define omSizeOfBinAddr(addr)
 
#define omSizeWOfBin(bin_ptr)
 
#define _omSizeOfBinAddr(addr)
 
#define omSizeWOfBinAddr(addr)
 
#define __omTypeAllocFromNonEmptyPage(type, addr, page)
 
#define __omFreeToPage(addr, page)
 
#define __omTypeAllocBin(type, addr, bin)
 
#define __omTypeAlloc0Bin(type, addr, bin)
 
#define __omFreeBinAddr(addr)
 
#define __omTypeReallocBin(old_addr, old_bin, new_type, new_addr, new_bin)
 
#define __omTypeRealloc0Bin(old_addr, old_bin, new_type, new_addr, new_bin)
 
#define omSmallSize2Bin(size)
 
#define __omTypeAlloc(type, addr, size)
 
#define __omTypeAlloc0(type, addr, size)
 
#define __omTypeAllocAligned   __omTypeAlloc
 
#define __omTypeAlloc0Aligned   __omTypeAlloc0
 
#define __omFreeSize(addr, size)
 
#define __omFree(addr)
 
#define ___omTypeRealloc(old_addr, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags)
 
#define ___omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags)
 
#define __omTypeRealloc(old_addr, new_type, new_addr, new_size)
 
#define __omTypeRealloc0(old_addr, new_type, new_addr, new_size)
 
#define __omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size)
 
#define __omTypeRealloc0Size(old_addr, old_size, new_type, new_addr, new_size)
 
#define __omTypeReallocAligned   __omTypeRealloc
 
#define __omTypeRealloc0Aligned   __omTypeRealloc0
 
#define __omTypeReallocAlignedSize   __omTypeReallocSize
 
#define __omTypeRealloc0AlignedSize   __omTypeRealloc0Size
 

Functions

void * omAllocBinFromFullPage (omBin bin)
 
void omFreeToPageFault (omBinPage page, void *addr)
 
void * omDoRealloc (void *old_addr, size_t new_size, int flags)
 

Variables

omSpecBin om_SpecBin
 
omBin om_StickyBins
 
omBinPage_t om_ZeroPage []
 
omBin om_Size2Bin []
 
omBin_t om_StaticBin []
 

Data Structure Documentation

◆ omBinPage_s

struct omBinPage_s

Definition at line 18 of file omAllocPrivate.h.

Data Fields
void * bin_sticky
void * current
omBinPage next
omBinPage prev
omBinPageRegion region
long used_blocks

◆ omBin_s

struct omBin_s

Definition at line 36 of file omAllocPrivate.h.

Data Fields
omBin_next curr
omBinPage current_page
omBinPage last_page
long max_blocks
omBin next
size_t size
size_t sizeW
unsigned long sticky

◆ omSpecBin_s

struct omSpecBin_s

Definition at line 47 of file omAllocPrivate.h.

Data Fields
omBin bin
long max_blocks
omSpecBin next
long ref

Macro Definition Documentation

◆ ___omTypeRealloc

#define ___omTypeRealloc ( old_addr,
new_type,
new_addr,
new_size,
SIZE_2_BIN,
REALLOC_BIN,
flags )
Value:
do \
{ \
size_t __new_size = new_size; \
if (__new_size <= OM_MAX_BLOCK_SIZE && omIsBinPageAddr(old_addr)) \
{ \
omBin __old_bin = omGetBinOfAddr(old_addr); \
omBin __new_bin = SIZE_2_BIN(__new_size); \
REALLOC_BIN(old_addr, __old_bin, new_type, new_addr, __new_bin); \
} \
else \
{ \
new_addr = (new_type) omDoRealloc(old_addr, __new_size, flags); \
} \
} \
while (0)
#define omGetBinOfAddr(addr)
#define omIsBinPageAddr(addr)
Definition omBinPage.h:68
omBin_t * omBin
Definition omStructs.h:12
#define OM_MAX_BLOCK_SIZE
Definition omTables.c:31
void * omDoRealloc(void *old_addr, size_t new_size, int flag)
Definition om_Alloc.c:229
int status int void size_t count const char int flags
Definition si_signals.h:83

Definition at line 314 of file omAllocPrivate.h.

314#define ___omTypeRealloc(old_addr, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags) \
315do \
316{ \
317 size_t __new_size = new_size; \
318 if (__new_size <= OM_MAX_BLOCK_SIZE && omIsBinPageAddr(old_addr)) \
319 { \
320 omBin __old_bin = omGetBinOfAddr(old_addr); \
321 omBin __new_bin = SIZE_2_BIN(__new_size); \
322 REALLOC_BIN(old_addr, __old_bin, new_type, new_addr, __new_bin); \
323 } \
324 else \
325 { \
326 new_addr = (new_type) omDoRealloc(old_addr, __new_size, flags); \
327 } \
328} \
329while (0)

◆ ___omTypeReallocSize

#define ___omTypeReallocSize ( old_addr,
old_size,
new_type,
new_addr,
new_size,
SIZE_2_BIN,
REALLOC_BIN,
flags )
Value:
do \
{ \
size_t __new_size = new_size; \
if (__new_size <= OM_MAX_BLOCK_SIZE && old_size <= OM_MAX_BLOCK_SIZE) \
{ \
omBin __old_bin = omGetBinOfAddr(old_addr); \
omBin __new_bin = SIZE_2_BIN(__new_size); \
REALLOC_BIN(old_addr, __old_bin, new_type, new_addr, __new_bin); \
} \
else \
{ \
new_addr = (new_type) omDoRealloc(old_addr, __new_size, flags); \
} \
} \
while (0)

Definition at line 331 of file omAllocPrivate.h.

331#define ___omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags) \
332do \
333{ \
334 size_t __new_size = new_size; \
335 if (__new_size <= OM_MAX_BLOCK_SIZE && old_size <= OM_MAX_BLOCK_SIZE) \
336 { \
337 omBin __old_bin = omGetBinOfAddr(old_addr); \
338 omBin __new_bin = SIZE_2_BIN(__new_size); \
339 REALLOC_BIN(old_addr, __old_bin, new_type, new_addr, __new_bin); \
340 } \
341 else \
342 { \
343 new_addr = (new_type) omDoRealloc(old_addr, __new_size, flags); \
344 } \
345} \
346while (0)

◆ __omFree

#define __omFree ( addr)
Value:
do \
{ \
if (omIsBinPageAddr(addr)) \
{ \
__omFreeBinAddr(addr); \
} \
else \
{ \
omFreeLarge(addr); \
} \
} \
while (0)

Definition at line 298 of file omAllocPrivate.h.

298#define __omFree(addr) \
299do \
300{ \
301 if (omIsBinPageAddr(addr)) \
302 { \
303 __omFreeBinAddr(addr); \
304 } \
305 else \
306 { \
307 omFreeLarge(addr); \
308 } \
309} \
310while (0)

◆ __omFreeBinAddr

#define __omFreeBinAddr ( addr)
Value:
do \
{ \
REGISTER void* __om_addr = (void*) (addr); \
REGISTER omBinPage __om_page = omGetBinPageOfAddr(__om_addr); \
__omFreeToPage(__om_addr, __om_page); \
} \
while (0)
#define omGetBinPageOfAddr(addr)
Definition omBinPage.h:22
omBinPage_t * omBinPage
Definition omStructs.h:16
#define REGISTER
Definition omalloc.h:27

Definition at line 163 of file omAllocPrivate.h.

163#define __omFreeBinAddr(addr) \
164do \
165{ \
166 REGISTER void* __om_addr = (void*) (addr); \
167 REGISTER omBinPage __om_page = omGetBinPageOfAddr(__om_addr); \
168 __omFreeToPage(__om_addr, __om_page); \
169} \
170while (0)

◆ __omFreeSize

#define __omFreeSize ( addr,
size )
Value:
do \
{ \
if ((size <= OM_MAX_BLOCK_SIZE) || omIsBinPageAddr(addr)) \
{ \
__omFreeBinAddr(addr); \
} \
else \
{ \
omFreeLarge(addr); \
} \
} \
while (0)
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition cf_ops.cc:600

Definition at line 284 of file omAllocPrivate.h.

284#define __omFreeSize(addr, size) \
285do \
286{ \
287 if ((size <= OM_MAX_BLOCK_SIZE) || omIsBinPageAddr(addr)) \
288 { \
289 __omFreeBinAddr(addr); \
290 } \
291 else \
292 { \
293 omFreeLarge(addr); \
294 } \
295} \
296while (0)

◆ __omFreeToPage

#define __omFreeToPage ( addr,
page )
Value:
do \
{ \
if ((page)->used_blocks > 0L) \
{ \
*((void**) (addr)) = (page)->current; \
((page)->used_blocks)--; \
(page)->current = (addr); \
} \
else \
{ \
omFreeToPageFault(page, addr); \
} \
} \
while (0)

Definition at line 124 of file omAllocPrivate.h.

124#define __omFreeToPage(addr, page) \
125do \
126{ \
127 if ((page)->used_blocks > 0L) \
128 { \
129 *((void**) (addr)) = (page)->current; \
130 ((page)->used_blocks)--; \
131 (page)->current = (addr); \
132 } \
133 else \
134 { \
135 omFreeToPageFault(page, addr); \
136 } \
137} \
138while (0)

◆ __omTypeAlloc

#define __omTypeAlloc ( type,
addr,
size )
Value:
do \
{ \
size_t __size = size; \
if (__size <= OM_MAX_BLOCK_SIZE) \
{ \
omBin __om_bin = omSmallSize2Bin(__size); \
__omTypeAllocBin(type, addr, __om_bin); \
} \
else \
{ \
addr = (type) omAllocLarge(__size); \
} \
} \
while(0)
#define omSmallSize2Bin(size)
void * omAllocLarge(size_t size)

Definition at line 213 of file omAllocPrivate.h.

213#define __omTypeAlloc(type, addr, size) \
214do \
215{ \
216 size_t __size = size; \
217 if (__size <= OM_MAX_BLOCK_SIZE) \
218 { \
219 omBin __om_bin = omSmallSize2Bin(__size); \
220 __omTypeAllocBin(type, addr, __om_bin); \
221 } \
222 else \
223 { \
224 addr = (type) omAllocLarge(__size); \
225 } \
226} \
227while(0)

◆ __omTypeAlloc0

#define __omTypeAlloc0 ( type,
addr,
size )
Value:
do \
{ \
size_t __size = size; \
if (__size <= OM_MAX_BLOCK_SIZE) \
{ \
omBin __om_bin = omSmallSize2Bin(__size); \
__omTypeAlloc0Bin(type, addr, __om_bin); \
} \
else \
{ \
addr = (type) omAlloc0Large(__size); \
} \
} \
while (0)
void * omAlloc0Large(size_t size)

Definition at line 229 of file omAllocPrivate.h.

229#define __omTypeAlloc0(type, addr, size) \
230do \
231{ \
232 size_t __size = size; \
233 if (__size <= OM_MAX_BLOCK_SIZE) \
234 { \
235 omBin __om_bin = omSmallSize2Bin(__size); \
236 __omTypeAlloc0Bin(type, addr, __om_bin); \
237 } \
238 else \
239 { \
240 addr = (type) omAlloc0Large(__size); \
241 } \
242} \
243while (0)

◆ __omTypeAlloc0Aligned

#define __omTypeAlloc0Aligned   __omTypeAlloc0

Definition at line 281 of file omAllocPrivate.h.

◆ __omTypeAlloc0Bin

#define __omTypeAlloc0Bin ( type,
addr,
bin )
Value:
do \
{ \
__omTypeAllocBin(type, addr, bin); \
omMemsetW(addr, 0, (bin)->sizeW); \
} \
while (0)

Definition at line 154 of file omAllocPrivate.h.

154#define __omTypeAlloc0Bin(type, addr, bin) \
155do \
156{ \
157 __omTypeAllocBin(type, addr, bin); \
158 omMemsetW(addr, 0, (bin)->sizeW); \
159} \
160while (0)

◆ __omTypeAllocAligned

#define __omTypeAllocAligned   __omTypeAlloc

Definition at line 280 of file omAllocPrivate.h.

◆ __omTypeAllocBin

#define __omTypeAllocBin ( type,
addr,
bin )
Value:
do \
{ \
REGISTER omBinPage __om_page = (bin)->current_page; \
if (__om_page->current != NULL) \
__omTypeAllocFromNonEmptyPage(type, addr, __om_page); \
else \
addr = (type) omAllocBinFromFullPage(bin); \
} \
while (0)
#define NULL
Definition omList.c:12
void * omAllocBinFromFullPage(omBin bin)
Definition om_Alloc.c:119

Definition at line 143 of file omAllocPrivate.h.

143#define __omTypeAllocBin(type, addr, bin) \
144do \
145{ \
146 REGISTER omBinPage __om_page = (bin)->current_page; \
147 if (__om_page->current != NULL) \
148 __omTypeAllocFromNonEmptyPage(type, addr, __om_page); \
149 else \
150 addr = (type) omAllocBinFromFullPage(bin); \
151} \
152while (0)

◆ __omTypeAllocFromNonEmptyPage

#define __omTypeAllocFromNonEmptyPage ( type,
addr,
page )
Value:
do \
{ \
((page)->used_blocks)++; \
addr = (type)((page)->current); \
(page)->current = *((void**) (page)->current); \
} \
while (0)

Definition at line 115 of file omAllocPrivate.h.

115#define __omTypeAllocFromNonEmptyPage(type, addr, page) \
116do \
117{ \
118 ((page)->used_blocks)++; \
119 addr = (type)((page)->current); \
120 (page)->current = *((void**) (page)->current); \
121} \
122while (0)

◆ __omTypeRealloc

#define __omTypeRealloc ( old_addr,
new_type,
new_addr,
new_size )
Value:
___omTypeRealloc(old_addr, new_type, new_addr, new_size, omSmallSize2Bin, __omTypeReallocBin, 0)
#define __omTypeReallocBin(old_addr, old_bin, new_type, new_addr, new_bin)
#define ___omTypeRealloc(old_addr, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags)

Definition at line 348 of file omAllocPrivate.h.

348#define __omTypeRealloc(old_addr, new_type, new_addr, new_size) \
349 ___omTypeRealloc(old_addr, new_type, new_addr, new_size, omSmallSize2Bin, __omTypeReallocBin, 0)

◆ __omTypeRealloc0

#define __omTypeRealloc0 ( old_addr,
new_type,
new_addr,
new_size )
Value:
___omTypeRealloc(old_addr, new_type, new_addr, new_size, omSmallSize2Bin, __omTypeRealloc0Bin, 1)
#define __omTypeRealloc0Bin(old_addr, old_bin, new_type, new_addr, new_bin)

Definition at line 350 of file omAllocPrivate.h.

350#define __omTypeRealloc0(old_addr, new_type, new_addr, new_size) \
351 ___omTypeRealloc(old_addr, new_type, new_addr, new_size, omSmallSize2Bin, __omTypeRealloc0Bin, 1)

◆ __omTypeRealloc0Aligned

#define __omTypeRealloc0Aligned   __omTypeRealloc0

Definition at line 368 of file omAllocPrivate.h.

◆ __omTypeRealloc0AlignedSize

#define __omTypeRealloc0AlignedSize   __omTypeRealloc0Size

Definition at line 370 of file omAllocPrivate.h.

◆ __omTypeRealloc0Bin

#define __omTypeRealloc0Bin ( old_addr,
old_bin,
new_type,
new_addr,
new_bin )
Value:
do \
{ \
if (old_bin != new_bin) \
{ \
size_t old_sizeW = (omIsNormalBinPageAddr(old_addr) ? old_bin->sizeW : omSizeWOfAddr(old_addr)); \
__omTypeAllocBin(new_type, new_addr, new_bin); \
omMemcpyW(new_addr, old_addr, (new_bin->sizeW > old_sizeW ? old_sizeW : new_bin->sizeW)); \
if (new_bin->sizeW > old_sizeW) \
omMemsetW((void**)new_addr + old_sizeW, 0, new_bin->sizeW - old_sizeW); \
__omFreeBinAddr(old_addr); \
} \
else \
{ \
new_addr = (new_type) old_addr; \
} \
} \
while (0)
#define omIsNormalBinPageAddr(addr)
Definition omDebug.h:14
#define omSizeWOfAddr(P)
Definition xalloc.h:223

Definition at line 190 of file omAllocPrivate.h.

190#define __omTypeRealloc0Bin(old_addr, old_bin, new_type, new_addr, new_bin) \
191do \
192{ \
193 if (old_bin != new_bin) \
194 { \
195 size_t old_sizeW = (omIsNormalBinPageAddr(old_addr) ? old_bin->sizeW : omSizeWOfAddr(old_addr)); \
196 __omTypeAllocBin(new_type, new_addr, new_bin); \
197 omMemcpyW(new_addr, old_addr, (new_bin->sizeW > old_sizeW ? old_sizeW : new_bin->sizeW)); \
198 if (new_bin->sizeW > old_sizeW) \
199 omMemsetW((void**)new_addr + old_sizeW, 0, new_bin->sizeW - old_sizeW); \
200 __omFreeBinAddr(old_addr); \
201 } \
202 else \
203 { \
204 new_addr = (new_type) old_addr; \
205 } \
206} \
207while (0)

◆ __omTypeRealloc0Size

#define __omTypeRealloc0Size ( old_addr,
old_size,
new_type,
new_addr,
new_size )
Value:
___omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size, omSmallSize2Bin, __omTypeRealloc0Bin, 1)
#define ___omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags)

Definition at line 354 of file omAllocPrivate.h.

354#define __omTypeRealloc0Size(old_addr, old_size, new_type, new_addr, new_size) \
355 ___omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size, omSmallSize2Bin, __omTypeRealloc0Bin, 1)

◆ __omTypeReallocAligned

#define __omTypeReallocAligned   __omTypeRealloc

Definition at line 367 of file omAllocPrivate.h.

◆ __omTypeReallocAlignedSize

#define __omTypeReallocAlignedSize   __omTypeReallocSize

Definition at line 369 of file omAllocPrivate.h.

◆ __omTypeReallocBin

#define __omTypeReallocBin ( old_addr,
old_bin,
new_type,
new_addr,
new_bin )
Value:
do \
{ \
if (old_bin != new_bin) \
{ \
size_t old_sizeW = (omIsNormalBinPageAddr(old_addr) ? old_bin->sizeW : omSizeWOfAddr(old_addr)); \
__omTypeAllocBin(new_type, new_addr, new_bin); \
omMemcpyW(new_addr, old_addr, (new_bin->sizeW > old_sizeW ? old_sizeW : new_bin->sizeW)); \
__omFreeBinAddr(old_addr); \
} \
else \
{ \
new_addr = (new_type) old_addr; \
} \
} \
while (0)

Definition at line 172 of file omAllocPrivate.h.

172#define __omTypeReallocBin(old_addr, old_bin, new_type, new_addr, new_bin) \
173do \
174{ \
175 if (old_bin != new_bin) \
176 { \
177 size_t old_sizeW = (omIsNormalBinPageAddr(old_addr) ? old_bin->sizeW : omSizeWOfAddr(old_addr)); \
178 __omTypeAllocBin(new_type, new_addr, new_bin); \
179 omMemcpyW(new_addr, old_addr, (new_bin->sizeW > old_sizeW ? old_sizeW : new_bin->sizeW)); \
180 __omFreeBinAddr(old_addr); \
181 } \
182 else \
183 { \
184 new_addr = (new_type) old_addr; \
185 } \
186} \
187while (0)

◆ __omTypeReallocSize

#define __omTypeReallocSize ( old_addr,
old_size,
new_type,
new_addr,
new_size )
Value:
___omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size, omSmallSize2Bin, __omTypeReallocBin, 0)

Definition at line 352 of file omAllocPrivate.h.

352#define __omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size) \
353 ___omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size, omSmallSize2Bin, __omTypeReallocBin, 0)

◆ _omSizeOfBinAddr

#define _omSizeOfBinAddr ( addr)
Value:
((omSizeWOfBinAddr(addr)) << LOG_SIZEOF_LONG)
#define omSizeWOfBinAddr(addr)

Definition at line 102 of file omAllocPrivate.h.

◆ omGetBinOfAddr

#define omGetBinOfAddr ( addr)
Value:
OM_INLINE_DECL omBin omGetBinOfPage(omBinPage page)

Definition at line 80 of file omAllocPrivate.h.

◆ omGetStickyOfPage

#define omGetStickyOfPage ( page)
Value:
(((unsigned long) ((page)->bin_sticky)) & ((unsigned long)SIZEOF_VOIDP-1))

Definition at line 67 of file omAllocPrivate.h.

67#define omGetStickyOfPage(page) \
68 (((unsigned long) ((page)->bin_sticky)) & ((unsigned long)SIZEOF_VOIDP-1))

◆ omGetTopBinOfAddr

#define omGetTopBinOfAddr ( addr)
Value:
#define omGetTopBinOfPage(page)
#define omGetPageOfAddr(addr)
Definition omBinPage.h:19

Definition at line 78 of file omAllocPrivate.h.

78#define omGetTopBinOfAddr(addr) \
79 omGetTopBinOfPage(((omBinPage) omGetPageOfAddr(addr)))

◆ omGetTopBinOfPage

#define omGetTopBinOfPage ( page)
Value:
((omBin) ( ((unsigned long) ((page)->bin_sticky)) & ~((unsigned long)SIZEOF_VOIDP - 1)))

Definition at line 65 of file omAllocPrivate.h.

65#define omGetTopBinOfPage(page) \
66 ((omBin) ( ((unsigned long) ((page)->bin_sticky)) & ~((unsigned long)SIZEOF_VOIDP - 1)))

◆ omSetStickyOfPage

#define omSetStickyOfPage ( page,
sticky )
Value:
(page)->bin_sticky = (void*)(((unsigned long)sticky & ((unsigned long)SIZEOF_VOIDP-1)) + \
(unsigned long)omGetTopBinOfPage(page))

Definition at line 71 of file omAllocPrivate.h.

71#define omSetStickyOfPage(page, sticky) \
72 (page)->bin_sticky = (void*)(((unsigned long)sticky & ((unsigned long)SIZEOF_VOIDP-1)) + \
73 (unsigned long)omGetTopBinOfPage(page))

◆ omSetTopBinAndStickyOfPage

#define omSetTopBinAndStickyOfPage ( page,
bin,
sticky )
Value:
(page)->bin_sticky= (void*)(((unsigned long)sticky & (SIZEOF_VOIDP-1)) \
+ (unsigned long)bin)

Definition at line 74 of file omAllocPrivate.h.

74#define omSetTopBinAndStickyOfPage(page, bin, sticky) \
75 (page)->bin_sticky= (void*)(((unsigned long)sticky & (SIZEOF_VOIDP-1)) \
76 + (unsigned long)bin)

◆ omSetTopBinOfPage

#define omSetTopBinOfPage ( page,
bin )
Value:
(page)->bin_sticky= (void*)((unsigned long)bin + omGetStickyOfPage(page))
#define omGetStickyOfPage(page)

Definition at line 69 of file omAllocPrivate.h.

69#define omSetTopBinOfPage(page, bin) \
70 (page)->bin_sticky= (void*)((unsigned long)bin + omGetStickyOfPage(page))

◆ omSizeOfBinAddr

#define omSizeOfBinAddr ( addr)
Value:
#define _omSizeOfBinAddr(addr)

Definition at line 97 of file omAllocPrivate.h.

◆ omSizeWOfBin

#define omSizeWOfBin ( bin_ptr)
Value:
((bin_ptr)->sizeW)

Definition at line 100 of file omAllocPrivate.h.

◆ omSizeWOfBinAddr

#define omSizeWOfBinAddr ( addr)
Value:
((omGetTopBinOfAddr(addr))->sizeW)
#define omGetTopBinOfAddr(addr)

Definition at line 103 of file omAllocPrivate.h.

◆ omSmallSize2Bin

#define omSmallSize2Bin ( size)
Value:
om_Size2Bin[((size) -1)>>LOG_SIZEOF_OM_ALIGNMENT]
omBin om_Size2Bin[]

Definition at line 211 of file omAllocPrivate.h.

◆ SIZEOF_OM_BIN_PAGE

#define SIZEOF_OM_BIN_PAGE   (SIZEOF_SYSTEM_PAGE - SIZEOF_OM_BIN_PAGE_HEADER)

Definition at line 32 of file omAllocPrivate.h.

◆ SIZEOF_OM_BIN_PAGE_HEADER

#define SIZEOF_OM_BIN_PAGE_HEADER   (5*SIZEOF_VOIDP + SIZEOF_LONG)

Definition at line 31 of file omAllocPrivate.h.

Function Documentation

◆ omAllocBinFromFullPage()

void * omAllocBinFromFullPage ( omBin bin)
extern

Definition at line 119 of file om_Alloc.c.

120{
121 void* addr;
122 omBinPage newpage;
123 omAssume(bin->current_page->current == NULL);
124
125 if (bin->current_page != om_ZeroPage)
126 {
127 omAssume(bin->last_page != NULL);
128 /* Set this to zero, but preserve the first bit,
129 so that tracking works */
130#ifdef OM_HAVE_TRACK
131 bin->current_page->used_blocks &= (((unsigned long) 1) << (BIT_SIZEOF_LONG -1));
132#else
133 bin->current_page->used_blocks = 0;
134#endif
135 }
136
137 if (!bin->sticky && bin->current_page->next != NULL)
138 {
139 omAssume(bin->current_page->next->current != NULL);
140 newpage = bin->current_page->next;
141 }
142 else
143 {
144 // need to Allocate new page
145 newpage = omAllocNewBinPage(bin);
146 omInsertBinPage(bin->current_page, newpage, bin);
147 }
148
149 bin->current_page = newpage;
150 omAssume(newpage != NULL && newpage != om_ZeroPage &&
151 newpage->current != NULL);
152 __omTypeAllocFromNonEmptyPage(void*, addr, newpage);
153 return addr;
154}
#define BIT_SIZEOF_LONG
Definition auxiliary.h:80
#define __omTypeAllocFromNonEmptyPage(type, addr, page)
#define omAssume(x)
Definition omError.h:85
omBinPage_t om_ZeroPage[]
Definition om_Alloc.c:19
OM_INLINE_LOCAL void omInsertBinPage(omBinPage after, omBinPage page, omBin bin)
Definition om_Alloc.c:90
static omBinPage omAllocNewBinPage(omBin bin)
Definition om_Alloc.c:32

◆ omDoRealloc()

void * omDoRealloc ( void * old_addr,
size_t new_size,
int flags )

Definition at line 229 of file om_Alloc.c.

230{
231 void* new_addr;
232
233 if (!omIsBinPageAddr(old_addr) && new_size > OM_MAX_BLOCK_SIZE)
234 {
235 if (DO_ZERO(flag))
236 return omRealloc0Large(old_addr, new_size);
237 else
238 return omReallocLarge(old_addr, new_size);
239 }
240 else
241 {
242 size_t old_size = omSizeOfAddr(old_addr);
243 size_t min_size;
244
245 omAssume(OM_IS_ALIGNED(old_addr));
246
247#ifdef OM_ALIGNMENT_NEEDS_WORK
248 if (flag & 2)
249 __omTypeAllocAligned(void*, new_addr, new_size);
250 else
251#endif
252 __omTypeAlloc(void*, new_addr, new_size);
253
254 new_size = omSizeOfAddr(new_addr);
255 min_size = (old_size < new_size ? old_size : new_size);
256 omMemcpyW(new_addr, old_addr, min_size >> LOG_SIZEOF_LONG);
257
258 if (DO_ZERO(flag) && (new_size > old_size))
259 omMemsetW((char*) new_addr + min_size, 0, (new_size - old_size) >> LOG_SIZEOF_LONG);
260
261 __omFreeSize(old_addr, old_size);
262
263 return new_addr;
264 }
265}
#define __omTypeAlloc(type, addr, size)
#define __omTypeAllocAligned
#define __omFreeSize(addr, size)
void * omRealloc0Large(void *old_addr, size_t new_size)
void * omReallocLarge(void *old_addr, size_t new_size)
size_t omSizeOfAddr(const void *addr)
#define omMemcpyW(p1, p2, l)
Definition omMemOps.h:29
#define omMemsetW(P1, W, L)
Definition omMemOps.h:161
#define DO_ZERO(flag)
Definition om_Alloc.c:226

◆ omFreeToPageFault()

void omFreeToPageFault ( omBinPage page,
void * addr )
extern

Definition at line 167 of file om_Alloc.c.

168{
169 omBin bin;
170 omAssume(page->used_blocks <= 0L);
171
172#ifdef OM_HAVE_TRACK
173 if (page->used_blocks < 0L)
174 {
175 omFreeTrackAddr(addr);
176 return;
177 }
178#endif
179
180 bin = omGetBinOfPage(page);
181 if ((page->current != NULL) || (bin->max_blocks <= 1))
182 {
183 // all blocks of page are now collected
184 omTakeOutBinPage(page, bin);
185 // page can be freed
186 if (bin->max_blocks > 0)
187 omFreeBinPage(page);
188 else
189 omFreeBinPages(page, - bin->max_blocks);
190#ifdef OM_HAVE_TRACK
191 om_JustFreedPage = page;
192#endif
193 }
194 else
195 {
196 // page was full
197 page->current = addr;
198 page->used_blocks = bin->max_blocks - 2;
199 *((void**)addr) = NULL;
200
201 omTakeOutBinPage(page, bin);
202#if defined(PAGE_BEFORE_CURRENT)
203 if (bin->current_page->prev != NULL)
204 omInsertBinPage(bin->current_page->prev, page);
205 else
206 omInsertBinPage(bin->current_page, page, bin);
207 bin->current_page = page;
208#else
209# if defined(PAGE_AFTER_CURRENT)
210 omInsertBinPage(bin->current_page, page, bin);
211# else
212 omInsertBinPage(bin->last_page, page, bin);
213# endif
214#endif
215 }
216}
void omFreeBinPages(omBinPage bin_page, int how_many)
Definition omBinPage.c:206
#define omFreeBinPage(addr)
Definition omBinPage.h:88
OM_INLINE_LOCAL void omTakeOutBinPage(omBinPage page, omBin bin)
Definition om_Alloc.c:59

Variable Documentation

◆ om_Size2Bin

omBin om_Size2Bin
extern

Definition at line 84 of file omAllocPrivate.h.

◆ om_SpecBin

omSpecBin om_SpecBin
extern

Definition at line 20 of file om_Alloc.c.

◆ om_StaticBin

omBin_t om_StaticBin[]
extern

◆ om_StickyBins

omBin om_StickyBins
extern

Definition at line 374 of file omBin.c.

◆ om_ZeroPage

omBinPage_t om_ZeroPage[]
extern

Definition at line 19 of file om_Alloc.c.

19{{0, NULL, NULL, NULL, NULL}};