Skip to content
Merged

Fix typos #122174

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/design/features/RandomizedAllocationSampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool GetNextTrialResult(CLRRandom* pRandom)

Rather than generating `_cachedFailedTrials` by doing many independent queries to a random number generator we can use some math to speed this up. The probability `_cachedFailedTrials` has some particular value `X` is given by the [Geometric distribution](https://en.wikipedia.org/wiki/Geometric_distribution). We can use [Inverse Transform Sampling](https://en.wikipedia.org/wiki/Inverse_transform_sampling) to generate random values for this distribution directly. The CDF for the Geometric distribution is `1-(1-p)^(floor(x)+1)` which means the inverse is `floor(ln(1-y)/ln(1-p))`.

We've been using BigInteger so far because mathmatically there is a non-zero probability of getting an arbitrarily large number of failed trials in a row. In practice however our PRNG has its outputs constrained to return a floating point number with value k/MAX_INT for an integer value of k between 0 and MAX_INT-1. The largest value PopulateTrials() can return under these constraints is ~2.148M which means a 32bit integer can easily accomodate the value. The perfect mathematical model of the Geometric distribution has a 0.00000005% chance of getting a larger run of failed trials but our PRNG rounds that incredibly unlikely case to zero probability.
We've been using BigInteger so far because mathematically there is a non-zero probability of getting an arbitrarily large number of failed trials in a row. In practice however our PRNG has its outputs constrained to return a floating point number with value k/MAX_INT for an integer value of k between 0 and MAX_INT-1. The largest value PopulateTrials() can return under these constraints is ~2.148M which means a 32bit integer can easily accommodate the value. The perfect mathematical model of the Geometric distribution has a 0.00000005% chance of getting a larger run of failed trials but our PRNG rounds that incredibly unlikely case to zero probability.

Both of these changes combined give the pseudo-code

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4892,7 +4892,7 @@ void CodeGen::genCodeForSelect(GenTreeOp* tree)
emit->emitIns_R_R_R_COND(ins, attr, targetReg, srcReg1, srcReg2, JumpKindToInsCond(prevDesc.jumpKind1));
}

