1106113Sphk/* Functions to support a pool of allocatable objects 2106113Sphk Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004 3106113Sphk Free Software Foundation, Inc. 4106113Sphk Contributed by Daniel Berlin <dan@cgsoftware.com> 5106113Sphk 6106113SphkThis file is part of GCC. 7106113Sphk 8106113SphkGCC is free software; you can redistribute it and/or modify 9106113Sphkit under the terms of the GNU General Public License as published by 10106113Sphkthe Free Software Foundation; either version 2, or (at your option) 11106113Sphkany later version. 12106113Sphk 13106113SphkGCC is distributed in the hope that it will be useful, 14106113Sphkbut WITHOUT ANY WARRANTY; without even the implied warranty of 15106113SphkMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16106113SphkGNU General Public License for more details. 17106113Sphk 18106113SphkYou should have received a copy of the GNU General Public License 19106113Sphkalong with GCC; see the file COPYING. If not, write to 20106113Sphkthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 21106113SphkBoston, MA 02110-1301, USA. */ 22106113Sphk#ifndef ALLOC_POOL_H 23106113Sphk#define ALLOC_POOL_H 24106113Sphk 25106113Sphktypedef unsigned long ALLOC_POOL_ID_TYPE; 26106113Sphk 27113823Sphktypedef struct alloc_pool_list_def 28113823Sphk{ 29106113Sphk struct alloc_pool_list_def *next; 30106113Sphk} 31106113Sphk *alloc_pool_list; 32106113Sphk 33106113Sphktypedef struct alloc_pool_def 34106113Sphk{ 35106113Sphk const char *name; 36106113Sphk#ifdef ENABLE_CHECKING 37106113Sphk ALLOC_POOL_ID_TYPE id; 38113823Sphk#endif 39106113Sphk size_t elts_per_block; 40106113Sphk alloc_pool_list free_list; 41106949Snyan size_t elts_allocated; 42106949Snyan size_t elts_free; 43106745Sjake size_t blocks_allocated; 44106949Snyan alloc_pool_list block_list; 45106745Sjake size_t block_size; 46106745Sjake size_t elt_size; 47106745Sjake} 48106745Sjake *alloc_pool; 49106745Sjake 50106113Sphkextern alloc_pool create_alloc_pool (const char *, size_t, size_t); 51106113Sphkextern void free_alloc_pool (alloc_pool); 52106113Sphkextern void free_alloc_pool_if_empty (alloc_pool *); 53106113Sphkextern void *pool_alloc (alloc_pool); 54106113Sphkextern void pool_free (alloc_pool, void *); 55106113Sphkextern void dump_alloc_pool_statistics (void); 56106113Sphk#endif 57106113Sphk