2 #ifndef __MONO_METADATA_INTERNALS_H__
3 #define __MONO_METADATA_INTERNALS_H__
5 #include "mono/metadata/image.h"
6 #include "mono/metadata/blob.h"
7 #include "mono/metadata/mempool.h"
8 #include "mono/utils/mono-hash.h"
10 struct _MonoAssembly {
13 MonoAssemblyName aname;
18 guint8 corlib_internal;
20 /* security manager flags (one bit is for lazy initialization) */
21 guint32 ecma:2; /* Has the ECMA key */
22 guint32 aptc:2; /* Has the [AllowPartiallyTrustedCallers] attributes */
23 guint32 fulltrust:2; /* Has FullTrust permission */
24 guint32 unmanaged:2; /* Has SecurityPermissionFlag.UnmanagedCode permission */
32 struct _MonoTableInfo {
38 * Tables contain up to 9 columns and the possible sizes of the
39 * fields in the documentation are 1, 2 and 4 bytes. So we
40 * can encode in 2 bits the size.
42 * A 32 bit value can encode the resulting size
44 * The top eight bits encode the number of columns in the table.
45 * we only need 4, but 8 is aligned no shift required.
47 guint32 size_bitfield;
53 /* if file_descr is NULL the image was loaded from raw data */
56 guint8 raw_data_allocated;
58 /* Whenever this is a dynamically emitted module */
62 const char *assembly_name;
63 const char *module_name;
71 guint8 idx_string_wide, idx_guid_wide, idx_blob_wide;
73 MonoStreamHeader heap_strings;
74 MonoStreamHeader heap_us;
75 MonoStreamHeader heap_blob;
76 MonoStreamHeader heap_guid;
77 MonoStreamHeader heap_tables;
79 const char *tables_base;
82 MonoTableInfo tables [MONO_TABLE_NUM];
85 * references is initialized only by using the mono_assembly_open
86 * function, and not by using the lowlevel mono_image_open.
88 * It is NULL terminated.
90 MonoAssembly **references;
98 * The Assembly this image was loaded from.
100 MonoAssembly *assembly;
103 * Indexed by method tokens and typedef tokens.
105 GHashTable *method_cache;
106 GHashTable *class_cache;
108 * Indexed by fielddef and memberref tokens
110 GHashTable *field_cache;
112 /* indexed by typespec tokens. */
113 GHashTable *typespec_cache;
114 /* indexed by token */
115 GHashTable *memberref_signatures;
116 GHashTable *helper_signatures;
119 * Indexes namespaces to hash tables that map class name to typedef token.
121 GHashTable *name_cache;
124 * Indexed by ((rank << 24) | (typedef & 0xffffff)), which limits us to a
125 * maximal rank of 255
127 GHashTable *array_cache;
130 * indexed by MonoMethodSignature
132 GHashTable *delegate_begin_invoke_cache;
133 GHashTable *delegate_end_invoke_cache;
134 GHashTable *delegate_invoke_cache;
137 * indexed by MonoMethod pointers
139 GHashTable *runtime_invoke_cache;
140 GHashTable *managed_wrapper_cache;
141 GHashTable *native_wrapper_cache;
142 GHashTable *remoting_invoke_cache;
143 GHashTable *synchronized_cache;
144 GHashTable *unbox_wrapper_cache;
146 void *reflection_info;
149 * user_info is a public field and is not touched by the
154 /* dll map entries */
168 guint32 alloc_size; /* malloced bytes */
170 guint32 offset; /* from start of metadata */
176 guint8 row_size; /* calculated later with column_sizes */
179 guint32 *values; /* rows * columns */
182 struct _MonoDynamicAssembly {
183 MonoAssembly assembly;
185 guint32 strong_name_size;
190 struct _MonoDynamicImage {
194 guint32 metadata_rva;
196 guint32 cli_header_offset;
200 guint32 imp_names_offset;
206 } sections [MONO_SECTION_MAX];
207 GHashTable *typespec;
209 GHashTable *handleref;
210 MonoGHashTable *tokens;
211 GHashTable *blob_cache;
212 GList *array_methods;
213 GPtrArray *gen_params;
214 MonoGHashTable *token_fixups;
215 GHashTable *method_to_table_idx;
216 GHashTable *field_to_table_idx;
217 GHashTable *method_aux_hash;
220 gboolean initial_image;
221 guint32 pe_kind, machine;
223 guint32 strong_name_size;
225 guint32 win32_res_size;
226 MonoDynamicStream sheap;
227 MonoDynamicStream code; /* used to store method headers and bytecode */
228 MonoDynamicStream resources; /* managed embedded resources */
229 MonoDynamicStream us;
230 MonoDynamicStream blob;
231 MonoDynamicStream tstream;
232 MonoDynamicStream guid;
233 MonoDynamicTable tables [MONO_TABLE_NUM];
236 /* for use with allocated memory blocks (assumes alignment is to 8 bytes) */
237 guint mono_aligned_addr_hash (gconstpointer ptr);
239 const char * mono_meta_table_name (int table);
240 void mono_metadata_compute_table_bases (MonoImage *meta);
243 mono_metadata_interfaces_from_typedef_full (MonoImage *image,
246 MonoGenericContext *context);
249 mono_metadata_parse_array_full (MonoImage *image,
250 MonoGenericContext *generic_context,
255 mono_metadata_parse_type_full (MonoImage *image,
256 MonoGenericContext *generic_context,
257 MonoParseTypeMode mode,
263 mono_type_create_from_typespec_full (MonoImage *image,
264 MonoGenericContext *generic_context,
267 MonoMethodSignature *
268 mono_metadata_parse_signature_full (MonoImage *image,
269 MonoGenericContext *generic_context,
272 MonoMethodSignature *
273 mono_metadata_parse_method_signature_full (MonoImage *image,
274 MonoGenericContext *generic_context,
280 mono_metadata_parse_mh_full (MonoImage *image,
281 MonoGenericContext *generic_context,
285 mono_metadata_generic_method_hash (MonoGenericMethod *gmethod);
288 mono_metadata_generic_method_equal (MonoGenericMethod *g1,
289 MonoGenericMethod *g2);
292 mono_metadata_parse_generic_inst (MonoImage *image,
293 MonoGenericContext *generic_context,
299 mono_metadata_lookup_generic_inst (MonoGenericInst *ginst);
302 mono_metadata_lookup_generic_class (MonoGenericClass *gclass);
305 mono_metadata_inflate_generic_inst (MonoGenericInst *ginst,
306 MonoGenericContext *context);
308 void mono_dynamic_stream_reset (MonoDynamicStream* stream);
309 void mono_assembly_addref (MonoAssembly *assembly);
311 #endif /* __MONO_METADATA_INTERNALS_H__ */