test_op_il_seq_point.sh now properly tests AOT compilation.
[mono.git] / mono / metadata / boehm-gc.c
index ef498c60760c6621d4e46a994f49dc89fcbc7c3d..bbebb14a1d3b9a937e2e974717e44855d5b98ee0 100644 (file)
@@ -30,6 +30,7 @@
 #include <mono/utils/dtrace.h>
 #include <mono/utils/gc_wrapper.h>
 #include <mono/utils/mono-mutex.h>
+#include <mono/utils/mono-counters.h>
 
 #if HAVE_BOEHM_GC
 
@@ -78,6 +79,8 @@ mono_gc_base_init (void)
        if (gc_initialized)
                return;
 
+       mono_counters_init ();
+
        /*
         * Handle the case when we are called from a thread different from the main thread,
         * confusing libgc.
@@ -455,7 +458,7 @@ on_gc_notification (GCEventType event)
                        mono_perfcounters->gc_gen0size = heap_size;
                }
 #endif
-               gc_stats.major_gc_time_usecs += (mono_100ns_ticks () - gc_start_time) / 10;
+               gc_stats.major_gc_time += mono_100ns_ticks () - gc_start_time;
                mono_trace_message (MONO_TRACE_GC, "gc took %d usecs", (mono_100ns_ticks () - gc_start_time) / 10);
                break;
        }
@@ -753,7 +756,7 @@ create_allocator (int atype, int tls_key)
        bytes_var = mono_mb_add_local (mb, &mono_defaults.int32_class->byval_arg);
        if (atype == ATYPE_STRING) {
                /* a string alloator method takes the args: (vtable, len) */
-               /* bytes = (sizeof (MonoString) + ((len + 1) * 2)); */
+               /* bytes = (offsetof (MonoString, chars) + ((len + 1) * 2)); */
                mono_mb_emit_ldarg (mb, 1);
                mono_mb_emit_icon (mb, 1);
                mono_mb_emit_byte (mb, MONO_CEE_ADD);
@@ -1177,7 +1180,7 @@ mono_gc_conservatively_scan_area (void *start, void *end)
 }
 
 void *
-mono_gc_scan_object (void *obj)
+mono_gc_scan_object (void *obj, void *gc_data)
 {
        g_assert_not_reached ();
        return NULL;
@@ -1291,6 +1294,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)
 {