mono_gc_register_root ((char*)&(x), sizeof(MonoObject*), mono_gc_make_root_descr_all_refs (1)); \
} while (0)
+/*
+ * This is used for fields which point to objects which are kept alive by other references
+ * when using Boehm.
+ */
+#ifdef HAVE_SGEN_GC
+#define MONO_GC_REGISTER_ROOT_IF_MOVING(x) do { \
+ MONO_GC_REGISTER_ROOT_SINGLE(x); \
+} while (0)
+
+#define MONO_GC_UNREGISTER_ROOT_IF_MOVING(x) do { \
+ MONO_GC_UNREGISTER_ROOT (x); \
+} while (0)
+#else
+#define MONO_GC_REGISTER_ROOT_IF_MOVING(x)
+#define MONO_GC_UNREGISTER_ROOT_IF_MOVING(x)
+#endif
+
+/* useful until we keep track of gc-references in corlib etc. */
+#ifdef HAVE_SGEN_GC
+#define IS_GC_REFERENCE(t) FALSE
+#else
+#define IS_GC_REFERENCE(t) ((t)->type == MONO_TYPE_U && class->image == mono_defaults.corlib)
+#endif
+
void mono_object_register_finalizer (MonoObject *obj) MONO_INTERNAL;
void ves_icall_System_GC_InternalCollect (int generation) MONO_INTERNAL;
gint64 ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection) MONO_INTERNAL;
extern gboolean mono_gc_is_finalizer_internal_thread (MonoInternalThread *thread) MONO_INTERNAL;
+extern void mono_gc_set_stack_end (void *stack_end) MONO_INTERNAL;
+
/* only valid after the RECLAIM_START GC event and before RECLAIM_END
* Not exported in public headers, but can be linked to (unsupported).
*/
int mono_gc_finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size) MONO_INTERNAL;
void mono_gc_run_finalize (void *obj, void *data) MONO_INTERNAL;
void mono_gc_clear_domain (MonoDomain * domain) MONO_INTERNAL;
+void* mono_gc_alloc_mature (MonoVTable *vtable) MONO_INTERNAL;
/*
* Register a root which can only be written using a write barrier.
* needed by the other functions.
*/
gpointer (*thread_attach_func) (void);
- /* FIXME: Add a cleanup function too */
+ /*
+ * Function called during thread deatch to free the data allocated by
+ * thread_attach_func.
+ */
+ void (*thread_detach_func) (gpointer user_data);
/*
* Function called from every thread when suspending for GC. It can save
* data needed for marking from thread stacks. user_data is the data returned
void* mono_gc_invoke_with_gc_lock (MonoGCLockedCallbackFunc func, void *data) MONO_INTERNAL;
-#ifdef HAVE_SGEN_GC
int mono_gc_get_los_limit (void) MONO_INTERNAL;
guint8* mono_gc_get_card_table (int *shift_bits, gpointer *card_mask) MONO_INTERNAL;
void* mono_gc_get_nursery (int *shift_bits, size_t *size) MONO_INTERNAL;
-#endif
/*
* Return whenever GC is disabled
gboolean mono_gc_parse_environment_string_extract_number (const char *str, glong *out) MONO_INTERNAL;
+gboolean mono_gc_precise_stack_mark_enabled (void) MONO_INTERNAL;
+
+FILE *mono_gc_get_logfile (void) MONO_INTERNAL;
+
+typedef void (*mono_reference_queue_callback) (void *user_data);
+
+typedef struct _MonoReferenceQueue MonoReferenceQueue;
+typedef struct _RefQueueEntry RefQueueEntry;
+
+struct _RefQueueEntry {
+#ifdef HAVE_SGEN_GC
+ void *dis_link;
+#else
+ guint32 gchandle;
+#endif
+ void *user_data;
+ RefQueueEntry *next;
+};
+
+struct _MonoReferenceQueue {
+ RefQueueEntry *queue;
+ mono_reference_queue_callback callback;
+ MonoReferenceQueue *next;
+ gboolean should_be_deleted;
+};
+
+MonoReferenceQueue* mono_gc_reference_queue_new (mono_reference_queue_callback callback) MONO_INTERNAL;
+void mono_gc_reference_queue_free (MonoReferenceQueue *queue) MONO_INTERNAL;
+gboolean mono_gc_reference_queue_add (MonoReferenceQueue *queue, MonoObject *obj, void *user_data) MONO_INTERNAL;
+
+#ifdef HOST_WIN32
+BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved) MONO_INTERNAL;
+#endif
+
#endif /* __MONO_METADATA_GC_INTERNAL_H__ */