2005-08-21 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mono / metadata / domain-internals.h
index 8ac24b6c4b43ba1366ebe78a2956dac97d4d6eb6..6d451abe8474fd8358cea022cb9e6d40c7a032a9 100644 (file)
@@ -35,6 +35,7 @@ typedef GArray MonoJitInfoTable;
 
 typedef struct {
        guint32  flags;
+       gint32   exvar_offset;
        gpointer try_start;
        gpointer try_end;
        gpointer handler_start;
@@ -47,10 +48,9 @@ typedef struct {
 struct _MonoJitInfo {
        MonoMethod *method;
        gpointer    code_start;
-       int         code_size;
        guint32     used_regs;
-       unsigned    num_clauses;
-       signed      exvar_offset;
+       int         code_size;
+       guint32     num_clauses:24;
        /* Whenever the code is domain neutral or 'shared' */
        gboolean    domain_neutral:1;
        gboolean    cas_inited:1;
@@ -60,7 +60,7 @@ struct _MonoJitInfo {
        gboolean    cas_method_assert:1;
        gboolean    cas_method_deny:1;
        gboolean    cas_method_permitonly:1;
-       MonoJitExceptionInfo *clauses;
+       MonoJitExceptionInfo clauses [MONO_ZERO_LEN_ARRAY];
 };
 
 typedef struct {
@@ -87,14 +87,14 @@ struct _MonoDomain {
        MonoMemPool        *mp;
        MonoCodeManager    *code_mp;
        MonoGHashTable     *env;
-       GHashTable         *assemblies_by_name;
-       GList              *assemblies;
+       GSList             *domain_assemblies;
        MonoAssembly       *entry_assembly;
        MonoAppDomainSetup *setup;
        char               *friendly_name;
        guint32            state;
        MonoGHashTable     *ldstr_table;
-       MonoGHashTable     *class_vtable_hash;
+       GHashTable         *class_vtable_hash;
+       /* maps MonoString -> MonoRemoteClass */
        MonoGHashTable     *proxy_vtable_hash;
        MonoGHashTable     *static_data_hash;
        GHashTable         *jit_code_hash;
@@ -120,17 +120,34 @@ struct _MonoDomain {
        /* Used to store offsets of thread and context static fields */
        GHashTable         *special_static_fields;
        GHashTable         *jump_target_hash;
-       MonoGHashTable     *class_init_trampoline_hash;
-       MonoGHashTable     *jump_trampoline_hash;
+       GHashTable         *class_init_trampoline_hash;
+       GHashTable         *jump_trampoline_hash;
+       GHashTable         *jit_trampoline_hash;
+       GHashTable         *delegate_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;
+       /* Used when accessing 'domain_assemblies' */
+       CRITICAL_SECTION    assemblies_lock;
 };
 
+typedef struct  {
+       guint16 major, minor, build, revision;
+} AssemblyVersionSet;
+
+/* MonoRuntimeInfo: Contains information about versions supported by this runtime */
+typedef struct  {
+       const char runtime_version [12];
+       const char framework_version [4];
+       const AssemblyVersionSet version_sets [2];
+} MonoRuntimeInfo;
+
 #define mono_domain_lock(domain)   EnterCriticalSection(&(domain)->lock)
 #define mono_domain_unlock(domain) LeaveCriticalSection(&(domain)->lock)
+#define mono_domain_assemblies_lock(domain)   EnterCriticalSection(&(domain)->assemblies_lock)
+#define mono_domain_assemblies_unlock(domain) LeaveCriticalSection(&(domain)->assemblies_lock)
 
 void
 mono_jit_info_table_add    (MonoDomain *domain, MonoJitInfo *ji);
@@ -138,11 +155,21 @@ mono_jit_info_table_add    (MonoDomain *domain, MonoJitInfo *ji);
 void
 mono_jit_info_table_remove (MonoDomain *domain, MonoJitInfo *ji);
 
+void
+mono_jit_info_add_aot_module (MonoImage *image, gpointer start, gpointer end);
+
+/* 
+ * Installs a new function which is used to return a MonoJitInfo for a method inside
+ * an AOT module.
+ */
+typedef MonoJitInfo *(*MonoJitInfoFindInAot)         (MonoDomain *domain, MonoImage *image, gpointer addr);
+void          mono_install_jit_info_find_in_aot (MonoJitInfoFindInAot func);
+
 MonoAppDomain *
 ves_icall_System_AppDomain_getCurDomain            (void);
 
 MonoAppDomain *
-ves_icall_System_AppDomain_getDomainByID           (gint32 domain_id);
+ves_icall_System_AppDomain_getRootDomain           (void);
 
 MonoAppDomain *
 ves_icall_System_AppDomain_createDomain            (MonoString         *friendly_name,
@@ -156,7 +183,8 @@ MonoReflectionAssembly *
 ves_icall_System_AppDomain_LoadAssemblyRaw         (MonoAppDomain *ad,
                                                    MonoArray *raw_assembly, 
                                                    MonoArray *raw_symbol_store,
-                                                   MonoObject *evidence);
+                                                   MonoObject *evidence,
+                                                   MonoBoolean refonly);
 
 void
 ves_icall_System_AppDomain_SetData                 (MonoAppDomain *ad, 
@@ -170,15 +198,18 @@ MonoString *
 ves_icall_System_AppDomain_getFriendlyName         (MonoAppDomain *ad);
 
 MonoArray *
-ves_icall_System_AppDomain_GetAssemblies           (MonoAppDomain *ad);
+ves_icall_System_AppDomain_GetAssemblies           (MonoAppDomain *ad,
+                                                   MonoBoolean refonly);
 
 MonoReflectionAssembly *
-ves_icall_System_Reflection_Assembly_LoadFrom      (MonoString *fname);
+ves_icall_System_Reflection_Assembly_LoadFrom      (MonoString *fname,
+                                                   MonoBoolean refonly);
 
 MonoReflectionAssembly *
 ves_icall_System_AppDomain_LoadAssembly            (MonoAppDomain *ad, 
                                                    MonoString *assRef,
-                                                   MonoObject    *evidence);
+                                                   MonoObject    *evidence,
+                                                   MonoBoolean refonly);
 
 gboolean
 ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id);
@@ -222,11 +253,16 @@ ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad);
 MonoString *
 ves_icall_System_AppDomain_InternalGetProcessGuid (MonoString* newguid);
 
-const char*
-mono_get_framework_version (void);
+MonoAssembly *
+mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus *status);
 
-const char*
-mono_get_runtime_version (void);
+const MonoRuntimeInfo*
+mono_get_runtime_info (void);
 
+gboolean
+mono_assembly_name_parse (const char *name, MonoAssemblyName *aname);
+
+void
+mono_assembly_name_free (MonoAssemblyName *aname);
 
 #endif /* __MONO_METADATA_DOMAIN_INTERNALS_H__ */