* SUN compatible -verbose:class implemented.
[cacao.git] / src / mm / boehm.c
index 14c7c6bfd93968a59872ad33e807e557ab8fd34a..e7c44aa65dee3861c4c8673d1d60982450e8dcce 100644 (file)
@@ -1,9 +1,9 @@
-/* mm/boehm.c - interface for boehm gc
+/* src/mm/boehm.c - interface for boehm gc
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
-   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
-   P. Tomsich, J. Wenninger
+   Copyright (C) 1996-2005 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
 
    This file is part of CACAO.
 
 
    Authors: Stefan Ring
 
-   $Id: boehm.c 1144 2004-06-05 23:53:56Z twisti $
+   Changes: Christian Thalinger
+
+   $Id: boehm.c 2896 2005-07-04 20:38:33Z twisti $
 
 */
 
 #if defined(USE_THREADS) && defined(NATIVE_THREADS) && defined(__LINUX__)
 #define GC_LINUX_THREADS
 #endif
+#if defined(USE_THREADS) && defined(NATIVE_THREADS) && defined(__IRIX__)
+#define GC_IRIX_THREADS
+#endif
 
-#include "main.h"
-#include "boehm.h"
-#include "global.h"
-#include "native.h"
-#include "asmpart.h"
-#include "builtin.h"
-#include "threads/thread.h"
-#include "toolbox/logging.h"
 #include "boehm-gc/include/gc.h"
+#include "mm/boehm.h"
+
+#if defined(USE_THREADS)
+# if defined(NATIVE_THREADS)
+#  include "threads/native/threads.h"
+# else
+#  include "threads/green/threads.h"
+# endif
+#endif
+
+#include "toolbox/logging.h"
+#include "vm/options.h"
+#include "vm/builtin.h"
+#include "vm/exceptions.h"
+#include "vm/global.h"
+#include "vm/loader.h"
+#include "vm/stringlocal.h"
+#include "vm/tables.h"
+#include "vm/jit/asmpart.h"
 
 
 static bool in_gc_out_of_memory = false;    /* is GC out of memory?           */
 
 
-static void *stackcall_twoargs(struct otherstackcall *p)
+static void
+#ifdef __GNUC__
+       __attribute__ ((unused))
+#endif
+*stackcall_twoargs(struct otherstackcall *p)
 {
        return (*p->p2)(p->p, p->l);
 }
@@ -160,12 +180,15 @@ void heap_free(void *p)
        MAINTHREADCALL(result, stackcall_free, p, 0);
 }
 
+static void gc_ignore_warnings(char *msg, GC_word arg)
+{
+}
 
 void gc_init(u4 heapmaxsize, u4 heapstartsize)
 {
        size_t heapcurrentsize;
 
-       GC_init();
+       GC_INIT();
 
        /* set the maximal heap size */
        GC_set_max_heap_size(heapmaxsize);
@@ -178,12 +201,15 @@ void gc_init(u4 heapmaxsize, u4 heapstartsize)
 
        /* define OOM function */
        GC_oom_fn = gc_out_of_memory;
+
+       /* suppress warnings */
+       GC_set_warn_proc(gc_ignore_warnings);
 }
 
 
-void gc_call()
+void gc_call(void)
 {
-       if (collectverbose)
+       if (opt_verbosegc)
                dolog("Garbage Collection:  previous/now = %d / %d ",
                          0, 0);
 
@@ -191,31 +217,31 @@ void gc_call()
 }
 
 
-s8 gc_get_heap_size()
+s8 gc_get_heap_size(void)
 {
        return GC_get_heap_size();
 }
 
 
-s8 gc_get_free_bytes()
+s8 gc_get_free_bytes(void)
 {
        return GC_get_free_bytes();
 }
 
 
-s8 gc_get_max_heap_size()
+s8 gc_get_max_heap_size(void)
 {
        return GC_get_max_heap_size();
 }
 
 
-void gc_invoke_finalizers()
+void gc_invoke_finalizers(void)
 {
        GC_invoke_finalizers();
 }
 
 
-void gc_finalize_all()
+void gc_finalize_all(void)
 {
        GC_finalize_all();
 }
@@ -227,14 +253,14 @@ void gc_finalize_all()
 
 *******************************************************************************/
 
-void *gc_out_of_memory()
+void *gc_out_of_memory(size_t bytes_requested)
 {
        /* if this happens, we are REALLY out of memory */
 
        if (in_gc_out_of_memory) {
                /* this is all we can do... */
                throw_cacao_exception_exit(string_java_lang_InternalError,
-                                                                  "out of memory");
+                                                                  "Out of memory");
        }
 
        in_gc_out_of_memory = true;