* src/vm/jit/i386/linux/md-os.c: Cleaned up.
[cacao.git] / src / mm / cacao-gc / gc.h
index a6af0e06ad7fa9abfc524e837b8bae822d7e7b37..f5e624c1265e92b8cf322b01ab050df8ea38a54f 100644 (file)
 #define _GC_H
 
 
+#include "config.h"
+#include "vm/types.h"
+
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
+#endif
+
+
+/* Configuration Switches *****************************************************/
+
+/*#define GCCONF_FINALIZER*/
+/*#define GCCONF_HDRFLAG_REFERENCING*/
+
+
 /* Debugging ******************************************************************/
 
 #define GC_DEBUGGING
-#define GC_DEBUGGING2
+/*#define GC_DEBUGGING2*/
 
 #if !defined(NDEBUG) && defined(GC_DEBUGGING)
 # include <assert.h>
@@ -64,7 +78,7 @@
 
 /* Development Break **********************************************************/
 
-#if 1 && defined(ENABLE_THREADS)
+#if 0 && defined(ENABLE_THREADS)
 # error "GC does not work with threads enabled!"
 #endif
 
 #endif
 
 
-/* Global Variables ***********************************************************/
-
-static bool gc_pending;
-
-
 /* Helper Macros **************************************************************/
 
 #define GC_SET_FLAGS(obj, flags)   ((obj)->hdrflags |=  (flags))
@@ -97,7 +106,38 @@ static bool gc_pending;
 #define GC_TEST_FLAGS(obj, flags)  ((obj)->hdrflags  &  (flags))
 
 #define POINTS_INTO(ptr, ptr_start, ptr_end) \
-       ((void *) (ptr) > (ptr_start) && (void *) (ptr) < (ptr_end))
+       ((void *) (ptr) >= (ptr_start) && (void *) (ptr) < (ptr_end))
+
+
+/* Global Variables ***********************************************************/
+
+extern bool gc_pending;
+extern bool gc_notify_finalizer;
+
+
+/* Prototypes *****************************************************************/
+
+#if defined(ENABLE_THREADS)
+void gc_suspend(threadobject *thread, ucontext_t *context);
+#endif
+
+
+/* Statistics *****************************************************************/
+
+#if defined(ENABLE_STATISTICS)
+
+#define GCSTAT_INIT(cnt)  { (cnt) = 0; }
+#define GCSTAT_COUNT(cnt) { (cnt)++; }
+#define GCSTAT_DEC(cnt)   { (cnt)--; GC_ASSERT((cnt) >= 0); }
+#define GCSTAT_COUNT_MAX(cnt,max) { (cnt)++; if ((cnt) > (max)) (max) = (cnt); }
+
+extern int gcstat_mark_depth;
+extern int gcstat_mark_depth_max;
+extern int gcstat_mark_count;
+
+void gcstat_println();
+
+#endif /* defined(ENABLE_STATISTICS) */
 
 
 #endif /* _GC_H */