Revert "Revert "Merge branch 'master' of https://github.com/mono/mono""
[mono.git] / mono / metadata / domain-internals.h
index 362d6b13c7177da04a5e236962e927727b11928b..09c6479c03d3805e5e1f6f12a43ba7f530168154 100644 (file)
@@ -91,11 +91,16 @@ typedef struct {
 } MonoJitExceptionInfo;
 
 /*
- * Will contain information on the generic type arguments in the
- * future.  For now, all arguments are always reference types.
+ * Contains information about the type arguments for generic shared methods.
  */
 typedef struct {
-       int dummy;
+       /*
+        * If not NULL, determines whenever the class type arguments of the gshared method are references or vtypes.
+        * The array length is equal to class_inst->type_argv.
+        */
+       gboolean *var_is_vt;
+       /* Same for method type parameters */
+       gboolean *mvar_is_vt;
 } MonoGenericSharingContext;
 
 /* Simplified DWARF location list entry */
@@ -185,7 +190,11 @@ struct _MonoJitInfo {
           next_jit_code_hash) must be in the same order and at the
           same offset as in RuntimeMethod, because of the jit_code_hash
           internal hash table in MonoDomain. */
-       MonoMethod *method;
+       union {
+               MonoMethod *method;
+               MonoImage *image;
+               gpointer aot_info;
+       } d;
        struct _MonoJitInfo *next_jit_code_hash;
        gpointer    code_start;
        /* This might contain an id for the unwind info instead of a register mask */
@@ -200,6 +209,14 @@ struct _MonoJitInfo {
        gboolean    has_arch_eh_info:1;
        gboolean    from_aot:1;
        gboolean    from_llvm:1;
+       gboolean    dbg_hidden_inited:1;
+       gboolean    dbg_hidden:1;
+       /* Whenever this jit info was loaded in async context */
+       gboolean    async:1;
+       gboolean    dbg_step_through_inited:1;
+       gboolean    dbg_step_through:1;
+       gboolean    dbg_non_user_code_inited:1;
+       gboolean    dbg_non_user_code:1;
 
        /* FIXME: Embed this after the structure later*/
        gpointer    gc_info; /* Currently only used by SGen */
@@ -219,6 +236,17 @@ struct _MonoAppContext {
        gpointer *static_data;
 };
 
+/* Lock-free allocator */
+typedef struct {
+       guint8 *mem;
+       gpointer prev;
+       int size, pos;
+} LockFreeMempoolChunk;
+
+typedef struct {
+       LockFreeMempoolChunk *current, *chunks;
+} LockFreeMempool;
+
 /*
  * We have two unloading states because the domain
  * must remain fully functional while AppDomain::DomainUnload is
@@ -308,10 +336,17 @@ struct _MonoDomain {
        int                 num_jit_info_tables;
        MonoJitInfoTable * 
          volatile          jit_info_table;
+       /*
+        * Contains information about AOT loaded code.
+        * Only used in the root domain.
+        */
+       MonoJitInfoTable *
+         volatile          aot_modules;
        GSList             *jit_info_free_queue;
        /* Used when loading assemblies */
        gchar **search_path;
        gchar *private_bin_path;
+       LockFreeMempool *lock_free_mp;
        
        /* Used by remoting proxies */
        MonoMethod         *create_proxy_for_type_method;
@@ -325,12 +360,6 @@ struct _MonoDomain {
         */
        GHashTable         *finalizable_objects_hash;
 
-       /* These two are boehm only */
-       /* Maps MonoObjects to a GSList of WeakTrackResurrection GCHandles pointing to them */
-       GHashTable         *track_resurrection_objects_hash;
-       /* Maps WeakTrackResurrection GCHandles to the MonoObjects they point to */
-       GHashTable         *track_resurrection_handles_hash;
-
        /* Protects the three hashes above */
        CRITICAL_SECTION   finalizable_objects_hash_lock;
        /* Used when accessing 'domain_assemblies' */
@@ -371,7 +400,6 @@ struct _MonoDomain {
 
        /* Used by threadpool.c */
        MonoImage *system_image;
-       MonoImage *system_net_dll;
        MonoClass *corlib_asyncresult_class;
        MonoClass *socket_class;
        MonoClass *ad_unloaded_ex_class;
@@ -392,7 +420,7 @@ typedef struct  {
 typedef struct  {
        const char runtime_version [12];
        const char framework_version [4];
-       const AssemblyVersionSet version_sets [3];
+       const AssemblyVersionSet version_sets [4];
 } MonoRuntimeInfo;
 
 #define mono_domain_lock(domain) mono_locks_acquire(&(domain)->lock, DomainLock)
@@ -420,9 +448,6 @@ typedef void (*MonoFreeDomainFunc) (MonoDomain *domain);
 void
 mono_install_free_domain_hook (MonoFreeDomainFunc func) MONO_INTERNAL;
 
-void 
-mono_init_com_types (void) MONO_INTERNAL;
-
 void 
 mono_cleanup (void) MONO_INTERNAL;
 
@@ -447,9 +472,6 @@ mono_jit_info_get_generic_sharing_context (MonoJitInfo *ji) MONO_INTERNAL;
 void
 mono_jit_info_set_generic_sharing_context (MonoJitInfo *ji, MonoGenericSharingContext *gsctx) MONO_INTERNAL;
 
-MonoJitInfo*
-mono_domain_lookup_shared_generic (MonoDomain *domain, MonoMethod *method) MONO_INTERNAL;
-
 char *
 mono_make_shadow_copy (const char *filename) MONO_INTERNAL;
 
@@ -462,6 +484,9 @@ mono_domain_alloc  (MonoDomain *domain, guint size) MONO_INTERNAL;
 gpointer
 mono_domain_alloc0 (MonoDomain *domain, guint size) MONO_INTERNAL;
 
+gpointer
+mono_domain_alloc0_lock_free (MonoDomain *domain, guint size) MONO_INTERNAL;
+
 void*
 mono_domain_code_reserve (MonoDomain *domain, int size) MONO_LLVM_INTERNAL;
 
@@ -611,7 +636,7 @@ MonoImage *mono_assembly_open_from_bundle (const char *filename,
                                           MonoImageOpenStatus *status,
                                           gboolean refonly) MONO_INTERNAL;
 
-void
+MONO_API void
 mono_domain_add_class_static_data (MonoDomain *domain, MonoClass *klass, gpointer data, guint32 *bitmap);
 
 MonoReflectionAssembly *
@@ -628,6 +653,10 @@ int mono_framework_version (void) MONO_INTERNAL;
 
 void mono_reflection_cleanup_domain (MonoDomain *domain) MONO_INTERNAL;
 
-void mono_assembly_cleanup_domain_bindings (guint32 domain_id) MONO_INTERNAL;;
+void mono_assembly_cleanup_domain_bindings (guint32 domain_id) MONO_INTERNAL;
+
+MonoJitInfo* mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_aot) MONO_INTERNAL;
+
+void mono_enable_debug_domain_unload (gboolean enable);
 
 #endif /* __MONO_METADATA_DOMAIN_INTERNALS_H__ */