2 * Scans one object, using the OBJ_XXX macros. The start of the
3 * object must be given in the variable "char* start". Afterwards,
4 * "start" will point to the start of the next object.
6 * Modifiers (automatically undefined):
8 * SCAN_OBJECT_NOSCAN - if defined, don't actually scan the object,
9 * i.e. don't invoke the OBJ_XXX macros.
11 * SCAN_OBJECT_ACTION - is invoked after an object has been scanned.
12 * The object's start is "start", its length in bytes (including
13 * padding at the end) is "skip_size". "desc" is the object's GC
14 * descriptor. The action can use the macro
15 * "SCAN" to scan the object.
18 #ifndef SCAN_OBJECT_ACTION
19 #define SCAN_OBJECT_ACTION
27 vt = (GCVTable*)LOAD_VTABLE (start);
28 //type = vt->desc & 0x7;
30 /* gcc should be smart enough to remove the bounds check, but it isn't:( */
33 case DESC_TYPE_STRING:
34 STRING_SIZE (skip_size, start);
40 case DESC_TYPE_RUN_LENGTH:
41 OBJ_RUN_LEN_SIZE (skip_size, desc, start);
43 #define SCAN OBJ_RUN_LEN_FOREACH_PTR (desc, start)
44 #ifndef SCAN_OBJECT_NOSCAN
52 case DESC_TYPE_VECTOR:
53 skip_size = safe_object_get_size ((MonoObject*)start);
54 skip_size += (ALLOC_ALIGN - 1);
55 skip_size &= ~(ALLOC_ALIGN - 1);
56 #define SCAN OBJ_VECTOR_FOREACH_PTR (vt, start)
57 #ifndef SCAN_OBJECT_NOSCAN
64 case DESC_TYPE_SMALL_BITMAP:
65 OBJ_BITMAP_SIZE (skip_size, desc, start);
67 #define SCAN OBJ_BITMAP_FOREACH_PTR (desc, start)
68 #ifndef SCAN_OBJECT_NOSCAN
75 case DESC_TYPE_LARGE_BITMAP:
76 skip_size = safe_object_get_size ((MonoObject*)start);
77 skip_size += (ALLOC_ALIGN - 1);
78 skip_size &= ~(ALLOC_ALIGN - 1);
79 #define SCAN OBJ_LARGE_BITMAP_FOREACH_PTR (vt,start)
80 #ifndef SCAN_OBJECT_NOSCAN
87 case DESC_TYPE_COMPLEX:
88 /* this is a complex object */
89 skip_size = safe_object_get_size ((MonoObject*)start);
90 skip_size += (ALLOC_ALIGN - 1);
91 skip_size &= ~(ALLOC_ALIGN - 1);
92 #define SCAN OBJ_COMPLEX_FOREACH_PTR (vt, start)
93 #ifndef SCAN_OBJECT_NOSCAN
100 case DESC_TYPE_COMPLEX_ARR:
101 /* this is an array of complex structs */
102 skip_size = safe_object_get_size ((MonoObject*)start);
103 skip_size += (ALLOC_ALIGN - 1);
104 skip_size &= ~(ALLOC_ALIGN - 1);
105 #define SCAN OBJ_COMPLEX_ARR_FOREACH_PTR (vt, start)
106 #ifndef SCAN_OBJECT_NOSCAN
114 g_assert_not_reached ();
118 #undef SCAN_OBJECT_NOSCAN
119 #undef SCAN_OBJECT_ACTION