[runtime] Implement FieldInfo.GetRawConstantValue () for dynamic types. Fixes #25690.
[mono.git] / mono / metadata / metadata-internals.h
index 618fd5b59d52a7487fe1b0798397971c06a119bf..ea35f5b7c636a7b4f7cf08313a6e0f81ac7389fe 100644 (file)
@@ -13,6 +13,7 @@
 #include "mono/utils/mono-property-hash.h"
 #include "mono/utils/mono-value-hash.h"
 #include <mono/utils/mono-error.h>
+#include "mono/utils/mono-conc-hashtable.h"
 
 struct _MonoType {
        union {
@@ -203,7 +204,7 @@ struct _MonoImage {
        guint32 module_count;
        gboolean *modules_loaded;
 
-       MonoImage **files;
+       MonoImage **files; /*protected by the image lock*/
 
        gpointer aot_module;
 
@@ -224,10 +225,10 @@ struct _MonoImage {
        /*
         * Indexed by fielddef and memberref tokens
         */
-       GHashTable *field_cache; /*protected by the image lock*/
+       MonoConcurrentHashTable *field_cache; /*protected by the image lock*/
 
        /* indexed by typespec tokens. */
-       GHashTable *typespec_cache;
+       GHashTable *typespec_cache; /* protected by the image lock */
        /* indexed by token */
        GHashTable *memberref_signatures;
        GHashTable *helper_signatures;
@@ -248,7 +249,7 @@ struct _MonoImage {
 
        GHashTable *szarray_cache;
        /* This has a separate lock to improve scalability */
-       CRITICAL_SECTION szarray_cache_lock;
+       mono_mutex_t szarray_cache_lock;
 
        /*
         * indexed by MonoMethodSignature 
@@ -316,6 +317,7 @@ struct _MonoImage {
        MonoDllMap *dll_map;
 
        /* interfaces IDs from this image */
+       /* protected by the classes lock */
        MonoBitSet *interface_bitset;
 
        /* when the image is being closed, this is abused as a list of
@@ -345,7 +347,7 @@ struct _MonoImage {
         * No other runtime locks must be taken while holding this lock.
         * It's meant to be used only to mutate and query structures part of this image.
         */
-       CRITICAL_SECTION    lock;
+       mono_mutex_t    lock;
 };
 
 /*
@@ -361,7 +363,7 @@ typedef struct {
 
        GHashTable *gclass_cache, *ginst_cache, *gmethod_cache, *gsignature_cache;
 
-       CRITICAL_SECTION    lock;
+       mono_mutex_t    lock;
 
        /*
         * Memory for generic instances owned by this image set should be allocated from
@@ -522,8 +524,42 @@ struct _MonoMethodSignature {
        MonoType     *params [MONO_ZERO_LEN_ARRAY];
 };
 
+/*
+ * AOT cache configuration loaded from config files.
+ * Doesn't really belong here.
+ */
+typedef struct {
+       /*
+        * Enable aot caching for applications whose main assemblies are in
+        * this list.
+        */
+       GSList *apps;
+       GSList *assemblies;
+       char *aot_options;
+} MonoAotCacheConfig;
+
 #define MONO_SIZEOF_METHOD_SIGNATURE (sizeof (struct _MonoMethodSignature) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
 
+static inline gboolean
+image_is_dynamic (MonoImage *image)
+{
+#ifdef DISABLE_REFLECTION_EMIT
+       return FALSE;
+#else
+       return image->dynamic;
+#endif
+}
+
+static inline gboolean
+assembly_is_dynamic (MonoAssembly *assembly)
+{
+#ifdef DISABLE_REFLECTION_EMIT
+       return FALSE;
+#else
+       return assembly->dynamic;
+#endif
+}
+
 /* for use with allocated memory blocks (assumes alignment is to 8 bytes) */
 guint mono_aligned_addr_hash (gconstpointer ptr) MONO_INTERNAL;
 
@@ -577,7 +613,7 @@ void
 mono_remove_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data) MONO_INTERNAL;
 
 void
-mono_image_append_class_to_reflection_info_set (MonoClass *class) MONO_INTERNAL;
+mono_image_append_class_to_reflection_info_set (MonoClass *klass) MONO_INTERNAL;
 
 gpointer
 mono_image_set_alloc  (MonoImageSet *set, guint size) MONO_INTERNAL;
@@ -719,7 +755,7 @@ gboolean
 mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, gboolean signature_only) MONO_INTERNAL;
 
 MonoMarshalSpec *
-mono_metadata_parse_marshal_spec_full (MonoImage *image, const char *ptr) MONO_INTERNAL;
+mono_metadata_parse_marshal_spec_full (MonoImage *image, MonoImage *parent_image, const char *ptr) MONO_INTERNAL;
 
 guint         mono_metadata_generic_inst_hash (gconstpointer data) MONO_INTERNAL;
 gboolean       mono_metadata_generic_inst_equal (gconstpointer ka, gconstpointer kb) MONO_INTERNAL;
@@ -762,5 +798,15 @@ MonoMethod* method_from_method_def_or_ref (MonoImage *m, guint32 tok, MonoGeneri
 
 MonoMethod *mono_get_method_constrained_with_method (MonoImage *image, MonoMethod *method, MonoClass *constrained_class, MonoGenericContext *context) MONO_INTERNAL;
 
+void mono_type_set_alignment (MonoTypeEnum type, int align) MONO_INTERNAL;
+
+MonoAotCacheConfig *mono_get_aot_cache_config (void) MONO_INTERNAL;
+MonoType *
+mono_type_create_from_typespec_checked (MonoImage *image, guint32 type_spec, MonoError *error) MONO_INTERNAL;
+
+MonoMethodSignature*
+mono_method_get_signature_checked (MonoMethod *method, MonoImage *image, guint32 token, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+       
+
 #endif /* __MONO_METADATA_INTERNALS_H__ */