From f0a7b65cd2dbb39fe9d77e3f3c90cd706e4b0838 Mon Sep 17 00:00:00 2001 From: Richard Brooksby Date: Fri, 16 Feb 1996 18:20:18 +0000 Subject: [PATCH] Adding class methods Copied from Perforce Change: 15267 ServerID: perforce.ravenbrook.com --- mps/src/poolmfs.c | 61 +++++++++++++++++++++++---------------------- mps/src/poolmv.c | 63 ++++++++++++++++++++++++----------------------- 2 files changed, 63 insertions(+), 61 deletions(-) diff --git a/mps/src/poolmfs.c b/mps/src/poolmfs.c index af8e7af4db4..92cf840ffc9 100644 --- a/mps/src/poolmfs.c +++ b/mps/src/poolmfs.c @@ -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 #include -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); diff --git a/mps/src/poolmv.c b/mps/src/poolmv.c index db627dc3fee..25e603e0a69 100644 --- a/mps/src/poolmv.c +++ b/mps/src/poolmv.c @@ -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 -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);