-/*
- * metadata.c: Routines for accessing the metadata
+/**
+ * \file
+ * Routines for accessing the metadata
*
* Authors:
* Miguel de Icaza (miguel@ximian.com)
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/bsearch.h>
#include <mono/utils/atomic.h>
+#include <mono/utils/mono-counters.h>
+
+static int img_set_cache_hit, img_set_cache_miss, img_set_count;
+
/* Auxiliary structure used for caching inflated signatures */
typedef struct {
MONO_MT_HS_IDX,
/* ResolutionScope coded index: Module, ModuleRef, AssemblytRef, TypeRef */
- MONO_MT_RS_IDX
+ MONO_MT_RS_IDX,
+
+ /* CustomDebugInformation parent encoded index */
+ MONO_MT_HASCUSTDEBUG_IDX
};
const static unsigned char TableSchemas [] = {
MONO_MT_STRING_IDX, /* Name */
MONO_MT_END,
-#define NULL_SCHEMA_OFFSET LOCALVARIABLE_SCHEMA_OFFSET + 4
+#define LOCALCONSTANT_SCHEMA_OFFSET LOCALVARIABLE_SCHEMA_OFFSET + 4
+ MONO_MT_STRING_IDX, /* Name (String heap index) */
+ MONO_MT_BLOB_IDX, /* Signature (Blob heap index, LocalConstantSig blob) */
+ MONO_MT_END,
+
+#define IMPORTSCOPE_SCHEMA_OFFSET LOCALCONSTANT_SCHEMA_OFFSET + 3
+ MONO_MT_TABLE_IDX, /* Parent (ImportScope row id or nil) */
+ MONO_MT_BLOB_IDX, /* Imports (Blob index, encoding: Imports blob) */
+ MONO_MT_END,
+
+#define ASYNCMETHOD_SCHEMA_OFFSET IMPORTSCOPE_SCHEMA_OFFSET + 3
+ MONO_MT_TABLE_IDX, /* MoveNextMethod (MethodDef row id) */
+ MONO_MT_TABLE_IDX, /* KickoffMethod (MethodDef row id) */
+ MONO_MT_END,
+
+#define CUSTOMDEBUGINFORMATION_SCHEMA_OFFSET ASYNCMETHOD_SCHEMA_OFFSET + 3
+ MONO_MT_HASCUSTDEBUG_IDX, /* Parent (HasCustomDebugInformation coded index) */
+ MONO_MT_GUID_IDX, /* Kind (Guid heap index) */
+ MONO_MT_BLOB_IDX, /* Value (Blob heap index) */
+ MONO_MT_END,
+
+#define NULL_SCHEMA_OFFSET CUSTOMDEBUGINFORMATION_SCHEMA_OFFSET + 4
MONO_MT_END
};
DOCUMENT_SCHEMA_OFFSET, /* 0x30 */
METHODBODY_SCHEMA_OFFSET,
LOCALSCOPE_SCHEMA_OFFSET,
- LOCALVARIABLE_SCHEMA_OFFSET
+ LOCALVARIABLE_SCHEMA_OFFSET,
+ LOCALCONSTANT_SCHEMA_OFFSET,
+ IMPORTSCOPE_SCHEMA_OFFSET,
+ ASYNCMETHOD_SCHEMA_OFFSET,
+ CUSTOMDEBUGINFORMATION_SCHEMA_OFFSET
};
#ifdef HAVE_ARRAY_ELEM_INIT
#endif
+/* If TRUE (but also see DISABLE_STICT_STRONG_NAMES #define), Mono will check
+ * that the public key token, culture and version of a candidate assembly matches
+ * the requested strong name. If FALSE, as long as the name matches, the candidate
+ * will be allowed.
+ */
+static gboolean check_strong_names_strictly = FALSE;
+
// Amount initially reserved in each imageset's mempool.
// FIXME: This number is arbitrary, a more practical number should be found
#define INITIAL_IMAGE_SET_SIZE 1024
/**
* mono_meta_table_name:
- * @table: table index
+ * \param table table index
*
* Returns the name of the given ECMA metadata logical format table
* as described in ECMA 335, Partition II, Section 22.
*
- * Returns: the name for the @table index
+ * \returns the name for the \p table index
*/
const char *
mono_meta_table_name (int table)
*/
#define rtsize(meta,s,b) (((s) < (1 << (b)) ? 2 : 4))
-#define idx_size(meta,tableidx) ((meta)->tables [(tableidx)].rows < 65536 ? 2 : 4)
+
+static inline int
+idx_size (MonoImage *meta, int tableidx)
+{
+ if (meta->referenced_tables && (meta->referenced_tables & ((guint64)1 << tableidx)))
+ return meta->referenced_table_rows [tableidx] < 65536 ? 2 : 4;
+ else
+ return meta->tables [tableidx].rows < 65536 ? 2 : 4;
+}
+
+static inline int
+get_nrows (MonoImage *meta, int tableidx)
+{
+ if (meta->referenced_tables && (meta->referenced_tables & ((guint64)1 << tableidx)))
+ return meta->referenced_table_rows [tableidx];
+ else
+ return meta->tables [tableidx].rows;
+}
/* Reference: Partition II - 23.2.6 */
-/*
+/**
* mono_metadata_compute_size:
- * @meta: metadata context
- * @tableindex: metadata table number
- * @result_bitfield: pointer to guint32 where to store additional info
+ * \param meta metadata context
+ * \param tableindex metadata table number
+ * \param result_bitfield pointer to \c guint32 where to store additional info
*
- * mono_metadata_compute_size() computes the lenght in bytes of a single
+ * \c mono_metadata_compute_size computes the length in bytes of a single
* row in a metadata table. The size of each column is encoded in the
- * @result_bitfield return value along with the number of columns in the table.
- * the resulting bitfield should be handed to the mono_metadata_table_size()
- * and mono_metadata_table_count() macros.
+ * \p result_bitfield return value along with the number of columns in the table.
+ * the resulting bitfield should be handed to the \c mono_metadata_table_size
+ * and \c mono_metadata_table_count macros.
* This is a Mono runtime internal only function.
*/
int
break;
case MONO_TABLE_GENERICPARAM:
g_assert (i == 2);
- n = MAX (meta->tables [MONO_TABLE_METHOD].rows, meta->tables [MONO_TABLE_TYPEDEF].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_METHOD), get_nrows (meta, MONO_TABLE_TYPEDEF));
/*This is a coded token for 2 tables, so takes 1 bit */
field_size = rtsize (meta, n, 16 - MONO_TYPEORMETHOD_BITS);
break;
break;
case MONO_TABLE_METHODBODY:
g_assert (i == 0);
- field_size = idx_size (meta, MONO_TABLE_DOCUMENT);
- break;
+ field_size = idx_size (meta, MONO_TABLE_DOCUMENT); break;
+ case MONO_TABLE_IMPORTSCOPE:
+ g_assert(i == 0);
+ field_size = idx_size (meta, MONO_TABLE_IMPORTSCOPE); break;
+ case MONO_TABLE_STATEMACHINEMETHOD:
+ g_assert(i == 0 || i == 1);
+ field_size = idx_size(meta, MONO_TABLE_METHOD); break;
default:
g_error ("Can't handle MONO_MT_TABLE_IDX for table %d element %d", tableindex, i);
}
* HasConstant: ParamDef, FieldDef, Property
*/
case MONO_MT_CONST_IDX:
- n = MAX (meta->tables [MONO_TABLE_PARAM].rows,
- meta->tables [MONO_TABLE_FIELD].rows);
- n = MAX (n, meta->tables [MONO_TABLE_PROPERTY].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_PARAM),
+ get_nrows (meta, MONO_TABLE_FIELD));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_PROPERTY));
/* 2 bits to encode tag */
field_size = rtsize (meta, n, 16-2);
break;
}*/
- n = MAX (meta->tables [MONO_TABLE_METHOD].rows,
- meta->tables [MONO_TABLE_FIELD].rows);
- n = MAX (n, meta->tables [MONO_TABLE_TYPEREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_TYPEDEF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_PARAM].rows);
- n = MAX (n, meta->tables [MONO_TABLE_INTERFACEIMPL].rows);
- n = MAX (n, meta->tables [MONO_TABLE_MEMBERREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_MODULE].rows);
- n = MAX (n, meta->tables [MONO_TABLE_DECLSECURITY].rows);
- n = MAX (n, meta->tables [MONO_TABLE_PROPERTY].rows);
- n = MAX (n, meta->tables [MONO_TABLE_EVENT].rows);
- n = MAX (n, meta->tables [MONO_TABLE_STANDALONESIG].rows);
- n = MAX (n, meta->tables [MONO_TABLE_MODULEREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_TYPESPEC].rows);
- n = MAX (n, meta->tables [MONO_TABLE_ASSEMBLY].rows);
- n = MAX (n, meta->tables [MONO_TABLE_ASSEMBLYREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_FILE].rows);
- n = MAX (n, meta->tables [MONO_TABLE_EXPORTEDTYPE].rows);
- n = MAX (n, meta->tables [MONO_TABLE_MANIFESTRESOURCE].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_METHOD),
+ get_nrows (meta, MONO_TABLE_FIELD));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_TYPEREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_TYPEDEF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_PARAM));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_INTERFACEIMPL));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_MEMBERREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_MODULE));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_DECLSECURITY));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_PROPERTY));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_EVENT));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_STANDALONESIG));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_MODULEREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_TYPESPEC));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_ASSEMBLY));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_ASSEMBLYREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_FILE));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_EXPORTEDTYPE));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_MANIFESTRESOURCE));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_GENERICPARAM));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_GENERICPARAMCONSTRAINT));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_METHODSPEC));
/* 5 bits to encode */
field_size = rtsize (meta, n, 16-5);
break;
+ /*
+ * HasCustomAttribute: points to any table but
+ * itself.
+ */
+
+ case MONO_MT_HASCUSTDEBUG_IDX:
+ n = MAX(get_nrows (meta, MONO_TABLE_METHOD),
+ get_nrows (meta, MONO_TABLE_FIELD));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_TYPEREF));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_TYPEDEF));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_PARAM));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_INTERFACEIMPL));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_MEMBERREF));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_MODULE));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_DECLSECURITY));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_PROPERTY));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_EVENT));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_STANDALONESIG));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_MODULEREF));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_TYPESPEC));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_ASSEMBLY));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_ASSEMBLYREF));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_FILE));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_EXPORTEDTYPE));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_MANIFESTRESOURCE));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_GENERICPARAM));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_GENERICPARAMCONSTRAINT));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_METHODSPEC));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_DOCUMENT));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_LOCALSCOPE));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_LOCALVARIABLE));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_LOCALCONSTANT));
+ n = MAX(n, get_nrows (meta, MONO_TABLE_IMPORTSCOPE));
+
+ /* 5 bits to encode */
+ field_size = rtsize(meta, n, 16 - 5);
+ break;
+
/*
* CustomAttributeType: TypeDef, TypeRef, MethodDef,
* MemberRef and String.
break;
}*/
- n = MAX (meta->tables [MONO_TABLE_TYPEREF].rows,
- meta->tables [MONO_TABLE_TYPEDEF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_METHOD].rows);
- n = MAX (n, meta->tables [MONO_TABLE_MEMBERREF].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_TYPEREF),
+ get_nrows (meta, MONO_TABLE_TYPEDEF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_METHOD));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_MEMBERREF));
/* 3 bits to encode */
field_size = rtsize (meta, n, 16-3);
* HasDeclSecurity: Typedef, MethodDef, Assembly
*/
case MONO_MT_HASDEC_IDX:
- n = MAX (meta->tables [MONO_TABLE_TYPEDEF].rows,
- meta->tables [MONO_TABLE_METHOD].rows);
- n = MAX (n, meta->tables [MONO_TABLE_ASSEMBLY].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_TYPEDEF),
+ get_nrows (meta, MONO_TABLE_METHOD));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_ASSEMBLY));
/* 2 bits to encode */
field_size = rtsize (meta, n, 16-2);
* Implementation: File, AssemblyRef, ExportedType
*/
case MONO_MT_IMPL_IDX:
- n = MAX (meta->tables [MONO_TABLE_FILE].rows,
- meta->tables [MONO_TABLE_ASSEMBLYREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_EXPORTEDTYPE].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_FILE),
+ get_nrows (meta, MONO_TABLE_ASSEMBLYREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_EXPORTEDTYPE));
/* 2 bits to encode tag */
field_size = rtsize (meta, n, 16-2);
* HasFieldMarshall: FieldDef, ParamDef
*/
case MONO_MT_HFM_IDX:
- n = MAX (meta->tables [MONO_TABLE_FIELD].rows,
- meta->tables [MONO_TABLE_PARAM].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_FIELD),
+ get_nrows (meta, MONO_TABLE_PARAM));
/* 1 bit used to encode tag */
field_size = rtsize (meta, n, 16-1);
* MemberForwarded: FieldDef, MethodDef
*/
case MONO_MT_MF_IDX:
- n = MAX (meta->tables [MONO_TABLE_FIELD].rows,
- meta->tables [MONO_TABLE_METHOD].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_FIELD),
+ get_nrows (meta, MONO_TABLE_METHOD));
/* 1 bit used to encode tag */
field_size = rtsize (meta, n, 16-1);
* It is TypeDef, _TypeRef_, TypeSpec, instead.
*/
case MONO_MT_TDOR_IDX:
- n = MAX (meta->tables [MONO_TABLE_TYPEDEF].rows,
- meta->tables [MONO_TABLE_TYPEREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_TYPESPEC].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_TYPEDEF),
+ get_nrows (meta, MONO_TABLE_TYPEREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_TYPESPEC));
/* 2 bits to encode */
field_size = rtsize (meta, n, 16-2);
* MemberRefParent: TypeDef, TypeRef, MethodDef, ModuleRef, TypeSpec, MemberRef
*/
case MONO_MT_MRP_IDX:
- n = MAX (meta->tables [MONO_TABLE_TYPEDEF].rows,
- meta->tables [MONO_TABLE_TYPEREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_METHOD].rows);
- n = MAX (n, meta->tables [MONO_TABLE_MODULEREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_TYPESPEC].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_TYPEDEF),
+ get_nrows (meta, MONO_TABLE_TYPEREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_METHOD));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_MODULEREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_TYPESPEC));
/* 3 bits to encode */
field_size = rtsize (meta, n, 16 - 3);
* MethodDefOrRef: MethodDef, MemberRef
*/
case MONO_MT_MDOR_IDX:
- n = MAX (meta->tables [MONO_TABLE_METHOD].rows,
- meta->tables [MONO_TABLE_MEMBERREF].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_METHOD),
+ get_nrows (meta, MONO_TABLE_MEMBERREF));
/* 1 bit used to encode tag */
field_size = rtsize (meta, n, 16-1);
* HasSemantics: Property, Event
*/
case MONO_MT_HS_IDX:
- n = MAX (meta->tables [MONO_TABLE_PROPERTY].rows,
- meta->tables [MONO_TABLE_EVENT].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_PROPERTY),
+ get_nrows (meta, MONO_TABLE_EVENT));
/* 1 bit used to encode tag */
field_size = rtsize (meta, n, 16-1);
* ResolutionScope: Module, ModuleRef, AssemblyRef, TypeRef
*/
case MONO_MT_RS_IDX:
- n = MAX (meta->tables [MONO_TABLE_MODULE].rows,
- meta->tables [MONO_TABLE_MODULEREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_ASSEMBLYREF].rows);
- n = MAX (n, meta->tables [MONO_TABLE_TYPEREF].rows);
+ n = MAX (get_nrows (meta, MONO_TABLE_MODULE),
+ get_nrows (meta, MONO_TABLE_MODULEREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_ASSEMBLYREF));
+ n = MAX (n, get_nrows (meta, MONO_TABLE_TYPEREF));
/* 2 bits used to encode tag (ECMA spec claims 3) */
field_size = rtsize (meta, n, 16 - 2);
/**
* mono_metadata_compute_table_bases:
- * @meta: metadata context to compute table values
+ * \param meta metadata context to compute table values
*
* Computes the table bases for the metadata structure.
* This is an internal function used by the image loader code.
/**
* mono_metadata_locate:
- * @meta: metadata context
- * @table: table code.
- * @idx: index of element to retrieve from @table.
+ * \param meta metadata context
+ * \param table table code.
+ * \param idx index of element to retrieve from \p table.
*
- * Returns: a pointer to the @idx element in the metadata table
- * whose code is @table.
+ * \returns a pointer to the \p idx element in the metadata table
+ * whose code is \p table.
*/
const char *
mono_metadata_locate (MonoImage *meta, int table, int idx)
/**
* mono_metadata_locate_token:
- * @meta: metadata context
- * @token: metadata token
+ * \param meta metadata context
+ * \param token metadata token
*
- * Returns: a pointer to the data in the metadata represented by the
- * token #token.
+ * \returns a pointer to the data in the metadata represented by the
+ * token \p token .
*/
const char *
mono_metadata_locate_token (MonoImage *meta, guint32 token)
/**
* mono_metadata_string_heap:
- * @meta: metadata context
- * @index: index into the string heap.
- *
- * Returns: an in-memory pointer to the @index in the string heap.
+ * \param meta metadata context
+ * \param index index into the string heap.
+ * \returns an in-memory pointer to the \p index in the string heap.
*/
const char *
mono_metadata_string_heap (MonoImage *meta, guint32 index)
/**
* mono_metadata_user_string:
- * @meta: metadata context
- * @index: index into the user string heap.
- *
- * Returns: an in-memory pointer to the @index in the user string heap ("#US").
+ * \param meta metadata context
+ * \param index index into the user string heap.
+ * \returns an in-memory pointer to the \p index in the user string heap (<code>#US</code>).
*/
const char *
mono_metadata_user_string (MonoImage *meta, guint32 index)
/**
* mono_metadata_blob_heap:
- * @meta: metadata context
- * @index: index into the blob.
- *
- * Returns: an in-memory pointer to the @index in the Blob heap.
+ * \param meta metadata context
+ * \param index index into the blob.
+ * \returns an in-memory pointer to the \p index in the Blob heap.
*/
const char *
mono_metadata_blob_heap (MonoImage *meta, guint32 index)
/**
* mono_metadata_guid_heap:
- * @meta: metadata context
- * @index: index into the guid heap.
- *
- * Returns: an in-memory pointer to the @index in the guid heap.
+ * \param meta metadata context
+ * \param index index into the guid heap.
+ * \returns an in-memory pointer to the \p index in the guid heap.
*/
const char *
mono_metadata_guid_heap (MonoImage *meta, guint32 index)
/**
* mono_metadata_decode_row:
- * @t: table to extract information from.
- * @idx: index in table.
- * @res: array of @res_size cols to store the results in
+ * \param t table to extract information from.
+ * \param idx index in table.
+ * \param res array of \p res_size cols to store the results in
*
- * This decompresses the metadata element @idx in table @t
- * into the guint32 @res array that has res_size elements
+ * This decompresses the metadata element \p idx in table \p t
+ * into the \c guint32 \p res array that has \p res_size elements
*/
void
mono_metadata_decode_row (const MonoTableInfo *t, int idx, guint32 *res, int res_size)
/**
* mono_metadata_decode_row_col:
- * @t: table to extract information from.
- * @idx: index for row in table.
- * @col: column in the row.
+ * \param t table to extract information from.
+ * \param idx index for row in table.
+ * \param col column in the row.
*
- * This function returns the value of column @col from the @idx
- * row in the table @t.
+ * This function returns the value of column \p col from the \p idx
+ * row in the table \p t .
*/
guint32
mono_metadata_decode_row_col (const MonoTableInfo *t, int idx, guint col)
/**
* mono_metadata_decode_blob_size:
- * @ptr: pointer to a blob object
- * @rptr: the new position of the pointer
+ * \param ptr pointer to a blob object
+ * \param rptr the new position of the pointer
*
* This decodes a compressed size as described by 23.1.4 (a blob or user string object)
*
- * Returns: the size of the blob object
+ * \returns the size of the blob object
*/
guint32
mono_metadata_decode_blob_size (const char *xptr, const char **rptr)
/**
* mono_metadata_decode_value:
- * @ptr: pointer to decode from
- * @rptr: the new position of the pointer
+ * \param ptr pointer to decode from
+ * \param rptr the new position of the pointer
*
* This routine decompresses 32-bit values as specified in the "Blob and
- * Signature" section (22.2)
+ * Signature" section (23.2)
*
- * Returns: the decoded value
+ * \returns the decoded value
*/
guint32
mono_metadata_decode_value (const char *_ptr, const char **rptr)
/**
* mono_metadata_decode_signed_value:
- * @ptr: pointer to decode from
- * @rptr: the new position of the pointer
+ * \param ptr pointer to decode from
+ * \param rptr the new position of the pointer
*
* This routine decompresses 32-bit signed values
* (not specified in the spec)
*
- * Returns: the decoded value
+ * \returns the decoded value
*/
gint32
mono_metadata_decode_signed_value (const char *ptr, const char **rptr)
return ival - 0x20000000;
}
-/*
- * Translates the given 1-based index into the Method, Field, Event, or Param tables
- * using the *Ptr tables in uncompressed metadata, if they are available.
+/**
+ * mono_metadata_translate_token_index:
+ * Translates the given 1-based index into the \c Method, \c Field, \c Event, or \c Param tables
+ * using the \c *Ptr tables in uncompressed metadata, if they are available.
*
* FIXME: The caller is not forced to call this function, which is error-prone, since
* forgetting to call it would only show up as a bug on uncompressed metadata.
/**
* mono_metadata_decode_table_row:
*
- * Same as mono_metadata_decode_row, but takes an IMAGE+TABLE ID pair, and takes
+ * Same as \c mono_metadata_decode_row, but takes an \p image + \p table ID pair, and takes
* uncompressed metadata into account, so it should be used to access the
- * Method, Field, Param and Event tables when the access is made from metadata, i.e.
- * IDX is retrieved from a metadata table, like MONO_TYPEDEF_FIELD_LIST.
+ * \c Method, \c Field, \c Param and \c Event tables when the access is made from metadata, i.e.
+ * \p idx is retrieved from a metadata table, like \c MONO_TYPEDEF_FIELD_LIST.
*/
void
mono_metadata_decode_table_row (MonoImage *image, int table, int idx, guint32 *res, int res_size)
/**
* mono_metadata_decode_table_row_col:
*
- * Same as mono_metadata_decode_row_col, but takes an IMAGE+TABLE ID pair, and takes
+ * Same as \c mono_metadata_decode_row_col, but takes an \p image + \p table ID pair, and takes
* uncompressed metadata into account, so it should be used to access the
- * Method, Field, Param and Event tables.
+ * \c Method, \c Field, \c Param and \c Event tables.
*/
guint32 mono_metadata_decode_table_row_col (MonoImage *image, int table, int idx, guint col)
{
return mono_metadata_decode_row_col (&image->tables [table], idx, col);
}
-/*
+/**
* mono_metadata_parse_typedef_or_ref:
- * @m: a metadata context.
- * @ptr: a pointer to an encoded TypedefOrRef in @m
- * @rptr: pointer updated to match the end of the decoded stream
- *
- * Returns: a token valid in the @m metadata decoded from
+ * \param m a metadata context.
+ * \param ptr a pointer to an encoded TypedefOrRef in \p m
+ * \param rptr pointer updated to match the end of the decoded stream
+ * \returns a token valid in the \p m metadata decoded from
* the compressed representation.
*/
guint32
return mono_metadata_token_from_dor (token);
}
-/*
+/**
* mono_metadata_parse_custom_mod:
- * @m: a metadata context.
- * @dest: storage where the info about the custom modifier is stored (may be NULL)
- * @ptr: a pointer to (possibly) the start of a custom modifier list
- * @rptr: pointer updated to match the end of the decoded stream
+ * \param m a metadata context.
+ * \param dest storage where the info about the custom modifier is stored (may be NULL)
+ * \param ptr a pointer to (possibly) the start of a custom modifier list
+ * \param rptr pointer updated to match the end of the decoded stream
*
- * Checks if @ptr points to a type custom modifier compressed representation.
+ * Checks if \p ptr points to a type custom modifier compressed representation.
*
- * Returns: #TRUE if a custom modifier was found, #FALSE if not.
+ * \returns TRUE if a custom modifier was found, FALSE if not.
*/
int
mono_metadata_parse_custom_mod (MonoImage *m, MonoCustomMod *dest, const char *ptr, const char **rptr)
return array;
}
+/**
+ * mono_metadata_parse_array:
+ */
MonoArrayType *
mono_metadata_parse_array (MonoImage *m, const char *ptr, const char **rptr)
{
return ret;
}
-/*
+/**
* mono_metadata_free_array:
- * @array: array description
+ * \param array array description
*
- * Frees the array description returned from mono_metadata_parse_array().
+ * Frees the array description returned from \c mono_metadata_parse_array.
*/
void
mono_metadata_free_array (MonoArrayType *array)
g_hash_table_insert (type_cache, (gpointer) &builtin_types [i], (gpointer) &builtin_types [i]);
mono_os_mutex_init_recursive (&image_sets_mutex);
+
+ mono_counters_register ("ImgSet Cache Hit", MONO_COUNTER_METADATA | MONO_COUNTER_INT, &img_set_cache_hit);
+ mono_counters_register ("ImgSet Cache Miss", MONO_COUNTER_METADATA | MONO_COUNTER_INT, &img_set_cache_miss);
+ mono_counters_register ("ImgSet Count", MONO_COUNTER_METADATA | MONO_COUNTER_INT, &img_set_count);
}
/**
/**
* mono_metadata_parse_type:
- * @m: metadata context
- * @mode: king of type that may be found at @ptr
- * @opt_attrs: optional attributes to store in the returned type
- * @ptr: pointer to the type representation
- * @rptr: pointer updated to match the end of the decoded stream
- * @transient: whenever to allocate the result from the heap or from a mempool
+ * \param m metadata context
+ * \param mode kind of type that may be found at \p ptr
+ * \param opt_attrs optional attributes to store in the returned type
+ * \param ptr pointer to the type representation
+ * \param rptr pointer updated to match the end of the decoded stream
+ * \param transient whenever to allocate the result from the heap or from a mempool
*
- * Decode a compressed type description found at @ptr in @m.
- * @mode can be one of MONO_PARSE_MOD_TYPE, MONO_PARSE_PARAM, MONO_PARSE_RET,
- * MONO_PARSE_FIELD, MONO_PARSE_LOCAL, MONO_PARSE_TYPE.
+ * Decode a compressed type description found at \p ptr in \p m .
+ * \p mode can be one of \c MONO_PARSE_MOD_TYPE, \c MONO_PARSE_PARAM, \c MONO_PARSE_RET,
+ * \c MONO_PARSE_FIELD, \c MONO_PARSE_LOCAL, \c MONO_PARSE_TYPE.
* This function can be used to decode type descriptions in method signatures,
* field signatures, locals signatures etc.
*
- * To parse a generic type, `generic_container' points to the current class'es
- * (the `generic_container' field in the MonoClass) or the current generic method's
- * (stored in image->property_hash) generic container.
- * When we encounter any MONO_TYPE_VAR or MONO_TYPE_MVAR's, they're looked up in
- * this MonoGenericContainer.
+ * To parse a generic type, \c generic_container points to the current class'es
+ * (the \c generic_container field in the <code>MonoClass</code>) or the current generic method's
+ * (stored in <code>image->property_hash</code>) generic container.
+ * When we encounter a \c MONO_TYPE_VAR or \c MONO_TYPE_MVAR, it's looked up in
+ * this \c MonoGenericContainer.
*
* LOCKING: Acquires the loader lock.
*
- * Returns: a #MonoType structure representing the decoded type.
+ * \returns a \c MonoType structure representing the decoded type.
*/
static MonoType*
mono_metadata_parse_type_internal (MonoImage *m, MonoGenericContainer *container,
int count = 0; // Number of mod arguments
gboolean found;
- mono_error_init (error);
+ error_init (error);
/*
* According to the spec, custom modifiers should come before the byref
}
-/*
+/**
* mono_metadata_parse_signature:
- * @image: metadata context
- * @token: metadata token
+ * \param image metadata context
+ * \param token metadata token
*
- * Decode a method signature stored in the STANDALONESIG table
+ * Decode a method signature stored in the \c StandAloneSig table
*
- * Returns: a MonoMethodSignature describing the signature.
+ * \returns a \c MonoMethodSignature describing the signature.
*/
MonoMethodSignature*
mono_metadata_parse_signature (MonoImage *image, guint32 token)
mono_metadata_parse_signature_checked (MonoImage *image, guint32 token, MonoError *error)
{
- mono_error_init (error);
+ error_init (error);
MonoTableInfo *tables = image->tables;
guint32 idx = mono_metadata_token_index (token);
guint32 sig;
return mono_metadata_parse_method_signature_full (image, NULL, 0, ptr, NULL, error);
}
-/*
+/**
* mono_metadata_signature_alloc:
- * @image: metadata context
- * @nparmas: number of parameters in the signature
+ * \param image metadata context
+ * \param nparams number of parameters in the signature
*
- * Allocate a MonoMethodSignature structure with the specified number of params.
+ * Allocate a \c MonoMethodSignature structure with the specified number of params.
* The return type and the params types need to be filled later.
* This is a Mono runtime internal function.
*
* LOCKING: Assumes the loader lock is held.
*
- * Returns: the new MonoMethodSignature structure.
+ * \returns the new \c MonoMethodSignature structure.
*/
MonoMethodSignature*
mono_metadata_signature_alloc (MonoImage *m, guint32 nparams)
return mono_metadata_signature_dup_internal (NULL, mp, sig);
}
-/*
+/**
* mono_metadata_signature_dup:
- * @sig: method signature
+ * \param sig method signature
*
- * Duplicate an existing MonoMethodSignature so it can be modified.
+ * Duplicate an existing \c MonoMethodSignature so it can be modified.
* This is a Mono runtime internal function.
*
- * Returns: the new MonoMethodSignature structure.
+ * \returns the new \c MonoMethodSignature structure.
*/
MonoMethodSignature*
mono_metadata_signature_dup (MonoMethodSignature *sig)
guint32 gen_param_count = 0;
gboolean is_open = FALSE;
- mono_error_init (error);
+ error_init (error);
if (*ptr & 0x10)
gen_param_count = 1;
return method;
}
-/*
+/**
* mono_metadata_parse_method_signature:
- * @m: metadata context
- * @def: the MethodDef index or 0 for Ref signatures.
- * @ptr: pointer to the signature metadata representation
- * @rptr: pointer updated to match the end of the decoded stream
+ * \param m metadata context
+ * \param def the \c MethodDef index or 0 for \c Ref signatures.
+ * \param ptr pointer to the signature metadata representation
+ * \param rptr pointer updated to match the end of the decoded stream
*
- * Decode a method signature stored at @ptr.
+ * Decode a method signature stored at \p ptr.
* This is a Mono runtime internal function.
*
* LOCKING: Assumes the loader lock is held.
*
- * Returns: a MonoMethodSignature describing the signature.
+ * \returns a \c MonoMethodSignature describing the signature.
*/
MonoMethodSignature *
mono_metadata_parse_method_signature (MonoImage *m, int def, const char *ptr, const char **rptr)
return ret;
}
-/*
+/**
* mono_metadata_free_method_signature:
- * @sig: signature to destroy
+ * \param sig signature to destroy
*
- * Free the memory allocated in the signature @sig.
+ * Free the memory allocated in the signature \p sig.
* This method needs to be robust and work also on partially-built
* signatures, so it does extra checks.
*/
mono_os_mutex_unlock (&image_sets_mutex);
}
+static int
+compare_pointers (const void *a, const void *b)
+{
+ return (size_t)a - (size_t)b;
+}
+
+//1103, 1327, 1597
+#define HASH_TABLE_SIZE 1103
+static MonoImageSet *img_set_cache [HASH_TABLE_SIZE];
+
+static guint32
+mix_hash (uintptr_t source)
+{
+ unsigned int hash = source;
+
+ // Actual hash
+ hash = (((hash * 215497) >> 16) ^ ((hash * 1823231) + hash));
+
+ // Mix in highest bits on 64-bit systems only
+ if (sizeof (source) > 4)
+ hash = hash ^ (source >> 32);
+
+ return hash;
+}
+
+static guint32
+hash_images (MonoImage **images, int nimages)
+{
+ guint32 res = 0;
+ int i;
+ for (i = 0; i < nimages; ++i)
+ res += mix_hash ((size_t)images [i]);
+
+ return res;
+}
+
+static gboolean
+compare_img_set (MonoImageSet *set, MonoImage **images, int nimages)
+{
+ int j, k;
+
+ if (set->nimages != nimages)
+ return FALSE;
+
+ for (j = 0; j < nimages; ++j) {
+ for (k = 0; k < nimages; ++k)
+ if (set->images [k] == images [j])
+ break; // Break on match
+
+ // If we iterated all the way through set->images, images[j] was *not* found.
+ if (k == nimages)
+ break; // Break on "image not found"
+ }
+
+ // If we iterated all the way through images without breaking, all items in images were found in set->images
+ return j == nimages;
+}
+
+
+static MonoImageSet*
+img_set_cache_get (MonoImage **images, int nimages)
+{
+ guint32 hash_code = hash_images (images, nimages);
+ int index = hash_code % HASH_TABLE_SIZE;
+ MonoImageSet *img = img_set_cache [index];
+ if (!img || !compare_img_set (img, images, nimages)) {
+ ++img_set_cache_miss;
+ return NULL;
+ }
+ ++img_set_cache_hit;
+ return img;
+}
+
+static void
+img_set_cache_add (MonoImageSet *set)
+{
+ guint32 hash_code = hash_images (set->images, set->nimages);
+ int index = hash_code % HASH_TABLE_SIZE;
+ img_set_cache [index] = set;
+}
+
+static void
+img_set_cache_remove (MonoImageSet *is)
+{
+ guint32 hash_code = hash_images (is->images, is->nimages);
+ int index = hash_code % HASH_TABLE_SIZE;
+ if (img_set_cache [index] == is)
+ img_set_cache [index] = NULL;
+}
/*
* get_image_set:
*
if (nimages == 0)
return mscorlib_image_set;
+ set = img_set_cache_get (images, nimages);
+ if (set)
+ return set;
+
image_sets_lock ();
if (!image_sets)
mono_os_mutex_init_recursive (&set->lock);
for (i = 0; i < nimages; ++i)
set->images [i] = images [i];
- set->gclass_cache = g_hash_table_new_full (mono_generic_class_hash, mono_generic_class_equal, NULL, (GDestroyNotify)free_generic_class);
+ set->gclass_cache = mono_conc_hashtable_new_full (mono_generic_class_hash, mono_generic_class_equal, NULL, (GDestroyNotify)free_generic_class);
set->ginst_cache = g_hash_table_new_full (mono_metadata_generic_inst_hash, mono_metadata_generic_inst_equal, NULL, (GDestroyNotify)free_generic_inst);
set->gmethod_cache = g_hash_table_new_full (inflated_method_hash, inflated_method_equal, NULL, (GDestroyNotify)free_inflated_method);
set->gsignature_cache = g_hash_table_new_full (inflated_signature_hash, inflated_signature_equal, NULL, (GDestroyNotify)free_inflated_signature);
set->images [i]->image_sets = g_slist_prepend (set->images [i]->image_sets, set);
g_ptr_array_add (image_sets, set);
+ ++img_set_count;
+
+ img_set_cache_add (set);
}
if (nimages == 1 && images [0] == mono_defaults.corlib) {
{
int i;
- g_hash_table_destroy (set->gclass_cache);
+ mono_conc_hashtable_destroy (set->gclass_cache);
g_hash_table_destroy (set->ginst_cache);
g_hash_table_destroy (set->gmethod_cache);
g_hash_table_destroy (set->gsignature_cache);
image_sets_unlock ();
+ img_set_cache_remove (set);
+
if (set->mempool)
mono_mempool_destroy (set->mempool);
g_free (set->images);
MonoImageSet *set = (MonoImageSet *)l->data;
mono_image_set_lock (set);
- g_hash_table_foreach_steal (set->gclass_cache, steal_gclass_in_image, &gclass_data);
+ mono_conc_hashtable_foreach_steal (set->gclass_cache, steal_gclass_in_image, &gclass_data);
g_hash_table_foreach_steal (set->ginst_cache, steal_ginst_in_image, &ginst_data);
g_hash_table_foreach_remove (set->gmethod_cache, inflated_method_in_image, image);
g_hash_table_foreach_remove (set->gsignature_cache, inflated_signature_in_image, image);
return set;
}
+static gboolean
+type_is_gtd (MonoType *type)
+{
+ switch (type->type) {
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_VALUETYPE:
+ return mono_class_is_gtd (type->data.klass);
+ default:
+ return FALSE;
+ }
+}
+
/*
* mono_metadata_get_generic_inst:
*
gboolean is_open;
int i;
int size = MONO_SIZEOF_GENERIC_INST + type_argc * sizeof (MonoType *);
- CollectData data;
- MonoImageSet *set;
for (i = 0; i < type_argc; ++i)
if (mono_class_is_open_constructed_type (type_argv [i]))
ginst->type_argc = type_argc;
memcpy (ginst->type_argv, type_argv, type_argc * sizeof (MonoType *));
+ for (i = 0; i < type_argc; ++i) {
+ MonoType *t = ginst->type_argv [i];
+ if (type_is_gtd (t)) {
+ ginst->type_argv [i] = mono_class_gtd_get_canonical_inst (t->data.klass);
+ }
+ }
+
+ return mono_metadata_get_canonical_generic_inst (ginst);
+}
+
+
+/**
+ * mono_metadata_get_canonical_generic_inst:
+ * \param candidate an arbitrary generic instantiation
+ *
+ * \returns the canonical generic instantiation that represents the given
+ * candidate by identifying the image set for the candidate instantiation and
+ * finding the instance in the image set or adding a copy of the given instance
+ * to the image set.
+ *
+ * The returned MonoGenericInst has its own copy of the list of types. The list
+ * passed in the argument can be freed, modified or disposed of.
+ *
+ */
+MonoGenericInst *
+mono_metadata_get_canonical_generic_inst (MonoGenericInst *candidate)
+{
+ CollectData data;
+ int type_argc = candidate->type_argc;
+ gboolean is_open = candidate->is_open;
+ MonoImageSet *set;
+
collect_data_init (&data);
- collect_ginst_images (ginst, &data);
+ collect_ginst_images (candidate, &data);
set = get_image_set (data.images, data.nimages);
mono_image_set_lock (set);
- ginst = (MonoGenericInst *)g_hash_table_lookup (set->ginst_cache, ginst);
+ MonoGenericInst *ginst = (MonoGenericInst *)g_hash_table_lookup (set->ginst_cache, candidate);
if (!ginst) {
+ int size = MONO_SIZEOF_GENERIC_INST + type_argc * sizeof (MonoType *);
ginst = (MonoGenericInst *)mono_image_set_alloc0 (set, size);
#ifndef MONO_SMALL_CONFIG
ginst->id = ++next_generic_inst_id;
ginst->is_open = is_open;
ginst->type_argc = type_argc;
- for (i = 0; i < type_argc; ++i)
- ginst->type_argv [i] = mono_metadata_type_dup (NULL, type_argv [i]);
+ for (int i = 0; i < type_argc; ++i)
+ ginst->type_argv [i] = mono_metadata_type_dup (NULL, candidate->type_argv [i]);
g_hash_table_insert (set->ginst_cache, ginst, ginst);
}
collect_data_free (&data);
- mono_image_set_lock (set);
-
- gclass = (MonoGenericClass *)g_hash_table_lookup (set->gclass_cache, &helper);
+ gclass = (MonoGenericClass *)mono_conc_hashtable_lookup (set->gclass_cache, &helper);
/* A tripwire just to keep us honest */
g_assert (!helper.cached_class);
- if (gclass) {
- mono_image_set_unlock (set);
+ if (gclass)
return gclass;
- }
gclass = mono_image_set_new0 (set, MonoGenericClass, 1);
if (is_dynamic)
if (inst == mono_class_get_generic_container (container_class)->context.class_inst && !is_tb_open)
gclass->cached_class = container_class;
- g_hash_table_insert (set->gclass_cache, gclass, gclass);
+ mono_image_set_lock (set);
+
+ MonoGenericClass *gclass2 = mono_conc_hashtable_insert (set->gclass_cache, gclass, gclass);
+ if (!gclass2)
+ gclass2 = gclass;
+
+ // g_hash_table_insert (set->gclass_cache, gclass, gclass);
mono_image_set_unlock (set);
- return gclass;
+ return gclass2;
}
/*
MonoGenericInst *nginst = NULL;
int i, count = 0;
- mono_error_init (error);
+ error_init (error);
if (!ginst->is_open)
return ginst;
MonoGenericInst *ginst;
int i;
- mono_error_init (error);
+ error_init (error);
type_argv = g_new0 (MonoType*, count);
for (i = 0; i < count; i++) {
MonoType *gtype;
int count;
- mono_error_init (error);
+ error_init (error);
// XXX how about transient?
gtype = mono_metadata_parse_type_checked (m, NULL, 0, FALSE, ptr, &ptr, error);
if (rptr)
*rptr = ptr;
- mono_error_init (error);
+ error_init (error);
generic_container = select_container (generic_container, type);
if (!generic_container) {
static gboolean
compare_type_literals (MonoImage *image, int class_type, int type_type, MonoError *error)
{
- mono_error_init (error);
+ error_init (error);
/* byval_arg.type can be zero if we're decoding a type that references a class been loading.
* See mcs/test/gtest-440. and #650936.
static gboolean
verify_var_type_and_container (MonoImage *image, int var_type, MonoGenericContainer *container, MonoError *error)
{
- mono_error_init (error);
+ error_init (error);
if (var_type == MONO_TYPE_MVAR) {
if (!container->is_method) { //MVAR and a method container
mono_error_set_bad_image (error, image, "MVAR parsed in a context without a method container");
do_mono_metadata_parse_type (MonoType *type, MonoImage *m, MonoGenericContainer *container,
gboolean transient, const char *ptr, const char **rptr, MonoError *error)
{
- mono_error_init (error);
+ error_init (error);
type->type = (MonoTypeEnum)mono_metadata_decode_value (ptr, &ptr);
return TRUE;
}
-/*
+/**
* mono_metadata_free_type:
- * @type: type to free
+ * \param type type to free
*
- * Free the memory allocated for type @type which is allocated on the heap.
+ * Free the memory allocated for type \p type which is allocated on the heap.
*/
void
mono_metadata_free_type (MonoType *type)
guint32 sect_data_len;
MonoExceptionClause* clauses = NULL;
- mono_error_init (error);
+ error_init (error);
while (1) {
/* align on 32-bit boundary */
MonoTableInfo *t = &m->tables [MONO_TABLE_STANDALONESIG];
guint32 cols [MONO_STAND_ALONE_SIGNATURE_SIZE];
- mono_error_init (error);
+ error_init (error);
if (!ptr) {
mono_error_set_bad_image (error, m, "Method header with null pointer");
}
-/*
+/**
* mono_metadata_parse_mh:
- * @generic_context: generics context
- * @ptr: pointer to the method header.
+ * \param generic_context generics context
+ * \param ptr pointer to the method header.
*
- * Decode the method header at @ptr, including pointer to the IL code,
+ * Decode the method header at \p ptr, including pointer to the IL code,
* info about local variables and optional exception tables.
*
- * Returns: a transient MonoMethodHeader allocated from the heap.
+ * \returns a transient \c MonoMethodHeader allocated from the heap.
*/
MonoMethodHeader *
mono_metadata_parse_mh (MonoImage *m, const char *ptr)
return header;
}
-/*
+/**
* mono_metadata_free_mh:
- * @mh: a method header
+ * \param mh a method header
*
* Free the memory allocated for the method header.
*/
}
}
-/*
+/**
* mono_method_header_get_code:
- * @header: a MonoMethodHeader pointer
- * @code_size: memory location for returning the code size
- * @max_stack: memory location for returning the max stack
+ * \param header a \c MonoMethodHeader pointer
+ * \param code_size memory location for returning the code size
+ * \param max_stack memory location for returning the max stack
*
* Method header accessor to retreive info about the IL code properties:
* a pointer to the IL code itself, the size of the code and the max number
* of stack slots used by the code.
*
- * Returns: pointer to the IL code represented by the method header.
+ * \returns pointer to the IL code represented by the method header.
*/
const unsigned char*
mono_method_header_get_code (MonoMethodHeader *header, guint32* code_size, guint32* max_stack)
return header->code;
}
-/*
+/**
* mono_method_header_get_locals:
- * @header: a MonoMethodHeader pointer
- * @num_locals: memory location for returning the number of local variables
- * @init_locals: memory location for returning the init_locals flag
+ * \param header a \c MonoMethodHeader pointer
+ * \param num_locals memory location for returning the number of local variables
+ * \param init_locals memory location for returning the init_locals flag
*
* Method header accessor to retreive info about the local variables:
* an array of local types, the number of locals and whether the locals
* are supposed to be initialized to 0 on method entry
*
- * Returns: pointer to an array of types of the local variables
+ * \returns pointer to an array of types of the local variables
*/
MonoType**
mono_method_header_get_locals (MonoMethodHeader *header, guint32* num_locals, gboolean *init_locals)
return header->num_clauses;
}
-/*
+/**
* mono_method_header_get_clauses:
- * @header: a MonoMethodHeader pointer
- * @method: MonoMethod the header belongs to
- * @iter: pointer to a iterator
- * @clause: pointer to a MonoExceptionClause structure which will be filled with the info
+ * \param header a \c MonoMethodHeader pointer
+ * \param method \c MonoMethod the header belongs to
+ * \param iter pointer to a iterator
+ * \param clause pointer to a \c MonoExceptionClause structure which will be filled with the info
*
- * Get the info about the exception clauses in the method. Set *iter to NULL to
+ * Get the info about the exception clauses in the method. Set \c *iter to NULL to
* initiate the iteration, then call the method repeatedly until it returns FALSE.
* At each iteration, the structure pointed to by clause if filled with the
* exception clause information.
*
- * Returns: TRUE if clause was filled with info, FALSE if there are no more exception
+ * \returns TRUE if clause was filled with info, FALSE if there are no more exception
* clauses.
*/
int
/**
* mono_metadata_parse_field_type:
- * @m: metadata context to extract information from
- * @ptr: pointer to the field signature
- * @rptr: pointer updated to match the end of the decoded stream
+ * \param m metadata context to extract information from
+ * \param ptr pointer to the field signature
+ * \param rptr pointer updated to match the end of the decoded stream
*
* Parses the field signature, and returns the type information for it.
*
- * Returns: The MonoType that was extracted from @ptr.
+ * \returns The \c MonoType that was extracted from \p ptr .
*/
MonoType *
mono_metadata_parse_field_type (MonoImage *m, short field_flags, const char *ptr, const char **rptr)
/**
* mono_metadata_parse_param:
- * @m: metadata context to extract information from
- * @ptr: pointer to the param signature
- * @rptr: pointer updated to match the end of the decoded stream
+ * \param m metadata context to extract information from
+ * \param ptr pointer to the param signature
+ * \param rptr pointer updated to match the end of the decoded stream
*
* Parses the param signature, and returns the type information for it.
*
- * Returns: The MonoType that was extracted from @ptr.
+ * \returns The \c MonoType that was extracted from \p ptr .
*/
MonoType *
mono_metadata_parse_param (MonoImage *m, const char *ptr, const char **rptr)
return type;
}
-/*
+/**
* mono_metadata_token_from_dor:
- * @dor_token: A TypeDefOrRef coded index
+ * \param dor_token A \c TypeDefOrRef coded index
*
- * dor_token is a TypeDefOrRef coded index: it contains either
- * a TypeDef, TypeRef or TypeSpec in the lower bits, and the upper
+ * \p dor_token is a \c TypeDefOrRef coded index: it contains either
+ * a \c TypeDef, \c TypeRef or \c TypeSpec in the lower bits, and the upper
* bits contain an index into the table.
*
- * Returns: an expanded token
+ * \returns an expanded token
*/
guint32
mono_metadata_token_from_dor (guint32 dor_index)
/**
* mono_metadata_typedef_from_field:
- * @meta: metadata context
- * @index: FieldDef token
+ * \param meta metadata context
+ * \param index FieldDef token
*
- * Returns: the 1-based index into the TypeDef table of the type that
- * declared the field described by @index, or 0 if not found.
+ * \returns the 1-based index into the \c TypeDef table of the type that
+ * declared the field described by \p index, or 0 if not found.
*/
guint32
mono_metadata_typedef_from_field (MonoImage *meta, guint32 index)
return loc.result + 1;
}
-/*
+/**
* mono_metadata_typedef_from_method:
- * @meta: metadata context
- * @index: MethodDef token
- *
- * Returns: the 1-based index into the TypeDef table of the type that
- * declared the method described by @index. 0 if not found.
+ * \param meta metadata context
+ * \param index \c MethodDef token
+ * \returns the 1-based index into the \c TypeDef table of the type that
+ * declared the method described by \p index. 0 if not found.
*/
guint32
mono_metadata_typedef_from_method (MonoImage *meta, guint32 index)
*interfaces = NULL;
*count = 0;
- mono_error_init (error);
+ error_init (error);
if (!tdef->base)
return TRUE;
return TRUE;
}
-/*
- * @meta: metadata context
- * @index: typedef token
- * @count: Out parameter used to store the number of interfaces
+/**
+ * mono_metadata_interfaces_from_typedef:
+ * \param meta metadata context
+ * \param index typedef token
+ * \param count Out parameter used to store the number of interfaces
*
- * The array of interfaces that the @index typedef token implements is returned in
- * @interfaces. The number of elements in the array is returned in @count. The returned
- * array is g_malloc'd and the caller must free it.
+ * The array of interfaces that the \p index typedef token implements is returned in
+ * \p interfaces. The number of elements in the array is returned in \p count. The returned
+ * array is allocated with \c g_malloc and the caller must free it.
*
* LOCKING: Acquires the loader lock .
*
- * Returns: the interface array on success, NULL on failure.
+ * \returns the interface array on success, NULL on failure.
*/
-
MonoClass**
mono_metadata_interfaces_from_typedef (MonoImage *meta, guint32 index, guint *count)
{
return NULL;
}
-/*
+/**
* mono_metadata_nested_in_typedef:
- * @meta: metadata context
- * @index: typedef token
- *
- * Returns: the 1-based index into the TypeDef table of the type
- * where the type described by @index is nested.
- * Returns 0 if @index describes a non-nested type.
+ * \param meta metadata context
+ * \param index typedef token
+ * \returns the 1-based index into the TypeDef table of the type
+ * where the type described by \p index is nested.
+ * Returns 0 if \p index describes a non-nested type.
*/
guint32
mono_metadata_nested_in_typedef (MonoImage *meta, guint32 index)
return mono_metadata_decode_row_col (tdef, loc.result, MONO_NESTED_CLASS_ENCLOSING) | MONO_TOKEN_TYPE_DEF;
}
-/*
+/**
* mono_metadata_nesting_typedef:
- * @meta: metadata context
- * @index: typedef token
- *
- * Returns: the 1-based index into the TypeDef table of the first type
- * that is nested inside the type described by @index. The search starts at
- * @start_index. returns 0 if no such type is found.
+ * \param meta metadata context
+ * \param index typedef token
+ * \returns the 1-based index into the \c TypeDef table of the first type
+ * that is nested inside the type described by \p index. The search starts at
+ * \p start_index. Returns 0 if no such type is found.
*/
guint32
mono_metadata_nesting_typedef (MonoImage *meta, guint32 index, guint32 start_index)
return start;
}
-/*
+/**
* mono_metadata_packing_from_typedef:
- * @meta: metadata context
- * @index: token representing a type
- *
- * Returns: the info stored in the ClassLAyout table for the given typedef token
- * into the @packing and @size pointers.
+ * \param meta metadata context
+ * \param index token representing a type
+ * \returns the info stored in the \c ClassLayout table for the given typedef token
+ * into the \p packing and \p size pointers.
* Returns 0 if the info is not found.
*/
guint32
return loc.result + 1;
}
-/*
+/**
* mono_metadata_custom_attrs_from_index:
- * @meta: metadata context
- * @index: token representing the parent
- *
- * Returns: the 1-based index into the CustomAttribute table of the first
- * attribute which belongs to the metadata object described by @index.
+ * \param meta metadata context
+ * \param index token representing the parent
+ * \returns: the 1-based index into the \c CustomAttribute table of the first
+ * attribute which belongs to the metadata object described by \p index.
* Returns 0 if no such attribute is found.
*/
guint32
return loc.result + 1;
}
-/*
+/**
* mono_metadata_declsec_from_index:
- * @meta: metadata context
- * @index: token representing the parent
- *
- * Returns: the 0-based index into the DeclarativeSecurity table of the first
- * attribute which belongs to the metadata object described by @index.
- * Returns -1 if no such attribute is found.
+ * \param meta metadata context
+ * \param index token representing the parent
+ * \returns the 0-based index into the \c DeclarativeSecurity table of the first
+ * attribute which belongs to the metadata object described by \p index.
+ * Returns \c -1 if no such attribute is found.
*/
guint32
mono_metadata_declsec_from_index (MonoImage *meta, guint32 index)
}
}
-/*
+/**
* mono_type_size:
- * @t: the type to return the size of
- *
- * Returns: the number of bytes required to hold an instance of this
+ * \param t the type to return the size of
+ * \returns The number of bytes required to hold an instance of this
* type in memory
*/
int
return 0;
}
-/*
+/**
* mono_type_stack_size:
- * @t: the type to return the size it uses on the stack
- *
- * Returns: the number of bytes required to hold an instance of this
+ * \param t the type to return the size it uses on the stack
+ * \returns The number of bytes required to hold an instance of this
* type on the runtime stack
*/
int
return type->data.generic_class->container_class->valuetype;
}
+/**
+ * mono_metadata_generic_class_is_valuetype:
+ */
gboolean
mono_metadata_generic_class_is_valuetype (MonoGenericClass *gclass)
{
return hash;
}
-/*
+/**
* mono_metadata_type_hash:
- * @t1: a type
- *
- * Computes an hash value for @t1 to be used in GHashTable.
+ * \param t1 a type
+ * Computes a hash value for \p t1 to be used in \c GHashTable.
* The returned hash is guaranteed to be the same across executions.
*/
guint
return FALSE;
}
+/**
+ * mono_metadata_type_equal:
+ */
gboolean
mono_metadata_type_equal (MonoType *t1, MonoType *t2)
{
/**
* mono_metadata_type_equal_full:
- * @t1: a type
- * @t2: another type
- * @signature_only: if signature only comparison should be made
+ * \param t1 a type
+ * \param t2 another type
+ * \param signature_only if signature only comparison should be made
*
- * Determine if @t1 and @t2 are signature compatible if @signature_only is #TRUE, otherwise
+ * Determine if \p t1 and \p t2 are signature compatible if \p signature_only is TRUE, otherwise
* behaves the same way as mono_metadata_type_equal.
* The function mono_metadata_type_equal(a, b) is just a shortcut for mono_metadata_type_equal_full(a, b, FALSE).
- * Returns: #TRUE if @t1 and @t2 are equal taking @signature_only into account.
+ * \returns TRUE if \p t1 and \p t2 are equal taking \p signature_only into account.
*/
gboolean
mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, gboolean signature_only)
/**
* mono_metadata_signature_equal:
- * @sig1: a signature
- * @sig2: another signature
+ * \param sig1 a signature
+ * \param sig2 another signature
*
- * Determine if @sig1 and @sig2 represent the same signature, with the
+ * Determine if \p sig1 and \p sig2 represent the same signature, with the
* same number of arguments and the same types.
- * Returns: #TRUE if @sig1 and @sig2 are equal.
+ * \returns TRUE if \p sig1 and \p sig2 are equal.
*/
gboolean
mono_metadata_signature_equal (MonoMethodSignature *sig1, MonoMethodSignature *sig2)
/**
* mono_metadata_type_dup:
- * @image: image to alloc memory from
- * @original: type to duplicate
- *
- * Returns: copy of type allocated from the image's mempool (or from the heap, if @image is null).
+ * \param image image to alloc memory from
+ * \param original type to duplicate
+ * \returns copy of type allocated from the image's mempool (or from the heap, if \p image is null).
*/
MonoType *
mono_metadata_type_dup (MonoImage *image, const MonoType *o)
return r;
}
+/**
+ * mono_signature_hash:
+ */
guint
mono_signature_hash (MonoMethodSignature *sig)
{
*endbuf = p;
}
-/*
+/**
* mono_metadata_field_info:
- * @meta: the Image the field is defined in
- * @index: the index in the field table representing the field
- * @offset: a pointer to an integer where to store the offset that
- * may have been specified for the field in a FieldLayout table
- * @rva: a pointer to the RVA of the field data in the image that
- * may have been defined in a FieldRVA table
- * @marshal_spec: a pointer to the marshal spec that may have been
- * defined for the field in a FieldMarshal table.
- *
- * Gather info for field @index that may have been defined in the FieldLayout,
- * FieldRVA and FieldMarshal tables.
- * Either of offset, rva and marshal_spec can be NULL if you're not interested
+ * \param meta the Image the field is defined in
+ * \param index the index in the field table representing the field
+ * \param offset a pointer to an integer where to store the offset that may have been specified for the field in a FieldLayout table
+ * \param rva a pointer to the RVA of the field data in the image that may have been defined in a \c FieldRVA table
+ * \param marshal_spec a pointer to the marshal spec that may have been defined for the field in a \c FieldMarshal table.
+ *
+ * Gather info for field \p index that may have been defined in the \c FieldLayout,
+ * \c FieldRVA and \c FieldMarshal tables.
+ * Either of \p offset, \p rva and \p marshal_spec can be NULL if you're not interested
* in the data.
*/
void
}
-/*
+/**
* mono_metadata_get_constant_index:
- * @meta: the Image the field is defined in
- * @index: the token that may have a row defined in the constants table
- * @hint: possible position for the row
+ * \param meta the Image the field is defined in
+ * \param index the token that may have a row defined in the constants table
+ * \param hint possible position for the row
*
- * @token must be a FieldDef, ParamDef or PropertyDef token.
+ * \p token must be a \c FieldDef, \c ParamDef or \c PropertyDef token.
*
- * Returns: the index into the Constants table or 0 if not found.
+ * \returns the index into the \c Constants table or 0 if not found.
*/
guint32
mono_metadata_get_constant_index (MonoImage *meta, guint32 token, guint32 hint)
return 0;
}
-/*
+/**
* mono_metadata_events_from_typedef:
- * @meta: metadata context
- * @index: 0-based index (in the TypeDef table) describing a type
- *
- * Returns: the 0-based index in the Event table for the events in the
+ * \param meta metadata context
+ * \param index 0-based index (in the \c TypeDef table) describing a type
+ * \returns the 0-based index in the \c Event table for the events in the
* type. The last event that belongs to the type (plus 1) is stored
- * in the @end_idx pointer.
+ * in the \p end_idx pointer.
*/
guint32
mono_metadata_events_from_typedef (MonoImage *meta, guint32 index, guint *end_idx)
return start - 1;
}
-/*
+/**
* mono_metadata_methods_from_event:
- * @meta: metadata context
- * @index: 0-based index (in the Event table) describing a event
- *
- * Returns: the 0-based index in the MethodDef table for the methods in the
+ * \param meta metadata context
+ * \param index 0-based index (in the \c Event table) describing a event
+ * \returns the 0-based index in the \c MethodDef table for the methods in the
* event. The last method that belongs to the event (plus 1) is stored
- * in the @end_idx pointer.
+ * in the \p end_idx pointer.
*/
guint32
mono_metadata_methods_from_event (MonoImage *meta, guint32 index, guint *end_idx)
return start;
}
-/*
+/**
* mono_metadata_properties_from_typedef:
- * @meta: metadata context
- * @index: 0-based index (in the TypeDef table) describing a type
- *
- * Returns: the 0-based index in the Property table for the properties in the
+ * \param meta metadata context
+ * \param index 0-based index (in the \c TypeDef table) describing a type
+ * \returns the 0-based index in the \c Property table for the properties in the
* type. The last property that belongs to the type (plus 1) is stored
- * in the @end_idx pointer.
+ * in the \p end_idx pointer.
*/
guint32
mono_metadata_properties_from_typedef (MonoImage *meta, guint32 index, guint *end_idx)
return start - 1;
}
-/*
+/**
* mono_metadata_methods_from_property:
- * @meta: metadata context
- * @index: 0-based index (in the PropertyDef table) describing a property
- *
- * Returns: the 0-based index in the MethodDef table for the methods in the
+ * \param meta metadata context
+ * \param index 0-based index (in the \c PropertyDef table) describing a property
+ * \returns the 0-based index in the \c MethodDef table for the methods in the
* property. The last method that belongs to the property (plus 1) is stored
- * in the @end_idx pointer.
+ * in the \p end_idx pointer.
*/
guint32
mono_metadata_methods_from_property (MonoImage *meta, guint32 index, guint *end_idx)
return start;
}
+/**
+ * mono_metadata_implmap_from_method:
+ */
guint32
mono_metadata_implmap_from_method (MonoImage *meta, guint32 method_idx)
{
}
/**
- * @image: context where the image is created
- * @type_spec: typespec token
- * @deprecated use mono_type_create_from_typespec_checked that has proper error handling
+ * mono_type_create_from_typespec:
+ * \param image context where the image is created
+ * \param type_spec typespec token
+ * \deprecated use \c mono_type_create_from_typespec_checked that has proper error handling
*
- * Creates a MonoType representing the TypeSpec indexed by the @type_spec
+ * Creates a \c MonoType representing the \c TypeSpec indexed by the \p type_spec
* token.
*/
MonoType *
const char *ptr;
MonoType *type, *type2;
- mono_error_init (error);
+ error_init (error);
- mono_image_lock (image);
- type = (MonoType *)g_hash_table_lookup (image->typespec_cache, GUINT_TO_POINTER (type_spec));
- mono_image_unlock (image);
+ type = (MonoType *)mono_conc_hashtable_lookup (image->typespec_cache, GUINT_TO_POINTER (type_spec));
if (type)
return type;
mono_metadata_free_type (type);
mono_image_lock (image);
- type = (MonoType *)g_hash_table_lookup (image->typespec_cache, GUINT_TO_POINTER (type_spec));
+
/* We might leak some data in the image mempool if found */
- if (!type) {
- g_hash_table_insert (image->typespec_cache, GUINT_TO_POINTER (type_spec), type2);
+ type = mono_conc_hashtable_insert (image->typespec_cache, GUINT_TO_POINTER (type_spec), type2);
+ if (!type)
type = type2;
- }
+
mono_image_unlock (image);
return type;
return res;
}
+/**
+ * mono_metadata_parse_marshal_spec:
+ */
MonoMarshalSpec *
mono_metadata_parse_marshal_spec (MonoImage *image, const char *ptr)
{
return res;
}
+/**
+ * mono_metadata_free_marshal_spec:
+ */
void
mono_metadata_free_marshal_spec (MonoMarshalSpec *spec)
{
/**
* mono_type_to_unmanaged:
- *
- * Returns: A MonoMarshalNative enumeration value (MONO_NATIVE_) value
+ * The value pointed to by \p conv will contain the kind of marshalling required for this
+ * particular type one of the \c MONO_MARSHAL_CONV_ enumeration values.
+ * \returns A \c MonoMarshalNative enumeration value (<code>MONO_NATIVE_</code>) value
* describing the underlying native reprensetation of the type.
- *
- * In addition the value pointed by
- * "conv" will contain the kind of marshalling required for this
- * particular type one of the MONO_MARSHAL_CONV_ enumeration values.
*/
guint32
mono_type_to_unmanaged (MonoType *type, MonoMarshalSpec *mspec, gboolean as_field,
*conv = MONO_MARSHAL_CONV_STR_TBSTR;
return MONO_NATIVE_TBSTR;
case MONO_NATIVE_UTF8STR:
- *conv = MONO_MARSHAL_CONV_STR_LPTSTR;
+ *conv = MONO_MARSHAL_CONV_STR_UTF8STR;
return MONO_NATIVE_UTF8STR;
case MONO_NATIVE_BYVALTSTR:
if (unicode)
return MONO_NATIVE_MAX;
}
+/**
+ * mono_metadata_get_marshal_info:
+ */
const char*
mono_metadata_get_marshal_info (MonoImage *meta, guint32 idx, gboolean is_field)
{
MonoMethod *result = NULL;
guint32 idx = tok >> MONO_METHODDEFORREF_BITS;
- mono_error_init (error);
+ error_init (error);
switch (tok & MONO_METHODDEFORREF_MASK) {
case MONO_METHODDEFORREF_METHODDEF:
GSList *cons = NULL, *tmp;
MonoGenericContext *context = &container->context;
- mono_error_init (error);
+ error_init (error);
*constraints = NULL;
found = 0;
{
guint32 start_row, i, owner;
- mono_error_init (error);
+ error_init (error);
if (! (start_row = mono_metadata_get_generic_param_row (image, token, &owner)))
return TRUE;
/**
* mono_type_is_byref:
- * @type: the MonoType operated on
- *
- * Returns: #TRUE if @type represents a type passed by reference,
- * #FALSE otherwise.
+ * \param type the \c MonoType operated on
+ * \returns TRUE if \p type represents a type passed by reference,
+ * FALSE otherwise.
*/
gboolean
mono_type_is_byref (MonoType *type)
/**
* mono_type_get_type:
- * @type: the MonoType operated on
- *
- * Returns: the IL type value for @type. This is one of the MonoTypeEnum
- * enum members like MONO_TYPE_I4 or MONO_TYPE_STRING.
+ * \param type the \c MonoType operated on
+ * \returns the IL type value for \p type. This is one of the \c MonoTypeEnum
+ * enum members like \c MONO_TYPE_I4 or \c MONO_TYPE_STRING.
*/
int
mono_type_get_type (MonoType *type)
/**
* mono_type_get_signature:
- * @type: the MonoType operated on
- *
- * It is only valid to call this function if @type is a MONO_TYPE_FNPTR.
- *
- * Returns: the MonoMethodSignature pointer that describes the signature
- * of the function pointer @type represents.
+ * \param type the \c MonoType operated on
+ * It is only valid to call this function if \p type is a \c MONO_TYPE_FNPTR .
+ * \returns the \c MonoMethodSignature pointer that describes the signature
+ * of the function pointer \p type represents.
*/
MonoMethodSignature*
mono_type_get_signature (MonoType *type)
/**
* mono_type_get_class:
- * @type: the MonoType operated on
- *
- * It is only valid to call this function if @type is a MONO_TYPE_CLASS or a
- * MONO_TYPE_VALUETYPE. For more general functionality, use mono_class_from_mono_type (),
- * instead
- *
- * Returns: the MonoClass pointer that describes the class that @type represents.
+ * \param type the \c MonoType operated on
+ * It is only valid to call this function if \p type is a \c MONO_TYPE_CLASS or a
+ * \c MONO_TYPE_VALUETYPE . For more general functionality, use \c mono_class_from_mono_type,
+ * instead.
+ * \returns the \c MonoClass pointer that describes the class that \p type represents.
*/
MonoClass*
mono_type_get_class (MonoType *type)
/**
* mono_type_get_array_type:
- * @type: the MonoType operated on
- *
- * It is only valid to call this function if @type is a MONO_TYPE_ARRAY.
- *
- * Returns: a MonoArrayType struct describing the array type that @type
+ * \param type the \c MonoType operated on
+ * It is only valid to call this function if \p type is a \c MONO_TYPE_ARRAY .
+ * \returns a \c MonoArrayType struct describing the array type that \p type
* represents. The info includes details such as rank, array element type
* and the sizes and bounds of multidimensional arrays.
*/
/**
* mono_type_get_ptr_type:
- * @type: the MonoType operated on
- *
- * It is only valid to call this function if @type is a MONO_TYPE_PTR.
- * instead
- *
- * Returns: the MonoType pointer that describes the type that @type
+ * \pararm type the \c MonoType operated on
+ * It is only valid to call this function if \p type is a \c MONO_TYPE_PTR .
+ * \returns the \c MonoType pointer that describes the type that \p type
* represents a pointer to.
*/
MonoType*
return type->data.type;
}
+/**
+ * mono_type_get_modifiers:
+ */
MonoClass*
mono_type_get_modifiers (MonoType *type, gboolean *is_required, gpointer *iter)
{
/**
* mono_type_is_struct:
- * @type: the MonoType operated on
- *
- * Returns: #TRUE is @type is a struct, that is a ValueType but not en enum
- * or a basic type like System.Int32. #FALSE otherwise.
+ * \param type the \c MonoType operated on
+ * \returns TRUE if \p type is a struct, that is a \c ValueType but not an enum
+ * or a basic type like \c System.Int32 . FALSE otherwise.
*/
mono_bool
mono_type_is_struct (MonoType *type)
/**
* mono_type_is_void:
- * @type: the MonoType operated on
- *
- * Returns: #TRUE is @type is System.Void. #FALSE otherwise.
+ * \param type the \c MonoType operated on
+ * \returns TRUE if \p type is \c System.Void . FALSE otherwise.
*/
mono_bool
mono_type_is_void (MonoType *type)
/**
* mono_type_is_pointer:
- * @type: the MonoType operated on
- *
- * Returns: #TRUE is @type is a managed or unmanaged pointer type. #FALSE otherwise.
+ * \param type the \c MonoType operated on
+ * \returns TRUE if \p type is a managed or unmanaged pointer type. FALSE otherwise.
*/
mono_bool
mono_type_is_pointer (MonoType *type)
/**
* mono_type_is_reference:
- * @type: the MonoType operated on
- *
- * Returns: #TRUE is @type represents an object reference . #FALSE otherwise.
+ * \param type the \c MonoType operated on
+ * \returns TRUE if \p type represents an object reference. FALSE otherwise.
*/
mono_bool
mono_type_is_reference (MonoType *type)
/**
* mono_signature_get_return_type:
- * @sig: the method signature inspected
- *
- * Returns: the return type of the method signature @sig
+ * \param sig the method signature inspected
+ * \returns the return type of the method signature \p sig
*/
MonoType*
mono_signature_get_return_type (MonoMethodSignature *sig)
/**
* mono_signature_get_params:
- * @sig: the method signature inspected
- * #iter: pointer to an iterator
- *
- * Iterates over the parameters for the method signature @sig.
- * A void* pointer must be initualized to #NULL to start the iteration
- * and it's address is passed to this function repeteadly until it returns
- * #NULL.
- *
- * Returns: the next parameter type of the method signature @sig,
- * #NULL when finished.
+ * \param sig the method signature inspected
+ * \param iter pointer to an iterator
+ * Iterates over the parameters for the method signature \p sig.
+ * A \c void* pointer must be initialized to NULL to start the iteration
+ * and its address is passed to this function repeteadly until it returns
+ * NULL.
+ * \returns the next parameter type of the method signature \p sig,
+ * NULL when finished.
*/
MonoType*
mono_signature_get_params (MonoMethodSignature *sig, gpointer *iter)
/**
* mono_signature_get_param_count:
- * @sig: the method signature inspected
- *
- * Returns: the number of parameters in the method signature @sig.
+ * \param sig the method signature inspected
+ * \returns the number of parameters in the method signature \p sig.
*/
guint32
mono_signature_get_param_count (MonoMethodSignature *sig)
/**
* mono_signature_get_call_conv:
- * @sig: the method signature inspected
- *
- * Returns: the call convention of the method signature @sig.
+ * \param sig the method signature inspected
+ * \returns the call convention of the method signature \p sig.
*/
guint32
mono_signature_get_call_conv (MonoMethodSignature *sig)
/**
* mono_signature_vararg_start:
- * @sig: the method signature inspected
- *
- * Returns: the number of the first vararg parameter in the
- * method signature @sig. -1 if this is not a vararg signature.
+ * \param sig the method signature inspected
+ * \returns the number of the first vararg parameter in the
+ * method signature \param sig. \c -1 if this is not a vararg signature.
*/
int
mono_signature_vararg_start (MonoMethodSignature *sig)
/**
* mono_signature_is_instance:
- * @sig: the method signature inspected
- *
- * Returns: #TRUE if this the method signature @sig has an implicit
- * first instance argument. #FALSE otherwise.
+ * \param sig the method signature inspected
+ * \returns TRUE if this the method signature \p sig has an implicit
+ * first instance argument. FALSE otherwise.
*/
gboolean
mono_signature_is_instance (MonoMethodSignature *sig)
/**
* mono_signature_param_is_out
- * @sig: the method signature inspected
- * @param_num: the 0-based index of the inspected parameter
- *
- * Returns: #TRUE if the parameter is an out parameter, #FALSE
+ * \param sig the method signature inspected
+ * \param param_num the 0-based index of the inspected parameter
+ * \returns TRUE if the parameter is an out parameter, FALSE
* otherwise.
*/
mono_bool
/**
* mono_signature_explicit_this:
- * @sig: the method signature inspected
- *
- * Returns: #TRUE if this the method signature @sig has an explicit
- * instance argument. #FALSE otherwise.
+ * \param sig the method signature inspected
+ * \returns TRUE if this the method signature \p sig has an explicit
+ * instance argument. FALSE otherwise.
*/
gboolean
mono_signature_explicit_this (MonoMethodSignature *sig)
guint
mono_aligned_addr_hash (gconstpointer ptr)
{
- return GPOINTER_TO_UINT (ptr) >> 3;
+ /* Same hashing we use for objects */
+ return (GPOINTER_TO_UINT (ptr) >> 3) * 2654435761u;
}
/*
return event;
gtd = mono_class_get_generic_class (event->parent)->container_class;
- offset = event - event->parent->ext->events;
- return gtd->ext->events + offset;
+ offset = event - mono_class_get_event_info (event->parent)->events;
+ return mono_class_get_event_info (gtd)->events + offset;
}
/*
MonoProperty*
mono_metadata_get_corresponding_property_from_generic_type_definition (MonoProperty *property)
{
+ MonoClassPropertyInfo *info;
MonoClass *gtd;
int offset;
if (!mono_class_is_ginst (property->parent))
return property;
+ info = mono_class_get_property_info (property->parent);
gtd = mono_class_get_generic_class (property->parent)->container_class;
- offset = property - property->parent->ext->properties;
- return gtd->ext->properties + offset;
+ offset = property - info->properties;
+ return mono_class_get_property_info (gtd)->properties + offset;
}
MonoWrapperCaches*
return owner;
}
+
+void
+mono_loader_set_strict_strong_names (gboolean enabled)
+{
+ check_strong_names_strictly = enabled;
+}
+
+gboolean
+mono_loader_get_strict_strong_names (void)
+{
+ return check_strong_names_strictly;
+}