[utils] Small header sanitization. networking.h now include config.h
[mono-project.git] / mono / metadata / sgen-marksweep-scan-object-concurrent.h
blob7902104fb790eeb699cbbbe8ad18c8b32aa12bdf
1 /*
2 * sgen-major-scan-object.h: Object scanning in the major collectors.
4 * Copyright 2001-2003 Ximian, Inc
5 * Copyright 2003-2010 Novell, Inc.
6 * Copyright (C) 2012 Xamarin Inc
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License 2.0 as published by the Free Software Foundation;
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License 2.0 along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 extern guint64 stat_scan_object_called_major;
25 * FIXME: We use the same scanning function in the concurrent collector whether we scan
26 * during the starting/finishing collection pause (with the world stopped) or from the
27 * concurrent worker thread.
29 * As long as the world is stopped, we should just follow pointers into the nursery and
30 * evict if possible. In that case we also don't need the ALWAYS_ADD_TO_GLOBAL_REMSET case,
31 * which only seems to make sense for when the world is stopped, in which case we only need
32 * it because we don't follow into the nursery.
35 #undef HANDLE_PTR
36 #define HANDLE_PTR(ptr,obj) do { \
37 void *__old = *(ptr); \
38 SGEN_OBJECT_LAYOUT_STATISTICS_MARK_BITMAP ((obj), (ptr)); \
39 binary_protocol_scan_process_reference ((obj), (ptr), __old); \
40 if (__old && !sgen_ptr_in_nursery (__old)) { \
41 void *__copy; \
42 PREFETCH_READ (__old); \
43 major_copy_or_mark_object_with_evacuation_concurrent ((ptr), __old, queue); \
44 __copy = *(ptr); \
45 SGEN_COND_LOG (9, __old != __copy, "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
46 if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)) && !SGEN_OBJECT_IS_CEMENTED (__copy))) \
47 sgen_add_to_global_remset ((ptr), __copy); \
48 } else { \
49 if (G_UNLIKELY (sgen_ptr_in_nursery (__old) && !sgen_ptr_in_nursery ((ptr)))) \
50 sgen_add_to_global_remset ((ptr), __old); \
51 } \
52 } while (0)
54 /* FIXME: Unify this with optimized code in sgen-marksweep.c. */
56 static void
57 major_scan_object_no_mark_concurrent (char *start, mword desc, SgenGrayQueue *queue)
59 SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP;
61 #ifdef HEAVY_STATISTICS
62 sgen_descriptor_count_scanned_object (desc);
63 #endif
64 #ifdef SGEN_HEAVY_BINARY_PROTOCOL
65 add_scanned_object (start);
66 #endif
68 #define SCAN_OBJECT_PROTOCOL
69 #include "sgen-scan-object.h"
71 SGEN_OBJECT_LAYOUT_STATISTICS_COMMIT_BITMAP;
72 HEAVY_STAT (++stat_scan_object_called_major);
75 static void
76 major_scan_vtype_concurrent (char *start, mword desc, SgenGrayQueue *queue BINARY_PROTOCOL_ARG (size_t size))
78 SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP;
80 #ifdef HEAVY_STATISTICS
81 /* FIXME: We're half scanning this object. How do we account for that? */
82 //add_scanned_object (start);
83 #endif
85 /* The descriptors include info about the MonoObject header as well */
86 start -= sizeof (MonoObject);
88 #define SCAN_OBJECT_NOVTABLE
89 #define SCAN_OBJECT_PROTOCOL
90 #include "sgen-scan-object.h"
92 SGEN_OBJECT_LAYOUT_STATISTICS_COMMIT_BITMAP;