[sgen] Rename sgen-major-scan-object.h to sgen-marksweep-scan-object-concurrent.h.
authorMark Probst <mark.probst@gmail.com>
Sun, 5 Oct 2014 03:13:41 +0000 (20:13 -0700)
committerMark Probst <mark.probst@gmail.com>
Wed, 26 Nov 2014 18:38:45 +0000 (10:38 -0800)
mono/metadata/Makefile.am
mono/metadata/sgen-major-scan-object.h [deleted file]
mono/metadata/sgen-marksweep-scan-object-concurrent.h [new file with mode: 0644]
mono/metadata/sgen-marksweep.c

index 41e756df4630b3cde7cce6786dead9f9b463fd79..6730238ba625f7356249c10f164dbf4505ad37e1 100644 (file)
@@ -249,7 +249,7 @@ sgen_sources = \
        sgen-major-copy-object.h \
        sgen-minor-copy-object.h \
        sgen-copy-object.h \
-       sgen-major-scan-object.h \
+       sgen-marksweep-scan-object-concurrent.h \
        sgen-minor-scan-object.h \
        sgen-marksweep-copy-or-mark-object.h    \
        sgen-protocol.h         \
diff --git a/mono/metadata/sgen-major-scan-object.h b/mono/metadata/sgen-major-scan-object.h
deleted file mode 100644 (file)
index 7d786d3..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * sgen-major-scan-object.h: Object scanning in the major collectors.
- *
- * Copyright 2001-2003 Ximian, Inc
- * Copyright 2003-2010 Novell, Inc.
- * Copyright (C) 2012 Xamarin Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License 2.0 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License 2.0 along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-extern long long stat_scan_object_called_major;
-
-/*
- * FIXME: We use the same scanning function in the concurrent collector whether we scan
- * during the starting/finishing collection pause (with the world stopped) or from the
- * concurrent worker thread.
- *
- * As long as the world is stopped, we should just follow pointers into the nursery and
- * evict if possible.  In that case we also don't need the ALWAYS_ADD_TO_GLOBAL_REMSET case,
- * which only seems to make sense for when the world is stopped, in which case we only need
- * it because we don't follow into the nursery.
- */
-
-#undef HANDLE_PTR
-#define HANDLE_PTR(ptr,obj)    do {                                    \
-               void *__old = *(ptr);                                   \
-               SGEN_OBJECT_LAYOUT_STATISTICS_MARK_BITMAP ((obj), (ptr)); \
-               binary_protocol_scan_process_reference ((obj), (ptr), __old); \
-               if (__old && !sgen_ptr_in_nursery (__old)) {            \
-                       void *__copy;                                   \
-                       PREFETCH_READ (__old);                  \
-                       major_copy_or_mark_object_with_evacuation_concurrent ((ptr), __old, queue); \
-                       __copy = *(ptr);                                \
-                       SGEN_COND_LOG (9, __old != __copy, "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
-                       if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)) && !SGEN_OBJECT_IS_CEMENTED (__copy))) \
-                               sgen_add_to_global_remset ((ptr), __copy);      \
-               } else {                                                \
-                       if (G_UNLIKELY (sgen_ptr_in_nursery (__old) && !sgen_ptr_in_nursery ((ptr)))) \
-                               sgen_add_to_global_remset ((ptr), __old); \
-               }                                                       \
-       } while (0)
-
-static void
-major_scan_object_no_mark_concurrent (char *start, mword desc, SgenGrayQueue *queue)
-{
-       SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP;
-
-#ifdef HEAVY_STATISTICS
-       sgen_descriptor_count_scanned_object (desc);
-#endif
-#ifdef SGEN_HEAVY_BINARY_PROTOCOL
-       add_scanned_object (start);
-#endif
-
-#define SCAN_OBJECT_PROTOCOL
-#include "sgen-scan-object.h"
-
-       SGEN_OBJECT_LAYOUT_STATISTICS_COMMIT_BITMAP;
-       HEAVY_STAT (++stat_scan_object_called_major);
-}
-
-/* FIXME: Unify this with optimized code in sgen-marksweep.c. */
-
-static void
-major_scan_object_concurrent (char *start, mword desc, SgenGrayQueue *queue)
-{
-#ifndef SGEN_MARK_ON_ENQUEUE
-       if (!sgen_ptr_in_nursery (start)) {
-               if (SGEN_ALIGN_UP (sgen_safe_object_get_size ((MonoObject*)start)) <= SGEN_MAX_SMALL_OBJ_SIZE) {
-                       MSBlockInfo *block = MS_BLOCK_FOR_OBJ (start);
-                       int word, bit;
-                       MS_CALC_MARK_BIT (word, bit, start);
-                       if (MS_MARK_BIT (block, word, bit))
-                               return;
-                       MS_SET_MARK_BIT (block, word, bit);
-                       binary_protocol_mark (start, (gpointer)LOAD_VTABLE (start), sgen_safe_object_get_size ((MonoObject*)start));
-               } else {
-                       if (sgen_los_object_is_pinned (start))
-                               return;
-                       sgen_los_pin_object (start);
-               }
-       }
-#endif
-
-       major_scan_object_no_mark_concurrent (start, desc, queue);
-}
-
-static void
-major_scan_vtype_concurrent (char *start, mword desc, SgenGrayQueue *queue BINARY_PROTOCOL_ARG (size_t size))
-{
-       SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP;
-
-#ifdef HEAVY_STATISTICS
-       /* FIXME: We're half scanning this object.  How do we account for that? */
-       //add_scanned_object (start);
-#endif
-
-       /* The descriptors include info about the MonoObject header as well */
-       start -= sizeof (MonoObject);
-
-#define SCAN_OBJECT_NOVTABLE
-#define SCAN_OBJECT_PROTOCOL
-#include "sgen-scan-object.h"
-
-       SGEN_OBJECT_LAYOUT_STATISTICS_COMMIT_BITMAP;
-}
diff --git a/mono/metadata/sgen-marksweep-scan-object-concurrent.h b/mono/metadata/sgen-marksweep-scan-object-concurrent.h
new file mode 100644 (file)
index 0000000..7d786d3
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * sgen-major-scan-object.h: Object scanning in the major collectors.
+ *
+ * Copyright 2001-2003 Ximian, Inc
+ * Copyright 2003-2010 Novell, Inc.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+extern long long stat_scan_object_called_major;
+
+/*
+ * FIXME: We use the same scanning function in the concurrent collector whether we scan
+ * during the starting/finishing collection pause (with the world stopped) or from the
+ * concurrent worker thread.
+ *
+ * As long as the world is stopped, we should just follow pointers into the nursery and
+ * evict if possible.  In that case we also don't need the ALWAYS_ADD_TO_GLOBAL_REMSET case,
+ * which only seems to make sense for when the world is stopped, in which case we only need
+ * it because we don't follow into the nursery.
+ */
+
+#undef HANDLE_PTR
+#define HANDLE_PTR(ptr,obj)    do {                                    \
+               void *__old = *(ptr);                                   \
+               SGEN_OBJECT_LAYOUT_STATISTICS_MARK_BITMAP ((obj), (ptr)); \
+               binary_protocol_scan_process_reference ((obj), (ptr), __old); \
+               if (__old && !sgen_ptr_in_nursery (__old)) {            \
+                       void *__copy;                                   \
+                       PREFETCH_READ (__old);                  \
+                       major_copy_or_mark_object_with_evacuation_concurrent ((ptr), __old, queue); \
+                       __copy = *(ptr);                                \
+                       SGEN_COND_LOG (9, __old != __copy, "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
+                       if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)) && !SGEN_OBJECT_IS_CEMENTED (__copy))) \
+                               sgen_add_to_global_remset ((ptr), __copy);      \
+               } else {                                                \
+                       if (G_UNLIKELY (sgen_ptr_in_nursery (__old) && !sgen_ptr_in_nursery ((ptr)))) \
+                               sgen_add_to_global_remset ((ptr), __old); \
+               }                                                       \
+       } while (0)
+
+static void
+major_scan_object_no_mark_concurrent (char *start, mword desc, SgenGrayQueue *queue)
+{
+       SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP;
+
+#ifdef HEAVY_STATISTICS
+       sgen_descriptor_count_scanned_object (desc);
+#endif
+#ifdef SGEN_HEAVY_BINARY_PROTOCOL
+       add_scanned_object (start);
+#endif
+
+#define SCAN_OBJECT_PROTOCOL
+#include "sgen-scan-object.h"
+
+       SGEN_OBJECT_LAYOUT_STATISTICS_COMMIT_BITMAP;
+       HEAVY_STAT (++stat_scan_object_called_major);
+}
+
+/* FIXME: Unify this with optimized code in sgen-marksweep.c. */
+
+static void
+major_scan_object_concurrent (char *start, mword desc, SgenGrayQueue *queue)
+{
+#ifndef SGEN_MARK_ON_ENQUEUE
+       if (!sgen_ptr_in_nursery (start)) {
+               if (SGEN_ALIGN_UP (sgen_safe_object_get_size ((MonoObject*)start)) <= SGEN_MAX_SMALL_OBJ_SIZE) {
+                       MSBlockInfo *block = MS_BLOCK_FOR_OBJ (start);
+                       int word, bit;
+                       MS_CALC_MARK_BIT (word, bit, start);
+                       if (MS_MARK_BIT (block, word, bit))
+                               return;
+                       MS_SET_MARK_BIT (block, word, bit);
+                       binary_protocol_mark (start, (gpointer)LOAD_VTABLE (start), sgen_safe_object_get_size ((MonoObject*)start));
+               } else {
+                       if (sgen_los_object_is_pinned (start))
+                               return;
+                       sgen_los_pin_object (start);
+               }
+       }
+#endif
+
+       major_scan_object_no_mark_concurrent (start, desc, queue);
+}
+
+static void
+major_scan_vtype_concurrent (char *start, mword desc, SgenGrayQueue *queue BINARY_PROTOCOL_ARG (size_t size))
+{
+       SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP;
+
+#ifdef HEAVY_STATISTICS
+       /* FIXME: We're half scanning this object.  How do we account for that? */
+       //add_scanned_object (start);
+#endif
+
+       /* The descriptors include info about the MonoObject header as well */
+       start -= sizeof (MonoObject);
+
+#define SCAN_OBJECT_NOVTABLE
+#define SCAN_OBJECT_PROTOCOL
+#include "sgen-scan-object.h"
+
+       SGEN_OBJECT_LAYOUT_STATISTICS_COMMIT_BITMAP;
+}
index cce8b9b5b86dd2bf762972a6da8f0c6fb092b2b9..f71101b29e3db734e2a215dc73a14c05b6dd842f 100644 (file)
@@ -1069,7 +1069,7 @@ drain_gray_stack (ScanCopyContext ctx)
 }
 
 #ifdef SGEN_HAVE_CONCURRENT_MARK
-#include "sgen-major-scan-object.h"
+#include "sgen-marksweep-scan-object-concurrent.h"
 #endif
 
 static void