#include "mono/metadata/image.h"
#include "mono/metadata/blob.h"
+#include "mono/metadata/cil-coff.h"
#include "mono/metadata/mempool.h"
#include "mono/metadata/domain-internals.h"
#include "mono/metadata/mono-hash.h"
guint32 skipverification:2; /* Has SecurityPermissionFlag.SkipVerification permission */
};
+typedef struct {
+ /*
+ * indexed by MonoMethodSignature
+ * Protected by the marshal lock
+ */
+ GHashTable *delegate_invoke_cache;
+ GHashTable *delegate_begin_invoke_cache;
+ GHashTable *delegate_end_invoke_cache;
+ GHashTable *runtime_invoke_cache;
+ GHashTable *runtime_invoke_vtype_cache;
+
+ /*
+ * indexed by SignaturePointerPair
+ */
+ GHashTable *delegate_abstract_invoke_cache;
+
+ /*
+ * indexed by MonoMethod pointers
+ * Protected by the marshal lock
+ */
+ GHashTable *runtime_invoke_direct_cache;
+ GHashTable *managed_wrapper_cache;
+
+ GHashTable *native_wrapper_cache;
+ GHashTable *native_wrapper_aot_cache;
+ GHashTable *native_wrapper_check_cache;
+ GHashTable *native_wrapper_aot_check_cache;
+
+ GHashTable *native_func_wrapper_aot_cache;
+ GHashTable *remoting_invoke_cache;
+ GHashTable *synchronized_cache;
+ GHashTable *unbox_wrapper_cache;
+ GHashTable *cominterop_invoke_cache;
+ GHashTable *cominterop_wrapper_cache; /* LOCKING: marshal lock */
+ GHashTable *thunk_invoke_cache;
+} MonoWrapperCaches;
+
typedef struct {
const char* data;
guint32 size;
typedef struct _MonoDllMap MonoDllMap;
+typedef struct {
+ gboolean (*match) (MonoImage*);
+ gboolean (*load_pe_data) (MonoImage*);
+ gboolean (*load_cli_data) (MonoImage*);
+ gboolean (*load_tables) (MonoImage*);
+} MonoImageLoader;
+
struct _MonoImage {
/*
* The number of assemblies which reference this MonoImage though their 'image'
/* This has a separate lock to improve scalability */
mono_mutex_t szarray_cache_lock;
- /*
- * indexed by MonoMethodSignature
- */
- GHashTable *delegate_begin_invoke_cache;
- GHashTable *delegate_end_invoke_cache;
- GHashTable *delegate_invoke_cache;
- GHashTable *runtime_invoke_cache;
- GHashTable *runtime_invoke_vtype_cache;
-
/*
* indexed by SignaturePointerPair
*/
- GHashTable *delegate_abstract_invoke_cache;
GHashTable *delegate_bound_static_invoke_cache;
GHashTable *native_func_wrapper_cache;
/*
* indexed by MonoMethod pointers
*/
- GHashTable *runtime_invoke_direct_cache;
GHashTable *runtime_invoke_vcall_cache;
- GHashTable *managed_wrapper_cache;
- GHashTable *native_wrapper_cache;
- GHashTable *native_wrapper_aot_cache;
- GHashTable *native_wrapper_check_cache;
- GHashTable *native_wrapper_aot_check_cache;
- GHashTable *native_func_wrapper_aot_cache;
- GHashTable *remoting_invoke_cache;
- GHashTable *synchronized_cache;
- GHashTable *unbox_wrapper_cache;
- GHashTable *cominterop_invoke_cache;
- GHashTable *cominterop_wrapper_cache; /* LOCKING: marshal lock */
- GHashTable *thunk_invoke_cache;
GHashTable *wrapper_param_names;
- GHashTable *synchronized_generic_cache;
GHashTable *array_accessor_cache;
/*
GHashTable *castclass_cache;
GHashTable *proxy_isinst_cache;
GHashTable *rgctx_template_hash; /* LOCKING: templates lock */
- GHashTable *delegate_invoke_generic_cache;
- GHashTable *delegate_begin_invoke_generic_cache;
- GHashTable *delegate_end_invoke_generic_cache;
/* Contains rarely used fields of runtime structures belonging to this image */
MonoPropertyHash *property_hash;
malloc'ed regions to be freed. */
GSList *reflection_info_unregister_classes;
- /* List of image sets containing this image */
+ /* List of dependent image sets containing this image */
/* Protected by image_sets_lock */
GSList *image_sets;
+ /* Caches for wrappers that DO NOT reference generic */
+ /* arguments */
+ MonoWrapperCaches wrapper_caches;
+
/* Caches for MonoClass-es representing anon generic params */
MonoClass **var_cache_fast;
MonoClass **mvar_cache_fast;
/* The length of the above array */
int gshared_types_len;
+ /* The loader used to load this image */
+ MonoImageLoader *loader;
+
/*
* 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.
int nimages;
MonoImage **images;
+ // Generic-specific caches
GHashTable *gclass_cache, *ginst_cache, *gmethod_cache, *gsignature_cache;
+ MonoWrapperCaches wrapper_caches;
+
mono_mutex_t lock;
/*
void
mono_remove_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data);
+void
+mono_install_image_loader (const MonoImageLoader *loader);
+
void
mono_image_append_class_to_reflection_info_set (MonoClass *klass);
gpointer
mono_image_set_alloc0 (MonoImageSet *set, guint size);
+void
+mono_image_set_lock (MonoImageSet *set);
+
+void
+mono_image_set_unlock (MonoImageSet *set);
+
char*
mono_image_set_strdup (MonoImageSet *set, const char *s);
#define mono_image_set_new0(image,type,size) ((type *) mono_image_set_alloc0 (image, sizeof (type)* (size)))
+gboolean
+mono_image_load_cli_header (MonoImage *image, MonoCLIImageInfo *iinfo);
+
+gboolean
+mono_image_load_metadata (MonoImage *image, MonoCLIImageInfo *iinfo);
+
MonoType*
mono_metadata_get_shared_type (MonoType *type);
MonoType *mono_metadata_type_dup (MonoImage *image, const MonoType *original);
MonoMethodSignature *mono_metadata_signature_dup_full (MonoImage *image,MonoMethodSignature *sig);
MonoMethodSignature *mono_metadata_signature_dup_mempool (MonoMemPool *mp, MonoMethodSignature *sig);
+MonoMethodSignature *mono_metadata_signature_dup_add_this (MonoImage *image, MonoMethodSignature *sig, MonoClass *klass);
MonoGenericInst *
mono_get_shared_generic_inst (MonoGenericContainer *container);
MonoImage *mono_image_open_metadata_only (const char *fname, MonoImageOpenStatus *status);
+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);
+
MonoException *mono_get_exception_field_access_msg (const char *msg);
MonoException *mono_get_exception_method_access_msg (const char *msg);
guint32
mono_metadata_localscope_from_methoddef (MonoImage *meta, guint32 index);
+void
+mono_wrapper_caches_free (MonoWrapperCaches *cache);
+
+MonoWrapperCaches*
+mono_method_get_wrapper_cache (MonoMethod *method);
+
+MonoWrapperCaches*
+mono_method_get_wrapper_cache (MonoMethod *method);
+
#endif /* __MONO_METADATA_INTERNALS_H__ */