Merge pull request #901 from Blewzman/FixAggregateExceptionGetBaseException
[mono.git] / mono / metadata / metadata-internals.h
1
2 #ifndef __MONO_METADATA_INTERNALS_H__
3 #define __MONO_METADATA_INTERNALS_H__
4
5 #include "mono/metadata/image.h"
6 #include "mono/metadata/blob.h"
7 #include "mono/metadata/mempool.h"
8 #include "mono/metadata/domain-internals.h"
9 #include "mono/metadata/mono-hash.h"
10 #include "mono/utils/mono-compiler.h"
11 #include "mono/utils/mono-dl.h"
12 #include "mono/utils/monobitset.h"
13 #include "mono/utils/mono-property-hash.h"
14 #include "mono/utils/mono-value-hash.h"
15 #include <mono/utils/mono-error.h>
16
17 struct _MonoType {
18         union {
19                 MonoClass *klass; /* for VALUETYPE and CLASS */
20                 MonoType *type;   /* for PTR */
21                 MonoArrayType *array; /* for ARRAY */
22                 MonoMethodSignature *method;
23                 MonoGenericParam *generic_param; /* for VAR and MVAR */
24                 MonoGenericClass *generic_class; /* for GENERICINST */
25         } data;
26         unsigned int attrs    : 16; /* param attributes or field flags */
27         MonoTypeEnum type     : 8;
28         unsigned int num_mods : 6;  /* max 64 modifiers follow at the end */
29         unsigned int byref    : 1;
30         unsigned int pinned   : 1;  /* valid when included in a local var signature */
31         MonoCustomMod modifiers [MONO_ZERO_LEN_ARRAY]; /* this may grow */
32 };
33
34 #define MONO_SIZEOF_TYPE (offsetof (struct _MonoType, modifiers))
35
36 #define MONO_SECMAN_FLAG_INIT(x)                (x & 0x2)
37 #define MONO_SECMAN_FLAG_GET_VALUE(x)           (x & 0x1)
38 #define MONO_SECMAN_FLAG_SET_VALUE(x,y)         do { x = ((y) ? 0x3 : 0x2); } while (0)
39
40 #define MONO_PUBLIC_KEY_TOKEN_LENGTH    17
41
42 #define MONO_PROCESSOR_ARCHITECTURE_NONE 0
43 #define MONO_PROCESSOR_ARCHITECTURE_MSIL 1
44 #define MONO_PROCESSOR_ARCHITECTURE_X86 2
45 #define MONO_PROCESSOR_ARCHITECTURE_IA64 3
46 #define MONO_PROCESSOR_ARCHITECTURE_AMD64 4
47 #define MONO_PROCESSOR_ARCHITECTURE_ARM 5
48
49 struct _MonoAssemblyName {
50         const char *name;
51         const char *culture;
52         const char *hash_value;
53         const mono_byte* public_key;
54         // string of 16 hex chars + 1 NULL
55         mono_byte public_key_token [MONO_PUBLIC_KEY_TOKEN_LENGTH];
56         uint32_t hash_alg;
57         uint32_t hash_len;
58         uint32_t flags;
59         uint16_t major, minor, build, revision, arch;
60 };
61
62 struct MonoTypeNameParse {
63         char *name_space;
64         char *name;
65         MonoAssemblyName assembly;
66         GList *modifiers; /* 0 -> byref, -1 -> pointer, > 0 -> array rank */
67         GPtrArray *type_arguments;
68         GList *nested;
69 };
70
71 struct _MonoAssembly {
72         /* 
73          * The number of appdomains which have this assembly loaded plus the number of 
74          * assemblies referencing this assembly through an entry in their image->references
75          * arrays. The later is needed because entries in the image->references array
76          * might point to assemblies which are only loaded in some appdomains, and without
77          * the additional reference, they can be freed at any time.
78          * The ref_count is initially 0.
79          */
80         int ref_count; /* use atomic operations only */
81         char *basedir;
82         MonoAssemblyName aname;
83         MonoImage *image;
84         GSList *friend_assembly_names; /* Computed by mono_assembly_load_friends () */
85         guint8 friend_assembly_names_inited;
86         guint8 in_gac;
87         guint8 dynamic;
88         guint8 corlib_internal;
89         gboolean ref_only;
90         guint8 wrap_non_exception_throws;
91         guint8 wrap_non_exception_throws_inited;
92         guint8 jit_optimizer_disabled;
93         guint8 jit_optimizer_disabled_inited;
94         /* security manager flags (one bit is for lazy initialization) */
95         guint32 ecma:2;         /* Has the ECMA key */
96         guint32 aptc:2;         /* Has the [AllowPartiallyTrustedCallers] attributes */
97         guint32 fulltrust:2;    /* Has FullTrust permission */
98         guint32 unmanaged:2;    /* Has SecurityPermissionFlag.UnmanagedCode permission */
99         guint32 skipverification:2;     /* Has SecurityPermissionFlag.SkipVerification permission */
100 };
101
102 typedef struct {
103         const char* data;
104         guint32  size;
105 } MonoStreamHeader;
106
107 struct _MonoTableInfo {
108         const char *base;
109         guint       rows     : 24;
110         guint       row_size : 8;
111
112         /*
113          * Tables contain up to 9 columns and the possible sizes of the
114          * fields in the documentation are 1, 2 and 4 bytes.  So we
115          * can encode in 2 bits the size.
116          *
117          * A 32 bit value can encode the resulting size
118          *
119          * The top eight bits encode the number of columns in the table.
120          * we only need 4, but 8 is aligned no shift required. 
121          */
122         guint32   size_bitfield;
123 };
124
125 #define REFERENCE_MISSING ((gpointer) -1)
126
127 typedef struct _MonoDllMap MonoDllMap;
128
129 struct _MonoImage {
130         /*
131          * The number of assemblies which reference this MonoImage though their 'image'
132          * field plus the number of images which reference this MonoImage through their 
133          * 'modules' field, plus the number of threads holding temporary references to
134          * this image between calls of mono_image_open () and mono_image_close ().
135          */
136         int   ref_count;
137         void *raw_data_handle;
138         char *raw_data;
139         guint32 raw_data_len;
140         guint8 raw_buffer_used    : 1;
141         guint8 raw_data_allocated : 1;
142         guint8 fileio_used : 1;
143
144 #ifdef HOST_WIN32
145         /* Module was loaded using LoadLibrary. */
146         guint8 is_module_handle : 1;
147
148         /* Module entry point is _CorDllMain. */
149         guint8 has_entry_point : 1;
150 #endif
151
152         /* Whenever this is a dynamically emitted module */
153         guint8 dynamic : 1;
154
155         /* Whenever this is a reflection only image */
156         guint8 ref_only : 1;
157
158         /* Whenever this image contains uncompressed metadata */
159         guint8 uncompressed_metadata : 1;
160
161         guint8 checked_module_cctor : 1;
162         guint8 has_module_cctor : 1;
163
164         guint8 idx_string_wide : 1;
165         guint8 idx_guid_wide : 1;
166         guint8 idx_blob_wide : 1;
167
168         /* Whenever this image is considered as platform code for the CoreCLR security model */
169         guint8 core_clr_platform_code : 1;
170                             
171         char *name;
172         const char *assembly_name;
173         const char *module_name;
174         char *version;
175         gint16 md_version_major, md_version_minor;
176         char *guid;
177         void *image_info;
178         MonoMemPool         *mempool; /*protected by the image lock*/
179
180         char                *raw_metadata;
181                             
182         MonoStreamHeader     heap_strings;
183         MonoStreamHeader     heap_us;
184         MonoStreamHeader     heap_blob;
185         MonoStreamHeader     heap_guid;
186         MonoStreamHeader     heap_tables;
187                             
188         const char          *tables_base;
189
190         /**/
191         MonoTableInfo        tables [MONO_TABLE_NUM];
192
193         /*
194          * references is initialized only by using the mono_assembly_open
195          * function, and not by using the lowlevel mono_image_open.
196          *
197          * It is NULL terminated.
198          */
199         MonoAssembly **references;
200         int nreferences;
201
202         MonoImage **modules;
203         guint32 module_count;
204         gboolean *modules_loaded;
205
206         MonoImage **files;
207
208         gpointer aot_module;
209
210         /*
211          * The Assembly this image was loaded from.
212          */
213         MonoAssembly *assembly;
214
215         /*
216          * Indexed by method tokens and typedef tokens.
217          */
218         GHashTable *method_cache; /*protected by the image lock*/
219         MonoInternalHashTable class_cache;
220
221         /* Indexed by memberref + methodspec tokens */
222         GHashTable *methodref_cache; /*protected by the image lock*/
223
224         /*
225          * Indexed by fielddef and memberref tokens
226          */
227         GHashTable *field_cache; /*protected by the image lock*/
228
229         /* indexed by typespec tokens. */
230         GHashTable *typespec_cache;
231         /* indexed by token */
232         GHashTable *memberref_signatures;
233         GHashTable *helper_signatures;
234
235         /* Indexed by blob heap indexes */
236         GHashTable *method_signatures;
237
238         /*
239          * Indexes namespaces to hash tables that map class name to typedef token.
240          */
241         GHashTable *name_cache;  /*protected by the image lock*/
242
243         /*
244          * Indexed by MonoClass
245          */
246         GHashTable *array_cache;
247         GHashTable *ptr_cache;
248
249         GHashTable *szarray_cache;
250         /* This has a separate lock to improve scalability */
251         CRITICAL_SECTION szarray_cache_lock;
252
253         /*
254          * indexed by MonoMethodSignature 
255          */
256         GHashTable *delegate_begin_invoke_cache;
257         GHashTable *delegate_end_invoke_cache;
258         GHashTable *delegate_invoke_cache;
259         GHashTable *runtime_invoke_cache;
260         GHashTable *runtime_invoke_vtype_cache;
261
262         /*
263          * indexed by SignatureMethodPair
264          */
265         GHashTable *delegate_abstract_invoke_cache;
266
267         /*
268          * indexed by SignatureMethodPair
269          */
270         GHashTable *delegate_bound_static_invoke_cache;
271         /*
272          * indexed by MonoMethod pointers 
273          */
274         GHashTable *runtime_invoke_direct_cache;
275         GHashTable *runtime_invoke_vcall_cache;
276         GHashTable *managed_wrapper_cache;
277         GHashTable *native_wrapper_cache;
278         GHashTable *native_wrapper_aot_cache;
279         GHashTable *native_func_wrapper_aot_cache;
280         GHashTable *remoting_invoke_cache;
281         GHashTable *synchronized_cache;
282         GHashTable *unbox_wrapper_cache;
283         GHashTable *cominterop_invoke_cache;
284         GHashTable *cominterop_wrapper_cache; /* LOCKING: marshal lock */
285         GHashTable *thunk_invoke_cache;
286         GHashTable *wrapper_param_names;
287         GHashTable *synchronized_generic_cache;
288         GHashTable *array_accessor_cache;
289
290         /*
291          * indexed by MonoClass pointers
292          */
293         GHashTable *ldfld_wrapper_cache;
294         GHashTable *ldflda_wrapper_cache;
295         GHashTable *stfld_wrapper_cache;
296         GHashTable *isinst_cache;
297         GHashTable *castclass_cache;
298         GHashTable *proxy_isinst_cache;
299         GHashTable *rgctx_template_hash; /* LOCKING: templates lock */
300         GHashTable *delegate_invoke_generic_cache;
301         GHashTable *delegate_begin_invoke_generic_cache;
302         GHashTable *delegate_end_invoke_generic_cache;
303
304         /* Contains rarely used fields of runtime structures belonging to this image */
305         MonoPropertyHash *property_hash;
306
307         void *reflection_info;
308
309         /*
310          * user_info is a public field and is not touched by the
311          * metadata engine
312          */
313         void *user_info;
314
315         /* dll map entries */
316         MonoDllMap *dll_map;
317
318         /* interfaces IDs from this image */
319         MonoBitSet *interface_bitset;
320
321         /* when the image is being closed, this is abused as a list of
322            malloc'ed regions to be freed. */
323         GSList *reflection_info_unregister_classes;
324
325         /* List of image sets containing this image */
326         GSList *image_sets;
327
328         /* Caches for MonoClass-es representing anon generic params */
329         MonoClass **var_cache_fast;
330         MonoClass **mvar_cache_fast;
331         GHashTable *var_cache_slow;
332         GHashTable *mvar_cache_slow;
333
334         /* Maps malloc-ed char* pinvoke scope -> MonoDl* */
335         GHashTable *pinvoke_scopes;
336
337         /* Maps malloc-ed char* pinvoke scope -> malloced-ed char* filename */
338         GHashTable *pinvoke_scope_filenames;
339
340         /* Indexed by MonoGenericParam pointers */
341         GHashTable *gsharedvt_types;
342
343         /*
344          * No other runtime locks must be taken while holding this lock.
345          * It's meant to be used only to mutate and query structures part of this image.
346          */
347         CRITICAL_SECTION    lock;
348 };
349
350 /*
351  * Generic instances depend on many images, and they need to be deleted if one
352  * of the images they depend on is unloaded. For example,
353  * List<Foo> depends on both List's image and Foo's image.
354  * A MonoImageSet is the owner of all generic instances depending on the same set of
355  * images.
356  */
357 typedef struct {
358         int nimages;
359         MonoImage **images;
360
361         GHashTable *gclass_cache, *ginst_cache, *gmethod_cache, *gsignature_cache;
362
363         CRITICAL_SECTION    lock;
364
365         /*
366          * Memory for generic instances owned by this image set should be allocated from
367          * this mempool, using the mono_image_set_alloc family of functions.
368          */
369         MonoMemPool         *mempool;
370 } MonoImageSet;
371
372 enum {
373         MONO_SECTION_TEXT,
374         MONO_SECTION_RSRC,
375         MONO_SECTION_RELOC,
376         MONO_SECTION_MAX
377 };
378
379 typedef struct {
380         GHashTable *hash;
381         char *data;
382         guint32 alloc_size; /* malloced bytes */
383         guint32 index;
384         guint32 offset; /* from start of metadata */
385 } MonoDynamicStream;
386
387 typedef struct {
388         guint32 alloc_rows;
389         guint32 rows;
390         guint8  row_size; /*  calculated later with column_sizes */
391         guint8  columns;
392         guint32 next_idx;
393         guint32 *values; /* rows * columns */
394 } MonoDynamicTable;
395
396 struct _MonoDynamicAssembly {
397         MonoAssembly assembly;
398         char *strong_name;
399         guint32 strong_name_size;
400         guint8 run;
401         guint8 save;
402         MonoDomain *domain;
403 };
404
405 struct _MonoDynamicImage {
406         MonoImage image;
407         guint32 meta_size;
408         guint32 text_rva;
409         guint32 metadata_rva;
410         guint32 image_base;
411         guint32 cli_header_offset;
412         guint32 iat_offset;
413         guint32 idt_offset;
414         guint32 ilt_offset;
415         guint32 imp_names_offset;
416         struct {
417                 guint32 rva;
418                 guint32 size;
419                 guint32 offset;
420                 guint32 attrs;
421         } sections [MONO_SECTION_MAX];
422         GHashTable *typespec;
423         GHashTable *typeref;
424         GHashTable *handleref;
425         MonoGHashTable *handleref_managed;
426         MonoGHashTable *tokens;
427         GHashTable *blob_cache;
428         GHashTable *standalonesig_cache;
429         GList *array_methods;
430         GPtrArray *gen_params;
431         MonoGHashTable *token_fixups;
432         GHashTable *method_to_table_idx;
433         GHashTable *field_to_table_idx;
434         GHashTable *method_aux_hash;
435         GHashTable *vararg_aux_hash;
436         MonoGHashTable *generic_def_objects;
437         MonoGHashTable *methodspec;
438         /*
439          * Maps final token values to the object they describe.
440          */
441         MonoGHashTable *remapped_tokens;
442         gboolean run;
443         gboolean save;
444         gboolean initial_image;
445         guint32 pe_kind, machine;
446         char *strong_name;
447         guint32 strong_name_size;
448         char *win32_res;
449         guint32 win32_res_size;
450         guint8 *public_key;
451         int public_key_len;
452         MonoDynamicStream sheap;
453         MonoDynamicStream code; /* used to store method headers and bytecode */
454         MonoDynamicStream resources; /* managed embedded resources */
455         MonoDynamicStream us;
456         MonoDynamicStream blob;
457         MonoDynamicStream tstream;
458         MonoDynamicStream guid;
459         MonoDynamicTable tables [MONO_TABLE_NUM];
460         MonoClass *wrappers_type; /*wrappers are bound to this type instead of <Module>*/
461 };
462
463 /* Contains information about assembly binding */
464 typedef struct _MonoAssemblyBindingInfo {
465         char *name;
466         char *culture;
467         guchar public_key_token [MONO_PUBLIC_KEY_TOKEN_LENGTH];
468         int major;
469         int minor;
470         AssemblyVersionSet old_version_bottom;
471         AssemblyVersionSet old_version_top;
472         AssemblyVersionSet new_version;
473         guint has_old_version_bottom : 1;
474         guint has_old_version_top : 1;
475         guint has_new_version : 1;
476         guint is_valid : 1;
477         gint32 domain_id; /*Needed to unload per-domain binding*/
478 } MonoAssemblyBindingInfo;
479
480 struct _MonoMethodHeader {
481         const unsigned char  *code;
482 #ifdef MONO_SMALL_CONFIG
483         guint16      code_size;
484 #else
485         guint32      code_size;
486 #endif
487         guint16      max_stack   : 15;
488         unsigned int is_transient: 1; /* mono_metadata_free_mh () will actually free this header */
489         unsigned int num_clauses : 15;
490         /* if num_locals != 0, then the following apply: */
491         unsigned int init_locals : 1;
492         guint16      num_locals;
493         MonoExceptionClause *clauses;
494         MonoType    *locals [MONO_ZERO_LEN_ARRAY];
495 };
496
497 typedef struct {
498         guint32      code_size;
499         gboolean     has_clauses;
500 } MonoMethodHeaderSummary;
501
502 #define MONO_SIZEOF_METHOD_HEADER (sizeof (struct _MonoMethodHeader) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
503
504 struct _MonoMethodSignature {
505         MonoType     *ret;
506 #ifdef MONO_SMALL_CONFIG
507         guint8        param_count;
508         gint8         sentinelpos;
509         unsigned int  generic_param_count : 5;
510 #else
511         guint16       param_count;
512         gint16        sentinelpos;
513         unsigned int  generic_param_count : 16;
514 #endif
515         unsigned int  call_convention     : 6;
516         unsigned int  hasthis             : 1;
517         unsigned int  explicit_this       : 1;
518         unsigned int  pinvoke             : 1;
519         unsigned int  is_inflated         : 1;
520         unsigned int  has_type_parameters : 1;
521         MonoType     *params [MONO_ZERO_LEN_ARRAY];
522 };
523
524 #define MONO_SIZEOF_METHOD_SIGNATURE (sizeof (struct _MonoMethodSignature) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
525
526 /* for use with allocated memory blocks (assumes alignment is to 8 bytes) */
527 guint mono_aligned_addr_hash (gconstpointer ptr) MONO_INTERNAL;
528
529 void
530 mono_image_check_for_module_cctor (MonoImage *image) MONO_INTERNAL;
531
532 gpointer
533 mono_image_alloc  (MonoImage *image, guint size) MONO_INTERNAL;
534
535 gpointer
536 mono_image_alloc0 (MonoImage *image, guint size) MONO_INTERNAL;
537
538 #define mono_image_new0(image,type,size) ((type *) mono_image_alloc0 (image, sizeof (type)* (size)))
539
540 char*
541 mono_image_strdup (MonoImage *image, const char *s) MONO_INTERNAL;
542
543 GList*
544 g_list_prepend_image (MonoImage *image, GList *list, gpointer data) MONO_INTERNAL;
545
546 GSList*
547 g_slist_append_image (MonoImage *image, GSList *list, gpointer data) MONO_INTERNAL;
548
549 void
550 mono_image_lock (MonoImage *image) MONO_INTERNAL;
551
552 void
553 mono_image_unlock (MonoImage *image) MONO_INTERNAL;
554
555 gpointer
556 mono_image_property_lookup (MonoImage *image, gpointer subject, guint32 property) MONO_INTERNAL;
557
558 void
559 mono_image_property_insert (MonoImage *image, gpointer subject, guint32 property, gpointer value) MONO_INTERNAL;
560
561 void
562 mono_image_property_remove (MonoImage *image, gpointer subject) MONO_INTERNAL;
563
564 gboolean
565 mono_image_close_except_pools (MonoImage *image) MONO_INTERNAL;
566
567 void
568 mono_image_close_finish (MonoImage *image) MONO_INTERNAL;
569
570 typedef void  (*MonoImageUnloadFunc) (MonoImage *image, gpointer user_data);
571
572 void
573 mono_install_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data) MONO_INTERNAL;
574
575 void
576 mono_remove_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data) MONO_INTERNAL;
577
578 void
579 mono_image_append_class_to_reflection_info_set (MonoClass *class) MONO_INTERNAL;
580
581 gpointer
582 mono_image_set_alloc  (MonoImageSet *set, guint size) MONO_INTERNAL;
583
584 gpointer
585 mono_image_set_alloc0 (MonoImageSet *set, guint size) MONO_INTERNAL;
586
587 char*
588 mono_image_set_strdup (MonoImageSet *set, const char *s) MONO_INTERNAL;
589
590 #define mono_image_set_new0(image,type,size) ((type *) mono_image_set_alloc0 (image, sizeof (type)* (size)))
591
592 MonoType*
593 mono_metadata_get_shared_type (MonoType *type) MONO_INTERNAL;
594
595 void
596 mono_metadata_clean_for_image (MonoImage *image) MONO_INTERNAL;
597
598 void
599 mono_metadata_clean_generic_classes_for_image (MonoImage *image) MONO_INTERNAL;
600
601 MONO_API void
602 mono_metadata_cleanup (void);
603
604 const char *   mono_meta_table_name              (int table) MONO_INTERNAL;
605 void           mono_metadata_compute_table_bases (MonoImage *meta) MONO_INTERNAL;
606
607 gboolean
608 mono_metadata_interfaces_from_typedef_full  (MonoImage             *image,
609                                                                                          guint32                table_index,
610                                                                                          MonoClass           ***interfaces,
611                                                                                          guint                 *count,
612                                                                                          gboolean               heap_alloc_result,
613                                                                                          MonoGenericContext    *context) MONO_INTERNAL;
614
615 MonoArrayType *
616 mono_metadata_parse_array_full              (MonoImage             *image,
617                                              MonoGenericContainer  *container,
618                                              const char            *ptr,
619                                              const char           **rptr) MONO_INTERNAL;
620
621 MONO_API MonoType *
622 mono_metadata_parse_type_full               (MonoImage             *image,
623                                              MonoGenericContainer  *container,
624                                              MonoParseTypeMode      mode,
625                                              short                  opt_attrs,
626                                              const char            *ptr,
627                                              const char           **rptr);
628
629 MonoMethodSignature *
630 mono_metadata_parse_signature_full          (MonoImage             *image,
631                                              MonoGenericContainer  *generic_container,
632                                              guint32                token) MONO_INTERNAL;
633
634 MONO_API MonoMethodSignature *
635 mono_metadata_parse_method_signature_full   (MonoImage             *image,
636                                              MonoGenericContainer  *generic_container,
637                                              int                     def,
638                                              const char             *ptr,
639                                              const char            **rptr);
640
641 MONO_API MonoMethodHeader *
642 mono_metadata_parse_mh_full                 (MonoImage             *image,
643                                              MonoGenericContainer  *container,
644                                              const char            *ptr);
645
646 gboolean
647 mono_method_get_header_summary (MonoMethod *method, MonoMethodHeaderSummary *summary) MONO_INTERNAL;
648
649 int* mono_metadata_get_param_attrs          (MonoImage *m, int def, int param_count) MONO_INTERNAL;
650 gboolean mono_metadata_method_has_param_attrs (MonoImage *m, int def) MONO_INTERNAL;
651
652 guint
653 mono_metadata_generic_context_hash          (const MonoGenericContext *context) MONO_INTERNAL;
654
655 gboolean
656 mono_metadata_generic_context_equal         (const MonoGenericContext *g1,
657                                              const MonoGenericContext *g2) MONO_INTERNAL;
658
659 MonoGenericInst *
660 mono_metadata_parse_generic_inst            (MonoImage             *image,
661                                              MonoGenericContainer  *container,
662                                              int                    count,
663                                              const char            *ptr,
664                                              const char           **rptr) MONO_INTERNAL;
665
666 MonoGenericInst *
667 mono_metadata_get_generic_inst              (int                    type_argc,
668                                              MonoType             **type_argv) MONO_INTERNAL;
669
670 MonoGenericClass *
671 mono_metadata_lookup_generic_class          (MonoClass             *gclass,
672                                              MonoGenericInst       *inst,
673                                              gboolean               is_dynamic) MONO_INTERNAL;
674
675 MonoGenericInst * mono_metadata_inflate_generic_inst  (MonoGenericInst *ginst, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
676
677 void mono_dynamic_stream_reset  (MonoDynamicStream* stream) MONO_INTERNAL;
678 void mono_assembly_addref       (MonoAssembly *assembly) MONO_INTERNAL;
679 void mono_assembly_load_friends (MonoAssembly* ass) MONO_INTERNAL;
680 gboolean mono_assembly_has_skip_verification (MonoAssembly* ass) MONO_INTERNAL;
681
682 void mono_assembly_release_gc_roots (MonoAssembly *assembly) MONO_INTERNAL;
683 gboolean mono_assembly_close_except_image_pools (MonoAssembly *assembly) MONO_INTERNAL;
684 void mono_assembly_close_finish (MonoAssembly *assembly) MONO_INTERNAL;
685
686
687 gboolean mono_public_tokens_are_equal (const unsigned char *pubt1, const unsigned char *pubt2) MONO_INTERNAL;
688
689 void mono_config_parse_publisher_policy (const char *filename, MonoAssemblyBindingInfo *binding_info) MONO_INTERNAL;
690 void mono_config_parse_assembly_bindings (const char *filename, int major, int minor, void *user_data,
691                                           void (*infocb)(MonoAssemblyBindingInfo *info, void *user_data)) MONO_INTERNAL;
692
693 gboolean
694 mono_assembly_name_parse_full                (const char           *name,
695                                               MonoAssemblyName     *aname,
696                                               gboolean save_public_key,
697                                               gboolean *is_version_defined,
698                                                   gboolean *is_token_defined) MONO_INTERNAL;
699
700 MONO_API guint32 mono_metadata_get_generic_param_row (MonoImage *image, guint32 token, guint32 *owner);
701
702 void mono_unload_interface_ids (MonoBitSet *bitset) MONO_INTERNAL;
703
704
705 MonoType *mono_metadata_type_dup (MonoImage *image, const MonoType *original) MONO_INTERNAL;
706 MonoMethodSignature  *mono_metadata_signature_dup_full (MonoImage *image,MonoMethodSignature *sig) MONO_INTERNAL;
707 MonoMethodSignature  *mono_metadata_signature_dup_mempool (MonoMemPool *mp, MonoMethodSignature *sig) MONO_INTERNAL;
708
709 MonoGenericInst *
710 mono_get_shared_generic_inst (MonoGenericContainer *container) MONO_INTERNAL;
711
712 int
713 mono_type_stack_size_internal (MonoType *t, int *align, gboolean allow_open) MONO_INTERNAL;
714
715 MONO_API void            mono_type_get_desc (GString *res, MonoType *type, mono_bool include_namespace);
716
717 gboolean
718 mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, gboolean signature_only) MONO_INTERNAL;
719
720 MonoMarshalSpec *
721 mono_metadata_parse_marshal_spec_full (MonoImage *image, const char *ptr) MONO_INTERNAL;
722
723 guint          mono_metadata_generic_inst_hash (gconstpointer data) MONO_INTERNAL;
724 gboolean       mono_metadata_generic_inst_equal (gconstpointer ka, gconstpointer kb) MONO_INTERNAL;
725
726 MONO_API void
727 mono_metadata_field_info_with_mempool (
728                                           MonoImage *meta, 
729                                       guint32       table_index,
730                                       guint32      *offset,
731                                       guint32      *rva,
732                                       MonoMarshalSpec **marshal_spec);
733
734 MonoClassField*
735 mono_metadata_get_corresponding_field_from_generic_type_definition (MonoClassField *field) MONO_INTERNAL;
736
737 MonoEvent*
738 mono_metadata_get_corresponding_event_from_generic_type_definition (MonoEvent *event) MONO_INTERNAL;
739
740 MonoProperty*
741 mono_metadata_get_corresponding_property_from_generic_type_definition (MonoProperty *property) MONO_INTERNAL;
742
743 guint32
744 mono_metadata_signature_size (MonoMethodSignature *sig) MONO_INTERNAL;
745
746 guint mono_metadata_str_hash (gconstpointer v1) MONO_INTERNAL;
747
748 gboolean mono_image_load_pe_data (MonoImage *image) MONO_INTERNAL;
749
750 gboolean mono_image_load_cli_data (MonoImage *image) MONO_INTERNAL;
751
752 void mono_image_load_names (MonoImage *image) MONO_INTERNAL;
753
754 MonoImage *mono_image_open_raw (const char *fname, MonoImageOpenStatus *status) MONO_INTERNAL;
755
756 MonoException *mono_get_exception_field_access_msg (const char *msg) MONO_INTERNAL;
757
758 MonoException *mono_get_exception_method_access_msg (const char *msg) MONO_INTERNAL;
759
760 MonoMethod* method_from_method_def_or_ref (MonoImage *m, guint32 tok, MonoGenericContext *context) MONO_INTERNAL;
761
762 MonoMethod *mono_get_method_constrained_with_method (MonoImage *image, MonoMethod *method, MonoClass *constrained_class, MonoGenericContext *context) MONO_INTERNAL;
763
764 #endif /* __MONO_METADATA_INTERNALS_H__ */
765