1 /* src/mm/gc-common.h - gc independant interface for heap managment
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
33 #include "vm/global.h"
35 #include "vmcore/method.h"
38 /* reference types ************************************************************/
41 GC_REFTYPE_THREADOBJECT,
42 GC_REFTYPE_CLASSLOADER,
43 GC_REFTYPE_JNI_GLOBALREF,
52 /* function prototypes ********************************************************/
54 void gc_init(size_t heapmaxsize, size_t heapstartsize);
56 void* heap_alloc_uncollectable(size_t size);
57 void* heap_alloc(size_t size, int references, methodinfo *finalizer, bool collect);
58 void heap_free(void *p);
60 #if defined(ENABLE_GC_CACAO)
61 void heap_init_objectheader(java_object_t *o, uint32_t size);
62 int32_t heap_get_hashcode(java_object_t *o);
64 void gc_reference_register(java_object_t **ref, int32_t reftype);
65 void gc_reference_unregister(java_object_t **ref);
67 void gc_weakreference_register(java_object_t **ref, int32_t reftype);
68 void gc_weakreference_unregister(java_object_t **ref);
72 int64_t gc_get_heap_size(void);
73 int64_t gc_get_free_bytes(void);
74 int64_t gc_get_total_bytes(void);
75 int64_t gc_get_max_heap_size(void);
76 void gc_invoke_finalizers(void);
77 void gc_finalize_all(void);
78 void* gc_out_of_memory(size_t bytes_requested);
81 /* inlined functions **********************************************************/
83 static inline int32_t heap_hashcode(java_object_t *obj)
85 #if defined(ENABLE_GC_CACAO)
86 return heap_get_hashcode(obj);
88 return (int32_t)(intptr_t) obj;
92 #endif /* _GC_COMMON_H */
96 * These are local overrides for various environment variables in Emacs.
97 * Please do not remove this and leave it at the end of the file, where
98 * Emacs will automagically detect them.
99 * ---------------------------------------------------------------------
102 * indent-tabs-mode: t