Loading...
Searching...
No Matches
omAllocPrivate.h File Reference
`#include "omalloc/omAllocSystem.h"`

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)
omGetBinOfAddr
#define omGetBinOfAddr(addr)
Definition omAllocPrivate.h:80
omIsBinPageAddr
#define omIsBinPageAddr(addr)
Definition omBinPage.h:68
omBin
omBin_t * omBin
Definition omStructs.h:12
OM_MAX_BLOCK_SIZE
#define OM_MAX_BLOCK_SIZE
Definition omTables.c:31
omDoRealloc
void * omDoRealloc(void *old_addr, size_t new_size, int flag)
Definition om_Alloc.c:229
flags
int status int void size_t count const char int flags
Definition si_signals.h:83

Definition at line 314 of file omAllocPrivate.h.

#define ___omTypeRealloc(old_addr, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags) \
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)

## ___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.

#define ___omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags) \
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)

## __omFree

#define __omFree | ( |  | addr | ) |

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

Definition at line 298 of file omAllocPrivate.h.

#define __omFree(addr) \
do \
{ \
if (omIsBinPageAddr(addr)) \
{ \
__omFreeBinAddr(addr); \
} \
else \
{ \
omFreeLarge(addr); \
} \
} \
while (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)
omGetBinPageOfAddr
#define omGetBinPageOfAddr(addr)
Definition omBinPage.h:22
omBinPage
omBinPage_t * omBinPage
Definition omStructs.h:16
REGISTER
#define REGISTER
Definition omalloc.h:27

Definition at line 163 of file omAllocPrivate.h.

#define __omFreeBinAddr(addr) \
do \
{ \
REGISTER void* __om_addr = (void*) (addr); \
REGISTER omBinPage __om_page = omGetBinPageOfAddr(__om_addr); \
__omFreeToPage(__om_addr, __om_page); \
} \
while (0)

## __omFreeSize

#define __omFreeSize | ( |  | addr,
|  |  | size )

Value:
do \
{ \
if ((size <= OM_MAX_BLOCK_SIZE) || omIsBinPageAddr(addr)) \
{ \
__omFreeBinAddr(addr); \
} \
else \
{ \
omFreeLarge(addr); \
} \
} \
while (0)
size
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.

#define __omFreeSize(addr, size) \
do \
{ \
if ((size <= OM_MAX_BLOCK_SIZE) || omIsBinPageAddr(addr)) \
{ \
__omFreeBinAddr(addr); \
} \
else \
{ \
omFreeLarge(addr); \
} \
} \
while (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.

#define __omFreeToPage(addr, page) \
do \
{ \
if ((page)->used_blocks > 0L) \
{ \
*((void**) (addr)) = (page)->current; \
((page)->used_blocks)--; \
(page)->current = (addr); \
} \
else \
{ \
omFreeToPageFault(page, addr); \
} \
} \
while (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)
omSmallSize2Bin
#define omSmallSize2Bin(size)
Definition omAllocPrivate.h:211
omAllocLarge
void * omAllocLarge(size_t size)
Definition omAllocSystem.c:48

Definition at line 213 of file omAllocPrivate.h.

#define __omTypeAlloc(type, addr, size) \
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)

## __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)
omAlloc0Large
void * omAlloc0Large(size_t size)
Definition omAllocSystem.c:82

Definition at line 229 of file omAllocPrivate.h.

#define __omTypeAlloc0(type, addr, size) \
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)

## __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.

#define __omTypeAlloc0Bin(type, addr, bin) \
do \
{ \
__omTypeAllocBin(type, addr, bin); \
omMemsetW(addr, 0, (bin)->sizeW); \
} \
while (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)
NULL
#define NULL
Definition omList.c:12
omAllocBinFromFullPage
void * omAllocBinFromFullPage(omBin bin)
Definition om_Alloc.c:119

Definition at line 143 of file omAllocPrivate.h.

#define __omTypeAllocBin(type, addr, bin) \
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)

## __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.

#define __omTypeAllocFromNonEmptyPage(type, addr, page) \
do \
{ \
((page)->used_blocks)++; \
addr = (type)((page)->current); \
(page)->current = *((void**) (page)->current); \
} \
while (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)
__omTypeReallocBin
#define __omTypeReallocBin(old_addr, old_bin, new_type, new_addr, new_bin)
Definition omAllocPrivate.h:172
___omTypeRealloc
#define ___omTypeRealloc(old_addr, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags)
Definition omAllocPrivate.h:314

