Merge pull request #1014 from txdv/master
[mono.git] / libgc / include / gc.h
index f7f3f01d77996a3efafb70763ecadf20c24963a1..4693a3d9a5416248700084c6acbb32d2ba3028d4 100644 (file)
@@ -61,8 +61,9 @@
   /* Win64 isn't really supported yet, but this is the first step. And */
   /* it might cause error messages to show up in more plausible places.        */
   /* This needs basetsd.h, which is included by windows.h.             */
-  typedef ULONG_PTR GC_word;
-  typedef LONG_PTR GC_word;
+  #include <stdint.h>
+  typedef unsigned __int64 GC_word;
+  typedef __int64 GC_signed_word;
 #endif
 
 /* Public read-only variables */
@@ -98,7 +99,11 @@ typedef enum {
        GC_EVENT_MARK_END,
        GC_EVENT_RECLAIM_START,
        GC_EVENT_RECLAIM_END,
-       GC_EVENT_END
+       GC_EVENT_END,
+       GC_EVENT_PRE_STOP_WORLD,
+       GC_EVENT_POST_STOP_WORLD,
+       GC_EVENT_PRE_START_WORLD,
+       GC_EVENT_POST_START_WORLD
 } GCEventType;
 
 GC_API void (*GC_notify_event) GC_PROTO((GCEventType event_type));
@@ -420,6 +425,14 @@ GC_API size_t GC_get_bytes_since_gc GC_PROTO((void));
 /* Never decreases, except due to wrapping.                            */
 GC_API size_t GC_get_total_bytes GC_PROTO((void));
 
+/* Return the signal used by the gc to suspend threads on posix platforms. */
+/* Return -1 otherwise. */
+int GC_get_suspend_signal GC_PROTO((void));
+
+/* Return the signal used by the gc to resume threads on posix platforms. */
+/* Return -1 otherwise. */
+int GC_get_restart_signal GC_PROTO((void));
+
 /* Disable garbage collection.  Even GC_gcollect calls will be                 */
 /* ineffective.                                                                */
 GC_API void GC_disable GC_PROTO((void));
@@ -592,6 +605,8 @@ GC_API GC_PTR GC_debug_realloc_replacement
 #   define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
 #   define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
        GC_general_register_disappearing_link(link, GC_base(obj))
+#   define GC_REGISTER_LONG_LINK(link, obj) \
+       GC_register_long_link(link, GC_base(obj))
 #   define GC_REGISTER_DISPLACEMENT(n) GC_debug_register_displacement(n)
 # else
 #   define GC_MALLOC(sz) GC_malloc(sz)
@@ -614,6 +629,8 @@ GC_API GC_PTR GC_debug_realloc_replacement
 #   define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p)
 #   define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
        GC_general_register_disappearing_link(link, obj)
+#   define GC_REGISTER_LONG_LINK(link, obj) \
+       GC_register_long_link(link, obj)
 #   define GC_REGISTER_DISPLACEMENT(n) GC_register_displacement(n)
 # endif
 /* The following are included because they are often convenient, and   */
@@ -753,6 +770,18 @@ GC_API int GC_unregister_disappearing_link GC_PROTO((GC_PTR * /* link */));
        /* Undoes a registration by either of the above two     */
        /* routines.                                            */
 
+GC_API int GC_register_long_link GC_PROTO((GC_PTR * /* link */, GC_PTR obj));
+GC_API int GC_unregister_long_link GC_PROTO((GC_PTR * /* link */));
+
+
+/* toggleref support */
+GC_API void GC_toggleref_register_callback GC_PROTO((int (*proccess_toggleref) (GC_PTR obj)));
+GC_API void GC_toggleref_add (GC_PTR object, int strong_ref);
+
+/* finalizer callback support */
+GC_API void GC_set_finalizer_notify_proc GC_PROTO((void (*object_finalized) (GC_PTR obj)));
+
+
 /* Returns !=0  if GC_invoke_finalizers has something to do.           */
 GC_API int GC_should_invoke_finalizers GC_PROTO((void));
 
@@ -833,6 +862,12 @@ GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR    p));
 /* Returns 1 if the calling thread is registered with the GC, 0 otherwise */
 GC_API int GC_thread_is_registered GC_PROTO((void));
 
+/* Notify the collector about the stack and the altstack of the current thread */
+/* STACK/STACK_SIZE is used to determine the stack dimensions when a thread is
+ * suspended while it is on an altstack.
+ */
+GC_API void GC_register_altstack GC_PROTO((void *stack, int stack_size, void *altstack, int altstack_size));
+
 /* Safer, but slow, pointer addition.  Probably useful mainly with     */
 /* a preprocessor.  Useful only for heap pointers.                     */
 #ifdef GC_DEBUG
@@ -918,6 +953,8 @@ extern void GC_thr_init(void);      /* Needed for Solaris/X86       */
 #if defined(GC_WIN32_THREADS) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
 # include <windows.h>
 
+   BOOL WINAPI GC_DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved);
+
   /*
    * All threads must be created using GC_CreateThread, so that they will be
    * recorded in the thread table.  For backwards compatibility, this is not