Fix race condition in static's inialization of mono_message_init.
[mono.git] / mono / metadata / sgen-major-copying.c
index 79336bf5cf975034c7b1f27940068d0f9f1ed693..7aef21559855e843254ded2ecfc5070b3a70047a 100644 (file)
@@ -134,7 +134,7 @@ alloc_major_section (void)
        section->size = MAJOR_SECTION_SIZE - SGEN_SIZEOF_GC_MEM_SECTION;
        section->end_data = section->data + section->size;
        sgen_update_heap_boundaries ((mword)section->data, (mword)section->end_data);
-       DEBUG (3, fprintf (gc_debug_file, "New major heap section: (%p-%p), total: %ld\n", section->data, section->end_data, mono_gc_get_heap_size ()));
+       DEBUG (3, fprintf (gc_debug_file, "New major heap section: (%p-%p), total: %lld\n", section->data, section->end_data, (long long int)mono_gc_get_heap_size ()));
        scan_starts = (section->size + SGEN_SCAN_START_SIZE - 1) / SGEN_SCAN_START_SIZE;
        section->scan_starts = sgen_alloc_internal_dynamic (sizeof (char*) * scan_starts, INTERNAL_MEM_SCAN_STARTS);
        section->num_scan_start = scan_starts;
@@ -279,7 +279,11 @@ major_alloc_degraded (MonoVTable *vtable, size_t size)
        return p;
 }
 
-#define pin_major_object       sgen_pin_object
+static inline void
+pin_major_object (char *obj, SgenGrayQueue *queue)
+{
+       sgen_pin_object (obj, queue);
+}
 
 #include "sgen-major-copy-object.h"
 
@@ -363,7 +367,7 @@ major_copy_or_mark_object (void **obj_slot, SgenGrayQueue *queue)
        if (G_UNLIKELY (objsize > SGEN_MAX_SMALL_OBJ_SIZE || obj_is_from_pinned_alloc (obj))) {
                if (SGEN_OBJECT_IS_PINNED (obj))
                        return;
-               DEBUG (9, fprintf (gc_debug_file, " (marked LOS/Pinned %p (%s), size: %zd)\n", obj, sgen_safe_name (obj), objsize));
+               DEBUG (9, fprintf (gc_debug_file, " (marked LOS/Pinned %p (%s), size: %td)\n", obj, sgen_safe_name (obj), objsize));
                binary_protocol_pin (obj, (gpointer)SGEN_LOAD_VTABLE (obj), sgen_safe_object_get_size ((MonoObject*)obj));
                SGEN_PIN_OBJECT (obj);
                GRAY_OBJECT_ENQUEUE (queue, obj);
@@ -674,6 +678,7 @@ sgen_copying_init (SgenMajorCollector *collector)
        collector->free_non_pinned_object = major_free_non_pinned_object;
        collector->find_pin_queue_start_ends = major_find_pin_queue_start_ends;
        collector->pin_objects = major_pin_objects;
+       collector->pin_major_object = pin_major_object;
        collector->init_to_space = major_init_to_space;
        collector->sweep = major_sweep;
        collector->check_scan_starts = major_check_scan_starts;
@@ -690,8 +695,7 @@ sgen_copying_init (SgenMajorCollector *collector)
        collector->print_gc_param_usage = NULL;
 
        collector->major_ops.copy_or_mark_object = major_copy_or_mark_object;
-       FILL_COLLECTOR_COPY_OBJECT (collector);
-       FILL_COLLECTOR_SCAN_OBJECT (collector);
+       collector->major_ops.scan_object = major_scan_object;
 }
 
 #endif