Definition at line 348 of file omAllocPrivate.h.

#define __omTypeRealloc(old_addr, new_type, new_addr, new_size) \
___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)
__omTypeRealloc0Bin
#define __omTypeRealloc0Bin(old_addr, old_bin, new_type, new_addr, new_bin)
Definition omAllocPrivate.h:190

Definition at line 350 of file omAllocPrivate.h.

#define __omTypeRealloc0(old_addr, new_type, new_addr, new_size) \
___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)
omIsNormalBinPageAddr
#define omIsNormalBinPageAddr(addr)
Definition omDebug.h:14
omSizeWOfAddr
#define omSizeWOfAddr(P)
Definition xalloc.h:223

Definition at line 190 of file omAllocPrivate.h.

#define __omTypeRealloc0Bin(old_addr, old_bin, new_type, new_addr, new_bin) \
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)

## __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)
___omTypeReallocSize
#define ___omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size, SIZE_2_BIN, REALLOC_BIN, flags)
Definition omAllocPrivate.h:331

Definition at line 354 of file omAllocPrivate.h.

#define __omTypeRealloc0Size(old_addr, old_size, new_type, new_addr, new_size) \
___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.

#define __omTypeReallocBin(old_addr, old_bin, new_type, new_addr, new_bin) \
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)

## __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.

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

## _omSizeOfBinAddr

#define _omSizeOfBinAddr | ( |  | addr | ) |

Value:
((omSizeWOfBinAddr(addr)) << LOG_SIZEOF_LONG)
omSizeWOfBinAddr
#define omSizeWOfBinAddr(addr)
Definition omAllocPrivate.h:103

Definition at line 102 of file omAllocPrivate.h.

## omGetBinOfAddr

#define omGetBinOfAddr | ( |  | addr | ) |

Value:
omGetBinOfPage(omGetBinPageOfAddr(addr))
omGetBinOfPage
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.

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

## omGetTopBinOfAddr

#define omGetTopBinOfAddr | ( |  | addr | ) |

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

Definition at line 78 of file omAllocPrivate.h.

#define omGetTopBinOfAddr(addr) \
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.

