[System.Private.CoreLib] Methods with no instance access can be made static (#42805)
authorMarek Safar <marek.safar@gmail.com>
Thu, 1 Oct 2020 09:55:57 +0000 (11:55 +0200)
committerGitHub <noreply@github.com>
Thu, 1 Oct 2020 09:55:57 +0000 (11:55 +0200)
21 files changed:
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
src/libraries/System.Private.CoreLib/src/System/Collections/Concurrent/ConcurrentQueue.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/XplatEventLogger.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Invariant.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/IdnMapping.Nls.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/PersianCalendar.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/UmAlQuraCalendar.cs
src/libraries/System.Private.CoreLib/src/System/Guid.cs
src/libraries/System.Private.CoreLib/src/System/IO/Stream.cs
src/libraries/System.Private.CoreLib/src/System/Text/DecoderExceptionFallback.cs
src/libraries/System.Private.CoreLib/src/System/Text/DecoderFallback.cs
src/libraries/System.Private.CoreLib/src/System/Text/EncoderLatin1BestFitFallback.cs
src/libraries/System.Private.CoreLib/src/System/Text/UTF32Encoding.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/ThreadPoolTaskScheduler.cs
src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.cs
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.cs

index e21b2c1..6ab9f20 100644 (file)
@@ -220,13 +220,13 @@ namespace System.Reflection.Emit
 
         public void SetBaseTypeConstraint([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? baseTypeConstraint)
         {
-            m_type.CheckContext(baseTypeConstraint);
+            AssemblyBuilder.CheckContext(baseTypeConstraint);
             m_type.SetParent(baseTypeConstraint);
         }
 
         public void SetInterfaceConstraints(params Type[]? interfaceConstraints)
         {
-            m_type.CheckContext(interfaceConstraints);
+            AssemblyBuilder.CheckContext(interfaceConstraints);
             m_type.SetInterfaces(interfaceConstraints);
         }
 
index 6d7f7fc..93b5c5b 100644 (file)
@@ -135,16 +135,6 @@ namespace System.Reflection.Emit
 
         #region Internal Members
 
-        internal void CheckContext(params Type[]?[]? typess)
-        {
-            m_module.CheckContext(typess);
-        }
-
-        internal void CheckContext(params Type?[]? types)
-        {
-            m_module.CheckContext(types);
-        }
-
         internal void CreateMethodBodyHelper(ILGenerator il)
         {
             // Sets the IL of the method.  An ILGenerator is passed as an argument and the method
@@ -657,14 +647,14 @@ namespace System.Reflection.Emit
 
         public void SetParameters(params Type[] parameterTypes)
         {
-            CheckContext(parameterTypes);
+            AssemblyBuilder.CheckContext(parameterTypes);
 
             SetSignature(null, null, null, parameterTypes, null, null);
         }
 
         public void SetReturnType(Type? returnType)
         {
-            CheckContext(returnType);
+            AssemblyBuilder.CheckContext(returnType);
 
             SetSignature(returnType, null, null, null, null, null);
         }
@@ -678,10 +668,10 @@ namespace System.Reflection.Emit
             if (m_tkMethod.Token != 0)
                 return;
 
-            CheckContext(returnType);
-            CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
-            CheckContext(parameterTypeRequiredCustomModifiers);
-            CheckContext(parameterTypeOptionalCustomModifiers);
+            AssemblyBuilder.CheckContext(returnType);
+            AssemblyBuilder.CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
+            AssemblyBuilder.CheckContext(parameterTypeRequiredCustomModifiers);
+            AssemblyBuilder.CheckContext(parameterTypeOptionalCustomModifiers);
 
             ThrowIfGeneric();
 
index c390d48..09a555a 100644 (file)
@@ -122,16 +122,6 @@ namespace System.Reflection.Emit
             return SymbolType.FormCompoundType(strFormat, baseType, 0);
         }
 
-        internal void CheckContext(params Type[]?[]? typess)
-        {
-            AssemblyBuilder.CheckContext(typess);
-        }
-
-        internal void CheckContext(params Type?[]? types)
-        {
-            AssemblyBuilder.CheckContext(types);
-        }
-
         [DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
         private static extern int GetTypeRef(QCallModule module, string strFullName, QCallModule refedModule, string? strRefedModuleFileName, int tkResolution);
 
@@ -458,7 +448,7 @@ namespace System.Reflection.Emit
             return sig;
         }
 
-        private MethodBase GetGenericMethodBaseDefinition(MethodBase methodBase)
+        private static MethodBase GetGenericMethodBaseDefinition(MethodBase methodBase)
         {
             // methodInfo = G<Foo>.M<Bar> ==> methDef = G<T>.M<S>
             MethodInfo? masmi = methodBase as MethodInfo;
@@ -839,7 +829,7 @@ namespace System.Reflection.Emit
         {
             lock (SyncRoot)
             {
-                CheckContext(parent);
+                AssemblyBuilder.CheckContext(parent);
 
                 return DefineTypeNoLock(name, attr, parent, null, PackingSize.Unspecified, TypeBuilder.UnspecifiedTypeSize);
             }
@@ -895,7 +885,7 @@ namespace System.Reflection.Emit
         // Nested enum types can be defined manually using ModuleBuilder.DefineType.
         public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type underlyingType)
         {
-            CheckContext(underlyingType);
+            AssemblyBuilder.CheckContext(underlyingType);
             lock (SyncRoot)
             {
                 EnumBuilder enumBuilder = DefineEnumNoLock(name, visibility, underlyingType);
@@ -936,8 +926,8 @@ namespace System.Reflection.Emit
                     throw new ArgumentException(SR.Argument_GlobalFunctionHasToBeStatic);
                 }
 
-                CheckContext(returnType);
-                CheckContext(parameterTypes);
+                AssemblyBuilder.CheckContext(returnType);
+                AssemblyBuilder.CheckContext(parameterTypes);
 
                 return _moduleData._globalTypeBuilder.DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet);
             }
@@ -987,10 +977,10 @@ namespace System.Reflection.Emit
                 throw new ArgumentException(SR.Argument_GlobalFunctionHasToBeStatic);
             }
 
-            CheckContext(returnType);
-            CheckContext(requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes);
-            CheckContext(requiredParameterTypeCustomModifiers);
-            CheckContext(optionalParameterTypeCustomModifiers);
+            AssemblyBuilder.CheckContext(returnType);
+            AssemblyBuilder.CheckContext(requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes);
+            AssemblyBuilder.CheckContext(requiredParameterTypeCustomModifiers);
+            AssemblyBuilder.CheckContext(optionalParameterTypeCustomModifiers);
 
             return _moduleData._globalTypeBuilder.DefineMethod(name, attributes, callingConvention,
                 returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers,
@@ -1100,7 +1090,7 @@ namespace System.Reflection.Emit
                 throw new ArgumentNullException(nameof(type));
             }
 
-            CheckContext(type);
+            AssemblyBuilder.CheckContext(type);
 
             // Return a token for the class relative to the Module.  Tokens
             // are used to indentify objects when the objects are used in IL
@@ -1406,8 +1396,8 @@ namespace System.Reflection.Emit
                 throw new ArgumentException(SR.Argument_HasToBeArrayClass);
             }
 
