2 * Appdomain-related internal data structures and functions.
4 #ifndef __MONO_METADATA_DOMAIN_INTERNALS_H__
5 #define __MONO_METADATA_DOMAIN_INTERNALS_H__
7 #include <mono/metadata/appdomain.h>
8 #include <mono/utils/mono-codeman.h>
9 #include <mono/utils/mono-hash.h>
10 #include <mono/io-layer/io-layer.h>
12 extern CRITICAL_SECTION mono_delegate_section;
14 /* This is a copy of System.AppDomainSetup */
17 MonoString *application_base;
18 MonoString *application_name;
19 MonoString *cache_path;
20 MonoString *configuration_file;
21 MonoString *dynamic_base;
22 MonoString *license_file;
23 MonoString *private_bin_path;
24 MonoString *private_bin_path_probe;
25 MonoString *shadow_copy_directories;
26 MonoString *shadow_copy_files;
27 MonoBoolean publisher_policy;
28 MonoBoolean path_changed;
29 int loader_optimization;
30 MonoBoolean disallow_binding_redirects;
31 MonoBoolean disallow_code_downloads;
34 typedef GArray MonoJitInfoTable;
40 gpointer handler_start;
42 MonoClass *catch_class;
45 } MonoJitExceptionInfo;
54 /* Whenever the code is domain neutral or 'shared' */
55 gboolean domain_neutral:1;
56 MonoJitExceptionInfo *clauses;
61 MonoCodeManager *code_mp;
62 } MonoJitDynamicMethodInfo;
64 struct _MonoAppContext {
68 gpointer *static_data;
72 MONO_APPDOMAIN_CREATED,
73 MONO_APPDOMAIN_UNLOADING,
74 MONO_APPDOMAIN_UNLOADED
78 MonoAppDomain *domain;
79 CRITICAL_SECTION lock;
81 MonoCodeManager *code_mp;
83 GHashTable *assemblies_by_name;
85 MonoAssembly *entry_assembly;
86 MonoAppDomainSetup *setup;
89 MonoGHashTable *ldstr_table;
90 MonoGHashTable *class_vtable_hash;
91 MonoGHashTable *proxy_vtable_hash;
92 MonoGHashTable *static_data_hash;
93 GHashTable *jit_code_hash;
94 /* maps MonoMethod -> MonoJitDynamicMethodInfo */
95 GHashTable *dynamic_code_hash;
96 /* maps delegate trampoline addr -> delegate object */
97 MonoGHashTable *delegate_hash_table;
98 MonoJitInfoTable *jit_info_table;
99 /* hashtables for Reflection handles */
100 MonoGHashTable *type_hash;
101 MonoGHashTable *refobject_hash;
102 /* Needed by Thread:GetDomainID() */
104 /* Used when loading assemblies */
106 /* Used by remoting proxies */
107 MonoMethod *create_proxy_for_type_method;
108 MonoMethod *private_invoke_method;
109 MonoAppContext *default_context;
110 MonoException *out_of_memory_ex;
111 MonoException *null_reference_ex;
112 MonoException *stack_overflow_ex;
113 /* Used to store offsets of thread and context static fields */
114 GHashTable *special_static_fields;
115 GHashTable *jump_target_hash;
116 MonoGHashTable *class_init_trampoline_hash;
117 MonoGHashTable *jump_trampoline_hash;
119 * This must be a GHashTable, since these objects can't be finalized
120 * if the hashtable contains a GC visible reference to them.
122 GHashTable *finalizable_objects_hash;
125 #define mono_domain_lock(domain) EnterCriticalSection(&(domain)->lock)
126 #define mono_domain_unlock(domain) LeaveCriticalSection(&(domain)->lock)
129 mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji);
132 mono_jit_info_table_remove (MonoDomain *domain, MonoJitInfo *ji);
135 ves_icall_System_AppDomain_getCurDomain (void);
138 ves_icall_System_AppDomain_getDomainByID (gint32 domain_id);
141 ves_icall_System_AppDomain_createDomain (MonoString *friendly_name,
142 MonoAppDomainSetup *setup);
145 ves_icall_System_AppDomain_GetData (MonoAppDomain *ad,
148 MonoReflectionAssembly *
149 ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad,
150 MonoArray *raw_assembly,
151 MonoArray *raw_symbol_store,
152 MonoObject *evidence);
155 ves_icall_System_AppDomain_SetData (MonoAppDomain *ad,
160 ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad);
163 ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad);
166 ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad);
168 MonoReflectionAssembly *
169 ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname);
171 MonoReflectionAssembly *
172 ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,
174 MonoObject *evidence);
177 ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id);
180 ves_icall_System_AppDomain_InternalUnload (gint32 domain_id);
183 ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad,
185 MonoObject *evidence,
189 ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomain *ad);
192 ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid);
195 ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomain *ad);
198 ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id);
201 ves_icall_System_AppDomain_InternalPopDomainRef (void);
204 ves_icall_System_AppDomain_InternalGetContext (void);
207 ves_icall_System_AppDomain_InternalGetDefaultContext (void);
210 ves_icall_System_AppDomain_InternalSetContext (MonoAppContext *mc);
213 ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad);
216 ves_icall_System_AppDomain_InternalGetProcessGuid (MonoString* newguid);
219 mono_get_framework_version (void);
222 mono_get_runtime_version (void);
225 #endif /* __MONO_METADATA_DOMAIN_INTERNALS_H__ */