Merge pull request #439 from mono-soc-2012/garyb/iconfix
[mono.git] / libgc / include / private / gc_priv.h
index 484a2b06357ee066eb9d4aa864c7245104f5388c..e0a9331292ced0e6074f23d07819ac4ce9574421 100644 (file)
@@ -259,17 +259,6 @@ typedef char * ptr_t;      /* A generic pointer to which we can add        */
 /*                               */
 /*********************************/
 
-#ifdef SAVE_CALL_CHAIN
-
-/* Fill in the pc and argument information for up to NFRAMES of my     */
-/* callers.  Ignore my frame and my callers frame.                     */
-struct callinfo;
-void GC_save_callers GC_PROTO((struct callinfo info[NFRAMES]));
-  
-void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
-
-#endif
-
 #ifdef NEED_CALLINFO
     struct callinfo {
        word ci_pc;     /* Caller, not callee, pc       */
@@ -283,6 +272,16 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
     };
 #endif
 
+#ifdef SAVE_CALL_CHAIN
+
+/* Fill in the pc and argument information for up to NFRAMES of my     */
+/* callers.  Ignore my frame and my callers frame.                     */
+void GC_save_callers GC_PROTO((struct callinfo info[NFRAMES]));
+  
+void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
+
+#endif
+
 
 /*********************************/
 /*                               */
@@ -367,6 +366,18 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
 #   define BZERO(x,n) bzero((char *)(x),(int)(n))
 # endif
 
+#if defined(DARWIN)
+#      if defined(POWERPC)
+#              define GC_MACH_THREAD_STATE_FLAVOR PPC_THREAD_STATE
+#      elif defined(I386)
+#              define GC_MACH_THREAD_STATE_FLAVOR i386_THREAD_STATE
+#      elif defined(X86_64)
+#              define GC_MACH_THREAD_STATE_FLAVOR x86_THREAD_STATE64
+#      else
+#              define GC_MACH_THREAD_STATE_FLAVOR MACHINE_THREAD_STATE
+#      endif
+#endif
+
 /* Delay any interrupts or signals that may abort this thread.  Data   */
 /* structures are in a consistent state outside this pair of calls.    */
 /* ANSI C allows both to be empty (though the standard isn't very      */
@@ -392,9 +403,9 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
 #     define ENABLE_SIGNALS()
 #   else
 #     define DISABLE_SIGNALS() GC_disable_signals()
-       void GC_disable_signals();
+       void GC_disable_signals(void);
 #     define ENABLE_SIGNALS() GC_enable_signals()
-       void GC_enable_signals();
+       void GC_enable_signals(void);
 #   endif
 # endif
 
@@ -414,8 +425,8 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
 # else
 #   if defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) \
        || defined(GC_PTHREADS)
-      void GC_stop_world();
-      void GC_start_world();
+      void GC_stop_world(void);
+      void GC_start_world(void);
 #     define STOP_WORLD() GC_stop_world()
 #     define START_WORLD() GC_start_world()
 #   else
@@ -551,7 +562,7 @@ extern GC_warn_proc GC_current_warn_proc;
 
 #define CPP_MAXOBJBYTES (CPP_HBLKSIZE/2)
 #define MAXOBJBYTES ((word)CPP_MAXOBJBYTES)
-#define CPP_MAXOBJSZ    BYTES_TO_WORDS(CPP_HBLKSIZE/2)
+#define CPP_MAXOBJSZ    BYTES_TO_WORDS(CPP_MAXOBJBYTES)
 #define MAXOBJSZ ((word)CPP_MAXOBJSZ)
                
 # define divHBLKSZ(n) ((n) >> LOG_HBLKSIZE)
