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
37 #include "vm/global.h"
39 #include "vmcore/method.h"
42 /* reference types ************************************************************/
45 GC_REFTYPE_THREADOBJECT,
46 GC_REFTYPE_CLASSLOADER,
47 GC_REFTYPE_JNI_GLOBALREF,
56 /* function prototypes ********************************************************/
58 void gc_init(size_t heapmaxsize, size_t heapstartsize);
60 void* heap_alloc_uncollectable(size_t size);
61 void* heap_alloc(size_t size, int references, methodinfo *finalizer, bool collect);
62 void heap_free(void *p);
64 #if defined(ENABLE_GC_CACAO)
65 void heap_init_objectheader(java_object_t *o, uint32_t size);
66 int32_t heap_get_hashcode(java_object_t *o);
68 void gc_reference_register(java_object_t **ref, int32_t reftype);
69 void gc_reference_unregister(java_object_t **ref);
71 void gc_weakreference_register(java_object_t **ref, int32_t reftype);
72 void gc_weakreference_unregister(java_object_t **ref);
76 int64_t gc_get_heap_size(void);
77 int64_t gc_get_free_bytes(void);
78 int64_t gc_get_total_bytes(void);
79 int64_t gc_get_max_heap_size(void);
80 void gc_invoke_finalizers(void);
81 void gc_finalize_all(void);
82 void* gc_out_of_memory(size_t bytes_requested);
85 /* inlined functions **********************************************************/
87 static inline int32_t heap_hashcode(java_object_t *obj)
89 #if defined(ENABLE_GC_CACAO)
90 return heap_get_hashcode(obj);
92 return (int32_t)(intptr_t) obj;
100 #endif /* _GC_COMMON_H */
104 * These are local overrides for various environment variables in Emacs.
105 * Please do not remove this and leave it at the end of the file, where
106 * Emacs will automagically detect them.
107 * ---------------------------------------------------------------------
110 * indent-tabs-mode: t