summaryrefslogtreecommitdiff
path: root/src/classlibnative
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-03-19 12:51:33 -0700
committerGitHub <noreply@github.com>2018-03-19 12:51:33 -0700
commitd3b818787748f09e63106b9b08d7bd6f5cd171bb (patch)
tree37dc57bca2f1a3f43fb485c5f768c8c260cd64c4 /src/classlibnative
parent3169b78f2da0a44c8de2b285db5eeb553a7c8231 (diff)
downloadcoreclr-d3b818787748f09e63106b9b08d7bd6f5cd171bb.tar.gz
coreclr-d3b818787748f09e63106b9b08d7bd6f5cd171bb.tar.bz2
coreclr-d3b818787748f09e63106b9b08d7bd6f5cd171bb.zip
Switch over to managed Marvin implementation for string hashing (#17029)
Diffstat (limited to 'src/classlibnative')
-rw-r--r--src/classlibnative/bcltype/stringnative.cpp25
-rw-r--r--src/classlibnative/bcltype/stringnative.h3
-rw-r--r--src/classlibnative/nls/nlsinfo.cpp66
3 files changed, 0 insertions, 94 deletions
diff --git a/src/classlibnative/bcltype/stringnative.cpp b/src/classlibnative/bcltype/stringnative.cpp
index 63eed7345a..8b040dc038 100644
--- a/src/classlibnative/bcltype/stringnative.cpp
+++ b/src/classlibnative/bcltype/stringnative.cpp
@@ -31,31 +31,6 @@
#pragma optimize("tgy", on)
#endif
-inline COMNlsHashProvider * GetCurrentNlsHashProvider()
-{
- LIMITED_METHOD_CONTRACT;
- return &COMNlsHashProvider::s_NlsHashProvider;
-}
-
-FCIMPL1(INT32, COMString::Marvin32HashString, StringObject* thisRefUNSAFE) {
- FCALL_CONTRACT;
-
- int iReturnHash = 0;
-
- if (thisRefUNSAFE == NULL) {
- FCThrow(kNullReferenceException);
- }
-
- BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException));
- iReturnHash = GetCurrentNlsHashProvider()->HashString(thisRefUNSAFE->GetBuffer(), thisRefUNSAFE->GetStringLength());
- END_SO_INTOLERANT_CODE;
-
- FC_GC_POLL_RET();
-
- return iReturnHash;
-}
-FCIMPLEND
-
/*===============================IsFastSort===============================
**Action: Call the helper to walk the string and see if we have any high chars.
**Returns: void. The appropriate bits are set on the String.
diff --git a/src/classlibnative/bcltype/stringnative.h b/src/classlibnative/bcltype/stringnative.h
index f0df0503e5..1f3970b0a0 100644
--- a/src/classlibnative/bcltype/stringnative.h
+++ b/src/classlibnative/bcltype/stringnative.h
@@ -61,9 +61,6 @@ public:
static FCDECL2(FC_BOOL_RET, FCTryGetTrailByte, StringObject* thisRefUNSAFE, UINT8 *pbData);
static FCDECL2(VOID, FCSetTrailByte, StringObject* thisRefUNSAFE, UINT8 bData);
#endif // FEATURE_COMINTEROP
-
- static FCDECL1(INT32, Marvin32HashString, StringObject* thisRefUNSAFE);
-
};
// Revert to command line compilation flags
diff --git a/src/classlibnative/nls/nlsinfo.cpp b/src/classlibnative/nls/nlsinfo.cpp
index e12e41b1c9..7699b4a231 100644
--- a/src/classlibnative/nls/nlsinfo.cpp
+++ b/src/classlibnative/nls/nlsinfo.cpp
@@ -34,72 +34,6 @@
#include "nls.h"
#include "nlsinfo.h"
-//
-// Constant Declarations.
-//
-
-#define MAX_STRING_VALUE 512
-
-////////////////////////////////////////////////////////////////////////////
-//
-// InternalGetGlobalizedHashCode
-//
-////////////////////////////////////////////////////////////////////////////
-INT32 QCALLTYPE COMNlsInfo::InternalGetGlobalizedHashCode(INT_PTR handle, LPCWSTR localeName, LPCWSTR string, INT32 length, INT32 dwFlagsIn)
-{
- CONTRACTL
- {
- QCALL_CHECK;
- PRECONDITION(CheckPointer(localeName));
- PRECONDITION(CheckPointer(string, NULL_OK));
- } CONTRACTL_END;
-
- INT32 iReturnHash = 0;
- BEGIN_QCALL;
-
- int byteCount = 0;
-
- //
- // Make sure there is a string.
- //
- if (!string) {
- COMPlusThrowArgumentNull(W("string"),W("ArgumentNull_String"));
- }
-
- DWORD dwFlags = (LCMAP_SORTKEY | dwFlagsIn);
-
- //
- // Caller has already verified that the string is not of zero length
- //
- // Assert if we might hit an AV in LCMapStringEx for the invariant culture.
- _ASSERTE(length > 0 || (dwFlags & LCMAP_LINGUISTIC_CASING) == 0);
- {
- byteCount=::LCMapStringEx(handle != NULL ? NULL : localeName, dwFlags, string, length, NULL, 0, NULL, NULL, (LPARAM) handle);
- }
-
- //A count of 0 indicates that we either had an error or had a zero length string originally.
- if (byteCount==0)
- {
- COMPlusThrow(kArgumentException, W("Arg_MustBeString"));
- }
-
- // We used to use a NewArrayHolder here, but it turns out that hurts our large # process
- // scalability in ASP.Net hosting scenarios, using the quick bytes instead mostly stack
- // allocates and ups throughput by 8% in 100 process case, 5% in 1000 process case
- {
- CQuickBytesSpecifySize<MAX_STRING_VALUE * sizeof(WCHAR)> qbBuffer;
- BYTE* pByte = (BYTE*)qbBuffer.AllocThrows(byteCount);
-
- {
- ::LCMapStringEx(handle != NULL ? NULL : localeName, dwFlags, string, length, (LPWSTR)pByte, byteCount, NULL,NULL, (LPARAM) handle);
- }
-
- iReturnHash = COMNlsHashProvider::s_NlsHashProvider.HashSortKey(pByte, byteCount);
- }
- END_QCALL;
- return(iReturnHash);
-}
-
/**
* This function returns a pointer to this table that we use in System.Globalization.EncodingTable.
* No error checking of any sort is performed. Range checking is entirely the responsibility of the managed