Added MonoString<->UTF-32 conversion helper functions.
[mono.git] / mono / metadata / sgen-tarjan-bridge.c
index ad47bcdf5f7ebdf37ed03cfbce9008b8856745b8..59013f70124aa832120f3c0a2216964bea45e1f4 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * sgen-bridge.c: Simple generational GC.
+ * sgen-tarjan-bridge.c: Tarjan-based bridge implementation.
  *
  * Copyright 2011 Novell, Inc (http://www.novell.com)
- * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
+ * Copyright 2014 Xamarin Inc (http://www.xamarin.com)
  *
  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
@@ -67,14 +67,6 @@ typedef struct {
 
 /* private */
 
-static void
-dyn_array_init (DynArray *da)
-{
-       da->size = 0;
-       da->capacity = 0;
-       da->data = NULL;
-}
-
 static void
 dyn_array_uninit (DynArray *da, int elem_size)
 {
@@ -121,12 +113,6 @@ dyn_array_add (DynArray *da, int elem_size)
 
 /* ptr */
 
-static void
-dyn_array_ptr_init (DynPtrArray *da)
-{
-       dyn_array_init (&da->array);
-}
-
 static void
 dyn_array_ptr_uninit (DynPtrArray *da)
 {
@@ -390,10 +376,10 @@ retry:
 static void
 free_color_buckets (void)
 {
-       color_data_count = 0;
-
        ColorBucket *cur, *tmp;
 
+       color_data_count = 0;
+
        for (cur = root_color_bucket; cur; cur = tmp) {
                ColorData *cd;
                for (cd = &cur->data [0]; cd < cur->next_data; ++cd) {
@@ -461,6 +447,7 @@ bridge_object_forward (MonoObject *obj)
        return fwd ? fwd : obj;
 }
 
+#ifdef DUMP_GRAPH
 static const char*
 safe_name_bridge (MonoObject *obj)
 {
@@ -476,7 +463,7 @@ find_or_create_data (MonoObject *obj)
                entry = create_data (obj);
        return entry;
 }
-
+#endif
 
 //----------
 typedef struct {
@@ -502,7 +489,7 @@ static HashEntry merge_cache [COLOR_CACHE_SIZE][ELEMENTS_PER_BUCKET];
 static int
 mix_hash (size_t hash)
 {
-       return ((hash * 215497) >> 16) ^ (hash * 1823231) + hash;
+       return (int)(((hash * 215497) >> 16) ^ ((hash * 1823231) + hash));
 }
 
 static void
@@ -908,6 +895,7 @@ cleanup (void)
        num_colors_with_bridges = 0;
 }
 
+#ifdef DUMP_GRAPH
 static void
 dump_color_table (const char *why, gboolean do_index)
 {
@@ -938,6 +926,7 @@ dump_color_table (const char *why, gboolean do_index)
        }
 
 }
+#endif
 
 static gint64
 step_timer (gint64 *timer)
@@ -1036,16 +1025,6 @@ reset_xrefs (ColorData *color)
        }
 }
 
-static mono_bool
-is_bridge_object_alive (MonoObject *obj, void *data)
-{
-       SgenHashTable *table = data;
-       unsigned char *value = sgen_hash_table_lookup (table, obj);
-       if (!value)
-               return TRUE;
-       return *value;
-}
-
 static void
 processing_build_callback_data (int generation)
 {