2007-09-11 Mark Probst <mark.probst@gmail.com>
[mono.git] / mono / metadata / domain-internals.h
index 37402a55abe059731209345efb67bc12d2e19503..bdbb7517c63f35ff30346b7b5b5f4b79cd23decb 100644 (file)
@@ -8,6 +8,7 @@
 #include <mono/utils/mono-codeman.h>
 #include <mono/utils/mono-hash.h>
 #include <mono/utils/mono-compiler.h>
+#include <mono/utils/mono-internal-hash.h>
 #include <mono/io-layer/io-layer.h>
 
 extern CRITICAL_SECTION mono_delegate_section;
@@ -30,9 +31,34 @@ typedef struct {
        int loader_optimization;
        MonoBoolean disallow_binding_redirects;
        MonoBoolean disallow_code_downloads;
+       MonoObject *activation_arguments; /* it is System.Object in 1.x, ActivationArguments in 2.0 */
+       MonoObject *domain_initializer;
+       MonoArray *domain_initializer_args;
+       MonoObject *application_trust; /* it is System.Object in 1.x, ApplicationTrust in 2.0 */
+       MonoBoolean disallow_appbase_probe;
+       MonoArray *configuration_bytes;
 } MonoAppDomainSetup;
 
-typedef GArray MonoJitInfoTable;
+typedef struct _MonoJitInfoTable MonoJitInfoTable;
+typedef struct _MonoJitInfoTableChunk MonoJitInfoTableChunk;
+
+#define MONO_JIT_INFO_TABLE_CHUNK_SIZE         64
+
+struct _MonoJitInfoTableChunk
+{
+       int                    refcount;
+       volatile int           num_elements;
+       volatile gint8        *last_code_end;
+       MonoJitInfo * volatile data [MONO_JIT_INFO_TABLE_CHUNK_SIZE];
+};
+
+struct _MonoJitInfoTable
+{
+       int                     num_chunks;
+       MonoJitInfoTableChunk  *chunks [MONO_ZERO_LEN_ARRAY];
+};
+
+typedef GArray MonoAotModuleInfoTable;
 
 typedef struct {
        guint32  flags;
@@ -47,7 +73,12 @@ typedef struct {
 } MonoJitExceptionInfo;
 
 struct _MonoJitInfo {
+       /* NOTE: These first two elements (method and
+          next_jit_code_hash) must be in the same order and at the
+          same offset as in RuntimeMethod, because of the jit_code_hash
+          internal hash table in MonoDomain. */
        MonoMethod *method;
+       struct _MonoJitInfo *next_jit_code_hash;
        gpointer    code_start;
        guint32     used_regs;
        int         code_size;
@@ -82,6 +113,8 @@ typedef enum {
        MONO_APPDOMAIN_UNLOADED
 } MonoAppDomainState;
 
+typedef struct _MonoJitCodeHash MonoJitCodeHash;
+
 struct _MonoDomain {
        CRITICAL_SECTION    lock;
        MonoMemPool        *mp;
@@ -113,18 +146,22 @@ struct _MonoDomain {
        guint32            state;
        /* Needed by Thread:GetDomainID() */
        gint32             domain_id;
+       gint32             shadow_serial;
        GSList             *domain_assemblies;
        MonoAssembly       *entry_assembly;
        char               *friendly_name;
        GHashTable         *class_vtable_hash;
        /* maps remote class key -> MonoRemoteClass */
        GHashTable         *proxy_vtable_hash;
-       GHashTable         *jit_code_hash;
+       MonoInternalHashTable jit_code_hash;
        /* maps MonoMethod -> MonoJitDynamicMethodInfo */
        GHashTable         *dynamic_code_hash;
-       MonoJitInfoTable   *jit_info_table;
+       MonoJitInfoTable * 
+         volatile          jit_info_table;
        /* Used when loading assemblies */
        gchar **search_path;
+       gchar *private_bin_path;
+       
        /* Used by remoting proxies */
        MonoMethod         *create_proxy_for_type_method;
        MonoMethod         *private_invoke_method;
@@ -135,6 +172,8 @@ struct _MonoDomain {
        GHashTable         *jump_trampoline_hash;
        GHashTable         *jit_trampoline_hash;
        GHashTable         *delegate_trampoline_hash;
+       GHashTable         *delegate_invoke_impl_with_target_hash;
+       GHashTable         *delegate_invoke_impl_no_target_hash;
        /* 
         * This must be a GHashTable, since these objects can't be finalized
         * if the hashtable contains a GC visible reference to them.
@@ -160,6 +199,9 @@ typedef struct  {
 #define mono_domain_assemblies_lock(domain)   EnterCriticalSection(&(domain)->assemblies_lock)
 #define mono_domain_assemblies_unlock(domain) LeaveCriticalSection(&(domain)->assemblies_lock)
 
+void 
+mono_init_com_types (void) MONO_INTERNAL;
+
 void 
 mono_cleanup (void) MONO_INTERNAL;
 
@@ -179,6 +221,9 @@ mono_jit_info_add_aot_module (MonoImage *image, gpointer start, gpointer end) MO
 typedef MonoJitInfo *(*MonoJitInfoFindInAot)         (MonoDomain *domain, MonoImage *image, gpointer addr);
 void          mono_install_jit_info_find_in_aot (MonoJitInfoFindInAot func) MONO_INTERNAL;
 
+void
+mono_jit_code_hash_init (MonoInternalHashTable *jit_code_hash) MONO_INTERNAL;
+
 MonoAppDomain *
 ves_icall_System_AppDomain_getCurDomain            (void) MONO_INTERNAL;
 
@@ -279,6 +324,10 @@ mono_assembly_name_parse (const char *name, MonoAssemblyName *aname) MONO_INTERN
 void
 mono_assembly_name_free (MonoAssemblyName *aname) MONO_INTERNAL;
 
+MonoImage *mono_assembly_open_from_bundle (const char *filename,
+                                          MonoImageOpenStatus *status,
+                                          gboolean refonly) MONO_INTERNAL;
+
 void
 mono_domain_add_class_static_data (MonoDomain *domain, MonoClass *klass, gpointer data, guint32 *bitmap);