* runboehmfinalizer: Removed.
authortwisti <none@none>
Thu, 3 Nov 2005 20:43:01 +0000 (20:43 +0000)
committertwisti <none@none>
Thu, 3 Nov 2005 20:43:01 +0000 (20:43 +0000)
* --disable-threads compile fixes.
* heap_allocate: Use finalizer_add.

src/mm/boehm.c

index d83b736d7b7fb9d808966ca2bb41868cd25d8a7e..3c0337d204ae66e74bc49730f4749b6d3c18778b 100644 (file)
 
    Changes: Christian Thalinger
 
-   $Id: boehm.c 3531 2005-11-02 13:29:38Z twisti $
+   $Id: boehm.c 3551 2005-11-03 20:43:01Z twisti $
 
 */
 
+
+#include "config.h"
+#include "vm/types.h"
+
 #if defined(USE_THREADS) && defined(NATIVE_THREADS) && defined(__LINUX__)
 #define GC_LINUX_THREADS
 #endif
@@ -41,6 +45,7 @@
 
 #include "boehm-gc/include/gc.h"
 #include "mm/boehm.h"
+#include "mm/memory.h"
 
 #if defined(USE_THREADS)
 # if defined(NATIVE_THREADS)
@@ -54,6 +59,7 @@
 #include "vm/options.h"
 #include "vm/builtin.h"
 #include "vm/exceptions.h"
+#include "vm/finalizer.h"
 #include "vm/global.h"
 #include "vm/loader.h"
 #include "vm/stringlocal.h"
@@ -61,6 +67,8 @@
 #include "vm/jit/asmpart.h"
 
 
+/* global variables ***********************************************************/
+
 static bool in_gc_out_of_memory = false;    /* is GC out of memory?           */
 
 
@@ -132,17 +140,6 @@ void *heap_alloc_uncollectable(u4 bytelength)
 }
 
 
-void runboehmfinalizer(void *o, void *p)
-{
-       java_objectheader *ob = (java_objectheader *) o;
-
-       asm_calljavafunction(ob->vftbl->class->finalizer, ob, NULL, NULL, NULL);
-       
-       /* if we had an exception in the finalizer, ignore it */
-       *exceptionptr = NULL;
-}
-
-
 void *heap_allocate(u4 bytelength, bool references, methodinfo *finalizer)
 {
        void *result;
@@ -158,7 +155,7 @@ void *heap_allocate(u4 bytelength, bool references, methodinfo *finalizer)
                return NULL;
 
        if (finalizer)
-               GC_REGISTER_FINALIZER(result, runboehmfinalizer, 0, 0, 0);
+               GC_REGISTER_FINALIZER(result, finalizer_add, 0, 0, 0);
 
        /* clear allocated memory region */
 
@@ -181,23 +178,28 @@ static void gc_ignore_warnings(char *msg, GC_word arg)
 
 void gc_init(u4 heapmaxsize, u4 heapstartsize)
 {
-       size_t heapcurrentsize;
+       size_t  heapcurrentsize;
 
        GC_INIT();
 
        /* set the maximal heap size */
+
        GC_set_max_heap_size(heapmaxsize);
 
        /* set the initial heap size */
+
        heapcurrentsize = GC_get_heap_size();
+
        if (heapstartsize > heapcurrentsize) {
                GC_expand_hp(heapstartsize - heapcurrentsize);
        }
 
        /* define OOM function */
+
        GC_oom_fn = gc_out_of_memory;
 
        /* suppress warnings */
+
        GC_set_warn_proc(gc_ignore_warnings);
 }