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