#define MONO_ZERO_LEN_ARRAY 1
#endif
-#define MONO_TYPE_ISSTRUCT(t) (!t->byref && t->type == MONO_TYPE_VALUETYPE && !t->data.klass->enumtype)
+#define MONO_TYPE_ISSTRUCT(t) (!(t)->byref && (((t)->type == MONO_TYPE_VALUETYPE && !(t)->data.klass->enumtype) || ((t)->type == MONO_TYPE_TYPEDBYREF)))
#define MONO_TYPE_IS_VOID(t) ((t) && ((t)->type == MONO_TYPE_VOID) && !(t)->byref)
-#define MONO_TYPE_IS_REFERENCE(t) ((t) && (((t)->byref || ((t)->type == MONO_TYPE_I) || (t)->type == MONO_TYPE_STRING) || ((t)->type == MONO_TYPE_SZARRAY) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_OBJECT) || ((t)->type == MONO_TYPE_ARRAY) || ((t)->type == MONO_TYPE_PTR)))
+#define MONO_TYPE_IS_POINTER(t) ((t) && (((t)->byref || ((t)->type == MONO_TYPE_I) || (t)->type == MONO_TYPE_STRING) || ((t)->type == MONO_TYPE_SZARRAY) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_OBJECT) || ((t)->type == MONO_TYPE_ARRAY) || ((t)->type == MONO_TYPE_PTR)))
+#define MONO_TYPE_IS_REFERENCE(t) ((t) && (((t)->type == MONO_TYPE_STRING) || ((t)->type == MONO_TYPE_SZARRAY) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_OBJECT) || ((t)->type == MONO_TYPE_ARRAY)))
+#define MONO_CLASS_IS_INTERFACE(c) ((c->flags & TYPE_ATTRIBUTE_INTERFACE) || (c->byval_arg.type == MONO_TYPE_VAR) || (c->byval_arg.type == MONO_TYPE_MVAR))
typedef struct _MonoClass MonoClass;
typedef struct _MonoDomain MonoDomain;
MONO_TABLE_MODULE,
MONO_TABLE_TYPEREF,
MONO_TABLE_TYPEDEF,
- MONO_TABLE_UNUSED1,
+ MONO_TABLE_FIELD_POINTER,
MONO_TABLE_FIELD,
- MONO_TABLE_UNUSED2,
+ MONO_TABLE_METHOD_POINTER,
MONO_TABLE_METHOD,
- MONO_TABLE_UNUSED3,
+ MONO_TABLE_PARAM_POINTER,
MONO_TABLE_PARAM,
MONO_TABLE_INTERFACEIMPL,
- MONO_TABLE_MEMBERREF,
+ MONO_TABLE_MEMBERREF, /* 0xa */
MONO_TABLE_CONSTANT,
MONO_TABLE_CUSTOMATTRIBUTE,
MONO_TABLE_FIELDMARSHAL,
MONO_TABLE_DECLSECURITY,
MONO_TABLE_CLASSLAYOUT,
- MONO_TABLE_FIELDLAYOUT,
+ MONO_TABLE_FIELDLAYOUT, /* 0x10 */
MONO_TABLE_STANDALONESIG,
MONO_TABLE_EVENTMAP,
- MONO_TABLE_UNUSED4,
+ MONO_TABLE_EVENT_POINTER,
MONO_TABLE_EVENT,
MONO_TABLE_PROPERTYMAP,
MONO_TABLE_UNUSED5,
MONO_TABLE_PROPERTY,
MONO_TABLE_METHODSEMANTICS,
MONO_TABLE_METHODIMPL,
- MONO_TABLE_MODULEREF,
+ MONO_TABLE_MODULEREF, /* 0x1a */
MONO_TABLE_TYPESPEC,
MONO_TABLE_IMPLMAP,
MONO_TABLE_FIELDRVA,
MONO_TABLE_UNUSED6,
MONO_TABLE_UNUSED7,
- MONO_TABLE_ASSEMBLY,
+ MONO_TABLE_ASSEMBLY, /* 0x20 */
MONO_TABLE_ASSEMBLYPROCESSOR,
MONO_TABLE_ASSEMBLYOS,
MONO_TABLE_ASSEMBLYREF,
MONO_TABLE_EXPORTEDTYPE,
MONO_TABLE_MANIFESTRESOURCE,
MONO_TABLE_NESTEDCLASS,
- MONO_TABLE_GENERICPARAM,
+ MONO_TABLE_GENERICPARAM, /* 0x2a */
MONO_TABLE_METHODSPEC,
MONO_TABLE_GENERICPARAMCONSTRAINT
-#define MONO_TABLE_LAST MONO_TABLE_NESTEDCLASS
+#define MONO_TABLE_LAST MONO_TABLE_GENERICPARAMCONSTRAINT
} MonoMetaTableEnum;
typedef enum {
MONO_MARSHAL_CONV_STR_BYVALSTR,
MONO_MARSHAL_CONV_STR_BYVALWSTR,
MONO_MARSHAL_CONV_SB_LPSTR,
+ MONO_MARSHAL_CONV_SB_LPTSTR,
+ MONO_MARSHAL_CONV_SB_LPWSTR,
MONO_MARSHAL_CONV_LPSTR_SB,
+ MONO_MARSHAL_CONV_LPTSTR_SB,
+ MONO_MARSHAL_CONV_LPWSTR_SB,
MONO_MARSHAL_CONV_ARRAY_BYVALARRAY,
MONO_MARSHAL_CONV_ARRAY_SAVEARRAY,
MONO_MARSHAL_CONV_ARRAY_LPARRAY,
MONO_MARSHAL_CONV_OBJECT_IUNKNOWN,
MONO_MARSHAL_CONV_OBJECT_STRUCT,
MONO_MARSHAL_CONV_DEL_FTN,
+ MONO_MARSHAL_CONV_FTN_DEL,
MONO_MARSHAL_CONV_STRARRAY_STRLPARRAY,
- MONO_MARSHAL_FREE_ARRAY
+ MONO_MARSHAL_CONV_STRARRAY_STRWLPARRAY,
+ MONO_MARSHAL_CONV_ASANY,
+ MONO_MARSHAL_FREE_ARRAY,
+ MONO_MARSHAL_FREE_ASANY
} MonoMarshalConv;
typedef struct {
MonoMarshalNative native;
- MonoMarshalNative elem_type;
- gint32 param_num;
- gint32 num_elem;
+ union {
+ struct {
+ MonoMarshalNative elem_type;
+ gint32 param_num;
+ gint32 num_elem;
+ } array_data;
+ struct {
+ char *custom_name;
+ char *cookie;
+ } custom_data;
+ } data;
} MonoMarshalSpec;
+void mono_metadata_init (void);
void mono_metadata_decode_row (MonoTableInfo *t,
int idx,
guint32 mono_metadata_methods_from_property (MonoImage *meta, guint32 table_index, guint *end);
guint32 mono_metadata_packing_from_typedef (MonoImage *meta, guint32 table_index, guint32 *packing, guint32 *size);
const char* mono_metadata_get_marshal_info (MonoImage *meta, guint32 idx, gboolean is_field);
+guint32 mono_metadata_custom_attrs_from_index (MonoImage *meta, guint32 index);
MonoMarshalSpec *mono_metadata_parse_marshal_spec (MonoImage *image, const char *ptr);
guint32 *rva,
MonoMarshalSpec **marshal_spec);
-guint32 mono_metadata_get_constant_index (MonoImage *meta, guint32 token);
+guint32 mono_metadata_get_constant_index (MonoImage *meta, guint32 token, guint32 hint);
/*
* Functions to extract information from the Blobs
typedef struct _MonoType MonoType;
typedef struct _MonoGenericInst MonoGenericInst;
+typedef struct _MonoDynamicGenericInst MonoDynamicGenericInst;
+typedef struct _MonoGenericMethod MonoGenericMethod;
+typedef struct _MonoGenericContext MonoGenericContext;
+typedef struct _MonoGenericParam MonoGenericParam;
typedef struct _MonoArrayType MonoArrayType;
typedef struct _MonoMethodSignature MonoMethodSignature;
} MonoCustomMod;
struct _MonoArrayType {
- MonoType *type;
+ MonoClass *eklass;
int rank;
int numsizes;
int numlobounds;
int *lobounds;
};
-/*
- * Generic instantiation data type encoding.
- */
-struct _MonoGenericInst {
- MonoType *generic_type;
- int type_argc;
- MonoType **type_argv;
-};
-
struct _MonoType {
union {
MonoClass *klass; /* for VALUETYPE and CLASS */
- MonoType *type; /* for PTR and SZARRAY */
+ MonoType *type; /* for PTR */
MonoArrayType *array; /* for ARRAY */
MonoMethodSignature *method;
- int type_param;
- MonoGenericInst *generic_inst;
+ MonoGenericParam *generic_param; /* for VAR and MVAR */
+ MonoGenericInst *generic_inst; /* for GENERICINST */
} data;
unsigned int attrs : 16; /* param attributes or field flags */
unsigned int type : 8; /* ElementTypeEnum */
unsigned int ref_count : 23;
guint16 param_count;
guint16 sentinelpos;
+ unsigned int generic_param_count : 30;
+ unsigned int is_inflated : 1;
+ unsigned int has_type_parameters : 1;
MonoType *ret;
MonoType *params [MONO_ZERO_LEN_ARRAY];
};
unsigned int init_locals : 1;
guint16 num_locals;
MonoExceptionClause *clauses;
+ MonoGenericParam *gen_params;
MonoType *locals [MONO_ZERO_LEN_ARRAY];
} MonoMethodHeader;
int *alignment);
int mono_type_stack_size (MonoType *type,
int *alignment);
-int mono_type_native_stack_size (MonoType *type,
- int *alignment);
+
+guint mono_metadata_generic_inst_hash (MonoGenericInst *ginst);
+gboolean mono_metadata_generic_inst_equal (MonoGenericInst *g1, MonoGenericInst *g2);
guint mono_metadata_type_hash (MonoType *t1);
gboolean mono_metadata_type_equal (MonoType *t1, MonoType *t2);
MonoMethodSignature *mono_metadata_signature_alloc (MonoImage *image, guint32 nparams);
+MonoMethodSignature *mono_metadata_signature_dup (MonoMethodSignature *sig);
+
MonoMethodSignature *mono_metadata_parse_signature (MonoImage *image,
guint32 token);
mono_type_to_unmanaged (MonoType *type, MonoMarshalSpec *mspec,
gboolean as_field, gboolean unicode, MonoMarshalConv *conv);
-gint32
-mono_marshal_type_size (MonoType *type, MonoMarshalSpec *mspec, gint32 *align,
- gboolean as_field, gboolean unicode);
-
/*
* Makes a token based on a table and an index
*/
-#define mono_metadata_make_token(table,idx) (((table) << 24)| idx)
+#define mono_metadata_make_token(table,idx) (((table) << 24)| (idx))
/*
* Returns the table index that this token encodes.