Skip to content

Instantly share code, notes, and snippets.

@kumpera
Created March 9, 2012 21:18
Show Gist options
  • Save kumpera/2008752 to your computer and use it in GitHub Desktop.
Save kumpera/2008752 to your computer and use it in GitHub Desktop.
diff --git a/mono/metadata/sgen-gc.c b/mono/metadata/sgen-gc.c
index 20d6447..ffb4a57 100644
--- a/mono/metadata/sgen-gc.c
+++ b/mono/metadata/sgen-gc.c
@@ -2575,6 +2575,8 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
*/
mono_sgen_bridge_reset_data ();
+ DEBUG (2, fprintf (gc_debug_file, "Bridge reset done"));
+
/*
* Walk the ephemeron tables marking all values with reachable keys. This must be completely done
* before processing finalizable objects or non-tracking weak hamdle to avoid finalizing/clearing
@@ -2587,11 +2589,17 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
++ephemeron_rounds;
} while (!done_with_ephemerons);
+ DEBUG (2, fprintf (gc_debug_file, "Ephemeron processing done"));
+
mono_sgen_scan_togglerefs (copy_func, start_addr, end_addr, queue);
if (generation == GENERATION_OLD)
mono_sgen_scan_togglerefs (copy_func, nursery_start, nursery_real_end, queue);
+ DEBUG (2, fprintf (gc_debug_file, "Toggleref processing done"));
+
if (mono_sgen_need_bridge_processing ()) {
+ DEBUG (2, fprintf (gc_debug_file, "Processing bridge objects."));
+
if (finalized_array == NULL) {
finalized_array_capacity = 32;
finalized_array = mono_sgen_alloc_internal_dynamic (sizeof (MonoObject*) * finalized_array_capacity, INTERNAL_MEM_BRIDGE_DATA);
@@ -2602,11 +2610,15 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
if (generation == GENERATION_OLD)
collect_bridge_objects (copy_func, nursery_start, nursery_real_end, GENERATION_NURSERY, queue);
+ DEBUG (2, fprintf (gc_debug_file, "Bridge objects collected."));
+
if (finalized_array_entries > 0) {
mono_sgen_bridge_processing_register_objects (finalized_array_entries, finalized_array);
finalized_array_entries = 0;
}
+ DEBUG (2, fprintf (gc_debug_file, "Bridge objects registered."));
drain_gray_stack (queue);
+ DEBUG (2, fprintf (gc_debug_file, "Bridge objects gray stack drained."));
}
/*
@@ -2617,6 +2629,7 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
if (generation == GENERATION_OLD)
null_link_in_range (copy_func, start_addr, end_addr, GENERATION_NURSERY, TRUE, queue);
+ DEBUG (2, fprintf (gc_debug_file, "Weak links processing done."));
/* walk the finalization queue and move also the objects that need to be
* finalized: use the finalized objects as new roots so the objects they depend
@@ -2640,6 +2653,8 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
drain_gray_stack (queue);
} while (fin_ready != num_ready_finalizers);
+ DEBUG (2, fprintf (gc_debug_file, "Finalizer processing done."));
+
if (mono_sgen_need_bridge_processing ())
g_assert (num_loops <= 1);
@@ -2653,6 +2668,8 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
++ephemeron_rounds;
} while (!done_with_ephemerons);
+ DEBUG (2, fprintf (gc_debug_file, "Second Ephemeron pass done."));
+
/*
* Clear ephemeron pairs with unreachable keys.
* We pass the copy func so we can figure out if an array was promoted or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment