Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Mirror changes from dotnet/coreclr #33446

Merged
merged 2 commits into from
Nov 13, 2018
Merged
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
34 changes: 17 additions & 17 deletions eng/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
These ref versions are pulled from https://github.com/dotnet/versions.
-->
<PropertyGroup>
<CoreFxCurrentRef>8f6558c7dc6384d0341d9bbe45741f0bb035c039</CoreFxCurrentRef>
<CoreClrCurrentRef>8f6558c7dc6384d0341d9bbe45741f0bb035c039</CoreClrCurrentRef>
<CoreSetupCurrentRef>4107975d8819ff8690e655f89044e169c092f614</CoreSetupCurrentRef>
<CoreFxCurrentRef>00c6269cccac9368c02bc7da887c9b4d4ed81cb3</CoreFxCurrentRef>
<CoreClrCurrentRef>00c6269cccac9368c02bc7da887c9b4d4ed81cb3</CoreClrCurrentRef>
<CoreSetupCurrentRef>00c6269cccac9368c02bc7da887c9b4d4ed81cb3</CoreSetupCurrentRef>
<ExternalCurrentRef>96dc7805f5df4a70a55783964ce69dcd91bfca80</ExternalCurrentRef>
<ProjectNTfsCurrentRef>3d83d48dc99e1dc3b90a649c21c01c32a4c45f22</ProjectNTfsCurrentRef>
<ProjectNTfsTestILCCurrentRef>3d83d48dc99e1dc3b90a649c21c01c32a4c45f22</ProjectNTfsTestILCCurrentRef>
<ProjectNTfsCurrentRef>00c6269cccac9368c02bc7da887c9b4d4ed81cb3</ProjectNTfsCurrentRef>
<ProjectNTfsTestILCCurrentRef>00c6269cccac9368c02bc7da887c9b4d4ed81cb3</ProjectNTfsTestILCCurrentRef>
<SniCurrentRef>8bd1ec5fac9f0eec34ff6b34b1d878b4359e02dd</SniCurrentRef>
<StandardCurrentRef>9004703a1923e5c5582ceb8d79712df777412446</StandardCurrentRef>
<BuildToolsCurrentRef>2f9cc14c9526d0f6c292b6ce49f57f4a59c05774</BuildToolsCurrentRef>
<CoreFxOptimizationDataCurrentRef>3d83d48dc99e1dc3b90a649c21c01c32a4c45f22</CoreFxOptimizationDataCurrentRef>
<CoreFxOptimizationDataCurrentRef>00c6269cccac9368c02bc7da887c9b4d4ed81cb3</CoreFxOptimizationDataCurrentRef>
</PropertyGroup>

<!-- Product dependency versions. -->
Expand All @@ -32,16 +32,16 @@