// Some floating point comparision conditions require an additional condition check.
// Some floating point comparison conditions require an additional condition check.
// These checks are emitted as a subsequent check using GT_AND or GT_OR nodes.
// e.g., using GT_OR => `dest = (cond1 || cond2) ? src1 : src2`
// GT_AND => `dest = (cond1 && cond2) ? src1 : src2`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static IntPtr RhpResolveInterfaceMethod(object pObject, IntPtr pCell)
{
if (pObject == null)
{
// Optimizer may perform code motion on dispatch such that it occurs independant of
// Optimizer may perform code motion on dispatch such that it occurs independent of
// null check on "this" pointer. Allow for this case by returning back an invalid pointer.
return IntPtr.Zero;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace ILCompiler.ObjectWriter
/// (> 65279). Some of the fields in the ELF file header are moved to the
/// first (NULL) section header. The symbol table that is normally a single
/// section in the file is extended with a second .symtab_shndx section
/// to accomodate the section indexes that don't fit within the regular
/// to accommodate the section indexes that don't fit within the regular
/// section number field.
/// </remarks>
internal sealed partial class ElfObjectWriter : UnixObjectWriter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace ILCompiler.ObjectWriter
/// (> 65279). Some of the fields in the ELF file header are moved to the
/// first (NULL) section header. The symbol table that is normally a single
/// section in the file is extended with a second .symtab_shndx section
/// to accomodate the section indexes that don't fit within the regular
/// to accommodate the section indexes that don't fit within the regular
/// section number field.
/// </remarks>
internal sealed partial class ElfObjectWriter : UnixObjectWriter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public static MachObjectFile Create(IMachOFileReader file)
public bool HasSignature => !_codeSignatureLoadCommand.Command.IsDefault;

/// <summary>
/// Adds or replaces the code signature load command and modifies the __LINKEDIT segment size to accomodate the signature.
/// Adds or replaces the code signature load command and modifies the __LINKEDIT segment size to accommodate the signature.
/// Writes the EmbeddedSignature blob to the file.
/// Returns the new size of the file (the end of the signature blob).
/// </summary>
Expand Down Expand Up @@ -430,7 +430,7 @@ private void AllocateCodeSignatureLoadCommand(string identifier)

if (_codeSignatureLoadCommand.Command.IsDefault)
{
// Update the header to accomodate the new code signature load command
// Update the header to accommodate the new code signature load command
_header.NumberOfCommands += 1;
_header.SizeOfCommands += (uint)sizeof(LinkEditLoadCommand);
if (_header.SizeOfCommands > _lowestSectionOffset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ private bool TryInsert(int index, TKey key, TValue value, InsertionBehavior beha
Entry[]? entries = _entries;
Debug.Assert(entries is not null);

// Grow capacity if necessary to accomodate the extra entry.
// Grow capacity if necessary to accommodate the extra entry.
if (entries.Length == _count)
{
Resize(HashHelpers.ExpandPrime(entries.Length));
Expand Down Expand Up @@ -1079,7 +1079,7 @@ private void RehashIfNecessary(uint collisionCount, Entry[] entries)
private void Resize(int newSize, bool forceNewHashCodes = false)
{
Debug.Assert(!forceNewHashCodes || !typeof(TKey).IsValueType, "Value types never rehash.");
Debug.Assert(newSize >= _count, "The requested size must accomodate all of the current elements.");
Debug.Assert(newSize >= _count, "The requested size must accommodate all of the current elements.");

// Create the new arrays. We allocate both prior to storing either; in case one of the allocation fails,
// we want to avoid corrupting the data structure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ internal static void Refresh()
{
ConfigurationManager.RefreshSection("system.diagnostics");

// There might still be some persistant state left behind for
// There might still be some persistent state left behind for
// ConfigPropertyCollection (for ex, swtichelements), probably for perf.
// We need to explicitly cleanup any unrecognized attributes that we
// have added during last deserialization, so that they are re-added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ public void UserProcessorTime_GetNotStarted_ThrowsInvalidOperationException()

[Fact]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")]
public void PriviledgedProcessorTime_GetNotStarted_ThrowsInvalidOperationException()
public void PrivilegedProcessorTime_GetNotStarted_ThrowsInvalidOperationException()
{
var process = new Process();
Assert.Throws<InvalidOperationException>(() => process.PrivilegedProcessorTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public PaxTarEntry(TarEntryType entryType, string entryName, IEnumerable<KeyValu
/// <para>-or-</para>
/// <para>The entry type of <paramref name="other"/> is not supported for conversion to the PAX format.</para>
/// </exception>
/// <remarks>When converting a <see cref="GnuTarEntry"/> to <see cref="PaxTarEntry"/> using this constructor, the <see cref="GnuTarEntry.AccessTime"/> and <see cref="GnuTarEntry.ChangeTime"/> values will get transfered to the <see cref="ExtendedAttributes" /> dictionary only if their values are not <see langword="default"/> (which is <see cref="DateTimeOffset.MinValue"/>).</remarks>
/// <remarks>When converting a <see cref="GnuTarEntry"/> to <see cref="PaxTarEntry"/> using this constructor, the <see cref="GnuTarEntry.AccessTime"/> and <see cref="GnuTarEntry.ChangeTime"/> values will get transferred to the <see cref="ExtendedAttributes" /> dictionary only if their values are not <see langword="default"/> (which is <see cref="DateTimeOffset.MinValue"/>).</remarks>
public PaxTarEntry(TarEntry other)
: base(other, TarEntryFormat.Pax)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void TimeoutIsRespected(int timeout)
[InlineData(1)]
[InlineData(50)]
[InlineData(1000)]
[PlatformSpecific(TestPlatforms.AnyUnix)] // Tests un-priviledged Ping support on Unix
[PlatformSpecific(TestPlatforms.AnyUnix)] // Tests un-privileged Ping support on Unix
public static async Task PacketSizeIsRespected(int payloadSize)
{
var stdOutLines = new List<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void Constructor_NullIPAddress_ThrowsArgumentNullException()
[InlineData("192.168.0.1", 33)]
[InlineData("::", -1)]
[InlineData("ffff::", 129)]
public void Constructor_PrefixLenghtOutOfRange_ThrowsArgumentOutOfRangeException(string ipStr, int prefixLength)
public void Constructor_PrefixLengthOutOfRange_ThrowsArgumentOutOfRangeException(string ipStr, int prefixLength)
{
IPAddress address = IPAddress.Parse(ipStr);
Assert.Throws<ArgumentOutOfRangeException>(() => new IPNetwork(address, prefixLength));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected virtual void Dispose(bool disposing)
{
//
// explicit cleanup is done by calling Dispose with true from
// Dispose() or Close(). The disposing arguement is ignored because there
// Dispose() or Close(). The disposing argument is ignored because there
// are no unmanaged resources.
// The finalizer calls Dispose with false.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private unsafe (string, string) JSGetLocaleInfo(string cultureName, string local
string result = new string(buffer, 0, resultLength);
string[] subresults = result.Split("##");
if (subresults.Length == 0)
throw new Exception("LocaleInfo recieved from the Browser is in incorrect format.");
throw new Exception("LocaleInfo received from the Browser is in incorrect format.");
if (subresults.Length == 1)
return (subresults[0], ""); // Neutral culture
return (subresults[0], subresults[1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ private static unsafe nuint ChangeCase<TFrom, TTo, TCasing>(TFrom* pSrc, TTo* pD

TFrom SourceSignedMinValue = TFrom.CreateTruncating(1 << (8 * sizeof(TFrom) - 1));
Vector128<TFrom> subtractionVector = Vector128.Create(conversionIsToUpper ? (SourceSignedMinValue + TFrom.CreateTruncating('a')) : (SourceSignedMinValue + TFrom.CreateTruncating('A')));
Vector128<TFrom> comparisionVector = Vector128.Create(SourceSignedMinValue + TFrom.CreateTruncating(26 /* A..Z or a..z */));
Vector128<TFrom> comparisonVector = Vector128.Create(SourceSignedMinValue + TFrom.CreateTruncating(26 /* A..Z or a..z */));
Vector128<TFrom> caseConversionVector = Vector128.Create(TFrom.CreateTruncating(0x20)); // works both directions

Vector128<TFrom> matches = SignedLessThan((srcVector - subtractionVector), comparisionVector);
Vector128<TFrom> matches = SignedLessThan((srcVector - subtractionVector), comparisonVector);
srcVector ^= (matches & caseConversionVector);

// Now write to the destination.
Expand Down Expand Up @@ -298,7 +298,7 @@ private static unsafe nuint ChangeCase<TFrom, TTo, TCasing>(TFrom* pSrc, TTo* pD

// Now find matching characters and perform case conversion.

matches = SignedLessThan((srcVector - subtractionVector), comparisionVector);
matches = SignedLessThan((srcVector - subtractionVector), comparisonVector);
srcVector ^= (matches & caseConversionVector);

// Now write to the destination.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public static void PolymorphicBaseClassConverter_IsPassedCorrectTypeToConvertPar

// Validate that the correct typeToConvert parameter is passed in all serialization contexts:
// 1. Typed root value.
// 2. Untyped root value (where the reported regression occured).
// 2. Untyped root value (where the reported regression occurred).
// 3. Nested values in POCOs, collections & dictionaries.

DerivedClass result = JsonSerializer.Deserialize<DerivedClass>("{}", options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5216,7 +5216,7 @@ void EmitIndexOf(RegexNode node, bool useLast, bool negate)
}

// IndexOfAny{Except}(ch1, ...)
Span<char> setChars = stackalloc char[128]; // arbitrary cut-off that accomodates all of ASCII and doesn't take too long to compute
Span<char> setChars = stackalloc char[128]; // arbitrary cut-off that accommodates all of ASCII and doesn't take too long to compute
int setCharsCount = RegexCharClass.GetSetChars(node.Str, setChars);
if (setCharsCount > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public MintermClassifier(BDD[] minterms)
// Compute all minterm ranges. We do this here in order to determine the maximum character value
// in order to size the lookup array to minimize steady-state memory consumption of the potentially
// large lookup array. We prefer to use the byte[] _lookup when possible, in order to keep memory
// consumption to a minimum; doing so accomodates up to 255 minterms, which is the vast majority case.
// consumption to a minimum; doing so accommodates up to 255 minterms, which is the vast majority case.
// However, when there are more than 255 minterms, we need to use int[] _intLookup. We rent an object[]
// rather than a (uint,uint)[][] to avoid the extra type pressure on the ArrayPool (object[]s are common,
// (uint,uint)[][]s much less so).
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/metadata/class-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ mono_class_setup_fields (MonoClass *klass)
if (mono_get_runtime_callbacks ()->mono_class_set_deferred_type_load_failure_callback (klass, "Inline array struct must not have explicit layout."))
break;
else
; // failure occured during AOT compilation, continue execution
; // failure occurred during AOT compilation, continue execution
} else {
mono_class_set_type_load_failure (klass, "Inline array struct must not have explicit layout.");
break;
Expand Down Expand Up @@ -2359,7 +2359,7 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
if (mono_get_runtime_callbacks ()->mono_class_set_deferred_type_load_failure_callback (klass, "Inline array struct size out of bounds, abnormally large."))
break;
else
size = initial_size; // failure occured during AOT compilation, continue execution
size = initial_size; // failure occurred during AOT compilation, continue execution
} else {
mono_class_set_type_load_failure (klass, "Inline array struct size out of bounds, abnormally large.");
break;
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6022,7 +6022,7 @@ mono_marshal_load_standard_layout_type_info(MonoClass* klass, MonoMarshalType* i
if (mono_get_runtime_callbacks ()->mono_class_set_deferred_type_load_failure_callback (klass, "Inline array struct size out of bounds, abnormally large."))
break;
else
size = initial_size; // failure occured during AOT compilation, continue execution
size = initial_size; // failure occurred during AOT compilation, continue execution
} else {
mono_class_set_type_load_failure (klass, "Inline array struct size out of bounds, abnormally large.");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static bool ConfigureEncryption(EVP_PKEY_CTX* ctx, RsaPaddingMode padding, const

EVP_PKEY_CTX_ctrl_str(ctx, "rsa_pkcs1_implicit_rejection", "0");

// Undo any changes to the error queue that may have occured while configuring implicit rejection if the
// Undo any changes to the error queue that may have occurred while configuring implicit rejection if the
// current version does not support implicit rejection.
ERR_pop_to_mark();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static int TestEntryPoint()
try
{
Console.WriteLine("Throwing ArgumentOutOfRangeException..");
throw new ArgumentOutOfRangeException("Arguement Name", 1, "Arguement Shame");
throw new ArgumentOutOfRangeException("Argument Name", 1, "Argument Shame");

}
catch(ArgumentOutOfRangeException e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static int Main(string[] args)
[DllImport("Profiler")]
public static extern int SwitchInlining(bool disable);

// this retrieves the number of inlining operations that occured
// this retrieves the number of inlining operations that occurred
[DllImport("Profiler")]
public static extern int GetInlineCount();
}
Expand Down
Loading