1 /* mm/cacao-gc/heap.h - GC header for heap management
3 Copyright (C) 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
35 #include "vm/array.h" /* needed for ARRAYTYPE_OBJECT */
38 #define GC_SIZE_DUMMY 0xff
40 #if SIZEOF_VOID_P == 8
41 # define GC_GET_SIZE(obj) ((u4) (((obj)->hdrflags >> 56) & 0xff))
42 # define GC_SET_SIZE(obj, size) ((obj)->hdrflags |= ((u8) ((size) & 0xff)) << 56)
44 # define GC_GET_SIZE(obj) ((u4) (((obj)->hdrflags >> 24) & 0xff))
45 # define GC_SET_SIZE(obj, size) ((obj)->hdrflags |= ((u4) ((size) & 0xff)) << 24)
49 extern s4 heap_current_size;
50 extern s4 heap_maximal_size;
51 extern regioninfo_t *heap_region_sys;
52 extern regioninfo_t *heap_region_main;
55 s4 get_object_size(java_object_t *o);
58 void heap_println_usage();
59 void heap_print_object(java_object_t *o);
60 void heap_dump_region(regioninfo_t *region, bool marked_only);
65 #define IS_ARRAY(o) ((o)->vftbl->arraydesc != NULL)
66 #define FOREACH_ARRAY_REF(o,ref,refptr,code) \
68 java_objectarray_t *a = (java_objectarray_t *) o; \
69 arraydescriptor *desc = o->vftbl->arraydesc; \
74 if (desc->arraytype == ARRAYTYPE_OBJECT) { \
75 for (i = 0; i < a->header.size; i++) { \
77 refptr = &( a->data[i] ); \
78 ref = (java_object_t *) (a->data[i]); \
85 #define FOREACH_OBJECT_REF(o,ref,refptr,code) \
87 classinfo *c = o->vftbl->class; \
93 for (; c; c = c->super) { \
94 for (i = 0; i < c->fieldscount; i++) { \
95 f = &(c->fields[i]); \
97 if (!IS_ADR_TYPE(f->type) || (f->flags & ACC_STATIC)) \
100 refptr = (java_object_t **) ((s1 *) o + f->offset); \
113 * These are local overrides for various environment variables in Emacs.
114 * Please do not remove this and leave it at the end of the file, where
115 * Emacs will automagically detect them.
116 * ---------------------------------------------------------------------
119 * indent-tabs-mode: t
123 * vim:noexpandtab:sw=4:ts=4: