+Tue Jan 23 18:09:21 CET 2007 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, object.c: restrict GC-tracked fields to
+ UIntPtr fields used inside corlib, so we provide better
+ type info to the GC and also allow broken packing as in
+ bug #80580.
+
Mon Jan 22 11:24:27 CET 2007 Paolo Molaro <lupus@ximian.com>
* sgen-gc.c: removed duplicated function.
#ifdef HAVE_SGEN_GC
#define IS_GC_REFERENCE(t) FALSE
#else
-#define IS_GC_REFERENCE(t) ((t)->type == MONO_TYPE_U || (t)->type == MONO_TYPE_I || (t)->type == MONO_TYPE_PTR)
+#define IS_GC_REFERENCE(t) ((t)->type == MONO_TYPE_U && class->image == mono_defaults.corlib)
#endif
/*
if (class->image != mono_defaults.corlib &&
class->byval_arg.type != MONO_TYPE_VALUETYPE)
gc_aware_layout = TRUE;
+ /* from System.dll, used in metadata/process.h */
+ if (strcmp (class->name, "ProcessStartInfo") == 0)
+ gc_aware_layout = FALSE;
}
/* Compute klass->has_references */
if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
continue;
+ ftype = mono_type_get_underlying_type (field->type);
if (gc_aware_layout) {
- /*
- * We process fields with reference type in the first pass,
- * and fields with non-reference type in the second pass.
- * We use IS_POINTER instead of IS_REFERENCE because in
- * some internal structures, we store GC_MALLOCed memory
- * in IntPtr fields...
- */
- if (MONO_TYPE_IS_POINTER (field->type)) {
+ if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype))))) {
if (pass == 1)
continue;
} else {
/* if the field has managed references, we need to force-align it
* see bug #77788
*/
- ftype = mono_type_get_underlying_type (field->type);
- if (MONO_TYPE_IS_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype)))))
+ if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype)))))
align = sizeof (gpointer);
class->min_align = MAX (align, class->min_align);