Remove System.Runtime.Remoting.Contexts.Context, its not used anymore on netcore...
authorZoltan Varga <vargaz@gmail.com>
Fri, 8 Jan 2021 14:59:02 +0000 (09:59 -0500)
committerGitHub <noreply@github.com>
Fri, 8 Jan 2021 14:59:02 +0000 (09:59 -0500)
src/mono/mono/metadata/domain.c
src/mono/mono/metadata/object-internals.h
src/mono/mono/metadata/object.c
src/mono/mono/metadata/threads.c
src/mono/netcore/System.Private.CoreLib/System.Private.CoreLib.csproj
src/mono/netcore/System.Private.CoreLib/src/System/Runtime/Remoting/Contexts/Context.cs [deleted file]
src/mono/netcore/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs

index 9c6927e..073f86d 100644 (file)
                mono_thread_info_tls_set (info, TLS_KEY_DOMAIN, (x));   \
 } while (FALSE)
 
+#ifndef ENABLE_NETCORE
 #define GET_APPCONTEXT() (mono_thread_internal_current ()->current_appcontext)
 #define SET_APPCONTEXT(x) MONO_OBJECT_SETREF_INTERNAL (mono_thread_internal_current (), current_appcontext, (x))
+#else
+#define GET_APPCONTEXT() NULL
+#define SET_APPCONTEXT(x)
+#endif
 
 static guint16 appdomain_list_size = 0;
 static guint16 appdomain_next = 0;
index a5d6e8a..db47b08 100644 (file)
@@ -594,7 +594,9 @@ struct _MonoInternalThread {
        gsize debugger_thread; // FIXME switch to bool as soon as CI testing with corlib version bump works
        gpointer *static_data;
        struct _MonoThreadInfo *thread_info;
+#ifndef ENABLE_NETCORE
        MonoAppContext *current_appcontext;
+#endif
        MonoThread *root_domain_thread;
        MonoObject *_serialized_principal;
        int _serialized_principal_version;
index bed293e..d70e3df 100644 (file)
@@ -1255,10 +1255,12 @@ field_is_special_static (MonoClass *fklass, MonoClassField *field)
                                mono_custom_attrs_free (ainfo);
                                return SPECIAL_STATIC_THREAD;
                        }
+#ifndef ENABLE_NETCORE
                        else if (strcmp (klass_name, "ContextStaticAttribute") == 0) {
                                mono_custom_attrs_free (ainfo);
                                return SPECIAL_STATIC_CONTEXT;
                        }
+#endif
                }
        }
        mono_custom_attrs_free (ainfo);
index ad2e348..4bb0579 100644 (file)
@@ -999,7 +999,9 @@ mono_thread_detach_internal (MonoInternalThread *thread)
        thread->abort_state_handle = 0;
 
        thread->abort_exc = NULL;
+#ifndef ENABLE_NETCORE
        thread->current_appcontext = NULL;
+#endif
 
        LOCK_THREAD (thread);
 
@@ -5039,7 +5041,11 @@ mono_get_special_static_data_for_thread (MonoInternalThread *thread, guint32 off
        if (static_type == SPECIAL_STATIC_OFFSET_TYPE_THREAD) {
                return get_thread_static_data (thread, offset);
        } else {
+#ifndef ENABLE_NETCORE
                return get_context_static_data (thread->current_appcontext, offset);
+#else
+               g_assert_not_reached ();
+#endif
        }
 }
 
index ebdf5f5..0414110 100644 (file)
       <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\SafeHandle.Mono.cs" />
       <Compile Include="$(BclSourcesRoot)\System\Runtime\Intrinsics\X86\X86Base.Mono.cs" />
       <Compile Include="$(BclSourcesRoot)\System\Runtime\Loader\AssemblyLoadContext.Mono.cs" />
-      <Compile Include="$(BclSourcesRoot)\System\Runtime\Remoting\Contexts\Context.cs" />
       <Compile Include="$(BclSourcesRoot)\System\Security\DynamicSecurityMethodAttribute.cs" />
       <Compile Include="$(BclSourcesRoot)\System\Threading\Interlocked.Mono.cs" />
       <Compile Include="$(BclSourcesRoot)\System\Threading\Monitor.Mono.cs" />
diff --git a/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/Remoting/Contexts/Context.cs b/src/mono/netcore/System.Private.CoreLib/src/System/Runtime/Remoting/Contexts/Context.cs
deleted file mode 100644 (file)
index 3252b4f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.Remoting.Contexts
-{
-
-    [StructLayout(LayoutKind.Sequential)]
-    /* FIXME: Mono: this was public in mscorlib */
-    internal class Context
-    {
-#pragma warning disable 169, 414
-        #region Sync with domain-internals.h
-        private int domain_id;
-        private int context_id;
-        private UIntPtr static_data; /* GC-tracked */
-        private UIntPtr data;
-        #endregion
-#pragma warning restore 169, 414
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void RegisterContext(Context ctx);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void ReleaseContext(Context ctx);
-
-        public Context()
-        {
-#if false
-                       domain_id = Thread.GetDomainID();
-                       context_id = Interlocked.Increment (ref global_count);
-
-                       RegisterContext (this);
-#endif
-        }
-
-        ~Context()
-        {
-            ReleaseContext(this);
-        }
-    }
-}
index 24662e2..104995f 100644 (file)
@@ -34,9 +34,6 @@ namespace System.Threading
         private IntPtr debugger_thread; // FIXME switch to bool as soon as CI testing with corlib version bump works
         private UIntPtr static_data; /* GC-tracked */
         private IntPtr runtime_thread_info;
-        /* current System.Runtime.Remoting.Contexts.Context instance
-           keep as an object to avoid triggering its class constructor when not needed */
-        private object? current_appcontext;
         private object? root_domain_thread;
         internal byte[]? _serialized_principal;
         internal int _serialized_principal_version;