Remove an intermediate buffer in the bridge code.
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 29 Dec 2011 23:00:41 +0000 (21:00 -0200)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 29 Dec 2011 23:00:41 +0000 (21:00 -0200)
mono/metadata/sgen-bridge.c
mono/metadata/sgen-fin-weak-hash.c
mono/metadata/sgen-gc.c
mono/metadata/sgen-gc.h

index d0f62c4dc99e2abe0043441c9ae64278aa8fd0e2..66ac5b6fdd82c13a4719865961509484d428d9a0 100644 (file)
@@ -507,29 +507,12 @@ static int fist_pass_links, second_pass_links, sccs_links;
 static int max_sccs_links = 0;
 
 void
-mono_sgen_bridge_processing_register_objects (int num_objs, MonoObject **objs)
+mono_sgen_bridge_register_finalized_object (MonoObject *obj)
 {
-       int i;
-       SGEN_TV_DECLARE (atv);
-       SGEN_TV_DECLARE (btv);
-
-       fist_pass_links = second_pass_links = sccs_links = 0;
-       dsf1_passes = dsf2_passes = 0;
-       SGEN_TV_GETTIME (atv);
-
        g_assert (mono_sgen_need_bridge_processing ());
 
-       //g_print ("%d finalized objects\n", num_objs);
-
-       /* The collector step checks for bridge objects already, so we don't need to do it again. */
-       for (i = 0; i < num_objs; ++i) {
-               MonoObject *obj = objs [i];
-               if (register_bridge_object (obj))
-                       dyn_array_ptr_push (&registered_bridges, obj);
-       }
-
-       SGEN_TV_GETTIME (btv);
-       step_1 += SGEN_TV_ELAPSED (atv, btv);
+       if (register_bridge_object (obj))
+               dyn_array_ptr_push (&registered_bridges, obj);
 }
 
 void
index 83ef9c4d35a3f09f07ebaffec068d3ff70222afc..54adfa9e2a7b9745ed739b62b651bcd55398d661 100644 (file)
@@ -98,7 +98,7 @@ collect_bridge_objects (CopyOrMarkObjectFunc copy_func, char *start, char *end,
                copy = (char*)object;
                copy_func ((void**)&copy, queue);
 
-               bridge_register_finalized_object ((MonoObject*)copy);
+               mono_sgen_bridge_register_finalized_object ((MonoObject*)copy);
                
                if (hash_table == &minor_finalizable_hash && !ptr_in_nursery (copy)) {
                        /* remove from the list */
index 895b8715f834fb695741aa4c17cf3b118e2c5844..d9af415a8a9a0d78922499babc1c76b53891b707 100644 (file)
@@ -2134,27 +2134,6 @@ generation_name (int generation)
        }
 }
 
-static MonoObject **finalized_array = NULL;
-static int finalized_array_capacity = 0;
-static int finalized_array_entries = 0;
-
-static void
-bridge_register_finalized_object (MonoObject *object)
-{
-       if (!finalized_array)
-               return;
-
-       if (finalized_array_entries >= finalized_array_capacity) {
-               MonoObject **new_array;
-               g_assert (finalized_array_entries == finalized_array_capacity);
-               finalized_array_capacity *= 2;
-               new_array = mono_sgen_alloc_internal_dynamic (sizeof (MonoObject*) * finalized_array_capacity, INTERNAL_MEM_BRIDGE_DATA);
-               memcpy (new_array, finalized_array, sizeof (MonoObject*) * finalized_array_entries);
-               mono_sgen_free_internal_dynamic (finalized_array, sizeof (MonoObject*) * finalized_array_entries, INTERNAL_MEM_BRIDGE_DATA);
-               finalized_array = new_array;
-       }
-       finalized_array [finalized_array_entries++] = object;
-}
 
 static void
 stw_bridge_process (void)
@@ -2247,20 +2226,9 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
                mono_sgen_scan_togglerefs (copy_func, nursery_start, nursery_end, queue);
 
        if (mono_sgen_need_bridge_processing ()) {
-               if (finalized_array == NULL) {
-                       finalized_array_capacity = 32;
-                       finalized_array = mono_sgen_alloc_internal_dynamic (sizeof (MonoObject*) * finalized_array_capacity, INTERNAL_MEM_BRIDGE_DATA);
-               }
-               finalized_array_entries = 0;            
-
                collect_bridge_objects (copy_func, start_addr, end_addr, generation, queue);
                if (generation == GENERATION_OLD)
                        collect_bridge_objects (copy_func, nursery_start, nursery_end, GENERATION_NURSERY, queue);
-
-               if (finalized_array_entries > 0) {
-                       mono_sgen_bridge_processing_register_objects (finalized_array_entries, finalized_array);
-                       finalized_array_entries = 0;
-               }
                mono_sgen_drain_gray_stack (queue, -1);
        }
 
index 34896397ad79ddb4d5ce84f691bedcf371dfc8f1..7f8b7bba7b09c33e73c24996260ce08969958dad 100644 (file)
@@ -557,12 +557,12 @@ const char* mono_sgen_safe_name (void* obj) MONO_INTERNAL;
 gboolean mono_sgen_object_is_live (void *obj) MONO_INTERNAL;
 
 gboolean mono_sgen_need_bridge_processing (void) MONO_INTERNAL;
-void mono_sgen_bridge_processing_register_objects (int num_objs, MonoObject **objs) MONO_INTERNAL;
 void mono_sgen_bridge_processing_stw_step (void) MONO_INTERNAL;
 void mono_sgen_bridge_processing_finish (void) MONO_INTERNAL;
 void mono_sgen_register_test_bridge_callbacks (const char *bridge_class_name) MONO_INTERNAL;
 gboolean mono_sgen_is_bridge_object (MonoObject *obj) MONO_INTERNAL;
 void mono_sgen_mark_bridge_object (MonoObject *obj) MONO_INTERNAL;
+void mono_sgen_bridge_register_finalized_object (MonoObject *object) MONO_INTERNAL;
 
 void mono_sgen_scan_togglerefs (CopyOrMarkObjectFunc copy_func, char *start, char *end, SgenGrayQueue *queue) MONO_INTERNAL;
 void mono_sgen_process_togglerefs (void) MONO_INTERNAL;