1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-09 13:10:57 -08:00
emacs/mps/code/sac.h
Richard Brooksby 3d5e2ca85f Adding hopenames back into the master sources, so that they can be included in the union sources along with the id keywords.
This was achieved by partially undoing changelist 24817, including an accidental corruption of eventgen.pl.

Copied from Perforce
 Change: 24877
 ServerID: perforce.ravenbrook.com
2001-12-06 18:14:02 +00:00

81 lines
2 KiB
C

/* impl.h.sac: SEGREGATED ALLOCATION CACHES INTERFACE
*
* $Id$
* $HopeName: MMsrc!sac.h(trunk.2) $
* Copyright (c) 2001 Ravenbrook Limited.
*/
#ifndef sac_h
#define sac_h
#include "mpmtypes.h"
#include "mpm.h" /* for PoolArena */
#define sacClassLIMIT ((Count)8)
/* ExternalSAC -- the external face of segregated allocation caches */
/* .sac: This structure must match impl.h.mps.sac. */
typedef struct ExternalSACStruct *ExternalSAC;
typedef struct SACFreeListBlockStruct {
Size size;
Count count;
Count countMax;
Addr blocks;
} SACFreeListBlockStruct;
typedef SACFreeListBlockStruct *SACFreeListBlock;
typedef struct ExternalSACStruct {
size_t middle; /* block size for starting searches */
Bool trapped; /* trap status */
/* freelist, variable length */
SACFreeListBlockStruct freelists[2 * sacClassLIMIT];
} ExternalSACStruct;
/* SAC -- the real segregated allocation caches */
#define SACSig ((Sig)0x5195AC99) /* SIGnature SAC */
typedef struct SACStruct *SAC;
typedef struct SACStruct {
Sig sig;
Pool pool;
Count classesCount; /* number of classes */
Index middleIndex; /* index of the middle */
ExternalSACStruct esacStruct; /* variable length, must be last */
} SACStruct;
#define SACOfExternalSAC(esac) PARENT(SACStruct, esacStruct, esac)
#define ExternalSACOfSAC(sac) (&((sac)->esacStruct))
#define SACArena(sac) PoolArena((sac)->pool)
/* SACClasses -- structure for specifying classes in the cache */
/* .sacc: This structure must match impl.h.mps.sacc. */
typedef struct SACClassesStruct *SACClasses;
typedef struct SACClassesStruct {
Size blockSize;
Count cachedCount;
unsigned frequency;
} SACClassesStruct;
extern Res SACCreate(SAC *sac_o, Pool pool, Count classesCount,
SACClasses classes);
extern void SACDestroy(SAC sac);
extern Res SACFill(Addr *p_o, SAC sac, Size size, Bool hasReservoirPermit);
extern void SACEmpty(SAC sac, Addr p, Size size);
extern void SACFlush(SAC sac);
#endif /* sac_h */