#include <glib.h>
#include <mono/metadata/loader.h>
#include <mono/metadata/object.h>
+#include <mono/metadata/domain-internals.h>
#include "config.h"
enum {
+Tue Jun 15 16:40:19 CEST 2004 Paolo Molaro <lupus@ximian.com>
+
+ * domain-internals.h, Makefile.am, appdomain.c, appdomain.h,
+ domain.c, gc.c, icall.c, mono-debug.c, object.c, reflection.c,
+ threadpool.c, threads.c: first pass at the exported API cleanup.
+
Tue Jun 15 15:29:47 CEST 2004 Paolo Molaro <lupus@ximian.com>
* icall.c: fix signatures of some VolatileRead and VolatileWrite icalls.
libmetadata_la_SOURCES = \
assembly.c \
domain.c \
+ domain-internals.h \
opcodes.c \
image.c \
metadata.c \
#include <mono/os/gc_wrapper.h>
#include <mono/metadata/object.h>
-#include <mono/metadata/appdomain.h>
+#include <mono/metadata/domain-internals.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/threads.h>
gpointer func);
typedef void (*MonoThreadAttachCB) (guint32 tid, gpointer stack_start);
-/* This is a copy of System.AppDomainSetup */
-typedef struct {
- MonoObject object;
- MonoString *application_base;
- MonoString *application_name;
- MonoString *cache_path;
- MonoString *configuration_file;
- MonoString *dynamic_base;
- MonoString *license_file;
- MonoString *private_bin_path;
- MonoString *private_bin_path_probe;
- MonoString *shadow_copy_directories;
- MonoString *shadow_copy_files;
- MonoBoolean publisher_policy;
- MonoBoolean path_changed;
- int loader_optimization;
- MonoBoolean disallow_binding_redirects;
- MonoBoolean disallow_code_downloads;
-} MonoAppDomainSetup;
-
-typedef GArray MonoJitInfoTable;
-
-typedef struct {
- guint32 flags;
- gpointer try_start;
- gpointer try_end;
- gpointer handler_start;
- union {
- guint32 token;
- gpointer filter;
- } data;
-} MonoJitExceptionInfo;
-
-typedef struct {
- MonoMethod *method;
- gpointer code_start;
- int code_size;
- guint32 used_regs;
- unsigned num_clauses;
- signed exvar_offset;
- /* Whenever the code is domain neutral or 'shared' */
- gboolean domain_neutral:1;
- MonoJitExceptionInfo *clauses;
-} MonoJitInfo;
-
-typedef struct {
- MonoObject obj;
- gint32 domain_id;
- gint32 context_id;
- gpointer *static_data;
-} MonoAppContext;
-
-typedef enum {
- MONO_APPDOMAIN_CREATED,
- MONO_APPDOMAIN_UNLOADING,
- MONO_APPDOMAIN_UNLOADED
-} MonoAppDomainState;
-
typedef struct _MonoAppDomain MonoAppDomain;
-
-struct _MonoDomain {
- MonoAppDomain *domain;
- CRITICAL_SECTION lock;
- MonoMemPool *mp;
- MonoCodeManager *code_mp;
- MonoGHashTable *env;
- GHashTable *assemblies;
- MonoAssembly *entry_assembly;
- MonoAppDomainSetup *setup;
- char *friendly_name;
- guint32 state;
- MonoGHashTable *ldstr_table;
- MonoGHashTable *class_vtable_hash;
- MonoGHashTable *proxy_vtable_hash;
- MonoGHashTable *static_data_hash;
- GHashTable *jit_code_hash;
- MonoJitInfoTable *jit_info_table;
- /* hashtables for Reflection handles */
- MonoGHashTable *type_hash;
- MonoGHashTable *refobject_hash;
- /* Needed by Thread:GetDomainID() */
- gint32 domain_id;
- /* Used when loading assemblies */
- gchar **search_path;
- /* Used by remoting proxies */
- MonoMethod *create_proxy_for_type_method;
- MonoMethod *private_invoke_method;
- MonoAppContext *default_context;
- MonoException *out_of_memory_ex;
- MonoException *null_reference_ex;
- MonoException *stack_overflow_ex;
- /* Used to store offsets of thread and context static fields */
- GHashTable *special_static_fields;
- GHashTable *jump_target_hash;
- MonoGHashTable *class_init_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;
-};
-
-/* This is a copy of System.AppDomain */
-struct _MonoAppDomain {
- MonoMarshalByRefObject mbr;
- MonoDomain *data;
-};
+typedef struct _MonoAppContext MonoAppContext;
+typedef struct _MonoJitInfo MonoJitInfo;
extern MonoDomain *mono_root_domain;
-extern HANDLE mono_delegate_semaphore;
-extern CRITICAL_SECTION mono_delegate_section;
-
-#define mono_domain_lock(domain) EnterCriticalSection(&(domain)->lock)
-#define mono_domain_unlock(domain) LeaveCriticalSection(&(domain)->lock)
-
typedef void (*MonoDomainFunc) (MonoDomain *domain, gpointer user_data);
MonoDomain*
inline MonoDomain *
mono_domain_get_by_id (gint32 domainid);
+gint32
+mono_domain_get_id (MonoDomain *domain);
+
inline gboolean
mono_domain_set (MonoDomain *domain, gboolean force);
MonoReflectionAssembly *
mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb);
-void
-mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji);
-
-MonoJitInfo *
-mono_jit_info_table_find (MonoDomain *domain, char *addr);
-
-MonoAppDomain *
-ves_icall_System_AppDomain_getCurDomain (void);
-
-MonoAppDomain *
-ves_icall_System_AppDomain_createDomain (MonoString *friendly_name,
- MonoAppDomainSetup *setup);
-
-MonoObject *
-ves_icall_System_AppDomain_GetData (MonoAppDomain *ad,
- MonoString *name);
-
-MonoReflectionAssembly *
-ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad,
- MonoArray *raw_assembly,
- MonoArray *raw_symbol_store,
- MonoObject *evidence);
-
-void
-ves_icall_System_AppDomain_SetData (MonoAppDomain *ad,
- MonoString *name,
- MonoObject *data);
-
-MonoAppDomainSetup *
-ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad);
-
-MonoString *
-ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad);
-
-MonoArray *
-ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad);
-
-MonoReflectionAssembly *
-ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname);
-
-MonoReflectionAssembly *
-ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,
- MonoString *assRef,
- MonoObject *evidence);
-
-gboolean
-ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id);
-
-void
-ves_icall_System_AppDomain_InternalUnload (gint32 domain_id);
-
-gint32
-ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad,
- MonoString *file,
- MonoObject *evidence,
- MonoArray *args);
-
void
mono_context_init (MonoDomain *domain);
inline MonoAppContext *
mono_context_get (void);
-MonoAppDomain *
-ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomain *ad);
-
-MonoAppDomain *
-ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid);
-
-void
-ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomain *ad);
-
-void
-ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id);
-
-void
-ves_icall_System_AppDomain_InternalPopDomainRef (void);
-
-MonoAppContext *
-ves_icall_System_AppDomain_InternalGetContext (void);
-
-MonoAppContext *
-ves_icall_System_AppDomain_InternalGetDefaultContext (void);
-
-MonoAppContext *
-ves_icall_System_AppDomain_InternalSetContext (MonoAppContext *mc);
-
-gint32
-ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad);
-
-MonoString *
-ves_icall_System_AppDomain_InternalGetProcessGuid (MonoString* newguid);
-
+MonoJitInfo *
+mono_jit_info_table_find (MonoDomain *domain, char *addr);
#endif /* _MONO_METADATA_APPDOMAIN_H_ */
--- /dev/null
+/*
+ * Appdomain-related internal data structures and functions.
+ */
+#ifndef __MONO_METADATA_DOMAIN_INTERNALS_H__
+#define __MONO_METADATA_DOMAIN_INTERNALS_H__
+
+#include <mono/metadata/appdomain.h>
+
+extern CRITICAL_SECTION mono_delegate_section;
+
+/* This is a copy of System.AppDomainSetup */
+typedef struct {
+ MonoObject object;
+ MonoString *application_base;
+ MonoString *application_name;
+ MonoString *cache_path;
+ MonoString *configuration_file;
+ MonoString *dynamic_base;
+ MonoString *license_file;
+ MonoString *private_bin_path;
+ MonoString *private_bin_path_probe;
+ MonoString *shadow_copy_directories;
+ MonoString *shadow_copy_files;
+ MonoBoolean publisher_policy;
+ MonoBoolean path_changed;
+ int loader_optimization;
+ MonoBoolean disallow_binding_redirects;
+ MonoBoolean disallow_code_downloads;
+} MonoAppDomainSetup;
+
+typedef GArray MonoJitInfoTable;
+
+typedef struct {
+ guint32 flags;
+ gpointer try_start;
+ gpointer try_end;
+ gpointer handler_start;
+ union {
+ guint32 token;
+ gpointer filter;
+ } data;
+} MonoJitExceptionInfo;
+
+struct _MonoJitInfo {
+ MonoMethod *method;
+ gpointer code_start;
+ int code_size;
+ guint32 used_regs;
+ unsigned num_clauses;
+ signed exvar_offset;
+ /* Whenever the code is domain neutral or 'shared' */
+ gboolean domain_neutral:1;
+ MonoJitExceptionInfo *clauses;
+};
+
+struct _MonoAppContext {
+ MonoObject obj;
+ gint32 domain_id;
+ gint32 context_id;
+ gpointer *static_data;
+};
+
+typedef enum {
+ MONO_APPDOMAIN_CREATED,
+ MONO_APPDOMAIN_UNLOADING,
+ MONO_APPDOMAIN_UNLOADED
+} MonoAppDomainState;
+
+struct _MonoDomain {
+ MonoAppDomain *domain;
+ CRITICAL_SECTION lock;
+ MonoMemPool *mp;
+ MonoCodeManager *code_mp;
+ MonoGHashTable *env;
+ GHashTable *assemblies;
+ MonoAssembly *entry_assembly;
+ MonoAppDomainSetup *setup;
+ char *friendly_name;
+ guint32 state;
+ MonoGHashTable *ldstr_table;
+ MonoGHashTable *class_vtable_hash;
+ MonoGHashTable *proxy_vtable_hash;
+ MonoGHashTable *static_data_hash;
+ GHashTable *jit_code_hash;
+ MonoJitInfoTable *jit_info_table;
+ /* hashtables for Reflection handles */
+ MonoGHashTable *type_hash;
+ MonoGHashTable *refobject_hash;
+ /* Needed by Thread:GetDomainID() */
+ gint32 domain_id;
+ /* Used when loading assemblies */
+ gchar **search_path;
+ /* Used by remoting proxies */
+ MonoMethod *create_proxy_for_type_method;
+ MonoMethod *private_invoke_method;
+ MonoAppContext *default_context;
+ MonoException *out_of_memory_ex;
+ MonoException *null_reference_ex;
+ MonoException *stack_overflow_ex;
+ /* Used to store offsets of thread and context static fields */
+ GHashTable *special_static_fields;
+ GHashTable *jump_target_hash;
+ MonoGHashTable *class_init_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;
+};
+
+/* This is a copy of System.AppDomain */
+struct _MonoAppDomain {
+ MonoMarshalByRefObject mbr;
+ MonoDomain *data;
+};
+
+#define mono_domain_lock(domain) EnterCriticalSection(&(domain)->lock)
+#define mono_domain_unlock(domain) LeaveCriticalSection(&(domain)->lock)
+
+void
+mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji);
+
+MonoAppDomain *
+ves_icall_System_AppDomain_getCurDomain (void);
+
+MonoAppDomain *
+ves_icall_System_AppDomain_createDomain (MonoString *friendly_name,
+ MonoAppDomainSetup *setup);
+
+MonoObject *
+ves_icall_System_AppDomain_GetData (MonoAppDomain *ad,
+ MonoString *name);
+
+MonoReflectionAssembly *
+ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad,
+ MonoArray *raw_assembly,
+ MonoArray *raw_symbol_store,
+ MonoObject *evidence);
+
+void
+ves_icall_System_AppDomain_SetData (MonoAppDomain *ad,
+ MonoString *name,
+ MonoObject *data);
+
+MonoAppDomainSetup *
+ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad);
+
+MonoString *
+ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad);
+
+MonoArray *
+ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad);
+
+MonoReflectionAssembly *
+ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname);
+
+MonoReflectionAssembly *
+ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,
+ MonoString *assRef,
+ MonoObject *evidence);
+
+gboolean
+ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id);
+
+void
+ves_icall_System_AppDomain_InternalUnload (gint32 domain_id);
+
+gint32
+ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad,
+ MonoString *file,
+ MonoObject *evidence,
+ MonoArray *args);
+
+MonoAppDomain *
+ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomain *ad);
+
+MonoAppDomain *
+ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid);
+
+void
+ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomain *ad);
+
+void
+ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id);
+
+void
+ves_icall_System_AppDomain_InternalPopDomainRef (void);
+
+MonoAppContext *
+ves_icall_System_AppDomain_InternalGetContext (void);
+
+MonoAppContext *
+ves_icall_System_AppDomain_InternalGetDefaultContext (void);
+
+MonoAppContext *
+ves_icall_System_AppDomain_InternalSetContext (MonoAppContext *mc);
+
+gint32
+ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad);
+
+MonoString *
+ves_icall_System_AppDomain_InternalGetProcessGuid (MonoString* newguid);
+
+#endif /* __MONO_METADATA_DOMAIN_INTERNALS_H__ */
#include <mono/os/gc_wrapper.h>
#include <mono/metadata/object.h>
-#include <mono/metadata/appdomain.h>
+#include <mono/metadata/domain-internals.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/cil-coff.h>
return domain;
}
+gint32
+mono_domain_get_id (MonoDomain *domain)
+{
+ return domain->domain_id;
+}
+
void
mono_context_set (MonoAppContext * new_context)
{
#include <mono/metadata/threads.h>
#include <mono/metadata/tabledefs.h>
#include <mono/metadata/exception.h>
+#include <mono/metadata/domain-internals.h>
#define GC_I_HIDE_POINTERS
#include <mono/os/gc_wrapper.h>
#include <mono/metadata/mono-endian.h>
#include <mono/metadata/tokentype.h>
#include <mono/metadata/unicode.h>
-#include <mono/metadata/appdomain.h>
+#include <mono/metadata/domain-internals.h>
#include <mono/metadata/marshal.h>
#include <mono/metadata/gc-internal.h>
#include <mono/metadata/rand.h>
mono_debug_get_domain_data (MonoDebugHandle *handle, MonoDomain *domain)
{
MonoDebugDomainData *data;
+ int domain_id = mono_domain_get_id (domain);
for (data = handle->_priv->domain_table; data; data = data->_priv->next)
- if (data->domain_id == domain->domain_id)
+ if (data->domain_id == domain_id)
return data;
data = g_new0 (MonoDebugDomainData, 1);
- data->domain_id = domain->domain_id;
+ data->domain_id = domain_id;
data->jit = g_new0 (MonoDebugMethodJitInfo *, read32(&(handle->symfile->offset_table->_method_count)) + 1);
data->_priv = g_new0 (MonoDebugDomainDataPriv, 1);
#include <mono/metadata/object.h>
#include <mono/metadata/gc-internal.h>
#include <mono/metadata/exception.h>
-#include <mono/metadata/appdomain.h>
+#include <mono/metadata/domain-internals.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/threadpool.h>
#include <mono/metadata/marshal.h>
#include "mono/metadata/reflection.h"
#include "mono/metadata/tabledefs.h"
#include "mono/metadata/tokentype.h"
-#include "mono/metadata/appdomain.h"
+#include "mono/metadata/domain-internals.h"
#include "mono/metadata/opcodes.h"
#include "mono/metadata/assembly.h"
#include <mono/metadata/exception.h>
#define _WIN32_WINNT 0x0500
#endif
-#include <mono/metadata/appdomain.h>
+#include <mono/metadata/domain-internals.h>
#include <mono/metadata/tabledefs.h>
#include <mono/metadata/threads.h>
#include <mono/metadata/exception.h>
#include <string.h>
#include <mono/metadata/object.h>
-#include <mono/metadata/appdomain.h>
+#include <mono/metadata/domain-internals.h>
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/threads.h>
#include <mono/metadata/threadpool.h>
#include <mono/metadata/object.h>
#include <mono/metadata/opcodes.h>
#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/domain-internals.h>
#include <mono/metadata/profiler-private.h>
#include "mini-arch.h"