/* src/mm/boehm.c - interface for boehm gc
- Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
- C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
- E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
- J. Wenninger, Institut f. Computersprachen - TU Wien
+ Copyright (C) 1996-2005, 2006, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: boehm.c 7615 2007-03-29 23:10:59Z michi $
-
*/
#include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
#if defined(ENABLE_THREADS) && defined(__LINUX__)
#define GC_LINUX_THREADS
#if defined(ENABLE_THREADS) && defined(__IRIX__)
#define GC_IRIX_THREADS
#endif
+#if defined(ENABLE_THREADS) && defined(__DARWIN__)
+#define GC_DARWIN_THREADS
+#endif
#include "boehm-gc/include/gc.h"
-#include "mm/gc-common.h"
+#include "mm/gc.hpp"
#include "mm/memory.h"
#include "toolbox/logging.h"
#include "vm/finalizer.h"
#include "vm/global.h"
#include "vm/stringlocal.h"
-#include "vm/vm.h"
+#include "vm/vm.hpp"
#include "vmcore/loader.h"
#include "vmcore/options.h"
*******************************************************************************/
-void gc_init(u4 heapmaxsize, u4 heapstartsize)
+void gc_init(size_t heapmaxsize, size_t heapstartsize)
{
size_t heapcurrentsize;
- GC_INIT();
+ TRACESUBSYSTEMINITIALIZATION("gc_init");
- /* set the maximal heap size */
+ /* just to be sure (should be set to 1 by JAVA_FINALIZATION macro) */
- GC_set_max_heap_size(heapmaxsize);
+ GC_java_finalization = 1;
- /* set the initial heap size */
+ /* Ignore pointers that do not point to the start of an object. */
- heapcurrentsize = GC_get_heap_size();
+ GC_all_interior_pointers = 0;
- if (heapstartsize > heapcurrentsize) {
- GC_expand_hp(heapstartsize - heapcurrentsize);
- }
+ /* suppress warnings */
+
+ GC_set_warn_proc(gc_ignore_warnings);
+
+ /* install a GC notifier */
+
+ GC_finalize_on_demand = 1;
+ GC_finalizer_notifier = finalizer_notify;
/* define OOM function */
GC_oom_fn = gc_out_of_memory;
- /* just to be sure (should be set to 1 by JAVA_FINALIZATION macro) */
+ GC_INIT();
- GC_java_finalization = 1;
+ /* set the maximal heap size */
- /* suppress warnings */
+ GC_set_max_heap_size(heapmaxsize);
- GC_set_warn_proc(gc_ignore_warnings);
+ /* set the initial heap size */
- /* install a GC notifier */
+ heapcurrentsize = GC_get_heap_size();
- GC_finalize_on_demand = 1;
- GC_finalizer_notifier = finalizer_notify;
+ if (heapstartsize > heapcurrentsize)
+ GC_expand_hp(heapstartsize - heapcurrentsize);
}
}
-void *heap_alloc_uncollectable(u4 size)
+void *heap_alloc_uncollectable(size_t size)
{
void *p;
/* clear allocated memory region */
- MSET(p, 0, u1, bytelength);
+ MSET(p, 0, uint8_t, size);
return p;
}
*******************************************************************************/
-void *heap_alloc(u4 size, u4 references, methodinfo *finalizer, bool collect)
+void *heap_alloc(size_t size, int references, methodinfo *finalizer, bool collect)
{
void *p;
#if defined(ENABLE_RT_TIMING)
return NULL;
if (finalizer != NULL)
- GC_REGISTER_FINALIZER(p, finalizer_run, 0, 0, 0);
+ GC_REGISTER_FINALIZER_NO_ORDER(p, finalizer_run, 0, 0, 0);
/* clear allocated memory region */
- MSET(p, 0, u1, size);
+ MSET(p, 0, uint8_t, size);
RT_TIMING_GET_TIME(time_end);
RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_GC_ALLOC);
}
-s8 gc_get_heap_size(void)
+int64_t gc_get_heap_size(void)
{
return GC_get_heap_size();
}
-s8 gc_get_free_bytes(void)
+int64_t gc_get_free_bytes(void)
{
return GC_get_free_bytes();
}
*******************************************************************************/
-s8 gc_get_total_bytes(void)
+int64_t gc_get_total_bytes(void)
{
return GC_get_total_bytes();
}
-s8 gc_get_max_heap_size(void)
+int64_t gc_get_max_heap_size(void)
{
return GC_get_max_heap_size();
}