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/utils/mono-compiler.h>
11 #include <mono/io-layer/io-layer.h>
13 extern CRITICAL_SECTION mono_delegate_section;
15 /* This is a copy of System.AppDomainSetup */
18 MonoString *application_base;
19 MonoString *application_name;
20 MonoString *cache_path;
21 MonoString *configuration_file;
22 MonoString *dynamic_base;
23 MonoString *license_file;
24 MonoString *private_bin_path;
25 MonoString *private_bin_path_probe;
26 MonoString *shadow_copy_directories;
27 MonoString *shadow_copy_files;
28 MonoBoolean publisher_policy;
29 MonoBoolean path_changed;
30 int loader_optimization;
31 MonoBoolean disallow_binding_redirects;
32 MonoBoolean disallow_code_downloads;
35 typedef GArray MonoJitInfoTable;
42 gpointer handler_start;
44 MonoClass *catch_class;
47 } MonoJitExceptionInfo;
54 guint32 num_clauses:24;
55 /* Whenever the code is domain neutral or 'shared' */
56 gboolean domain_neutral:1;
57 gboolean cas_inited:1;
58 gboolean cas_class_assert:1;
59 gboolean cas_class_deny:1;
60 gboolean cas_class_permitonly:1;
61 gboolean cas_method_assert:1;
62 gboolean cas_method_deny:1;
63 gboolean cas_method_permitonly:1;
64 MonoJitExceptionInfo clauses [MONO_ZERO_LEN_ARRAY];
69 MonoCodeManager *code_mp;
70 } MonoJitDynamicMethodInfo;
72 struct _MonoAppContext {
76 gpointer *static_data;
80 MONO_APPDOMAIN_CREATED,
81 MONO_APPDOMAIN_UNLOADING,
82 MONO_APPDOMAIN_UNLOADED
86 MonoAppDomain *domain;
87 CRITICAL_SECTION lock;
89 MonoCodeManager *code_mp;
91 GSList *domain_assemblies;
92 MonoAssembly *entry_assembly;
93 MonoAppDomainSetup *setup;
96 MonoGHashTable *ldstr_table;
97 GHashTable *class_vtable_hash;
98 /* maps remote class key -> MonoRemoteClass */
99 GHashTable *proxy_vtable_hash;
100 MonoGHashTable *static_data_hash;
101 GHashTable *jit_code_hash;
102 /* maps MonoMethod -> MonoJitDynamicMethodInfo */
103 GHashTable *dynamic_code_hash;
104 /* maps delegate trampoline addr -> delegate object */
105 MonoGHashTable *delegate_hash_table;
106 MonoJitInfoTable *jit_info_table;
107 /* hashtables for Reflection handles */
108 MonoGHashTable *type_hash;
109 MonoGHashTable *refobject_hash;
110 /* Needed by Thread:GetDomainID() */
112 /* Used when loading assemblies */
114 /* Used by remoting proxies */
115 MonoMethod *create_proxy_for_type_method;
116 MonoMethod *private_invoke_method;
117 MonoAppContext *default_context;
118 MonoException *out_of_memory_ex;
119 MonoException *null_reference_ex;
120 MonoException *stack_overflow_ex;
121 /* Used to store offsets of thread and context static fields */
122 GHashTable *special_static_fields;
123 GHashTable *jump_target_hash;
124 GHashTable *class_init_trampoline_hash;
125 GHashTable *jump_trampoline_hash;
126 GHashTable *jit_trampoline_hash;
127 GHashTable *delegate_trampoline_hash;
129 * This must be a GHashTable, since these objects can't be finalized
130 * if the hashtable contains a GC visible reference to them.
132 GHashTable *finalizable_objects_hash;
133 /* Used when accessing 'domain_assemblies' */
134 CRITICAL_SECTION assemblies_lock;
138 guint16 major, minor, build, revision;
139 } AssemblyVersionSet;
141 /* MonoRuntimeInfo: Contains information about versions supported by this runtime */
143 const char runtime_version [12];
144 const char framework_version [4];
145 const AssemblyVersionSet version_sets [2];
148 #define mono_domain_lock(domain) EnterCriticalSection(&(domain)->lock)
149 #define mono_domain_unlock(domain) LeaveCriticalSection(&(domain)->lock)
150 #define mono_domain_assemblies_lock(domain) EnterCriticalSection(&(domain)->assemblies_lock)
151 #define mono_domain_assemblies_unlock(domain) LeaveCriticalSection(&(domain)->assemblies_lock)
154 mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji) MONO_INTERNAL;
157 mono_jit_info_table_remove (MonoDomain *domain, MonoJitInfo *ji) MONO_INTERNAL;
160 mono_jit_info_add_aot_module (MonoImage *image, gpointer start, gpointer end) MONO_INTERNAL;
163 * Installs a new function which is used to return a MonoJitInfo for a method inside
166 typedef MonoJitInfo *(*MonoJitInfoFindInAot) (MonoDomain *domain, MonoImage *image, gpointer addr);
167 void mono_install_jit_info_find_in_aot (MonoJitInfoFindInAot func) MONO_INTERNAL;
170 ves_icall_System_AppDomain_getCurDomain (void) MONO_INTERNAL;
173 ves_icall_System_AppDomain_getRootDomain (void) MONO_INTERNAL;
176 ves_icall_System_AppDomain_createDomain (MonoString *friendly_name,
177 MonoAppDomainSetup *setup) MONO_INTERNAL;
180 ves_icall_System_AppDomain_GetData (MonoAppDomain *ad,
181 MonoString *name) MONO_INTERNAL;
183 MonoReflectionAssembly *
184 ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad,
185 MonoArray *raw_assembly,
186 MonoArray *raw_symbol_store,
187 MonoObject *evidence,
188 MonoBoolean refonly) MONO_INTERNAL;
191 ves_icall_System_AppDomain_SetData (MonoAppDomain *ad,
193 MonoObject *data) MONO_INTERNAL;
196 ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad) MONO_INTERNAL;
199 ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad) MONO_INTERNAL;
202 ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad,
203 MonoBoolean refonly) MONO_INTERNAL;
205 MonoReflectionAssembly *
206 ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname,
207 MonoBoolean refonly) MONO_INTERNAL;
209 MonoReflectionAssembly *
210 ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,
212 MonoObject *evidence,
213 MonoBoolean refonly) MONO_INTERNAL;
216 ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id) MONO_INTERNAL;
219 ves_icall_System_AppDomain_InternalUnload (gint32 domain_id) MONO_INTERNAL;
222 ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad,
224 MonoObject *evidence,
225 MonoArray *args) MONO_INTERNAL;
228 ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomain *ad) MONO_INTERNAL;
231 ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid) MONO_INTERNAL;
234 ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomain *ad) MONO_INTERNAL;
237 ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id) MONO_INTERNAL;
240 ves_icall_System_AppDomain_InternalPopDomainRef (void) MONO_INTERNAL;
243 ves_icall_System_AppDomain_InternalGetContext (void) MONO_INTERNAL;
246 ves_icall_System_AppDomain_InternalGetDefaultContext (void) MONO_INTERNAL;
249 ves_icall_System_AppDomain_InternalSetContext (MonoAppContext *mc) MONO_INTERNAL;
252 ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad) MONO_INTERNAL;
255 ves_icall_System_AppDomain_InternalGetProcessGuid (MonoString* newguid) MONO_INTERNAL;
258 mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus *status) MONO_INTERNAL;
260 const MonoRuntimeInfo*
261 mono_get_runtime_info (void) MONO_INTERNAL;
264 mono_assembly_name_parse (const char *name, MonoAssemblyName *aname) MONO_INTERNAL;
267 mono_assembly_name_free (MonoAssemblyName *aname) MONO_INTERNAL;
269 #endif /* __MONO_METADATA_DOMAIN_INTERNALS_H__ */