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
17 #ifndef SCAN_OBJECT_ACTION
18 #define SCAN_OBJECT_ACTION
26 vt = (GCVTable*)LOAD_VTABLE (start);
27 //type = vt->desc & 0x7;
29 /* gcc should be smart enough to remove the bounds check, but it isn't:( */
32 case DESC_TYPE_STRING:
33 STRING_SIZE (skip_size, start);
37 case DESC_TYPE_RUN_LENGTH:
38 OBJ_RUN_LEN_SIZE (skip_size, desc, start);
40 #ifndef SCAN_OBJECT_NOSCAN
41 OBJ_RUN_LEN_FOREACH_PTR (desc, start);
47 case DESC_TYPE_VECTOR:
48 skip_size = safe_object_get_size ((MonoObject*)start);
49 skip_size += (ALLOC_ALIGN - 1);
50 skip_size &= ~(ALLOC_ALIGN - 1);
51 #ifndef SCAN_OBJECT_NOSCAN
52 OBJ_VECTOR_FOREACH_PTR (vt, start);
57 case DESC_TYPE_SMALL_BITMAP:
58 OBJ_BITMAP_SIZE (skip_size, desc, start);
60 #ifndef SCAN_OBJECT_NOSCAN
61 OBJ_BITMAP_FOREACH_PTR (desc, start);
66 case DESC_TYPE_LARGE_BITMAP:
67 skip_size = safe_object_get_size ((MonoObject*)start);
68 skip_size += (ALLOC_ALIGN - 1);
69 skip_size &= ~(ALLOC_ALIGN - 1);
70 #ifndef SCAN_OBJECT_NOSCAN
71 OBJ_LARGE_BITMAP_FOREACH_PTR (vt,start);
76 case DESC_TYPE_COMPLEX:
77 /* this is a complex object */
78 skip_size = safe_object_get_size ((MonoObject*)start);
79 skip_size += (ALLOC_ALIGN - 1);
80 skip_size &= ~(ALLOC_ALIGN - 1);
81 #ifndef SCAN_OBJECT_NOSCAN
82 OBJ_COMPLEX_FOREACH_PTR (vt, start);
87 case DESC_TYPE_COMPLEX_ARR:
88 /* this is an array of complex structs */
89 skip_size = safe_object_get_size ((MonoObject*)start);
90 skip_size += (ALLOC_ALIGN - 1);
91 skip_size &= ~(ALLOC_ALIGN - 1);
92 #ifndef SCAN_OBJECT_NOSCAN
93 OBJ_COMPLEX_ARR_FOREACH_PTR (vt, start);
99 g_assert_not_reached ();
103 #undef SCAN_OBJECT_NOSCAN
104 #undef SCAN_OBJECT_ACTION