X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fdomain.c;h=dfb3c29eefc5af88d07cdc37c168c66c6f39a58c;hb=20c72671c19e43952c3713660f350642e1f392d1;hp=6cfd0dbbb9ea31c1a6ff8ba24d0db0e423381f01;hpb=71694e1e9d9a4b221ed1396f74603972e1b8efae;p=mono.git diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c index 6cfd0dbbb9e..dfb3c29eefc 100644 --- a/mono/metadata/domain.c +++ b/mono/metadata/domain.c @@ -40,6 +40,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -179,7 +182,7 @@ lock_free_mempool_free (LockFreeMempool *mp) chunk = mp->chunks; while (chunk) { next = (LockFreeMempoolChunk *)chunk->prev; - mono_vfree (chunk, mono_pagesize ()); + mono_vfree (chunk, mono_pagesize (), MONO_MEM_ACCOUNT_DOMAIN); chunk = next; } g_free (mp); @@ -197,7 +200,7 @@ lock_free_mempool_chunk_new (LockFreeMempool *mp, int len) size = mono_pagesize (); while (size - sizeof (LockFreeMempoolChunk) < len) size += mono_pagesize (); - chunk = (LockFreeMempoolChunk *)mono_valloc (0, size, MONO_MMAP_READ|MONO_MMAP_WRITE); + chunk = (LockFreeMempoolChunk *)mono_valloc (0, size, MONO_MMAP_READ|MONO_MMAP_WRITE, MONO_MEM_ACCOUNT_DOMAIN); g_assert (chunk); chunk->mem = (guint8 *)ALIGN_PTR_TO ((char*)chunk + sizeof (LockFreeMempoolChunk), 16); chunk->size = ((char*)chunk + size) - (char*)chunk->mem; @@ -519,16 +522,21 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * if (domain) g_assert_not_reached (); -#ifdef HOST_WIN32 +#if defined(HOST_WIN32) && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) /* Avoid system error message boxes. */ SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); #endif #ifndef HOST_WIN32 mono_w32handle_init (); + mono_w32handle_namespace_init (); wapi_init (); #endif + mono_w32mutex_init (); + mono_w32semaphore_init (); + mono_w32event_init (); + #ifndef DISABLE_PERFCOUNTERS mono_perfcounters_init (); #endif @@ -808,16 +816,6 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * mono_profiler_appdomain_name (domain, domain->friendly_name); - /* Have to do this quite late so that we at least have System.Object */ - MonoError custom_attr_error; - if (mono_assembly_get_reference_assembly_attribute (ass, &custom_attr_error)) { - char *corlib_file = g_build_filename (mono_assembly_getrootdir (), "mono", current_runtime->framework_version, "mscorlib.dll", NULL); - g_print ("Could not load file or assembly %s. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context.", corlib_file); - g_free (corlib_file); - exit (1); - } - mono_error_assert_ok (&custom_attr_error); - return domain; } @@ -1177,6 +1175,12 @@ mono_domain_free (MonoDomain *domain, gboolean force) g_slist_free (domain->domain_assemblies); domain->domain_assemblies = NULL; + /* + * Send this after the assemblies have been unloaded and the domain is still in a + * usable state. + */ + mono_profiler_appdomain_event (domain, MONO_PROFILE_END_UNLOAD); + if (free_domain_hook) free_domain_hook (domain); @@ -1250,10 +1254,6 @@ mono_domain_free (MonoDomain *domain, gboolean force) g_hash_table_destroy (domain->generic_virtual_cases); domain->generic_virtual_cases = NULL; } - if (domain->generic_virtual_thunks) { - g_hash_table_destroy (domain->generic_virtual_thunks); - domain->generic_virtual_thunks = NULL; - } if (domain->ftnptrs_hash) { g_hash_table_destroy (domain->ftnptrs_hash); domain->ftnptrs_hash = NULL;