[runtime] Convert String.InternalSetLength to an icall. Needed for canary support.
[mono.git] / mono / metadata / boehm-gc.c
index a3f8296459a2500efea3372f8c4441cc822df519..090f2f7a1dc98e9296d02c829debb4cba317c11c 100644 (file)
@@ -1291,6 +1291,18 @@ mono_gc_get_los_limit (void)
        return G_MAXINT;
 }
 
+void
+mono_gc_set_string_length (MonoString *str, gint32 new_length)
+{
+       mono_unichar2 *new_end = str->chars + new_length;
+       
+       /* zero the discarded string. This null-delimits the string and allows 
+        * the space to be reclaimed by SGen. */
+        
+       memset (new_end, 0, (str->length - new_length + 1) * sizeof (mono_unichar2));
+       str->length = new_length;
+}
+
 gboolean
 mono_gc_user_markers_supported (void)
 {