@@ -931,6 +942,7 @@ struct _GC_arrays {
 #   define MAP_SIZE MAP_ENTRIES
 #   define CPP_MAX_OFFSET (OFFSET_TOO_BIG - 1) 
 #   define MAX_OFFSET ((word)CPP_MAX_OFFSET)
+#   define INIT_MAP(map) memset((map), OBJ_INVALID, MAP_SIZE)
     /* The following are used only if GC_all_interior_ptrs != 0 */
 #      define VALID_OFFSET_SZ \
          (CPP_MAX_OFFSET > WORDS_TO_BYTES(CPP_MAXOBJSZ)? \
@@ -939,11 +951,11 @@ struct _GC_arrays {
        char _valid_offsets[VALID_OFFSET_SZ];
                                /* GC_valid_offsets[i] == TRUE ==> i    */
                                /* is registered as a displacement.     */
-#      define OFFSET_VALID(displ) \
-         (GC_all_interior_pointers || GC_valid_offsets[displ])
        char _modws_valid_offsets[sizeof(word)];
                                /* GC_valid_offsets[i] ==>                */
                                /* GC_modws_valid_offsets[i%sizeof(word)] */
+#   define OFFSET_VALID(displ) \
+         (GC_all_interior_pointers || GC_valid_offsets[displ])
 # ifdef STUBBORN_ALLOC
     page_hash_table _changed_pages;
         /* Stubborn object pages that were changes since last call to  */
@@ -973,7 +985,7 @@ struct _GC_arrays {
 #   ifdef SMALL_CONFIG
 #     define MAX_HEAP_SECTS 128                /* Roughly 256MB (128*2048*1K)  */
 #   else
-#     define MAX_HEAP_SECTS 384                /* Roughly 3GB                  */
+#     define MAX_HEAP_SECTS (384+128)          /* Roughly 4GB                  */
 #   endif
 # endif
   struct HeapSect {
@@ -1633,6 +1645,10 @@ ptr_t GC_generic_malloc_ignore_off_page GC_PROTO((size_t b, int k));
                                /* are ignored.                         */
 ptr_t GC_generic_malloc_inner GC_PROTO((word lb, int k));
                                /* Ditto, but I already hold lock, etc. */
+ptr_t GC_generic_malloc_words_small_inner GC_PROTO((word lw, int k));
+                               /* Analogous to the above, but assumes  */
+                               /* a small object size, and bypasses    */
+                               /* MERGE_SIZES mechanism.               */
 ptr_t GC_generic_malloc_words_small GC_PROTO((size_t lw, int k));
                                /* As above, but size in units of words */
                                /* Bypasses MERGE_SIZES.  Assumes       */
@@ -1726,6 +1742,13 @@ extern GC_bool GC_print_stats;   /* Produce at least some logging output */
 
 #ifdef KEEP_BACK_PTRS
   extern long GC_backtraces;
+  void GC_generate_random_backtrace_no_gc(void);
+#endif
+
+extern GC_bool GC_print_back_height;
+
+#ifdef MAKE_BACK_GRAPH
+  void GC_print_back_graph_stats(void);
 #endif
 
 /* Macros used for collector internal allocation.      */
@@ -1819,7 +1842,7 @@ void GC_dump GC_PROTO((void));
 #   ifdef __DMC__
       GC_API void GC_noop(...);
 #   else
-      GC_API void GC_noop();
+      GC_API void GC_noop(void*,...);
 #   endif
 # endif
 
@@ -1908,17 +1931,17 @@ void GC_err_puts GC_PROTO((GC_CONST char *s));
     /* GC_notify_all_builder() is called when GC_fl_builder_count      */
     /* reaches 0.                                                      */
 
-     extern void GC_acquire_mark_lock();
-     extern void GC_release_mark_lock();
-     extern void GC_notify_all_builder();
+     extern void GC_acquire_mark_lock(void);
+     extern void GC_release_mark_lock(void);
+     extern void GC_notify_all_builder(void);
      /* extern void GC_wait_builder(); */
-     extern void GC_wait_for_reclaim();
+     extern void GC_wait_for_reclaim(void);
 
      extern word GC_fl_builder_count;  /* Protected by mark lock.      */
 # endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */
 # ifdef PARALLEL_MARK
-     extern void GC_notify_all_marker();
-     extern void GC_wait_marker();
+     extern void GC_notify_all_marker(void);
+     extern void GC_wait_marker(void);
      extern word GC_mark_no;           /* Protected by mark lock.      */
 
      extern void GC_help_marker(word my_mark_no);
@@ -1936,11 +1959,13 @@ void GC_err_puts GC_PROTO((GC_CONST char *s));
   /* in Linux glibc, but it's not exported.)  Thus we continue to use  */
   /* the same hard-coded signals we've always used.                    */
 #  if !defined(SIG_SUSPEND)
-#   if defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS)
+#   if defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS) || defined(GC_NETBSD_THREADS)
 #    if defined(SPARC) && !defined(SIGPWR)
        /* SPARC/Linux doesn't properly define SIGPWR in <signal.h>.
         * It is aliased to SIGLOST in asm/signal.h, though.            */
 #      define SIG_SUSPEND SIGLOST
+#    elif defined(NACL)
+#      define SIG_SUSPEND 0
 #    else
        /* Linuxthreads itself uses SIGUSR1 and SIGUSR2.                        */
 #      define SIG_SUSPEND SIGPWR