Add Decimal.TryFormat span-based method (#15145)
authorStephen Toub <stoub@microsoft.com>
Wed, 22 Nov 2017 05:13:37 +0000 (00:13 -0500)
committerGitHub <noreply@github.com>
Wed, 22 Nov 2017 05:13:37 +0000 (00:13 -0500)
commit63f1a0f6fbb0f24dc881be1defa899eae9dbf86c
tree0fbfbe1511108f75bbb31e9b55204d89f9ca6f29
parent58561e4e2c8c4973aa740a182d0d5f57f1bd8cfb
Add Decimal.TryFormat span-based method (#15145)

* Move decimal formatting to managed code

- Move decimal formatting to shared (decimal itself is still not shared)
- Delete VM's decimal formatting code

* Add Decimal.TryFormat span-based method

* Workaround ProjectN compiler bug

Apply the same attribution that's applied to the code in corert.

* Address PR feedback

* Temporarily undo explicit layout change

Seeing whether it's the cause of these failures on Unix (Ubuntu, CentOS, and OSX):
```
JIT.Directed.coverage.oldtests.lclfldadd_cs_r.lclfldadd_cs_r
JIT.Directed.perffix.primitivevt.mixed1_cs_ro.mixed1_cs_ro
JIT.Methodical.fp.exgen.1000w1d_cs_r.1000w1d_cs_r
JIT.Methodical.fp.exgen.1000w1d_cs_ro.1000w1d_cs_ro
JIT.Methodical.fp.exgen.1000w1d_cs_do.1000w1d_cs_do
JIT.Methodical.fp.exgen.1000w1d_cs_d.1000w1d_cs_d
JIT.Methodical.fp.exgen.10w5d_cs_d.10w5d_cs_d
JIT.Methodical.fp.exgen.10w5d_cs_do.10w5d_cs_do
JIT.Methodical.fp.exgen.10w5d_cs_ro.10w5d_cs_ro
JIT.Methodical.fp.exgen.200w1d-02_cs_do.200w1d-02_cs_do
JIT.Methodical.fp.exgen.10w5d_cs_r.10w5d_cs_r
JIT.Methodical.fp.exgen.200w1d-02_cs_ro.200w1d-02_cs_ro
JIT.Directed.perffix.primitivevt.mixed1_cs_do.mixed1_cs_do
```

Example failure:
```
FAILED   - JIT/Methodical/fp/exgen/200w1d-02_cs_ro/200w1d-02_cs_ro.sh
               BEGIN EXECUTION
               /mnt/j/workspace/dotnet_coreclr/master/checked_ubuntu_tst_prtest/bin/tests/Windows_NT.x64.Checked/Tests/coreoverlay/corerun 200w1d-02_cs_ro.exe

               Unhandled Exception: System.OverflowException: Value was either too large or too small for an Int32.
                  at System.Convert.ThrowInt32OverflowException()
                  at System.Convert.ToInt32(Int64 value)
                  at testout1.Func_0()
                  at testout1.Main()
               ./200w1d-02_cs_ro.sh: line 243: 101339 Aborted                 (core dumped) $_DebuggerFullPath "$CORE_ROOT/corerun" $ExePath $CLRTestExecutionArguments
               Expected: 100
               Actual: 134
               END EXECUTION - FAILED
```
src/classlibnative/bcltype/decimal.cpp
src/classlibnative/bcltype/decimal.h
src/classlibnative/bcltype/number.cpp
src/classlibnative/bcltype/number.h
src/mscorlib/System.Private.CoreLib.csproj
src/mscorlib/shared/System/Number.Formatting.cs
src/mscorlib/src/System/Decimal.DecCalc.cs [new file with mode: 0644]
src/mscorlib/src/System/Decimal.cs
src/mscorlib/src/System/Number.CoreCLR.cs
src/vm/ecalllist.h