2004-01-19 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mono / metadata / appdomain.h
index b946ec4f927e0ce7ff8697ddbad4c1bb7f78b19f..45b8a3195bec27b40898867b750a5834cf794918 100644 (file)
@@ -37,6 +37,9 @@ typedef struct {
        MonoString *shadow_copy_files;
        MonoBoolean publisher_policy;
        MonoBoolean path_changed;
+       int loader_optimization;
+       MonoBoolean disallow_binding_redirects;
+       MonoBoolean disallow_code_downloads;
 } MonoAppDomainSetup;
 
 typedef GArray MonoJitInfoTable;
@@ -59,6 +62,8 @@ typedef struct {
        guint32     used_regs;
        unsigned    num_clauses;
        signed      exvar_offset;
+       /* Whenever the code is domain neutral or 'shared' */
+       gboolean    domain_neutral:1;
        MonoJitExceptionInfo *clauses;
 } MonoJitInfo;
 
@@ -66,9 +71,14 @@ typedef struct {
        MonoObject obj;
        gint32 domain_id;
        gint32 context_id;
+       gpointer *static_data;
 } MonoAppContext;
 
-extern CRITICAL_SECTION *metadata_section;
+typedef enum {
+       MONO_APPDOMAIN_CREATED,
+       MONO_APPDOMAIN_UNLOADING,
+       MONO_APPDOMAIN_UNLOADED
+} MonoAppDomainState;
 
 typedef struct _MonoAppDomain MonoAppDomain;
 
@@ -82,6 +92,7 @@ struct _MonoDomain {
        MonoAssembly       *entry_assembly;
        MonoAppDomainSetup *setup;
        char               *friendly_name;
+       guint32            state;
        MonoGHashTable     *ldstr_table;
        MonoGHashTable     *class_vtable_hash;
        MonoGHashTable     *proxy_vtable_hash;
@@ -99,8 +110,16 @@ struct _MonoDomain {
        MonoMethod         *create_proxy_for_type_method;
        MonoMethod         *private_invoke_method;
        MonoAppContext     *default_context;
-       GHashTable         *thread_static_fields;
+       MonoException      *out_of_memory_ex;
+       /* Used to store offsets of thread and context static fields */
+       GHashTable         *special_static_fields;
        GHashTable         *jump_target_hash;
+       MonoGHashTable     *class_init_trampoline_hash;
+       /* 
+        * This must be a GHashTable, since these objects can't be finalized
+        * if the hashtable contains a GC visible reference to them.
+        */
+       GHashTable         *finalizable_objects_hash;
 };
 
 /* This is a copy of System.AppDomain */
@@ -135,6 +154,12 @@ mono_runtime_install_cleanup (MonoDomainFunc func);
 void
 mono_runtime_quit (void);
 
+gboolean
+mono_runtime_is_shutting_down (void);
+
+const char*
+mono_check_corlib_version (void);
+
 MonoDomain *
 mono_domain_create         (void);
 
@@ -144,8 +169,14 @@ mono_domain_get            (void);
 inline MonoDomain *
 mono_domain_get_by_id      (gint32 domainid);
 
+inline gboolean
+mono_domain_set            (MonoDomain *domain, gboolean force);
+
 inline void
-mono_domain_set            (MonoDomain *domain);
+mono_domain_set_internal   (MonoDomain *domain);
+
+gboolean
+mono_domain_is_unloading   (MonoDomain *domain);
 
 void
 mono_domain_foreach        (MonoDomainFunc func, gpointer user_data);
@@ -153,11 +184,11 @@ mono_domain_foreach        (MonoDomainFunc func, gpointer user_data);
 MonoAssembly *
 mono_domain_assembly_open  (MonoDomain *domain, const char *name);
 
-void
-mono_domain_finalize       (MonoDomain *domain);
+gboolean
+mono_domain_finalize       (MonoDomain *domain, guint32 timeout);
 
 void
-mono_domain_unload         (MonoDomain *domain, gboolean force);
+mono_domain_free           (MonoDomain *domain, gboolean force);
 
 gboolean
 mono_domain_has_type_resolve (MonoDomain *domain);
@@ -185,6 +216,12 @@ MonoObject *
 ves_icall_System_AppDomain_GetData                 (MonoAppDomain *ad, 
                                                    MonoString    *name);
 
+MonoReflectionAssembly *
+ves_icall_System_AppDomain_LoadAssemblyRaw         (MonoAppDomain *ad,
+                                                   MonoArray *raw_assembly, 
+                                                   MonoArray *raw_symbol_store,
+                                                   MonoObject *evidence);
+
 void
 ves_icall_System_AppDomain_SetData                 (MonoAppDomain *ad, 
                                                    MonoString    *name, 
@@ -204,9 +241,12 @@ ves_icall_System_Reflection_Assembly_LoadFrom      (MonoString *fname);
 
 MonoReflectionAssembly *
 ves_icall_System_AppDomain_LoadAssembly            (MonoAppDomain *ad, 
-                                                   MonoReflectionAssemblyName *assRef,
+                                                   MonoString *assRef,
                                                    MonoObject    *evidence);
 
+gboolean
+ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id);
+
 void
 ves_icall_System_AppDomain_InternalUnload          (gint32 domain_id);
 
@@ -231,6 +271,15 @@ ves_icall_System_AppDomain_InternalSetDomain          (MonoAppDomain *ad);
 MonoAppDomain * 
 ves_icall_System_AppDomain_InternalSetDomainByID   (gint32 domainid);
 
+void
+ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomain *ad);
+
+void
+ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id);
+
+void
+ves_icall_System_AppDomain_InternalPopDomainRef (void);
+
 MonoAppContext * 
 ves_icall_System_AppDomain_InternalGetContext      (void);