summaryrefslogtreecommitdiff
path: root/src/classlibnative
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2017-11-22 00:13:37 -0500
committerGitHub <noreply@github.com>2017-11-22 00:13:37 -0500
commit63f1a0f6fbb0f24dc881be1defa899eae9dbf86c (patch)
tree0fbfbe1511108f75bbb31e9b55204d89f9ca6f29 /src/classlibnative
parent58561e4e2c8c4973aa740a182d0d5f57f1bd8cfb (diff)
downloadcoreclr-63f1a0f6fbb0f24dc881be1defa899eae9dbf86c.tar.gz
coreclr-63f1a0f6fbb0f24dc881be1defa899eae9dbf86c.tar.bz2
coreclr-63f1a0f6fbb0f24dc881be1defa899eae9dbf86c.zip
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 ```
Diffstat (limited to 'src/classlibnative')
-rw-r--r--src/classlibnative/bcltype/decimal.cpp27
-rw-r--r--src/classlibnative/bcltype/decimal.h1
-rw-r--r--src/classlibnative/bcltype/number.cpp39
-rw-r--r--src/classlibnative/bcltype/number.h1
4 files changed, 0 insertions, 68 deletions
diff --git a/src/classlibnative/bcltype/decimal.cpp b/src/classlibnative/bcltype/decimal.cpp
index ed63391e54..c338e5d0c3 100644
--- a/src/classlibnative/bcltype/decimal.cpp
+++ b/src/classlibnative/bcltype/decimal.cpp
@@ -288,33 +288,6 @@ FCIMPL1(void, COMDecimal::DoTruncate, DECIMAL * d)
}
FCIMPLEND
-
-void COMDecimal::DecimalToNumber(DECIMAL* value, NUMBER* number)
-{
- WRAPPER_NO_CONTRACT
- _ASSERTE(number != NULL);
- _ASSERTE(value != NULL);
-
- wchar_t buffer[DECIMAL_PRECISION+1];
- DECIMAL d = *value;
- number->precision = DECIMAL_PRECISION;
- number->sign = DECIMAL_SIGN(d)? 1: 0;
- wchar_t* p = buffer + DECIMAL_PRECISION;
- while (DECIMAL_MID32(d) | DECIMAL_HI32(d)) {
- p = COMNumber::Int32ToDecChars(p, DecDivMod1E9(&d), 9);
- _ASSERTE(p != NULL);
- }
- p = COMNumber::Int32ToDecChars(p, DECIMAL_LO32(d), 0);
- _ASSERTE(p != NULL);
- int i = (int) (buffer + DECIMAL_PRECISION - p);
- number->scale = i - DECIMAL_SCALE(d);
- wchar_t* dst = number->digits;
- _ASSERTE(dst != NULL);
- while (--i >= 0) *dst++ = *p++;
- *dst = 0;
-
-}
-
int COMDecimal::NumberToDecimal(NUMBER* number, DECIMAL* value)
{
WRAPPER_NO_CONTRACT
diff --git a/src/classlibnative/bcltype/decimal.h b/src/classlibnative/bcltype/decimal.h
index 6ce1fbe677..b932420bde 100644
--- a/src/classlibnative/bcltype/decimal.h
+++ b/src/classlibnative/bcltype/decimal.h
@@ -43,7 +43,6 @@ public:
static FCDECL1(INT32, ToInt32, FC_DECIMAL d);
static FCDECL1(Object*, ToString, FC_DECIMAL d);
- static void DecimalToNumber(DECIMAL* value, NUMBER* number);
static int NumberToDecimal(NUMBER* number, DECIMAL* value);
diff --git a/src/classlibnative/bcltype/number.cpp b/src/classlibnative/bcltype/number.cpp
index e399c82f63..eea2b2e60b 100644
--- a/src/classlibnative/bcltype/number.cpp
+++ b/src/classlibnative/bcltype/number.cpp
@@ -2009,45 +2009,6 @@ ParseSection:
#pragma warning(pop)
#endif
-FCIMPL3_VII(Object*, COMNumber::FormatDecimal, FC_DECIMAL value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE)
-{
- FCALL_CONTRACT;
-
- NUMBER number;
-
- wchar fmt;
- int digits;
-
- STRINGREF refRetVal = NULL;
- HELPER_METHOD_FRAME_BEGIN_RET_1(refRetVal);
-
- struct _gc
- {
- STRINGREF format;
- NUMFMTREF numfmt;
- } gc;
-
- gc.format = (STRINGREF) formatUNSAFE;
- gc.numfmt = (NUMFMTREF) numfmtUNSAFE;
-
- if (gc.numfmt == 0)
- COMPlusThrowArgumentNull(W("NumberFormatInfo"));
-
- COMDecimal::DecimalToNumber(&value, &number);
-
- fmt = ParseFormatSpecifier(gc.format, &digits);
- if (fmt != 0) {
- refRetVal = NumberToString(&number, fmt, digits, gc.numfmt, TRUE);
- } else {
- refRetVal = NumberToStringFormat(&number, gc.format, gc.numfmt);
- }
-
- HELPER_METHOD_FRAME_END();
-
- return OBJECTREFToObject(refRetVal);
-}
-FCIMPLEND
-
FCIMPL3_VII(Object*, COMNumber::FormatDouble, double value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE)
{
FCALL_CONTRACT;
diff --git a/src/classlibnative/bcltype/number.h b/src/classlibnative/bcltype/number.h
index 77f902fb41..e9651b66a1 100644
--- a/src/classlibnative/bcltype/number.h
+++ b/src/classlibnative/bcltype/number.h
@@ -31,7 +31,6 @@ struct NUMBER {
class COMNumber
{
public:
- static FCDECL3_VII(Object*, FormatDecimal, FC_DECIMAL value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE);
static FCDECL3_VII(Object*, FormatDouble, double value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE);
static FCDECL3_VII(Object*, FormatSingle, float value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE);
static FCDECL2(FC_BOOL_RET, NumberBufferToDecimal, BYTE* number, DECIMAL* value);