00001 /* Functions to support a pool of allocatable objects 00002 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004 00003 Free Software Foundation, Inc. 00004 Contributed by Daniel Berlin <dan@cgsoftware.com> 00005 00006 This file is part of GCC. 00007 00008 GCC is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2, or (at your option) 00011 any later version. 00012 00013 GCC is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with GCC; see the file COPYING. If not, write to 00020 the Free Software Foundation, 59 Temple Place - Suite 330, 00021 Boston, MA 02111-1307, USA. */ 00022 #ifndef ALLOC_POOL_H 00023 #define ALLOC_POOL_H 00024 00025 typedef unsigned long ALLOC_POOL_ID_TYPE; 00026 00027 typedef struct alloc_pool_list_def 00028 { 00029 struct alloc_pool_list_def *next; 00030 } 00031 *alloc_pool_list; 00032 00033 typedef struct alloc_pool_def 00034 { 00035 const char *name; 00036 #ifdef ENABLE_CHECKING 00037 ALLOC_POOL_ID_TYPE id; 00038 #endif 00039 size_t elts_per_block; 00040 alloc_pool_list free_list; 00041 size_t elts_allocated; 00042 size_t elts_free; 00043 size_t blocks_allocated; 00044 alloc_pool_list block_list; 00045 size_t block_size; 00046 size_t elt_size; 00047 } 00048 *alloc_pool; 00049 00050 extern alloc_pool create_alloc_pool (const char *, size_t, size_t); 00051 extern void free_alloc_pool (alloc_pool); 00052 extern void *pool_alloc (alloc_pool); 00053 extern void pool_free (alloc_pool, void *); 00054 extern void dump_alloc_pool_statistics (void); 00055 #endif
1.5.6