Merge pull request #3028 from lateralusX/jlorenss/threadpool_warning
[mono.git] / mono / metadata / domain.c
index 9f2d9fbd81433be9d715311d2d995efc214b61c4..26ab2d2d9b55a1d96d1d3360ecb4c6c484779824 100644 (file)
@@ -8,6 +8,7 @@
  * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
  * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
  * Copyright 2011-2012 Xamarin, Inc (http://www.xamarin.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
 #include <config.h>
@@ -782,7 +783,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
 
        mono_assembly_load_friends (ass);
 
-       mono_defaults.handleref_class = mono_class_load_from_name (
+       mono_defaults.handleref_class = mono_class_try_load_from_name (
                mono_defaults.corlib, "System.Runtime.InteropServices", "HandleRef");
 
        mono_defaults.attribute_class = mono_class_load_from_name (
@@ -886,8 +887,8 @@ mono_cleanup (void)
        mono_loader_cleanup ();
        mono_classes_cleanup ();
        mono_assemblies_cleanup ();
-       mono_images_cleanup ();
        mono_debug_cleanup ();
+       mono_images_cleanup ();
        mono_metadata_cleanup ();
 
        mono_native_tls_free (appdomain_thread_id);
@@ -1168,12 +1169,6 @@ 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);
 
@@ -1425,58 +1420,6 @@ mono_domain_code_commit (MonoDomain *domain, void *data, int size, int newsize)
        mono_domain_unlock (domain);
 }
 
-#if defined(__native_client_codegen__) && defined(__native_client__)
-/*
- * Given the temporary buffer (allocated by mono_domain_code_reserve) into which
- * we are generating code, return a pointer to the destination in the dynamic 
- * code segment into which the code will be copied when mono_domain_code_commit
- * is called.
- * LOCKING: Acquires the domain lock.
- */
-void *
-nacl_domain_get_code_dest (MonoDomain *domain, void *data)
-{
-       void *dest;
-       mono_domain_lock (domain);
-       dest = nacl_code_manager_get_code_dest (domain->code_mp, data);
-       mono_domain_unlock (domain);
-       return dest;
-}
-
-/* 
- * Convenience function which calls mono_domain_code_commit to validate and copy
- * the code. The caller sets *buf_base and *buf_size to the start and size of
- * the buffer (allocated by mono_domain_code_reserve), and *code_end to the byte
- * after the last instruction byte. On return, *buf_base will point to the start
- * of the copied in the code segment, and *code_end will point after the end of 
- * the copied code.
- */
-void
-nacl_domain_code_validate (MonoDomain *domain, guint8 **buf_base, int buf_size, guint8 **code_end)
-{
-       guint8 *tmp = nacl_domain_get_code_dest (domain, *buf_base);
-       mono_domain_code_commit (domain, *buf_base, buf_size, *code_end - *buf_base);
-       *code_end = tmp + (*code_end - *buf_base);
-       *buf_base = tmp;
-}
-
-#else
-
-/* no-op versions of Native Client functions */
-
-void *
-nacl_domain_get_code_dest (MonoDomain *domain, void *data)
-{
-       return data;
-}
-
-void
-nacl_domain_code_validate (MonoDomain *domain, guint8 **buf_base, int buf_size, guint8 **code_end)
-{
-}
-
-#endif
-
 /*
  * mono_domain_code_foreach:
  * Iterate over the code thunks of the code manager of @domain.