2 * sgen-minor-scan-object.h: Object scanning in the nursery collectors.
4 * Copyright 2001-2003 Ximian, Inc
5 * Copyright 2003-2010 Novell, Inc.
6 * Copyright (C) 2012 Xamarin Inc
8 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
11 extern guint64 stat_scan_object_called_nursery
;
13 #undef SERIAL_SCAN_OBJECT
14 #undef SERIAL_SCAN_VTYPE
15 #undef SERIAL_SCAN_PTR_FIELD
17 #if defined(SGEN_SIMPLE_NURSERY)
19 #ifdef SGEN_CONCURRENT_MAJOR
20 #define SERIAL_SCAN_OBJECT simple_nursery_serial_with_concurrent_major_scan_object
21 #define SERIAL_SCAN_VTYPE simple_nursery_serial_with_concurrent_major_scan_vtype
22 #define SERIAL_SCAN_PTR_FIELD simple_nursery_serial_with_concurrent_major_scan_ptr_field
24 #define SERIAL_SCAN_OBJECT simple_nursery_serial_scan_object
25 #define SERIAL_SCAN_VTYPE simple_nursery_serial_scan_vtype
26 #define SERIAL_SCAN_PTR_FIELD simple_nursery_serial_scan_ptr_field
29 #elif defined (SGEN_SPLIT_NURSERY)
31 #ifdef SGEN_CONCURRENT_MAJOR
32 #define SERIAL_SCAN_OBJECT split_nursery_serial_with_concurrent_major_scan_object
33 #define SERIAL_SCAN_VTYPE split_nursery_serial_with_concurrent_major_scan_vtype
34 #define SERIAL_SCAN_PTR_FIELD split_nursery_serial_with_concurrent_major_scan_ptr_field
36 #define SERIAL_SCAN_OBJECT split_nursery_serial_scan_object
37 #define SERIAL_SCAN_VTYPE split_nursery_serial_scan_vtype
38 #define SERIAL_SCAN_PTR_FIELD split_nursery_serial_scan_ptr_field
42 #error "No nursery configuration specified"
46 /* Global remsets are handled in SERIAL_COPY_OBJECT_FROM_OBJ */
47 #define HANDLE_PTR(ptr,obj) do { \
48 void *__old = *(ptr); \
49 SGEN_OBJECT_LAYOUT_STATISTICS_MARK_BITMAP ((obj), (ptr)); \
50 binary_protocol_scan_process_reference ((full_object), (ptr), __old); \
52 SERIAL_COPY_OBJECT_FROM_OBJ ((ptr), queue); \
53 SGEN_COND_LOG (9, __old != *(ptr), "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
58 SERIAL_SCAN_OBJECT (GCObject
*full_object
, SgenDescriptor desc
, SgenGrayQueue
*queue
)
60 char *start
= (char*)full_object
;
62 SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP
;
64 #ifdef HEAVY_STATISTICS
65 sgen_descriptor_count_scanned_object (desc
);
68 SGEN_ASSERT (9, sgen_get_current_collection_generation () == GENERATION_NURSERY
, "Must not use minor scan during major collection.");
70 #define SCAN_OBJECT_PROTOCOL
71 #include "sgen-scan-object.h"
73 SGEN_OBJECT_LAYOUT_STATISTICS_COMMIT_BITMAP
;
74 HEAVY_STAT (++stat_scan_object_called_nursery
);
78 SERIAL_SCAN_VTYPE (GCObject
*full_object
, char *start
, SgenDescriptor desc
, SgenGrayQueue
*queue
BINARY_PROTOCOL_ARG (size_t size
))
80 SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP
;
82 SGEN_ASSERT (9, sgen_get_current_collection_generation () == GENERATION_NURSERY
, "Must not use minor scan during major collection.");
84 /* The descriptors include info about the MonoObject header as well */
85 start
-= SGEN_CLIENT_OBJECT_HEADER_SIZE
;
87 #define SCAN_OBJECT_NOVTABLE
88 #define SCAN_OBJECT_PROTOCOL
89 #include "sgen-scan-object.h"
93 SERIAL_SCAN_PTR_FIELD (GCObject
*full_object
, GCObject
**ptr
, SgenGrayQueue
*queue
)
95 HANDLE_PTR (ptr
, NULL
);
98 #define FILL_MINOR_COLLECTOR_SCAN_OBJECT(ops) do { \
99 (ops)->scan_object = SERIAL_SCAN_OBJECT; \
100 (ops)->scan_vtype = SERIAL_SCAN_VTYPE; \
101 (ops)->scan_ptr_field = SERIAL_SCAN_PTR_FIELD; \