diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-03-08 06:09:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 06:09:03 -0800 |
commit | 5e03df42d9fb2fe05a4246695128ddfb6e9ca7fd (patch) | |
tree | fa70a69b3489bc3164178edd376b4683123ebbec /src/vm | |
parent | 5928c09ddc7ff9fb998ba3cae53db8d6d8c56b02 (diff) | |
download | coreclr-5e03df42d9fb2fe05a4246695128ddfb6e9ca7fd.tar.gz coreclr-5e03df42d9fb2fe05a4246695128ddfb6e9ca7fd.tar.bz2 coreclr-5e03df42d9fb2fe05a4246695128ddfb6e9ca7fd.zip |
Move String to shared corelib partition (#16749)
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/ecall.cpp | 8 | ||||
-rw-r--r-- | src/vm/ecall.h | 3 | ||||
-rw-r--r-- | src/vm/ecalllist.h | 6 | ||||
-rw-r--r-- | src/vm/metasig.h | 3 | ||||
-rw-r--r-- | src/vm/mscorlib.h | 17 | ||||
-rw-r--r-- | src/vm/object.cpp | 56 | ||||
-rw-r--r-- | src/vm/object.h | 1 |
7 files changed, 26 insertions, 68 deletions
diff --git a/src/vm/ecall.cpp b/src/vm/ecall.cpp index 6f5f11b894..dacec45787 100644 --- a/src/vm/ecall.cpp +++ b/src/vm/ecall.cpp @@ -37,6 +37,9 @@ static_assert_no_msg(METHOD__STRING__CTORF_FIRST + 2 == METHOD__STRING__CTORF_CH static_assert_no_msg(METHOD__STRING__CTORF_FIRST + 3 == METHOD__STRING__CTORF_CHARPTR); static_assert_no_msg(METHOD__STRING__CTORF_FIRST + 4 == METHOD__STRING__CTORF_CHARPTR_START_LEN); static_assert_no_msg(METHOD__STRING__CTORF_FIRST + 5 == METHOD__STRING__CTORF_READONLYSPANOFCHAR); +static_assert_no_msg(METHOD__STRING__CTORF_FIRST + 6 == METHOD__STRING__CTORF_SBYTEPTR); +static_assert_no_msg(METHOD__STRING__CTORF_FIRST + 7 == METHOD__STRING__CTORF_SBYTEPTR_START_LEN); +static_assert_no_msg(METHOD__STRING__CTORF_FIRST + 8 == METHOD__STRING__CTORF_SBYTEPTR_START_LEN_ENCODING); // ECall::CtorCharXxx has to be in same order as METHOD__STRING__CTORF_XXX #define ECallCtor_First ECall::CtorCharArrayManaged @@ -46,8 +49,11 @@ static_assert_no_msg(ECallCtor_First + 2 == ECall::CtorCharCountManaged); static_assert_no_msg(ECallCtor_First + 3 == ECall::CtorCharPtrManaged); static_assert_no_msg(ECallCtor_First + 4 == ECall::CtorCharPtrStartLengthManaged); static_assert_no_msg(ECallCtor_First + 5 == ECall::CtorReadOnlySpanOfCharManaged); +static_assert_no_msg(ECallCtor_First + 6 == ECall::CtorSBytePtrManaged); +static_assert_no_msg(ECallCtor_First + 7 == ECall::CtorSBytePtrStartLengthManaged); +static_assert_no_msg(ECallCtor_First + 8 == ECall::CtorSBytePtrStartLengthEncodingManaged); -#define NumberOfStringConstructors 6 +#define NumberOfStringConstructors 9 void ECall::PopulateManagedStringConstructors() { diff --git a/src/vm/ecall.h b/src/vm/ecall.h index 26fa9eb478..c809109c4c 100644 --- a/src/vm/ecall.h +++ b/src/vm/ecall.h @@ -111,6 +111,9 @@ class ECall DYNAMICALLY_ASSIGNED_FCALL_IMPL(CtorCharPtrManaged, NULL) \ DYNAMICALLY_ASSIGNED_FCALL_IMPL(CtorCharPtrStartLengthManaged, NULL) \ DYNAMICALLY_ASSIGNED_FCALL_IMPL(CtorReadOnlySpanOfCharManaged, NULL) \ + DYNAMICALLY_ASSIGNED_FCALL_IMPL(CtorSBytePtrManaged, NULL) \ + DYNAMICALLY_ASSIGNED_FCALL_IMPL(CtorSBytePtrStartLengthManaged, NULL) \ + DYNAMICALLY_ASSIGNED_FCALL_IMPL(CtorSBytePtrStartLengthEncodingManaged, NULL) \ DYNAMICALLY_ASSIGNED_FCALL_IMPL(InternalGetCurrentThread, NULL) \ enum diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h index 05ce0e0ec2..5877f3183d 100644 --- a/src/vm/ecalllist.h +++ b/src/vm/ecalllist.h @@ -103,9 +103,9 @@ FCFuncStart(gStringFuncs) FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrChar_Int_Int_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorCharPtrStartLengthManaged) FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_Char_Int_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorCharCountManaged) FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_ReadOnlySpanOfChar_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorReadOnlySpanOfCharManaged) - FCFuncElementSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_RetVoid, COMString::StringInitCharPtr) - FCFuncElementSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_Int_Int_RetVoid, COMString::StringInitCharPtrPartial) - FCFuncElementSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_Int_Int_Encoding_RetVoid, COMString::StringInitSBytPtrPartialEx) + FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorSBytePtrManaged) + FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_Int_Int_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorSBytePtrStartLengthManaged) + FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_Int_Int_Encoding_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorSBytePtrStartLengthEncodingManaged) FCFuncElement("IsFastSort", COMString::IsFastSort) FCFuncElement("nativeCompareOrdinalIgnoreCaseWC", COMString::FCCompareOrdinalIgnoreCaseWC) FCIntrinsic("get_Length", COMString::Length, CORINFO_INTRINSIC_StringLength) diff --git a/src/vm/metasig.h b/src/vm/metasig.h index 47dd024bde..49e26f17e9 100644 --- a/src/vm/metasig.h +++ b/src/vm/metasig.h @@ -409,6 +409,9 @@ DEFINE_METASIG(IM(Char_Int_RetStr, u i, s)) DEFINE_METASIG(IM(PtrChar_RetStr, P(u), s)) DEFINE_METASIG(IM(PtrChar_Int_Int_RetStr, P(u) i i, s)) DEFINE_METASIG_T(IM(ReadOnlySpanOfChar_RetStr, GI(g(READONLY_SPAN), 1, u), s)) +DEFINE_METASIG(IM(PtrSByt_RetStr, P(B), s)) +DEFINE_METASIG(IM(PtrSByt_Int_Int_RetStr, P(B) i i, s)) +DEFINE_METASIG_T(IM(PtrSByt_Int_Int_Encoding_RetStr, P(B) i i C(ENCODING), s)) DEFINE_METASIG(IM(Obj_Int_RetIntPtr, j i, I)) DEFINE_METASIG(IM(Char_Char_RetStr, u u, s)) diff --git a/src/vm/mscorlib.h b/src/vm/mscorlib.h index 0af6c94bc9..7642db6638 100644 --- a/src/vm/mscorlib.h +++ b/src/vm/mscorlib.h @@ -866,18 +866,21 @@ DEFINE_FIELD(UINTPTR, ZERO, Zero) DEFINE_CLASS(BITCONVERTER, System, BitConverter) DEFINE_FIELD(BITCONVERTER, ISLITTLEENDIAN, IsLittleEndian) + // Defined as element type alias // DEFINE_CLASS(STRING, System, String) DEFINE_FIELD(STRING, M_FIRST_CHAR, _firstChar) DEFINE_FIELD(STRING, EMPTY, Empty) -DEFINE_METHOD(STRING, CREATE_STRING, CreateString, SM_PtrSByt_Int_Int_Encoding_RetStr) DEFINE_METHOD(STRING, CTOR_CHARPTR, .ctor, IM_PtrChar_RetVoid) -DEFINE_METHOD(STRING, CTORF_CHARARRAY, CtorCharArray, IM_ArrChar_RetStr) -DEFINE_METHOD(STRING, CTORF_CHARARRAY_START_LEN,CtorCharArrayStartLength, IM_ArrChar_Int_Int_RetStr) -DEFINE_METHOD(STRING, CTORF_CHAR_COUNT, CtorCharCount, IM_Char_Int_RetStr) -DEFINE_METHOD(STRING, CTORF_CHARPTR, CtorCharPtr, IM_PtrChar_RetStr) -DEFINE_METHOD(STRING, CTORF_CHARPTR_START_LEN,CtorCharPtrStartLength, IM_PtrChar_Int_Int_RetStr) -DEFINE_METHOD(STRING, CTORF_READONLYSPANOFCHAR,CtorReadOnlySpanOfChar, IM_ReadOnlySpanOfChar_RetStr) +DEFINE_METHOD(STRING, CTORF_CHARARRAY, Ctor, IM_ArrChar_RetStr) +DEFINE_METHOD(STRING, CTORF_CHARARRAY_START_LEN,Ctor, IM_ArrChar_Int_Int_RetStr) +DEFINE_METHOD(STRING, CTORF_CHAR_COUNT, Ctor, IM_Char_Int_RetStr) +DEFINE_METHOD(STRING, CTORF_CHARPTR, Ctor, IM_PtrChar_RetStr) +DEFINE_METHOD(STRING, CTORF_CHARPTR_START_LEN,Ctor, IM_PtrChar_Int_Int_RetStr) +DEFINE_METHOD(STRING, CTORF_READONLYSPANOFCHAR,Ctor, IM_ReadOnlySpanOfChar_RetStr) +DEFINE_METHOD(STRING, CTORF_SBYTEPTR, Ctor, IM_PtrSByt_RetStr) +DEFINE_METHOD(STRING, CTORF_SBYTEPTR_START_LEN, Ctor, IM_PtrSByt_Int_Int_RetStr) +DEFINE_METHOD(STRING, CTORF_SBYTEPTR_START_LEN_ENCODING, Ctor, IM_PtrSByt_Int_Int_Encoding_RetStr) DEFINE_METHOD(STRING, INTERNAL_COPY, InternalCopy, SM_Str_IntPtr_Int_RetVoid) DEFINE_METHOD(STRING, WCSLEN, wcslen, SM_PtrChar_RetInt) DEFINE_PROPERTY(STRING, LENGTH, Length, Int) diff --git a/src/vm/object.cpp b/src/vm/object.cpp index 374fe192f2..0282b6a6a4 100644 --- a/src/vm/object.cpp +++ b/src/vm/object.cpp @@ -1082,62 +1082,6 @@ STRINGREF* StringObject::InitEmptyStringRefPtr() { return EmptyStringRefPtr; } -/*=============================StringInitCharHelper============================= -**Action: -**Returns: -**Arguments: -**Exceptions: -**Note this -==============================================================================*/ -STRINGREF __stdcall StringObject::StringInitCharHelper(LPCSTR pszSource, int length) { - CONTRACTL { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } CONTRACTL_END; - - STRINGREF pString=NULL; - int dwSizeRequired=0; - _ASSERTE(length>=-1); - - if (!pszSource || length == 0) { - return StringObject::GetEmptyString(); - } -#ifndef FEATURE_PAL - else if ((size_t)pszSource < 64000) { - COMPlusThrow(kArgumentException, W("Arg_MustBeStringPtrNotAtom")); - } -#endif // FEATURE_PAL - - // Make sure we can read from the pointer. - // This is better than try to read from the pointer and catch the access violation exceptions. - if( length == -1) { - length = (INT32)strlen(pszSource); - } - - if(length > 0) { - dwSizeRequired=WszMultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pszSource, length, NULL, 0); - } - - if (dwSizeRequired == 0) { - if (length == 0) { - return StringObject::GetEmptyString(); - } - COMPlusThrow(kArgumentException, W("Arg_InvalidANSIString")); - } - - pString = AllocateString(dwSizeRequired); - dwSizeRequired = WszMultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, (LPCSTR)pszSource, length, pString->GetBuffer(), dwSizeRequired); - if (dwSizeRequired == 0) { - COMPlusThrow(kArgumentException, W("Arg_InvalidANSIString")); - } - - _ASSERTE(dwSizeRequired != INT32_MAX && pString->GetBuffer()[dwSizeRequired]==0); - - return pString; -} - - // strAChars must be null-terminated, with an appropriate aLength // strBChars must be null-terminated, with an appropriate bLength OR bLength == -1 // If bLength == -1, we stop on the first null character in strBChars diff --git a/src/vm/object.h b/src/vm/object.h index 5970806e71..b0125fa50e 100644 --- a/src/vm/object.h +++ b/src/vm/object.h @@ -1024,7 +1024,6 @@ class StringObject : public Object static STRINGREF* InitEmptyStringRefPtr(); - static STRINGREF __stdcall StringInitCharHelper(LPCSTR pszSource, int length); DWORD InternalCheckHighChars(); BOOL HasTrailByte(); |