-            CheckContext(returnType, arrayClass);
-            CheckContext(parameterTypes);
+            AssemblyBuilder.CheckContext(returnType, arrayClass);
+            AssemblyBuilder.CheckContext(parameterTypes);
 
             // Return a token for the MethodInfo for a method on an Array.  This is primarily
             // used to get the LoadElementAddress method.
@@ -1424,8 +1414,8 @@ namespace System.Reflection.Emit
         public MethodInfo GetArrayMethod(Type arrayClass, string methodName, CallingConventions callingConvention,
             Type? returnType, Type[]? parameterTypes)
         {
-            CheckContext(returnType, arrayClass);
-            CheckContext(parameterTypes);
+            AssemblyBuilder.CheckContext(returnType, arrayClass);
+            AssemblyBuilder.CheckContext(parameterTypes);
 
             // GetArrayMethod is useful when you have an array of a type whose definition has not been completed and
             // you want to access methods defined on Array. For example, you might define a type and want to define a
index 6292367..7ae71d9 100644 (file)
@@ -1183,7 +1183,7 @@ namespace System.Reflection.Emit
 
         public override Type MakeGenericType(params Type[] typeArguments)
         {
-            CheckContext(typeArguments);
+            AssemblyBuilder.CheckContext(typeArguments);
 
             return TypeBuilderInstantiation.MakeGenericType(this, typeArguments);
         }
@@ -1275,10 +1275,10 @@ namespace System.Reflection.Emit
             if (name.Length == 0)
                 throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
 
-            CheckContext(returnType);
-            CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
-            CheckContext(parameterTypeRequiredCustomModifiers);
-            CheckContext(parameterTypeOptionalCustomModifiers);
+            AssemblyBuilder.CheckContext(returnType);
+            AssemblyBuilder.CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
+            AssemblyBuilder.CheckContext(parameterTypeRequiredCustomModifiers);
+            AssemblyBuilder.CheckContext(parameterTypeOptionalCustomModifiers);
 
             if (parameterTypes != null)
             {
@@ -1350,10 +1350,10 @@ namespace System.Reflection.Emit
             Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers,
             CallingConvention nativeCallConv, CharSet nativeCharSet)
         {
-            CheckContext(returnType);
-            CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
-            CheckContext(parameterTypeRequiredCustomModifiers);
-            CheckContext(parameterTypeOptionalCustomModifiers);
+            AssemblyBuilder.CheckContext(returnType);
+            AssemblyBuilder.CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
+            AssemblyBuilder.CheckContext(parameterTypeRequiredCustomModifiers);
+            AssemblyBuilder.CheckContext(parameterTypeOptionalCustomModifiers);
 
             lock (SyncRoot)
             {
@@ -1560,9 +1560,9 @@ namespace System.Reflection.Emit
         private ConstructorBuilder DefineConstructorNoLock(MethodAttributes attributes, CallingConventions callingConvention,
             Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
         {
-            CheckContext(parameterTypes);
-            CheckContext(requiredCustomModifiers);
-            CheckContext(optionalCustomModifiers);
+            AssemblyBuilder.CheckContext(parameterTypes);
+            AssemblyBuilder.CheckContext(requiredCustomModifiers);
+            AssemblyBuilder.CheckContext(optionalCustomModifiers);
 
             ThrowIfCreated();
 
@@ -1604,8 +1604,8 @@ namespace System.Reflection.Emit
             lock (SyncRoot)
             {
                 // Why do we only call CheckContext here? Why don't we call it in the other overloads?
-                CheckContext(parent);
-                CheckContext(interfaces);
+                AssemblyBuilder.CheckContext(parent);
+                AssemblyBuilder.CheckContext(interfaces);
 
                 return DefineNestedTypeNoLock(name, attr, parent, interfaces, PackingSize.Unspecified, UnspecifiedTypeSize);
             }
@@ -1677,8 +1677,8 @@ namespace System.Reflection.Emit
             Type[]? optionalCustomModifiers, FieldAttributes attributes)
         {
             ThrowIfCreated();
-            CheckContext(type);
-            CheckContext(requiredCustomModifiers);
+            AssemblyBuilder.CheckContext(type);
+            AssemblyBuilder.CheckContext(requiredCustomModifiers);
 
             if (m_enumUnderlyingType == null && IsEnum)
             {
@@ -1771,10 +1771,10 @@ namespace System.Reflection.Emit
             if (name.Length == 0)
                 throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
 
-            CheckContext(returnType);
-            CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
-            CheckContext(parameterTypeRequiredCustomModifiers);
-            CheckContext(parameterTypeOptionalCustomModifiers);
+            AssemblyBuilder.CheckContext(returnType);
+            AssemblyBuilder.CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
+            AssemblyBuilder.CheckContext(parameterTypeRequiredCustomModifiers);
+            AssemblyBuilder.CheckContext(parameterTypeOptionalCustomModifiers);
 
             SignatureHelper sigHelper;
             byte[] sigBytes;
@@ -1831,7 +1831,7 @@ namespace System.Reflection.Emit
             int tkType;
             EventToken evToken;
 
-            CheckContext(eventtype);
+            AssemblyBuilder.CheckContext(eventtype);
 
             ThrowIfCreated();
 
@@ -1876,15 +1876,6 @@ namespace System.Reflection.Emit
             }
         }
 
-        internal void CheckContext(params Type[]?[]? typess)
-        {
-            m_module.CheckContext(typess);
-        }
-        internal void CheckContext(params Type?[]? types)
-        {
-            m_module.CheckContext(types);
-        }
-
         private TypeInfo? CreateTypeNoLock()
         {
             if (IsCreated())
@@ -2078,7 +2069,7 @@ namespace System.Reflection.Emit
 
             if (parent != null)
             {
-                CheckContext(parent);
+                AssemblyBuilder.CheckContext(parent);
 
                 if (parent.IsInterface)
                     throw new ArgumentException(SR.Argument_CannotSetParentToInterface);
@@ -2109,7 +2100,7 @@ namespace System.Reflection.Emit
                 throw new ArgumentNullException(nameof(interfaceType));
             }
 
-            CheckContext(interfaceType);
+            AssemblyBuilder.CheckContext(interfaceType);
 
             ThrowIfCreated();
 
index 08eb093..d46f450 100644 (file)
@@ -540,7 +540,7 @@ namespace System.Collections.Concurrent
             return segment._slots[i].Item!;
         }
 
-        private IEnumerator<T> Enumerate(ConcurrentQueueSegment<T> head, int headHead, ConcurrentQueueSegment<T> tail, int tailTail)
+        private static IEnumerator<T> Enumerate(ConcurrentQueueSegment<T> head, int headHead, ConcurrentQueueSegment<T> tail, int tailTail)
         {
             Debug.Assert(head._preservedForObservation);
             Debug.Assert(head._frozenForEnqueues);
index ffd6f18..d5bc0a6 100644 (file)
@@ -3713,7 +3713,7 @@ namespace System.Diagnostics.Tracing
             catch { }      // If we fail during last chance logging, well, we have to give up....
         }
 
-        private EventSourceSettings ValidateSettings(EventSourceSettings settings)
+        private static EventSourceSettings ValidateSettings(EventSourceSettings settings)
         {
             const EventSourceSettings evtFormatMask = EventSourceSettings.EtwManifestEventFormat |
                                 EventSourceSettings.EtwSelfDescribingEventFormat;
index 4945b55..abe2362 100644 (file)
@@ -182,12 +182,13 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        private void LogOnEventWritten(EventWrittenEventArgs eventData)
+        private static void LogOnEventWritten(EventWrittenEventArgs eventData)
         {
             string payload = "";
             if (eventData.Payload != null)
             {
-                try{
+                try
+                {
                     payload = Serialize(eventData.PayloadNames, eventData.Payload, eventData.Message);
                 }
                 catch (Exception ex)
index 3c12aca..e1c1b71 100644 (file)
@@ -384,7 +384,7 @@ namespace System.Globalization
             return "en-US";
         }
 
-        private bool SystemSupportsTaiwaneseCalendar() => GlobalizationMode.UseNls ?
+        private static bool SystemSupportsTaiwaneseCalendar() => GlobalizationMode.UseNls ?
                                                             NlsSystemSupportsTaiwaneseCalendar() :
                                                             IcuSystemSupportsTaiwaneseCalendar();
     }
index 3279678..b1033b5 100644 (file)
@@ -269,7 +269,7 @@ namespace System.Globalization
             }
         }
 
-        private int InvariantGetSortKey(ReadOnlySpan<char> source, Span<byte> destination, CompareOptions options)
+        private static int InvariantGetSortKey(ReadOnlySpan<char> source, Span<byte> destination, CompareOptions options)
         {
             Debug.Assert(GlobalizationMode.Invariant);
             Debug.Assert((options & ValidCompareMaskOffFlags) == 0);
@@ -295,7 +295,7 @@ namespace System.Globalization
             return source.Length * sizeof(char);
         }
 
-        private int InvariantGetSortKeyLength(ReadOnlySpan<char> source, CompareOptions options)
+        private static int InvariantGetSortKeyLength(ReadOnlySpan<char> source, CompareOptions options)
         {
             Debug.Assert(GlobalizationMode.Invariant);
             Debug.Assert((options & ValidCompareMaskOffFlags) == 0);
index b3758b2..2e0e664 100644 (file)
@@ -41,7 +41,7 @@ namespace System.Globalization
             }
         }
 
-        private unsafe string NlsGetAsciiCore(string unicodeString, char* unicode, int count, uint flags, char* output, int outputLength)
+        private static unsafe string NlsGetAsciiCore(string unicodeString, char* unicode, int count, uint flags, char* output, int outputLength)
         {
             Debug.Assert(!GlobalizationMode.Invariant);
             Debug.Assert(GlobalizationMode.UseNls);
@@ -88,7 +88,7 @@ namespace System.Globalization
             }
         }
 
-        private unsafe string NlsGetUnicodeCore(string asciiString, char* ascii, int count, uint flags, char* output, int outputLength)
+        private static unsafe string NlsGetUnicodeCore(string asciiString, char* ascii, int count, uint flags, char* output, int outputLength)
         {
             Debug.Assert(!GlobalizationMode.Invariant);
             Debug.Assert(GlobalizationMode.UseNls);
index b9f075c..752d6b9 100644 (file)
@@ -55,7 +55,7 @@ namespace System.Globalization
 
         internal override CalendarId ID => CalendarId.PERSIAN;
 
-        private long GetAbsoluteDatePersian(int year, int month, int day)
+        private static long GetAbsoluteDatePersian(int year, int month, int day)
         {
             if (year < 1 || year > MaxCalendarYear || month < 1 || month > 12)
             {
index 14ee2fd..940d9b3 100644 (file)
@@ -379,7 +379,7 @@ namespace System.Globalization
         /// In order to get the exact UmAlQura year, we compare the exact absolute date for UmAlQuraYear and (UmAlQuraYear + 1).
         /// From here, we can get the correct UmAlQura year.
         /// </summary>
-        private int GetDatePart(DateTime time, int part)
+        private static int GetDatePart(DateTime time, int part)
         {
             long ticks = time.Ticks;
             CheckTicksRange(ticks);
index 465dad6..b8ab16d 100644 (file)
@@ -798,7 +798,7 @@ namespace System
                 Unsafe.Add(ref g._a, 3) == Unsafe.Add(ref _a, 3);
         }
 
-        private int GetResult(uint me, uint them) => me < them ? -1 : 1;
+        private static int GetResult(uint me, uint them) => me < them ? -1 : 1;
 
         public int CompareTo(object? value)
         {
index 7938828..5f77bfc 100644 (file)
@@ -475,7 +475,7 @@ namespace System.IO
             return asyncResult; // return it
         }
 
-        private void RunReadWriteTaskWhenReady(Task asyncWaiter, ReadWriteTask readWriteTask)
+        private static void RunReadWriteTaskWhenReady(Task asyncWaiter, ReadWriteTask readWriteTask)
         {
             Debug.Assert(readWriteTask != null);
             Debug.Assert(asyncWaiter != null);
@@ -492,13 +492,13 @@ namespace System.IO
                 {
                     Debug.Assert(t.IsCompletedSuccessfully, "The semaphore wait should always complete successfully.");
                     var rwt = (ReadWriteTask)state!;
-                    Debug.Assert(rwt._stream != null);
-                    rwt._stream.RunReadWriteTask(rwt); // RunReadWriteTask(readWriteTask);
+                    Debug.Assert(rwt._stream != null, "Validates that this code isn't run a second time.");
+                    RunReadWriteTask(rwt); // RunReadWriteTask(readWriteTask);
                 }, readWriteTask, default, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
             }
         }
 
-        private void RunReadWriteTask(ReadWriteTask readWriteTask)
+        private static void RunReadWriteTask(ReadWriteTask readWriteTask)
         {
             Debug.Assert(readWriteTask != null);
 
@@ -679,7 +679,7 @@ namespace System.IO
             }
         }
 
-        private async Task FinishWriteAsync(Task writeTask, byte[] localBuffer)
+        private static async Task FinishWriteAsync(Task writeTask, byte[] localBuffer)
         {
             try
             {
index ea446bc..cb46c71 100644 (file)
@@ -41,7 +41,7 @@ namespace System.Text
         public override int Remaining => 0;
 
         [DoesNotReturn]
-        private void Throw(byte[] bytesUnknown, int index)
+        private static void Throw(byte[] bytesUnknown, int index)
         {
             bytesUnknown ??= Array.Empty<byte>();
 
index 5e90913..da8d123 100644 (file)
@@ -290,7 +290,7 @@ namespace System.Text
 
         // private helper methods
         [DoesNotReturn]
-        internal void ThrowLastBytesRecursive(byte[] bytesUnknown)
+        internal static void ThrowLastBytesRecursive(byte[] bytesUnknown)
         {
             bytesUnknown ??= Array.Empty<byte>();
 
index 6a9e3d1..3a83763 100644 (file)
@@ -119,7 +119,7 @@ namespace System.Text
         }
 
         // private helper methods
-        private char TryBestFit(char cUnknown)
+        private static char TryBestFit(char cUnknown)
         {
             // Need to figure out our best fit character, low is beginning of array, high is 1 AFTER end of array
             int lowBound = 0;
index 241c860..6bcb50f 100644 (file)
@@ -1045,17 +1045,17 @@ namespace System.Text
             return (int)(chars - charStart);
         }
 
-        private uint GetSurrogate(char cHigh, char cLow)
+        private static uint GetSurrogate(char cHigh, char cLow)
         {
             return (((uint)cHigh - 0xD800) * 0x400) + ((uint)cLow - 0xDC00) + 0x10000;
         }
 
-        private char GetHighSurrogate(uint iChar)
+        private static char GetHighSurrogate(uint iChar)
         {
             return (char)((iChar - 0x10000) / 0x400 + 0xD800);
         }
 
-        private char GetLowSurrogate(uint iChar)
+        private static char GetLowSurrogate(uint iChar)
         {
             return (char)((iChar - 0x10000) % 0x400 + 0xDC00);
         }
index dd502ab..d6b85c5 100644 (file)
@@ -95,7 +95,7 @@ namespace System.Threading.Tasks
             return FilterTasksFromWorkItems(ThreadPool.GetQueuedWorkItems());
         }
 
-        private IEnumerable<Task> FilterTasksFromWorkItems(IEnumerable<object> tpwItems)
+        private static IEnumerable<Task> FilterTasksFromWorkItems(IEnumerable<object> tpwItems)
         {
             foreach (object tpwi in tpwItems)
             {
index 55b149d..2093db5 100644 (file)
@@ -469,7 +469,7 @@ namespace System.Threading
             EnsureThreadRequested();
         }
 
-        internal bool LocalFindAndPop(object callback)
+        internal static bool LocalFindAndPop(object callback)
         {
             ThreadPoolWorkQueueThreadLocals? tl = ThreadPoolWorkQueueThreadLocals.threadLocals;
             return tl != null && tl.workStealingQueue.LocalFindAndPop(callback);
@@ -508,7 +508,7 @@ namespace System.Threading
             return callback;
         }
 
-        public long LocalCount
+        public static long LocalCount
         {
             get
             {
@@ -1186,7 +1186,7 @@ namespace System.Threading
         internal static bool TryPopCustomWorkItem(object workItem)
         {
             Debug.Assert(null != workItem);
-            return s_workQueue.LocalFindAndPop(workItem);
+            return ThreadPoolWorkQueue.LocalFindAndPop(workItem);
         }
 
         // Get all workitems.  Called by TaskScheduler in its debugger hooks.
@@ -1278,7 +1278,7 @@ namespace System.Threading
             get
             {
                 ThreadPoolWorkQueue workQueue = s_workQueue;
-                return workQueue.LocalCount + workQueue.GlobalCount + PendingUnmanagedWorkItemCount;
+                return ThreadPoolWorkQueue.LocalCount + workQueue.GlobalCount + PendingUnmanagedWorkItemCount;
             }
         }
     }
index b9b2d38..dacf928 100644 (file)
@@ -1314,7 +1314,7 @@ namespace System
         /// <summary>
         /// Gets the offset that should be used to calculate DST end times from a UTC time.
         /// </summary>
-        private TimeSpan GetDaylightSavingsEndOffsetFromUtc(TimeSpan baseUtcOffset, AdjustmentRule rule)
+        private static TimeSpan GetDaylightSavingsEndOffsetFromUtc(TimeSpan baseUtcOffset, AdjustmentRule rule)
         {
             // NOTE: even NoDaylightTransitions rules use this logic since DST ends w.r.t. the current rule
             return baseUtcOffset + rule.BaseUtcOffsetDelta + rule.DaylightDelta; /* FUTURE: + rule.StandardDelta; */
@@ -1374,7 +1374,7 @@ namespace System
                 startTime = daylightTime.Start - dstStartOffset;
             }
 
-            TimeSpan dstEndOffset = zone.GetDaylightSavingsEndOffsetFromUtc(utc, rule);
+            TimeSpan dstEndOffset = GetDaylightSavingsEndOffsetFromUtc(utc, rule);
             DateTime endTime;
             if (rule.IsEndDateMarkerForEndOfYear() && daylightTime.End.Year < DateTime.MaxValue.Year)
             {