Skip to content

Commit af989aa

Browse files
authored
Merge branch 'main' into feature/system.io.mmf/unix-memfdcreate
2 parents 0d86fd1 + 043ae8c commit af989aa

File tree

14 files changed

+34
-31
lines changed

14 files changed

+34
-31
lines changed

src/coreclr/vm/comreflectioncache.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ template <class Element, class CacheType, int CacheSize> class ReflectionCache
2626

2727
void Init();
2828

29+
#ifndef DACCESS_COMPILE
2930
BOOL GetFromCache(Element *pElement, CacheType& rv)
3031
{
3132
CONTRACTL
@@ -102,6 +103,7 @@ template <class Element, class CacheType, int CacheSize> class ReflectionCache
102103
AdjustStamp(TRUE);
103104
this->LeaveWrite();
104105
}
106+
#endif // !DACCESS_COMPILE
105107

106108
private:
107109
// Lock must have been taken before calling this.
@@ -141,6 +143,7 @@ template <class Element, class CacheType, int CacheSize> class ReflectionCache
141143
return CacheSize;
142144
}
143145

146+
#ifndef DACCESS_COMPILE
144147
void AdjustStamp(BOOL hasWriterLock)
145148
{
146149
CONTRACTL
@@ -170,6 +173,7 @@ template <class Element, class CacheType, int CacheSize> class ReflectionCache
170173
if (!hasWriterLock)
171174
this->LeaveWrite();
172175
}
176+
#endif // !DACCESS_COMPILE
173177

174178
void UpdateHashTable(SIZE_T hash, int slot)
175179
{

src/libraries/Common/src/Extensions/Logging/DebuggerDisplayFormatting.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ internal static string DebuggerToString(string name, ILogger logger)
3131

3232
internal static LogLevel? CalculateEnabledLogLevel(ILogger logger)
3333
{
34-
ReadOnlySpan<LogLevel> logLevels = stackalloc LogLevel[]
35-
{
34+
ReadOnlySpan<LogLevel> logLevels =
35+
[
3636
LogLevel.Critical,
3737
LogLevel.Error,
3838
LogLevel.Warning,
3939
LogLevel.Information,
4040
LogLevel.Debug,
4141
LogLevel.Trace,
42-
};
42+
];
4343

4444
LogLevel? minimumLevel = null;
4545

src/libraries/Common/src/System/Net/Security/MD4.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ internal static void HashData(ReadOnlySpan<byte> source, Span<byte> destination)
6666

6767
Span<byte> buffer = stackalloc byte[64];
6868
buffer.Clear();
69+
6970
// Initialize the context
70-
Span<uint> state = stackalloc uint[4] { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 };
71-
Span<uint> count = stackalloc uint[2] { 0, 0 };
71+
Span<uint> state = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476];
72+
Span<uint> count = [0, 0];
7273

7374
HashCore(source, state, count, buffer);
7475

src/libraries/Microsoft.Bcl.Cryptography/src/System/Security/Cryptography/SP800108HmacCounterKdfImplementationCng.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal unsafe SP800108HmacCounterKdfImplementationCng(ReadOnlySpan<byte> key,
3838
else
3939
{
4040
// CNG requires a non-null pointer even when the length is zero.
41-
symmetricKeyMaterial = stackalloc byte[] { 0 };
41+
symmetricKeyMaterial = [0];
4242
symmetricKeyMaterialLength = 0;
4343
}
4444

@@ -82,7 +82,7 @@ internal unsafe SP800108HmacCounterKdfImplementationCng(byte[] key, HashAlgorith
8282
else
8383
{
8484
// CNG requires a non-null pointer even when the length is zero.
85-
symmetricKeyMaterial = stackalloc byte[] { 0 };
85+
symmetricKeyMaterial = [0];
8686
symmetricKeyMaterialLength = 0;
8787
}
8888

src/libraries/Microsoft.Extensions.Logging/src/Logger.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,15 @@ private sealed class LoggerProviderDebugView(string providerName, MessageLogger?
238238
return null;
239239
}
240240

241-
ReadOnlySpan<LogLevel> logLevels = stackalloc LogLevel[]
242-
{
241+
ReadOnlySpan<LogLevel> logLevels =
242+
[
243243
LogLevel.Critical,
244244
LogLevel.Error,
245245
LogLevel.Warning,
246246
LogLevel.Information,
247247
LogLevel.Debug,
248248
LogLevel.Trace,
249-
};
249+
];
250250

251251
LogLevel? minimumLevel = null;
252252

src/libraries/System.Private.CoreLib/src/System/StartupHookProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ private static unsafe void CallStartupHook(char* pStartupHookPart)
8585

8686
private static void ParseStartupHook(ref StartupHookNameOrPath startupHook, string startupHookPart)
8787
{
88-
ReadOnlySpan<char> disallowedSimpleAssemblyNameChars = stackalloc char[4]
89-
{
88+
ReadOnlySpan<char> disallowedSimpleAssemblyNameChars =
89+
[
9090
Path.DirectorySeparatorChar,
9191
Path.AltDirectorySeparatorChar,
9292
' ',
9393
','
94-
};
94+
];
9595

9696
if (string.IsNullOrEmpty(startupHookPart))
9797
{

src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBufferReader.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,13 @@ public decimal ReadDecimal()
396396
{
397397
byte[] buffer = GetBuffer(ValueHandleLength.Decimal, out int offset);
398398
ReadOnlySpan<byte> bytes = buffer.AsSpan(offset, sizeof(decimal));
399-
ReadOnlySpan<int> span = stackalloc int[4]
400-
{
399+
ReadOnlySpan<int> span =
400+
[
401401
BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(8, 4)),
402402
BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(12, 4)),
403403
BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(4, 4)),
404404
BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(0, 4))
405-
};
405+
];
406406

407407
Advance(ValueHandleLength.Decimal);
408408
return new decimal(span);
@@ -975,13 +975,13 @@ public decimal GetDecimal(int offset)
975975
else
976976
{
977977
ReadOnlySpan<byte> bytes = _buffer.AsSpan(offset, sizeof(decimal));
978-
ReadOnlySpan<int> span = stackalloc int[4]
979-
{
978+
ReadOnlySpan<int> span =
979+
[
980980
BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(8, 4)),
981981
BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(12, 4)),
982982
BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(4, 4)),
983983
BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(0, 4))
984-
};
984+
];
985985

