1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-27 07:30:59 -08:00

Adding class methods

Copied from Perforce
 Change: 15267
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Brooksby 1996-02-16 18:20:18 +00:00
parent 064134c09a
commit f0a7b65cd2
2 changed files with 63 additions and 61 deletions

View file

@ -1,35 +1,34 @@
/* ==== MANUAL FIXED SMALL UNIT POOL ====
/* impl.c.poolmfs: MANUAL FIXED SMALL UNIT POOL
*
* $HopeName: MMsrc!poolmfs.c(trunk.7) $
* $HopeName: MMsrc!poolmfs.c(trunk.8) $
* Copyright (C) 1994,1995 Harlequin Group, all rights reserved
*
* Copyright (C) 1994,1995 Harlequin Group, all rights reserved
* This is the implementation of the MFS pool class. PoolMFS operates
* in a very simple manner: each segment is divided into units. Free
* units are kept on a linked list using a header stored in the unit
* itself. The linked list it not ordered, so allocation and
* deallocation simply pop and push from the head of the list. This is
* fast, but successive allocations might have poor locality if
* previous successive frees did.
*
* This is the implementation of the MFS pool class. PoolMFS operates
* in a very simple manner: each segment is divided into units. Free
* units are kept on a linked list using a header stored in the unit
* itself. The linked list it not ordered, so allocation and
* deallocation simply pop and push from the head of the list. This is
* fast, but successive allocations might have poor locality if
* previous successive frees did.
* **** RESTRICTION: This pool cannot allocate from the arena control
* pool, nor can it allocate sub-pools, as it is used in the arena
* bootstrap sequence. See the arena manager implementation for
* details.
*
* **** RESTRICTION: This pool cannot allocate from the arena control
* pool, nor can it allocate sub-pools, as it is used in the arena
* bootstrap sequence. See the arena manager implementation for
* details.
*
* Notes
* 1. The simple freelist policy might lead to poor locality of allocation
* if the list gets fragmented. richard 1994-11-03
* 2. free should check that the pointer it is asked to free is in a
* segment owned by the pool. This required more support from the
* arena manager than is currently available. richard 1994-11-03
* 3. A describe method is needed. richard 1994-11-03
* 4. By not using the rounded extent of a segment some space may be
* wasted at the end in alloc. richard 1994-11-03
* 5. isValid should check that free list points into the pool.
* richard 1994-11-03
* 6. This pool doesn't support fast cache allocation, which is a shame.
* richard 1994-11-03
* Notes
* 1. The simple freelist policy might lead to poor locality of
* allocation if the list gets fragmented. richard 1994-11-03
* 2. free should check that the pointer it is asked to free is in a
* segment owned by the pool. This required more support from the
* arena manager than is currently available. richard 1994-11-03
* 3. A describe method is needed. richard 1994-11-03
* 4. By not using the rounded extent of a segment some space may be
* wasted at the end in alloc. richard 1994-11-03
* 5. isValid should check that free list points into the pool.
* richard 1994-11-03
* 6. This pool doesn't support fast cache allocation, which is a
* shame. richard 1994-11-03
*/
#include "std.h"
@ -44,7 +43,7 @@
#include <stdarg.h>
#include <stddef.h>
SRCID("$HopeName$");
SRCID("$HopeName: MMsrc!poolmfs.c(trunk.8) $");
/* == Round up ==
@ -73,7 +72,9 @@ PoolClass PoolClassMFS(void)
create, destroy,
alloc, free_,
NULL, NULL, /* bufferCreate, bufferDestroy */
NULL, NULL, NULL, /* comdemn, mark, scan */
NULL, NULL, /* bufferFill, bufferTrip */
NULL, NULL, /* bufferExpose, bufferCover */
NULL, NULL, /* mark, scan */
NULL, NULL, /* fix, relcaim */
NULL, NULL, /* access, poll */
describe);

View file

@ -1,36 +1,35 @@
/* ==== MANUAL VARIABLE POOL ====
/* impl.c.poolmv: MANUAL VARIABLE POOL
*
* $HopeName: MMsrc!poolmv.c(trunk.9) $
* $HopeName: MMsrc!poolmv.c(trunk.10) $
* Copyright (C) 1994, 1995 Harlequin Group, all rights reserved
*
* Copyright (C) 1994, 1995 Harlequin Group, all rights reserved
* **** RESTRICTION: This pool may not allocate from the arena control
* pool, since it is used to implement that pool.
* It may call PoolCreate, which allocates from the
* poolPool.
*
* **** RESTRICTION: This pool may not allocate from the arena control
* pool, since it is used to implement that pool.
* It may call PoolCreate, which allocates from the
* poolPool.
* An observation: Freeing memory introduces more information
* into the system than allocating it. This causes the problem described
* in note 2.
*
* An observation: Freeing memory introduces more information
* into the system than allocating it. This causes the problem described
* in note 2.
*
* Notes
* 1. Need to measure typical fragmentation levels and adjust the
* blockExtendBy parameter appropriately. richard 1994-11-08
* 2. free can lose memory if it can't allocate a block descriptor. The
* memory could be pushed onto a special chain to be reclaimed later.
* richard 1994-11-09
* 3. The span chain could be adaptive. richard 1994-11-09
* 4. Spans with no blocks could be freed. richard 1994-11-09
* 5. An MFS pool for the block descriptors is justified, but not really
* for the spans, which are much rarer. richard 1994-11-09
* 7. IsValid should check pointer destinations are in the right pools.
* richard 1994-11-10
* 8. By changing SpanAlloc it might be possible to keep track of all
* allocated blocks using descriptors, for debugging purposes. richard
* 1994-11-10
* 9. (See note 7.) IsValid methods can't easily get hold of the relevant
* pools in ordr to check pointers using PoolAddrPool.
* 1995-01-19 drj
* Notes
* 1. Need to measure typical fragmentation levels and adjust the
* blockExtendBy parameter appropriately. richard 1994-11-08
* 2. free can lose memory if it can't allocate a block descriptor. The
* memory could be pushed onto a special chain to be reclaimed later.
* richard 1994-11-09
* 3. The span chain could be adaptive. richard 1994-11-09
* 4. Spans with no blocks could be freed. richard 1994-11-09
* 5. An MFS pool for the block descriptors is justified, but not really
* for the spans, which are much rarer. richard 1994-11-09
* 7. IsValid should check pointer destinations are in the right pools.
* richard 1994-11-10
* 8. By changing SpanAlloc it might be possible to keep track of all
* allocated blocks using descriptors, for debugging purposes. richard
* 1994-11-10
* 9. (See note 7.) IsValid methods can't easily get hold of the relevant
* pools in ordr to check pointers using PoolAddrPool.
* 1995-01-19 drj
*/
#include "std.h"
@ -44,7 +43,7 @@
#include "mpscmv.h"
#include <stdarg.h>
SRCID("$HopeName: MMsrc!poolmv.c(trunk.9) $");
SRCID("$HopeName: MMsrc!poolmv.c(trunk.10) $");
#define BLOCKPOOL(mv) (PoolMFSPool(&(mv)->blockPoolStruct))
@ -69,7 +68,9 @@ PoolClass PoolClassMV(void)
create, destroy,
alloc, free_,
NULL, NULL, /* bufferCreate, bufferDestroy */
NULL, NULL, NULL, /* condemn, mark, scan */
NULL, NULL, /* bufferFill, bufferTrip */
NULL, NULL, /* bufferExpose, bufferCover */
NULL, NULL, /* mark, scan */
NULL, NULL, /* fix, relcaim */
NULL, NULL, /* access, poll */
describe);