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;
41 gpointer handler_start;
43 MonoClass *catch_class;
46 } MonoJitExceptionInfo;
53 guint32 num_clauses:24;
54 /* Whenever the code is domain neutral or 'shared' */
55 gboolean domain_neutral:1;
56 gboolean cas_inited:1;
57 gboolean cas_class_assert:1;
58 gboolean cas_class_deny:1;
59 gboolean cas_class_permitonly:1;
60 gboolean cas_method_assert:1;
61 gboolean cas_method_deny:1;
62 gboolean cas_method_permitonly:1;
63 MonoJitExceptionInfo clauses [MONO_ZERO_LEN_ARRAY];
68 MonoCodeManager *code_mp;
69 } MonoJitDynamicMethodInfo;
71 struct _MonoAppContext {
75 gpointer *static_data;
79 MONO_APPDOMAIN_CREATED,
80 MONO_APPDOMAIN_UNLOADING,
81 MONO_APPDOMAIN_UNLOADED
85 MonoAppDomain *domain;
86 CRITICAL_SECTION lock;
88 MonoCodeManager *code_mp;
90 GSList *domain_assemblies;
91 MonoAssembly *entry_assembly;
92 MonoAppDomainSetup *setup;
95 MonoGHashTable *ldstr_table;
96 GHashTable *class_vtable_hash;
97 /* maps MonoString -> MonoRemoteClass */
98 MonoGHashTable *proxy_vtable_hash;
99 MonoGHashTable *static_data_hash;
100 GHashTable *jit_code_hash;
101 /* maps MonoMethod -> MonoJitDynamicMethodInfo */
102 GHashTable *dynamic_code_hash;
103 /* maps delegate trampoline addr -> delegate object */
104 MonoGHashTable *delegate_hash_table;
105 MonoJitInfoTable *jit_info_table;
106 /* hashtables for Reflection handles */
107 MonoGHashTable *type_hash;
108 MonoGHashTable *refobject_hash;
109 /* Needed by Thread:GetDomainID() */
111 /* Used when loading assemblies */
113 /* Used by remoting proxies */
114 MonoMethod *create_proxy_for_type_method;
115 MonoMethod *private_invoke_method;
116 MonoAppContext *default_context;
117 MonoException *out_of_memory_ex;
118 MonoException *null_reference_ex;
119 MonoException *stack_overflow_ex;
120 /* Used to store offsets of thread and context static fields */
121 GHashTable *special_static_fields;
122 GHashTable *jump_target_hash;
123 GHashTable *class_init_trampoline_hash;
124 GHashTable *jump_trampoline_hash;
125 GHashTable *jit_trampoline_hash;
126 GHashTable *delegate_trampoline_hash;
128 * This must be a GHashTable, since these objects can't be finalized
129 * if the hashtable contains a GC visible reference to them.
131 GHashTable *finalizable_objects_hash;
132 /* Used when accessing 'domain_assemblies' */
133 CRITICAL_SECTION assemblies_lock;
137 guint16 major, minor, build, revision;
138 } AssemblyVersionSet;
140 /* MonoRuntimeInfo: Contains information about versions supported by this runtime */
142 const char runtime_version [12];
143 const char framework_version [4];
144 const AssemblyVersionSet version_sets [2];
147 #define mono_domain_lock(domain) EnterCriticalSection(&(domain)->lock)
148 #define mono_domain_unlock(domain) LeaveCriticalSection(&(domain)->lock)
149 #define mono_domain_assemblies_lock(domain) EnterCriticalSection(&(domain)->assemblies_lock)
150 #define mono_domain_assemblies_unlock(domain) LeaveCriticalSection(&(domain)->assemblies_lock)
153 mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji);
156 mono_jit_info_table_remove (MonoDomain *domain, MonoJitInfo *ji);
159 mono_jit_info_add_aot_module (MonoImage *image, gpointer start, gpointer end);
162 * Installs a new function which is used to return a MonoJitInfo for a method inside
165 typedef MonoJitInfo *(*MonoJitInfoFindInAot) (MonoDomain *domain, MonoImage *image, gpointer addr);
166 void mono_install_jit_info_find_in_aot (MonoJitInfoFindInAot func);
169 ves_icall_System_AppDomain_getCurDomain (void);
172 ves_icall_System_AppDomain_getRootDomain (void);
175 ves_icall_System_AppDomain_createDomain (MonoString *friendly_name,
176 MonoAppDomainSetup *setup);
179 ves_icall_System_AppDomain_GetData (MonoAppDomain *ad,
182 MonoReflectionAssembly *
183 ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad,
184 MonoArray *raw_assembly,
185 MonoArray *raw_symbol_store,
186 MonoObject *evidence,
187 MonoBoolean refonly);
190 ves_icall_System_AppDomain_SetData (MonoAppDomain *ad,
195 ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad);
198 ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad);
201 ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad,
202 MonoBoolean refonly);
204 MonoReflectionAssembly *
205 ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname,
206 MonoBoolean refonly);
208 MonoReflectionAssembly *
209 ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,
211 MonoObject *evidence,
212 MonoBoolean refonly);
215 ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id);
218 ves_icall_System_AppDomain_InternalUnload (gint32 domain_id);
221 ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad,
223 MonoObject *evidence,
227 ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomain *ad);
230 ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid);
233 ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomain *ad);
236 ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id);
239 ves_icall_System_AppDomain_InternalPopDomainRef (void);
242 ves_icall_System_AppDomain_InternalGetContext (void);
245 ves_icall_System_AppDomain_InternalGetDefaultContext (void);
248 ves_icall_System_AppDomain_InternalSetContext (MonoAppContext *mc);
251 ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad);
254 ves_icall_System_AppDomain_InternalGetProcessGuid (MonoString* newguid);
257 mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus *status);
259 const MonoRuntimeInfo*
260 mono_get_runtime_info (void);
263 mono_assembly_name_parse (const char *name, MonoAssemblyName *aname);
266 mono_assembly_name_free (MonoAssemblyName *aname);
268 #endif /* __MONO_METADATA_DOMAIN_INTERNALS_H__ */