Merged with tip.
[cacao.git] / src / mm / cacao-gc / gc.h
index ee8ac829f614ceddf143cabbe9fc997c525d2236..31060381d73868057a9a8dcbfb33960a0ee6cf40 100644 (file)
@@ -1,9 +1,7 @@
 /* src/mm/cacao-gc/gc.h - main garbage collector header
 
-   Copyright (C) 2006 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) 2006, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
@@ -22,8 +20,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id$
-
 */
 
 
@@ -39,9 +35,7 @@
 #include "config.h"
 #include "vm/types.h"
 
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#endif
+#include "threads/thread.h"
 
 #include "toolbox/list.h"
 #include "vm/jit/replace.h"
 # error "GC does only work with replacement enabled!"
 #endif
 
+#if 1 && !defined(ENABLE_HANDLES)
+# error "GC does only work with handles (indirection cells) enabled!"
+#endif
+
 #if 1 && !defined(__ALPHA__) && !defined(__ARM__) && !defined(__I386__) && !defined(__POWERPC__) && !defined(__X86_64__) && !defined(__M68K__) && !defined(__SPARC_64__)
 # error "GC was only ported to some architectures so far!"
 #endif
 extern bool gc_pending;
 extern bool gc_notify_finalizer;
 
-extern list_t *gc_reflist;
+extern list_t *gc_reflist_strong;
+extern list_t *gc_reflist_weak;
 
 
 /* Structures *****************************************************************/
@@ -126,9 +125,23 @@ typedef struct list_gcref_entry_t list_gcref_entry_t;
 struct list_gcref_entry_t {
        listnode_t      linkage;
        java_object_t **ref;
+#if !defined(NDEBUG)
+       s4              reftype;
+#endif
 };
 
 
+/* Global GC mutext stuff *****************************************************/
+
+#if defined(ENABLE_THREADS)
+# define GC_MUTEX_LOCK   threads_mutex_gc_lock()
+# define GC_MUTEX_UNLOCK threads_mutex_gc_unlock()
+#else
+# define GC_MUTEX_LOCK
+# define GC_MUTEX_UNLOCK
+#endif
+
+
 /* No-Thread specific stuff ***************************************************/
 
 #if defined(ENABLE_THREADS)