#define omGetTopBinOfPage(page) \
((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.

#define omSetStickyOfPage(page, sticky) \
(page)->bin_sticky = (void*)(((unsigned long)sticky & ((unsigned long)SIZEOF_VOIDP-1)) + \
(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.

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

## omSetTopBinOfPage

#define omSetTopBinOfPage | ( |  | page,
|  |  | bin )

Value:
(page)->bin_sticky= (void*)((unsigned long)bin + omGetStickyOfPage(page))
omGetStickyOfPage
#define omGetStickyOfPage(page)
Definition omAllocPrivate.h:67

Definition at line 69 of file omAllocPrivate.h.

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

## omSizeOfBinAddr

#define omSizeOfBinAddr | ( |  | addr | ) |

Value:
_omSizeOfBinAddr(addr)
_omSizeOfBinAddr
#define _omSizeOfBinAddr(addr)
Definition omAllocPrivate.h:102

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)
omGetTopBinOfAddr
#define omGetTopBinOfAddr(addr)
Definition omAllocPrivate.h:78

Definition at line 103 of file omAllocPrivate.h.

## omSmallSize2Bin

#define omSmallSize2Bin | ( |  | size | ) |

Value:
om_Size2Bin[((size) -1)>>LOG_SIZEOF_OM_ALIGNMENT]
om_Size2Bin
omBin om_Size2Bin[]
Definition omAllocPrivate.h:84

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.

{
void* addr;
omBinPage newpage;
omAssume(bin->current_page->current == NULL);
if (bin->current_page != om_ZeroPage)
{
omAssume(bin->last_page != NULL);
/* Set this to zero, but preserve the first bit,
so that tracking works */
#ifdef OM_HAVE_TRACK
bin->current_page->used_blocks &= (((unsigned long) 1) << (BIT_SIZEOF_LONG -1));
#else
bin->current_page->used_blocks = 0;
#endif
}
if (!bin->sticky && bin->current_page->next != NULL)
{
omAssume(bin->current_page->next->current != NULL);
newpage = bin->current_page->next;
}
else
{
// need to Allocate new page
newpage = omAllocNewBinPage(bin);
omInsertBinPage(bin->current_page, newpage, bin);
}
bin->current_page = newpage;
omAssume(newpage != NULL && newpage != om_ZeroPage &&
newpage->current != NULL);
__omTypeAllocFromNonEmptyPage(void*, addr, newpage);
return addr;
}
BIT_SIZEOF_LONG
#define BIT_SIZEOF_LONG
Definition auxiliary.h:80
__omTypeAllocFromNonEmptyPage
#define __omTypeAllocFromNonEmptyPage(type, addr, page)
Definition omAllocPrivate.h:115
omAssume
#define omAssume(x)
Definition omError.h:85
om_ZeroPage
omBinPage_t om_ZeroPage[]
Definition om_Alloc.c:19
omInsertBinPage
OM_INLINE_LOCAL void omInsertBinPage(omBinPage after, omBinPage page, omBin bin)
Definition om_Alloc.c:90
omAllocNewBinPage
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.

{
void* new_addr;
if (!omIsBinPageAddr(old_addr) && new_size > OM_MAX_BLOCK_SIZE)
{
if (DO_ZERO(flag))
return omRealloc0Large(old_addr, new_size);
else
return omReallocLarge(old_addr, new_size);
}
else
{
size_t old_size = omSizeOfAddr(old_addr);
size_t min_size;
omAssume(OM_IS_ALIGNED(old_addr));
#ifdef OM_ALIGNMENT_NEEDS_WORK
if (flag & 2)
__omTypeAllocAligned(void*, new_addr, new_size);
else
#endif
__omTypeAlloc(void*, new_addr, new_size);
new_size = omSizeOfAddr(new_addr);
min_size = (old_size < new_size ? old_size : new_size);
omMemcpyW(new_addr, old_addr, min_size >> LOG_SIZEOF_LONG);
if (DO_ZERO(flag) && (new_size > old_size))
omMemsetW((char*) new_addr + min_size, 0, (new_size - old_size) >> LOG_SIZEOF_LONG);
__omFreeSize(old_addr, old_size);
return new_addr;
}
}
__omTypeAlloc
#define __omTypeAlloc(type, addr, size)
Definition omAllocPrivate.h:213
__omTypeAllocAligned
#define __omTypeAllocAligned
Definition omAllocPrivate.h:280
__omFreeSize
#define __omFreeSize(addr, size)
Definition omAllocPrivate.h:284
omRealloc0Large
void * omRealloc0Large(void *old_addr, size_t new_size)
Definition omAllocSystem.c:89
omReallocLarge
void * omReallocLarge(void *old_addr, size_t new_size)
Definition omAllocSystem.c:57
omSizeOfAddr
size_t omSizeOfAddr(const void *addr)
Definition omAllocSystem.c:110
omMemcpyW
#define omMemcpyW(p1, p2, l)
Definition omMemOps.h:29
omMemsetW
#define omMemsetW(P1, W, L)
Definition omMemOps.h:161
DO_ZERO
#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.

{
omBin bin;
omAssume(page->used_blocks <= 0L);
#ifdef OM_HAVE_TRACK
if (page->used_blocks < 0L)
{
omFreeTrackAddr(addr);
return;
}
#endif
bin = omGetBinOfPage(page);
if ((page->current != NULL) || (bin->max_blocks <= 1))
{
// all blocks of page are now collected
omTakeOutBinPage(page, bin);
// page can be freed
if (bin->max_blocks > 0)
omFreeBinPage(page);
else
omFreeBinPages(page, - bin->max_blocks);
#ifdef OM_HAVE_TRACK
om_JustFreedPage = page;
#endif
}
else
{
// page was full
page->current = addr;
page->used_blocks = bin->max_blocks - 2;
*((void**)addr) = NULL;
omTakeOutBinPage(page, bin);
#if defined(PAGE_BEFORE_CURRENT)
if (bin->current_page->prev != NULL)
omInsertBinPage(bin->current_page->prev, page);
else
omInsertBinPage(bin->current_page, page, bin);
bin->current_page = page;
#else
# if defined(PAGE_AFTER_CURRENT)
omInsertBinPage(bin->current_page, page, bin);
# else
omInsertBinPage(bin->last_page, page, bin);
# endif
#endif
}
}
omFreeBinPages
void omFreeBinPages(omBinPage bin_page, int how_many)
Definition omBinPage.c:206
omFreeBinPage
#define omFreeBinPage(addr)
Definition omBinPage.h:88
omTakeOutBinPage
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.

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