[sgen] Fix race conditions in worker thread start/stop.
[mono.git] / mono / metadata / sgen-scan-object.h
index d5a637ed8fe3717c8d5a660c15ac778389c6cf46..48490d781e227d7f58179e5b49e8521ad27923ce 100644 (file)
@@ -38,6 +38,9 @@
  * padding at the end) is "skip_size".  "desc" is the object's GC
  * descriptor.  The action can use the macro
  * "SCAN" to scan the object.
+ *
+ * SCAN_OBJECT_NOVTABLE - desc is provided by the includer, instead of
+ * vt.  Complex arrays cannot not be scanned.
  */
 
 #ifndef SCAN_OBJECT_ACTION
@@ -45,6 +48,7 @@
 #endif
 
 {
+#ifndef SCAN_OBJECT_NOVTABLE
        GCVTable *vt;
        mword desc;
 
@@ -53,6 +57,7 @@
 
        /* gcc should be smart enough to remove the bounds check, but it isn't:( */
        desc = vt->desc;
+#endif
        switch (desc & 0x7) {
        case DESC_TYPE_RUN_LENGTH:
 #define SCAN OBJ_RUN_LEN_FOREACH_PTR (desc, start)
                SCAN_OBJECT_ACTION;
 #undef SCAN
                break;
-       case DESC_TYPE_ARRAY:
-       case DESC_TYPE_VECTOR:
-#define SCAN OBJ_VECTOR_FOREACH_PTR (vt, start)
+       case DESC_TYPE_SMALL_BITMAP:
+#define SCAN OBJ_BITMAP_FOREACH_PTR (desc, start)
 #ifndef SCAN_OBJECT_NOSCAN
                SCAN;
 #endif
                SCAN_OBJECT_ACTION;
 #undef SCAN
                break;
-       case DESC_TYPE_SMALL_BITMAP:
-#define SCAN OBJ_BITMAP_FOREACH_PTR (desc, start)
+       case DESC_TYPE_VECTOR:
+#define SCAN OBJ_VECTOR_FOREACH_PTR (desc, start)
 #ifndef SCAN_OBJECT_NOSCAN
                SCAN;
 #endif
@@ -80,7 +84,7 @@
 #undef SCAN
                break;
        case DESC_TYPE_LARGE_BITMAP:
-#define SCAN OBJ_LARGE_BITMAP_FOREACH_PTR (vt,start)
+#define SCAN OBJ_LARGE_BITMAP_FOREACH_PTR (desc, start)
 #ifndef SCAN_OBJECT_NOSCAN
                SCAN;
 #endif
                break;
        case DESC_TYPE_COMPLEX:
                /* this is a complex object */
-#define SCAN OBJ_COMPLEX_FOREACH_PTR (vt, start)
+#define SCAN OBJ_COMPLEX_FOREACH_PTR (desc, start)
 #ifndef SCAN_OBJECT_NOSCAN
                SCAN;
 #endif
                SCAN_OBJECT_ACTION;
 #undef SCAN
                break;
+#ifndef SCAN_OBJECT_NOVTABLE
        case DESC_TYPE_COMPLEX_ARR:
                /* this is an array of complex structs */
 #define SCAN OBJ_COMPLEX_ARR_FOREACH_PTR (vt, start)
                SCAN_OBJECT_ACTION;
 #undef SCAN
                break;
+#endif
+       case DESC_TYPE_COMPLEX_PTRFREE:
+               /*Nothing to do*/
+               SCAN_OBJECT_ACTION;
+               break;
        default:
                g_assert_not_reached ();
        }
 
 #undef SCAN_OBJECT_NOSCAN
 #undef SCAN_OBJECT_ACTION
+#undef SCAN_OBJECT_NOVTABLE