2009-02-04 Mark Probst <mark.probst@gmail.com>
[mono.git] / mono / metadata / domain-internals.h
index fe9c90d2257e5d6630ae44de52182237d5ade631..dc2ab2eb0f871205a8169c0b54999eefa0ff056c 100644 (file)
@@ -12,6 +12,7 @@
 #include <mono/io-layer/io-layer.h>
 
 extern CRITICAL_SECTION mono_delegate_section;
+extern CRITICAL_SECTION mono_strtod_mutex;
 
 /*
  * If this is set, the memory belonging to appdomains is not freed when a domain is
@@ -106,9 +107,10 @@ struct _MonoJitInfo {
        MonoMethod *method;
        struct _MonoJitInfo *next_jit_code_hash;
        gpointer    code_start;
+       /* This might contain an id for the unwind info instead of a register mask */
        guint32     used_regs;
        int         code_size;
-       guint32     num_clauses:16;
+       guint32     num_clauses:15;
        /* Whenever the code is domain neutral or 'shared' */
        gboolean    domain_neutral:1;
        gboolean    cas_inited:1;
@@ -119,6 +121,7 @@ struct _MonoJitInfo {
        gboolean    cas_method_deny:1;
        gboolean    cas_method_permitonly:1;
        gboolean    has_generic_jit_info:1;
+       gboolean    from_aot:1;
        MonoJitExceptionInfo clauses [MONO_ZERO_LEN_ARRAY];
        /* There is an optional MonoGenericJitInfo after the clauses */
 };
@@ -130,8 +133,16 @@ struct _MonoAppContext {
        gpointer *static_data;
 };
 
+/*
+ * We have two unloading states because the domain
+ * must remain fully functional while AppDomain::DomainUnload is
+ * processed.
+ * After that unloading began and all domain facilities are teared down
+ * such as execution of new threadpool jobs.  
+ */
 typedef enum {
        MONO_APPDOMAIN_CREATED,
+       MONO_APPDOMAIN_UNLOADING_START,
        MONO_APPDOMAIN_UNLOADING,
        MONO_APPDOMAIN_UNLOADED
 } MonoAppDomainState;
@@ -145,6 +156,11 @@ typedef struct _MonoThunkFreeList {
 typedef struct _MonoJitCodeHash MonoJitCodeHash;
 
 struct _MonoDomain {
+       /*
+        * This lock must never be taken before the loader lock,
+        * i.e. if both are taken by the same thread, the loader lock
+        * must taken first.
+        */
        CRITICAL_SECTION    lock;
        MonoMemPool        *mp;
        MonoCodeManager    *code_mp;
@@ -209,7 +225,6 @@ struct _MonoDomain {
        /* Used when accessing 'domain_assemblies' */
        CRITICAL_SECTION    assemblies_lock;
 
-       GHashTable         *shared_generics_hash;
        GHashTable         *method_rgctx_hash;
 
        GHashTable         *generic_virtual_cases;
@@ -286,12 +301,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;
-
-void
-mono_domain_register_shared_generic (MonoDomain *domain, MonoMethod *method, MonoJitInfo *jit_info) MONO_INTERNAL;
-
 char *
 mono_make_shadow_copy (const char *filename) MONO_INTERNAL;