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