<!-- Tests/infrastructure dependency versions. -->
<PropertyGroup>
<CoreFxExpectedPrerelease>preview.18562.3</CoreFxExpectedPrerelease>
<MicrosoftNETCorePlatformsPackageVersion>3.0.0-preview.18562.3</MicrosoftNETCorePlatformsPackageVersion>
<MicrosoftNETCoreRuntimeCoreCLRPackageVersion>3.0.0-preview-27112-03</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
<MicrosoftNetCoreIlasmPackageVersion>3.0.0-preview-27112-03</MicrosoftNetCoreIlasmPackageVersion>
<ProjectNTfsExpectedPrerelease>beta-27112-00</ProjectNTfsExpectedPrerelease>
<ProjectNTfsTestILCExpectedPrerelease>beta-27112-00</ProjectNTfsTestILCExpectedPrerelease>
<ProjectNTfsTestILCPackageVersion>1.0.0-beta-27112-00</ProjectNTfsTestILCPackageVersion>
<MicrosoftNETCoreDotNetHostPackageVersion>3.0.0-preview-27109-05</MicrosoftNETCoreDotNetHostPackageVersion>
<MicrosoftNETCoreDotNetHostPolicyPackageVersion>3.0.0-preview-27109-05</MicrosoftNETCoreDotNetHostPolicyPackageVersion>
<MicrosoftNETCoreAppPackageVersion>3.0.0-preview-27109-05</MicrosoftNETCoreAppPackageVersion>
<CoreFxExpectedPrerelease>preview.18563.1</CoreFxExpectedPrerelease>
<MicrosoftNETCorePlatformsPackageVersion>3.0.0-preview.18563.1</MicrosoftNETCorePlatformsPackageVersion>
<MicrosoftNETCoreRuntimeCoreCLRPackageVersion>3.0.0-preview-27113-05</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
<MicrosoftNetCoreIlasmPackageVersion>3.0.0-preview-27113-05</MicrosoftNetCoreIlasmPackageVersion>
<ProjectNTfsExpectedPrerelease>beta-27113-00</ProjectNTfsExpectedPrerelease>
<ProjectNTfsTestILCExpectedPrerelease>beta-27113-00</ProjectNTfsTestILCExpectedPrerelease>
<ProjectNTfsTestILCPackageVersion>1.0.0-beta-27113-00</ProjectNTfsTestILCPackageVersion>
<MicrosoftNETCoreDotNetHostPackageVersion>3.0.0-preview-27112-04</MicrosoftNETCoreDotNetHostPackageVersion>
<MicrosoftNETCoreDotNetHostPolicyPackageVersion>3.0.0-preview-27112-04</MicrosoftNETCoreDotNetHostPolicyPackageVersion>
<MicrosoftNETCoreAppPackageVersion>3.0.0-preview-27112-04</MicrosoftNETCoreAppPackageVersion>

<!-- CoreFX-built SNI identity package -->
<RuntimeNativeSystemDataSqlClientSniPackageVersion>4.4.0</RuntimeNativeSystemDataSqlClientSniPackageVersion>
Expand All @@ -59,7 +59,7 @@
<TestILCArmretPackageVersion>$(ProjectNTfsTestILCPackageVersion)</TestILCArmretPackageVersion>
<TestILCX86retPackageVersion>$(ProjectNTfsTestILCPackageVersion)</TestILCX86retPackageVersion>
<OptimizationDataVersion>2.0.0-rc-61101-17</OptimizationDataVersion>
<CoreFxOptimizationDataVersion>99.99.99-master-20181112-0045</CoreFxOptimizationDataVersion>
<CoreFxOptimizationDataVersion>99.99.99-master-20181113-0044</CoreFxOptimizationDataVersion>
</PropertyGroup>

<!-- Package versions used as toolsets -->
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18556.6",
"Microsoft.NET.Sdk.IL": "3.0.0-preview-27112-03"
"Microsoft.NET.Sdk.IL": "3.0.0-preview-27113-05"
}
}
50 changes: 50 additions & 0 deletions src/Common/src/CoreLib/System.Private.CoreLib.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\IPinnable.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\MemoryHandle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\MemoryManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\StandardFormat.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\TlsOverPerCoreLockedStacksArrayPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Utilities.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Binary\Reader.cs" />
Expand All @@ -60,6 +61,55 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Binary\WriterBigEndian.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Binary\WriterLittleEndian.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\FormattingHelpers.CountDigits.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Constants.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\FormattingHelpers.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Boolean.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Date.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Date.G.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Date.L.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Date.O.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Date.R.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Decimal.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Decimal.E.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Decimal.F.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Decimal.G.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Float.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Guid.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.Signed.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.Signed.D.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.Signed.Default.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.Signed.N.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.Unsigned.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.Unsigned.D.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.Unsigned.Default.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.Unsigned.N.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.Unsigned.X.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Formatter\Utf8Formatter.TimeSpan.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\ParserHelpers.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Boolean.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Date.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Date.Default.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Date.G.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Date.Helpers.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Date.O.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Date.R.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Decimal.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Float.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Guid.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Signed.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Signed.D.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Signed.N.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Unsigned.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Unsigned.D.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Unsigned.N.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Unsigned.X.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.Number.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.TimeSpan.BigG.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.TimeSpan.C.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.TimeSpan.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.TimeSpan.LittleG.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Text\Utf8Parser\Utf8Parser.TimeSpanSplitter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Byte.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Char.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\CharEnumerator.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,15 @@ public static uint DivMod(uint numerator, uint denominator, out uint modulo)
}

