1 /* src/mm/dumpmemory.h - dump memory management
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 /* forward typedefs ***********************************************************/
31 typedef struct dumpblock_t dumpblock_t;
32 typedef struct dumpinfo_t dumpinfo_t;
40 /* ATTENTION: We need to define dumpblock_t and dumpinfo_t before
41 internal includes, as we need dumpinfo_t as nested structure in
44 /* dumpblock ******************************************************************/
46 #define DUMPBLOCKSIZE 2 << 13 /* 2 * 8192 bytes */
56 /* dump_allocation *************************************************************
58 This struct is used to record dump memory allocations for ENABLE_MEMCHECK.
60 *******************************************************************************/
62 #if defined(ENABLE_MEMCHECK)
63 typedef struct dump_allocation_t dump_allocation_t;
65 struct dump_allocation_t {
66 dump_allocation_t *next;
74 /* dumpinfo *******************************************************************/
77 dumpblock_t *block; /* the current top-most block */
78 int32_t allocated; /* allocated bytes in this area */
79 int32_t used; /* used bytes in this dump area */
80 #if defined(ENABLE_MEMCHECK)
81 dump_allocation_t *allocations; /* list of allocations in this area */
86 /* convenience macros *********************************************************/
88 #define DMARKER dumpmarker = dumpmemory_marker()
89 #define DRELEASE dumpmemory_release(dumpmarker)
91 #define DNEW(type) ((type *) dumpmemory_get(sizeof(type)))
92 #define DMNEW(type,num) ((type *) dumpmemory_get(sizeof(type) * (num)))
93 #define DMREALLOC(ptr,type,num1,num2) dumpmemory_realloc((ptr), sizeof(type) * (num1), \
94 sizeof(type) * (num2))
96 /* function prototypes ********************************************************/
98 void *dumpmemory_get(size_t size);
99 void *dumpmemory_realloc(void *src, int32_t len1, int32_t len2);
100 int32_t dumpmemory_marker(void);
101 void dumpmemory_release(int32_t size);
103 #endif /* _DUMPMEMORY_H */
107 * These are local overrides for various environment variables in Emacs.
108 * Please do not remove this and leave it at the end of the file, where
109 * Emacs will automagically detect them.
110 * ---------------------------------------------------------------------
113 * indent-tabs-mode: t
117 * vim:noexpandtab:sw=4:ts=4: