Merge pull request #1698 from ludovic-henry/socket-reorg-2
[mono.git] / mono / metadata / domain.c
index e30c0345c0abae993f6e0394aae83b1719aedd7d..d2d92fd51c9868342956d7ca8876457c1d0fca8f 100755 (executable)
@@ -119,8 +119,6 @@ static const MonoRuntimeInfo *current_runtime = NULL;
 /* This is the list of runtime versions supported by this JIT.
  */
 static const MonoRuntimeInfo supported_runtimes[] = {
-       {"v2.0.50215","2.0", { {2,0,0,0}, { 8,0,0,0}, {3,5,0,0}, {3,0,0,0} } },
-       {"v2.0.50727","2.0", { {2,0,0,0}, { 8,0,0,0}, {3,5,0,0}, {3,0,0,0} } },
        {"v4.0.30319","4.5", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
        {"v4.0.30128","4.0", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
        {"v4.0.20506","4.0", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
@@ -130,7 +128,7 @@ static const MonoRuntimeInfo supported_runtimes[] = {
 
 
 /* The stable runtime version */
-#define DEFAULT_RUNTIME_VERSION "v2.0.50727"
+#define DEFAULT_RUNTIME_VERSION "v4.0.30319"
 
 /* Callbacks installed by the JIT */
 static MonoCreateDomainFunc create_domain_hook;
@@ -139,9 +137,6 @@ static MonoFreeDomainFunc free_domain_hook;
 /* AOT cache configuration */
 static MonoAotCacheConfig aot_cache_config;
 
-/* This is intentionally not in the header file, so people don't misuse it. */
-extern void _mono_debug_init_corlib (MonoDomain *domain);
-
 static void
 get_runtimes_from_exe (const char *exe_file, MonoImage **exe_image, const MonoRuntimeInfo** runtimes);
 
@@ -512,6 +507,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
 #ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters_init ();
 #endif
+       mono_counters_init ();
 
        mono_counters_register ("Max native code in a domain", MONO_COUNTER_INT|MONO_COUNTER_JIT, &max_domain_code_size);
        mono_counters_register ("Max code space allocated in a domain", MONO_COUNTER_INT|MONO_COUNTER_JIT, &max_domain_code_alloc);
@@ -717,6 +713,10 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
                 mono_defaults.corlib, "System", "MonoType");
        g_assert (mono_defaults.monotype_class != 0);
 
+       mono_defaults.runtimetype_class = mono_class_from_name (
+                mono_defaults.corlib, "System", "RuntimeType");
+       g_assert (mono_defaults.runtimetype_class != 0);
+
        mono_defaults.exception_class = mono_class_from_name (
                 mono_defaults.corlib, "System", "Exception");
        g_assert (mono_defaults.exception_class != 0);
@@ -835,8 +835,6 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
        mono_defaults.customattribute_data_class = mono_class_from_name (
                mono_defaults.corlib, "System.Reflection", "CustomAttributeData");
 
-       /* these are initialized lazily when COM features are used */
-
        mono_class_init (mono_defaults.array_class);
        mono_defaults.generic_nullable_class = mono_class_from_name (
                mono_defaults.corlib, "System", "Nullable`1");
@@ -847,8 +845,6 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
 
        domain->friendly_name = g_path_get_basename (filename);
 
-       _mono_debug_init_corlib (domain);
-
        return domain;
 }
 
@@ -1923,3 +1919,17 @@ mono_get_aot_cache_config (void)
 {
        return &aot_cache_config;
 }
+
+void
+mono_domain_lock (MonoDomain *domain)
+{
+       MONO_PREPARE_BLOCKING
+       mono_locks_acquire (&(domain)->lock, DomainLock);
+       MONO_FINISH_BLOCKING
+}
+
+void
+mono_domain_unlock (MonoDomain *domain)
+{
+       mono_locks_release (&(domain)->lock, DomainLock);
+}