#endregion Math Helper methods

//
// Enable use of ThrowHelper from TryFormat() routines without introducing dozens of non-code-coveraged "bytesWritten = 0; return false" boilerplate.
//
public static bool TryFormatThrowFormatException(out int bytesWritten)
{
bytesWritten = 0;
ThrowHelper.ThrowFormatException_BadFormatSpecifier();
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static bool TryFormat(bool value, Span<byte> destination, out int bytesWr
return false;

BadFormat:
return ThrowHelper.TryFormatThrowFormatException(out bytesWritten);
return FormattingHelpers.TryFormatThrowFormatException(out bytesWritten);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static bool TryFormat(DateTimeOffset value, Span<byte> destination, out i
return TryFormatDateTimeG(value.DateTime, offset, destination, out bytesWritten);

default:
return ThrowHelper.TryFormatThrowFormatException(out bytesWritten);
return FormattingHelpers.TryFormatThrowFormatException(out bytesWritten);
}
}

Expand Down Expand Up @@ -164,7 +164,7 @@ public static bool TryFormat(DateTime value, Span<byte> destination, out int byt
return TryFormatDateTimeG(value, Utf8Constants.NullUtcOffset, destination, out bytesWritten);

default:
return ThrowHelper.TryFormatThrowFormatException(out bytesWritten);
return FormattingHelpers.TryFormatThrowFormatException(out bytesWritten);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.Buffers.Text
{
public static partial class Utf8Formatter
{
private static bool TryFormatDecimalE(ref NumberBuffer number, Span<byte> destination, out int bytesWritten, byte precision, byte exponentSymbol)
private static bool TryFormatDecimalE(ref Number.NumberBuffer number, Span<byte> destination, out int bytesWritten, byte precision, byte exponentSymbol)
{
const int NumExponentDigits = 3;

Expand Down Expand Up @@ -89,7 +89,7 @@ private static bool TryFormatDecimalE(ref NumberBuffer number, Span<byte> destin
exponent = -exponent;
}

Debug.Assert(exponent < Number.DECIMAL_PRECISION, "If you're trying to reuse this routine for double/float, you'll need to review the code carefully for Decimal-specific assumptions.");
Debug.Assert(exponent < Number.DecimalPrecision, "If you're trying to reuse this routine for double/float, you'll need to review the code carefully for Decimal-specific assumptions.");

// Emit exactly three digits for the exponent.
destination[dstIndex++] = (byte)'0'; // The exponent for Decimal can never exceed 28 (let alone 99)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.Buffers.Text
{
public static partial class Utf8Formatter
{
private static bool TryFormatDecimalF(ref NumberBuffer number, Span<byte> destination, out int bytesWritten, byte precision)
private static bool TryFormatDecimalF(ref Number.NumberBuffer number, Span<byte> destination, out int bytesWritten, byte precision)
{
int scale = number.Scale;
ReadOnlySpan<byte> digits = number.Digits;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ namespace System.Buffers.Text
{
public static partial class Utf8Formatter
{
private static bool TryFormatDecimalG(ref NumberBuffer number, Span<byte> destination, out int bytesWritten)
private static bool TryFormatDecimalG(ref Number.NumberBuffer number, Span<byte> destination, out int bytesWritten)
{
int scale = number.Scale;
ReadOnlySpan<byte> digits = number.Digits;
int numDigits = number.NumDigits;
int numDigits = number.DigitsCount;

bool isFraction = scale < numDigits;
int numBytesNeeded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static partial class Utf8Formatter
/// <exceptions>
/// <cref>System.FormatException</cref> if the format is not valid for this data type.
/// </exceptions>
public static bool TryFormat(decimal value, Span<byte> destination, out int bytesWritten, StandardFormat format = default)
public static unsafe bool TryFormat(decimal value, Span<byte> destination, out int bytesWritten, StandardFormat format = default)
{
if (format.IsDefault)
{
Expand All @@ -42,8 +42,11 @@ public static bool TryFormat(decimal value, Span<byte> destination, out int byte
{
if (format.Precision != StandardFormat.NoPrecision)
throw new NotSupportedException(SR.Argument_GWithPrecisionNotSupported);
NumberBuffer number = default;
Number.DecimalToNumber(value, ref number);

byte* pDigits = stackalloc byte[Number.DecimalNumberBufferLength];
Number.NumberBuffer number = new Number.NumberBuffer(Number.NumberBufferKind.Decimal, pDigits, Number.DecimalNumberBufferLength);

Number.DecimalToNumber(ref value, ref number);
bool success = TryFormatDecimalG(ref number, destination, out bytesWritten);
#if DEBUG
// This DEBUG segment exists to close a code coverage hole inside TryFormatDecimalG(). Because we don't call RoundNumber() on this path, we have no way to feed
Expand All @@ -52,7 +55,7 @@ public static bool TryFormat(decimal value, Span<byte> destination, out int byte
if (success)
{
Span<byte> digits = number.Digits;
int numDigits = number.NumDigits;
int numDigits = number.DigitsCount;
if (numDigits != 0 && number.Scale == numDigits && digits[numDigits - 1] == '0')
{
while (numDigits != 0 && digits[numDigits - 1] == '0')
Expand All @@ -61,6 +64,7 @@ public static bool TryFormat(decimal value, Span<byte> destination, out int byte
numDigits--;
}

number.DigitsCount = numDigits;
number.CheckConsistency();

byte[] buffer2 = new byte[destination.Length];
Expand All @@ -81,8 +85,10 @@ public static bool TryFormat(decimal value, Span<byte> destination, out int byte
case 'f':
case 'F':
{
NumberBuffer number = default;
Number.DecimalToNumber(value, ref number);
byte* pDigits = stackalloc byte[Number.DecimalNumberBufferLength];
Number.NumberBuffer number = new Number.NumberBuffer(Number.NumberBufferKind.Decimal, pDigits, Number.DecimalNumberBufferLength);

Number.DecimalToNumber(ref value, ref number);
byte precision = (format.Precision == StandardFormat.NoPrecision) ? (byte)2 : format.Precision;
Number.RoundNumber(ref number, number.Scale + precision);
return TryFormatDecimalF(ref number, destination, out bytesWritten, precision);
Expand All @@ -91,15 +97,17 @@ public static bool TryFormat(decimal value, Span<byte> destination, out int byte
case 'e':
case 'E':
{
NumberBuffer number = default;
Number.DecimalToNumber(value, ref number);
byte* pDigits = stackalloc byte[Number.DecimalNumberBufferLength];
Number.NumberBuffer number = new Number.NumberBuffer(Number.NumberBufferKind.Decimal, pDigits, Number.DecimalNumberBufferLength);

Number.DecimalToNumber(ref value, ref number);
byte precision = (format.Precision == StandardFormat.NoPrecision) ? (byte)6 : format.Precision;
Number.RoundNumber(ref number, precision + 1);
return TryFormatDecimalE(ref number, destination, out bytesWritten, precision, exponentSymbol: (byte)format.Symbol);
}

default:
return ThrowHelper.TryFormatThrowFormatException(out bytesWritten);
return FormattingHelpers.TryFormatThrowFormatException(out bytesWritten);
}
}
}
Expand Down
Loading