/*
* Stores the default value / RVA of fields.
- * This information is rarely needed, so it is stored separately from MonoClassField.
+ * This information is rarely needed, so it is stored separately from
+ * MonoClassField.
*/
typedef struct MonoFieldDefaultValue {
/*
* field, it's the offset from the start of the object, if
* it's static, it's from the start of the memory chunk
* allocated for statics for the class.
+ * For special static fields, this is set to -1 during vtable construction.
*/
int offset;
};
MonoObject **field_objects;
};
+/*
+ * A type parameter.
+ */
+struct _MonoGenericParam {
+ MonoGenericContainer *owner; /* Type or method this parameter was defined in. */
+ guint16 num;
+ /*
+ * If owner is NULL, or owner is 'owned' by this gparam,
+ * then this is the image whose mempool this struct was allocated from.
+ * The second case happens for gparams created in
+ * mono_reflection_initialize_generic_parameter ().
+ */
+ MonoImage *image;
+};
+
+/* Additional details about a MonoGenericParam */
+typedef struct {
+ MonoClass *pklass; /* The corresponding `MonoClass'. */
+ const char *name;
+ guint16 flags;
+ guint32 token;
+ MonoClass** constraints; /* NULL means end of list */
+} MonoGenericParamInfo;
+
+typedef struct {
+ MonoGenericParam param;
+ MonoGenericParamInfo info;
+} MonoGenericParamFull;
+
/*
* The generic container.
*
/* Invariant: parent != NULL => is_method */
int is_method : 1;
/* Our type parameters. */
- MonoGenericParam *type_params;
-};
+ MonoGenericParamFull *type_params;
-/*
- * A type parameter.
- */
-struct _MonoGenericParam {
- MonoGenericContainer *owner; /* Type or method this parameter was defined in. */
- MonoClass *pklass; /* The corresponding `MonoClass'. */
- const char *name;
- guint16 flags;
- guint16 num;
- MonoClass** constraints; /* NULL means end of list */
- /* If owner is NULL, this is the image whose mempool this struct was allocated from */
+ /*
+ * For owner-less containers created by SRE, the image the container was
+ * allocated from.
+ */
MonoImage *image;
};
+#define mono_generic_container_get_param(gc, i) ((MonoGenericParam *) ((gc)->type_params + (i)))
+#define mono_generic_container_get_param_info(gc, i) (&((gc)->type_params + (i))->info)
+
+#define mono_generic_param_owner(p) ((p)->owner)
+#define mono_generic_param_num(p) ((p)->num)
+#define mono_generic_param_info(p) (mono_generic_param_owner (p) ? &((MonoGenericParamFull *) p)->info : NULL)
+#define mono_type_get_generic_param_owner(t) (mono_generic_param_owner ((t)->data.generic_param))
+#define mono_type_get_generic_param_num(t) (mono_generic_param_num ((t)->data.generic_param))
+
/*
* Class information which might be cached by the runtime in the AOT file for
* example. Caching this allows us to avoid computing a generic vtable
MonoClass *handleref_class;
MonoClass *attribute_class;
MonoClass *customattribute_data_class;
+ MonoClass *critical_finalizer_object;
} MonoDefaults;
extern MonoDefaults mono_defaults MONO_INTERNAL;
MonoType*
mono_type_get_basic_type_from_generic (MonoType *type) MONO_INTERNAL;
+void
+mono_set_generic_sharing_supported (gboolean supported) MONO_INTERNAL;
+
gboolean
mono_class_generic_sharing_enabled (MonoClass *class) MONO_INTERNAL;