abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ivyMem.c File Reference
#include "ivy.h"

Go to the source code of this file.

Macros

#define IVY_PAGE_SIZE   12
 DECLARATIONS ///. More...
 
#define IVY_PAGE_MASK   4095
 

Functions

void Ivy_ManStartMemory (Ivy_Man_t *p)
 FUNCTION DEFINITIONS ///. More...
 
void Ivy_ManStopMemory (Ivy_Man_t *p)
 
void Ivy_ManAddMemory (Ivy_Man_t *p)
 

Macro Definition Documentation

#define IVY_PAGE_MASK   4095

Definition at line 32 of file ivyMem.c.

#define IVY_PAGE_SIZE   12

DECLARATIONS ///.

CFile****************************************************************

FileName [ivyMem.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [Memory management for the AIG nodes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id:
ivyMem.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

]

Definition at line 31 of file ivyMem.c.

Function Documentation

void Ivy_ManAddMemory ( Ivy_Man_t p)

Function*************************************************************

Synopsis [Allocates additional memory for the nodes.]

Description [Allocates IVY_PAGE_SIZE nodes. Aligns memory by 32 bytes. Records the pointer to the AIG manager in the -1 entry.]

SideEffects []

SeeAlso []

Definition at line 89 of file ivyMem.c.

90 {
91  char * pMemory;
92  int i, nBytes;
93  int EntrySizeMax = 128;
94  assert( sizeof(Ivy_Obj_t) <= EntrySizeMax );
95  assert( p->pListFree == NULL );
96 // assert( (Ivy_ManObjNum(p) & IVY_PAGE_MASK) == 0 );
97  // allocate new memory page
98  nBytes = sizeof(Ivy_Obj_t) * (1<<IVY_PAGE_SIZE) + EntrySizeMax;
99  pMemory = ABC_ALLOC( char, nBytes );
100  Vec_PtrPush( p->vChunks, pMemory );
101  // align memory at the 32-byte boundary
102  pMemory = pMemory + EntrySizeMax - (((int)(ABC_PTRUINT_T)pMemory) & (EntrySizeMax-1));
103  // remember the manager in the first entry
104  Vec_PtrPush( p->vPages, pMemory );
105  // break the memory down into nodes
106  p->pListFree = (Ivy_Obj_t *)pMemory;
107  for ( i = 1; i <= IVY_PAGE_MASK; i++ )
108  {
109  *((char **)pMemory) = pMemory + sizeof(Ivy_Obj_t);
110  pMemory += sizeof(Ivy_Obj_t);
111  }
112  *((char **)pMemory) = NULL;
113 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
for(p=first;p->value< newval;p=p->next)
#define IVY_PAGE_MASK
Definition: ivyMem.c:32
Definition: ivy.h:73
#define IVY_PAGE_SIZE
DECLARATIONS ///.
Definition: ivyMem.c:31
struct Ivy_Obj_t_ Ivy_Obj_t
Definition: ivy.h:47
#define assert(ex)
Definition: util_old.h:213
void Ivy_ManStartMemory ( Ivy_Man_t p)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Starts the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file ivyMem.c.

50 {
51  p->vChunks = Vec_PtrAlloc( 128 );
52  p->vPages = Vec_PtrAlloc( 128 );
53 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Ivy_ManStopMemory ( Ivy_Man_t p)

Function*************************************************************

Synopsis [Stops the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file ivyMem.c.

67 {
68  void * pMemory;
69  int i;
70  Vec_PtrForEachEntry( void *, p->vChunks, pMemory, i )
71  ABC_FREE( pMemory );
72  Vec_PtrFree( p->vChunks );
73  Vec_PtrFree( p->vPages );
74  p->pListFree = NULL;
75 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223