Merge pull request #1388 from schani/fix-23401
[mono.git] / mono / metadata / sgen-pinning.c
index 9c8c819a0974a6d1c94f1943b381cb9ed40f8399..66d5c7d9b8365cabb9b0c9ea12a09926c7cb0dd1 100644 (file)
@@ -305,21 +305,30 @@ sgen_cement_lookup_or_register (char *obj)
        return FALSE;
 }
 
-void
-sgen_pin_cemented_objects (void)
+static void
+pin_from_hash (CementHashEntry *hash, gboolean has_been_reset)
 {
        int i;
        for (i = 0; i < SGEN_CEMENT_HASH_SIZE; ++i) {
-               if (!cement_hash [i].count)
+               if (!hash [i].count)
                        continue;
 
-               SGEN_ASSERT (5, cement_hash [i].count >= SGEN_CEMENT_THRESHOLD, "Cementing hash inconsistent");
+               if (has_been_reset)
+                       SGEN_ASSERT (5, hash [i].count >= SGEN_CEMENT_THRESHOLD, "Cementing hash inconsistent");
 
-               sgen_pin_stage_ptr (cement_hash [i].obj);
+               sgen_pin_stage_ptr (hash [i].obj);
                /* FIXME: do pin stats if enabled */
        }
 }
 
+void
+sgen_pin_cemented_objects (void)
+{
+       pin_from_hash (cement_hash, TRUE);
+       if (cement_concurrent)
+               pin_from_hash (cement_hash_concurrent, FALSE);
+}
+
 void
 sgen_cement_clear_below_threshold (void)
 {