* src/threads/posix/lock.c: Moved to .cpp.
[cacao.git] / src / mm / cacao-gc / gc.c
index f2739cbdbf6307cd498fe5ec8efe334dc81e8c20..e9fd6d50f66e34a5f5232eff0da07d1cb7bcaf71 100644 (file)
@@ -1,7 +1,7 @@
 /* src/mm/cacao-gc/gc.c - main garbage collector methods
 
    Copyright (C) 2006, 2007, 2008
-   CACAOVM - Verein zu Foerderung der freien virtuellen Machine CACAO
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
@@ -30,8 +30,8 @@
 
 #include "vm/types.h"
 
-#include "threads/lock-common.h"
-#include "threads/threads-common.h"
+#include "threads/lock.hpp"
+#include "threads/thread.hpp"
 
 #include "compact.h"
 #include "copy.h"
 #include "rootset.h"
 #include "mm/memory.h"
 #include "toolbox/logging.h"
+
 #include "vm/finalizer.h"
-#include "vm/vm.h"
-#include "vmcore/rt-timing.h"
+#include "vm/rt-timing.h"
+#include "vm/vm.hpp"
 
 
 /* Global Variables ***********************************************************/
@@ -139,7 +140,7 @@ static void gc_reference_register_intern(list_t *list, java_object_t **ref, int3
 
 #if !defined(NDEBUG)
        /* check if this reference is already registered */
-       for (re = list_first_unsynced(list); re != NULL; re = list_next_unsynced(list, re)) {
+       for (re = list_first(list); re != NULL; re = list_next(list, re)) {
                if (re->ref == ref)
                        vm_abort("gc_reference_register_intern: reference already registered");
        }
@@ -154,7 +155,7 @@ static void gc_reference_register_intern(list_t *list, java_object_t **ref, int3
 #endif
 
        /* add the entry to the given list */
-       list_add_last_unsynced(list, re);
+       list_add_last(list, re);
 
        /* the global GC lock also guards the reference lists */
        GC_MUTEX_UNLOCK;
@@ -187,10 +188,10 @@ static void gc_reference_unregister_intern(list_t *list, java_object_t **ref)
        GC_LOG2( printf("Un-Registering Reference at %p\n", (void *) ref); );
 
        /* search for the appropriate reference entry */
-       for (re = list_first_unsynced(list); re != NULL; re = list_next_unsynced(list, re)) {
+       for (re = list_first(list); re != NULL; re = list_next(list, re)) {
                if (re->ref == ref) {
                        /* remove the entry from the given list */
-                       list_remove_unsynced(list, re);
+                       list_remove(list, re);
 
                        /* free the reference entry */
                        FREE(re, list_gcref_entry_t);
@@ -234,8 +235,7 @@ void gc_collect(s4 level)
        rootset_t    *rs;
        int32_t       dumpmarker;
 #if !defined(NDEBUG)
-       stackframeinfo_t *sfi;
-       stacktracebuffer *stb;
+       stacktrace_t *st;
 #endif
 #if defined(ENABLE_RT_TIMING)
        struct timespec time_start, time_suspend, time_rootset, time_mark, time_compact, time_end;
@@ -270,11 +270,10 @@ void gc_collect(s4 level)
 #if !defined(NDEBUG)
        /* get the stacktrace of the current thread and make sure it is non-empty */
        GC_LOG( printf("Stacktrace of current thread:\n"); );
-       sfi = STACKFRAMEINFO;
-       stb = stacktrace_create(sfi);
-       if (stb == NULL)
+       st = stacktrace_get_current();
+       if (st == NULL)
                vm_abort("gc_collect: no stacktrace available for current thread!");
-       GC_LOG( stacktrace_print_trace_from_buffer(stb); );
+       GC_LOG( stacktrace_print(st); );
 #endif
 
        /* sourcestate of the current thread, assuming we are in the native world */