986986
return new decimal(span);
987987
}

src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHelpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ internal static void WriteByteStringLength(IncrementalHash hasher, ulong value)
4747
if (value < (byte)CborAdditionalInfo.Additional8BitData)
4848
{
4949
initialByte = new CborInitialByte(MajorType, (CborAdditionalInfo)value);
50-
hasher.AppendData(stackalloc byte[] { initialByte.InitialByte });
50+
hasher.AppendData([initialByte.InitialByte]);
5151
}
5252
else if (value <= byte.MaxValue)
5353
{
5454
initialByte = new CborInitialByte(MajorType, CborAdditionalInfo.Additional8BitData);
55-
hasher.AppendData(stackalloc byte[] { initialByte.InitialByte, (byte)value });
55+
hasher.AppendData([initialByte.InitialByte, (byte)value]);
5656
}
5757
else if (value <= ushort.MaxValue)
5858
{

src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.RSA.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,7 @@ protected override RSASignaturePadding GetSignaturePadding(
186186
return RSASignaturePadding.Pkcs1;
187187
}
188188

189-
Span<byte> expectedParameters = stackalloc byte[2];
190-
expectedParameters[0] = 0x05;
191-
expectedParameters[1] = 0x00;
189+
ReadOnlySpan<byte> expectedParameters = [0x05, 0x00];
192190

193191
if (expectedParameters.SequenceEqual(signatureParameters.Value.Span))
194192
{

src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Pbkdf2Implementation.Windows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private static unsafe void FillKeyDerivation(
6060
if (password.IsEmpty)
6161
{
6262
// CNG won't accept a null pointer for the password.
63-
symmetricKeyMaterial = stackalloc byte[1];
63+
symmetricKeyMaterial = [0];
6464
symmetricKeyMaterialLength = 0;
6565
clearSpan = default;
6666
}

src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/DefaultJavaScriptEncoder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ private DefaultJavaScriptEncoder(TextEncoderSettings settings, bool allowMinimal
3131

3232
_innerEncoder = allowMinimalJsonEscaping
3333
? new OptimizedInboxTextEncoder(EscaperImplementation.SingletonMinimallyEscaped, settings.GetAllowedCodePointsBitmap(), forbidHtmlSensitiveCharacters: false,
34-
extraCharactersToEscape: stackalloc char[] { '\"', '\\' })
34+
extraCharactersToEscape: ['\"', '\\'])
3535
: new OptimizedInboxTextEncoder(EscaperImplementation.Singleton, settings.GetAllowedCodePointsBitmap(), forbidHtmlSensitiveCharacters: true,
36-
extraCharactersToEscape: stackalloc char[] { '\\', '`' });
36+
extraCharactersToEscape: ['\\', '`']);
3737
}
3838

3939
public override int MaxOutputCharactersPerInputCharacter => 6; // "\uXXXX" for a single char ("\uXXXX\uYYYY" [12 chars] for supplementary scalar value)

src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/DefaultUrlEncoder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ internal DefaultUrlEncoder(TextEncoderSettings settings)
6464
// Basic Latin set is:
6565
// ALPHA / DIGIT / "-" / "." / "_" / "~" / "!" / "$" / "(" / ")" / "*" / "," / ";" / "@"
6666

67-
_innerEncoder = new OptimizedInboxTextEncoder(EscaperImplementation.Singleton, settings.GetAllowedCodePointsBitmap(), extraCharactersToEscape: stackalloc char[] {
67+
_innerEncoder = new OptimizedInboxTextEncoder(EscaperImplementation.Singleton, settings.GetAllowedCodePointsBitmap(), extraCharactersToEscape: [
6868
' ', // chars from Basic Latin which aren't already disallowed by the base encoder
6969
'#',
7070
'%',
@@ -96,7 +96,7 @@ internal DefaultUrlEncoder(TextEncoderSettings settings)
9696
'\uFFFD',
9797
'\uFFFE',
9898
'\uFFFF',
99-
});
99+
]);
100100
}
101101

102102
public override int MaxOutputCharactersPerInputCharacter => 9; // "%XX%YY%ZZ" for a single char ("%XX%YY%ZZ%WW" [12 chars] for supplementary scalar value)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ private static RegexCharClass ParseRecursive(string charClass, int start)
15411541
/// <param name="c">The character for which to create the set.</param>
15421542
/// <returns>The create set string.</returns>
15431543
public static string OneToStringClass(char c)
1544-
=> CharsToStringClass(stackalloc char[1] { c });
1544+
=> CharsToStringClass([c]);
15451545

15461546
internal static unsafe string CharsToStringClass(ReadOnlySpan<char> chars)
15471547
{

src/native/containers/dn-simdhash-arch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ find_first_matching_suffix_simd (
105105
dn_simdhash_suffixes match_vector;
106106
// Completely untested.
107107
static const dn_simdhash_suffixes byte_mask = {
108-
1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128
108+
{ 1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128 }
109109
};
110110
union {
111111
uint8_t b[4];

0 commit comments

Comments
 (0)