Skip to content

Commit a9d6c38

Browse files
josesimoesnfbot
andauthored
Update declaration of mscorlib (#3208)
Co-authored-by: nfbot[bot] <[email protected]>
1 parent 866996d commit a9d6c38

File tree

3 files changed

+120
-35
lines changed

3 files changed

+120
-35
lines changed

src/CLR/CorLib/corlib_native.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ static const CLR_RT_MethodHandler method_lookup[] =
123123
Library_corlib_native_System_String::Split___SZARRAY_STRING__SZARRAY_CHAR__I4,
124124
Library_corlib_native_System_String::Substring___STRING__I4,
125125
Library_corlib_native_System_String::Substring___STRING__I4__I4,
126+
Library_corlib_native_System_String::Trim___STRING,
126127
Library_corlib_native_System_String::Trim___STRING__SZARRAY_CHAR,
128+
Library_corlib_native_System_String::TrimStart___STRING,
127129
Library_corlib_native_System_String::TrimStart___STRING__SZARRAY_CHAR,
130+
Library_corlib_native_System_String::TrimEnd___STRING,
128131
Library_corlib_native_System_String::TrimEnd___STRING__SZARRAY_CHAR,
129132
Library_corlib_native_System_String::_ctor___VOID__SZARRAY_CHAR__I4__I4,
130133
Library_corlib_native_System_String::_ctor___VOID__SZARRAY_CHAR,
@@ -133,12 +136,12 @@ static const CLR_RT_MethodHandler method_lookup[] =
133136
Library_corlib_native_System_String::IndexOf___I4__CHAR,
134137
Library_corlib_native_System_String::IndexOf___I4__CHAR__I4,
135138
Library_corlib_native_System_String::IndexOf___I4__CHAR__I4__I4,
136-
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR,
137-
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR__I4,
138-
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR__I4__I4,
139139
Library_corlib_native_System_String::IndexOf___I4__STRING,
140140
Library_corlib_native_System_String::IndexOf___I4__STRING__I4,
141141
Library_corlib_native_System_String::IndexOf___I4__STRING__I4__I4,
142+
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR,
143+
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR__I4,
144+
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR__I4__I4,
142145
Library_corlib_native_System_String::LastIndexOf___I4__CHAR,
143146
Library_corlib_native_System_String::LastIndexOf___I4__CHAR__I4,
144147
Library_corlib_native_System_String::LastIndexOf___I4__CHAR__I4__I4,
@@ -150,7 +153,6 @@ static const CLR_RT_MethodHandler method_lookup[] =
150153
Library_corlib_native_System_String::LastIndexOf___I4__STRING__I4__I4,
151154
Library_corlib_native_System_String::ToLower___STRING,
152155
Library_corlib_native_System_String::ToUpper___STRING,
153-
Library_corlib_native_System_String::Trim___STRING,
154156
nullptr,
155157
nullptr,
156158
nullptr,
@@ -887,6 +889,7 @@ static const CLR_RT_MethodHandler method_lookup[] =
887889
Library_corlib_native_System_String::Split___SZARRAY_STRING__SZARRAY_CHAR__I4,
888890
Library_corlib_native_System_String::Substring___STRING__I4,
889891
Library_corlib_native_System_String::Substring___STRING__I4__I4,
892+
Library_corlib_native_System_String::Trim___STRING,
890893
Library_corlib_native_System_String::Trim___STRING__SZARRAY_CHAR,
891894
Library_corlib_native_System_String::TrimStart___STRING__SZARRAY_CHAR,
892895
Library_corlib_native_System_String::TrimEnd___STRING__SZARRAY_CHAR,
@@ -897,12 +900,12 @@ static const CLR_RT_MethodHandler method_lookup[] =
897900
Library_corlib_native_System_String::IndexOf___I4__CHAR,
898901
Library_corlib_native_System_String::IndexOf___I4__CHAR__I4,
899902
Library_corlib_native_System_String::IndexOf___I4__CHAR__I4__I4,
900-
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR,
901-
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR__I4,
902-
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR__I4__I4,
903903
Library_corlib_native_System_String::IndexOf___I4__STRING,
904904
Library_corlib_native_System_String::IndexOf___I4__STRING__I4,
905905
Library_corlib_native_System_String::IndexOf___I4__STRING__I4__I4,
906+
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR,
907+
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR__I4,
908+
Library_corlib_native_System_String::IndexOfAny___I4__SZARRAY_CHAR__I4__I4,
906909
Library_corlib_native_System_String::LastIndexOf___I4__CHAR,
907910
Library_corlib_native_System_String::LastIndexOf___I4__CHAR__I4,
908911
Library_corlib_native_System_String::LastIndexOf___I4__CHAR__I4__I4,
@@ -914,7 +917,6 @@ static const CLR_RT_MethodHandler method_lookup[] =
914917
Library_corlib_native_System_String::LastIndexOf___I4__STRING__I4__I4,
915918
Library_corlib_native_System_String::ToLower___STRING,
916919
Library_corlib_native_System_String::ToUpper___STRING,
917-
Library_corlib_native_System_String::Trim___STRING,
918920
nullptr,
919921
nullptr,
920922
nullptr,
@@ -1505,11 +1507,11 @@ const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_mscorlib =
15051507

15061508
#if (NANOCLR_REFLECTION == TRUE)
15071509

1508-
0x4E06901B,
1510+
0x50BF350D,
15091511

15101512
#elif (NANOCLR_REFLECTION == FALSE)
15111513

1512-
0xB9FA421B,
1514+
0x3184D138,
15131515
,
15141516

15151517
#else

src/CLR/CorLib/corlib_native.h

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ struct Library_corlib_native_System_String
196196
{
197197
static const int FIELD_STATIC__Empty = 2;
198198

199+
#if (NANOCLR_REFLECTION == TRUE)
200+
199201
NANOCLR_NATIVE_DECLARE(CompareTo___I4__OBJECT);
200202
NANOCLR_NATIVE_DECLARE(get_Chars___CHAR__I4);
201203
NANOCLR_NATIVE_DECLARE(ToCharArray___SZARRAY_CHAR);
@@ -205,8 +207,11 @@ struct Library_corlib_native_System_String
205207
NANOCLR_NATIVE_DECLARE(Split___SZARRAY_STRING__SZARRAY_CHAR__I4);
206208
NANOCLR_NATIVE_DECLARE(Substring___STRING__I4);
207209
NANOCLR_NATIVE_DECLARE(Substring___STRING__I4__I4);
210+
NANOCLR_NATIVE_DECLARE(Trim___STRING);
208211
NANOCLR_NATIVE_DECLARE(Trim___STRING__SZARRAY_CHAR);
212+
NANOCLR_NATIVE_DECLARE(TrimStart___STRING);
209213
NANOCLR_NATIVE_DECLARE(TrimStart___STRING__SZARRAY_CHAR);
214+
NANOCLR_NATIVE_DECLARE(TrimEnd___STRING);
210215
NANOCLR_NATIVE_DECLARE(TrimEnd___STRING__SZARRAY_CHAR);
211216
NANOCLR_NATIVE_DECLARE(_ctor___VOID__SZARRAY_CHAR__I4__I4);
212217
NANOCLR_NATIVE_DECLARE(_ctor___VOID__SZARRAY_CHAR);
@@ -215,12 +220,60 @@ struct Library_corlib_native_System_String
215220
NANOCLR_NATIVE_DECLARE(IndexOf___I4__CHAR);
216221
NANOCLR_NATIVE_DECLARE(IndexOf___I4__CHAR__I4);
217222
NANOCLR_NATIVE_DECLARE(IndexOf___I4__CHAR__I4__I4);
223+
NANOCLR_NATIVE_DECLARE(IndexOf___I4__STRING);
224+
NANOCLR_NATIVE_DECLARE(IndexOf___I4__STRING__I4);
225+
NANOCLR_NATIVE_DECLARE(IndexOf___I4__STRING__I4__I4);
218226
NANOCLR_NATIVE_DECLARE(IndexOfAny___I4__SZARRAY_CHAR);
219227
NANOCLR_NATIVE_DECLARE(IndexOfAny___I4__SZARRAY_CHAR__I4);
220228
NANOCLR_NATIVE_DECLARE(IndexOfAny___I4__SZARRAY_CHAR__I4__I4);
229+
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__CHAR);
230+
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__CHAR__I4);
231+
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__CHAR__I4__I4);
232+
NANOCLR_NATIVE_DECLARE(LastIndexOfAny___I4__SZARRAY_CHAR);
233+
NANOCLR_NATIVE_DECLARE(LastIndexOfAny___I4__SZARRAY_CHAR__I4);
234+
NANOCLR_NATIVE_DECLARE(LastIndexOfAny___I4__SZARRAY_CHAR__I4__I4);
235+
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__STRING);
236+
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__STRING__I4);
237+
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__STRING__I4__I4);
238+
NANOCLR_NATIVE_DECLARE(ToLower___STRING);
239+
NANOCLR_NATIVE_DECLARE(ToUpper___STRING);
240+
NANOCLR_NATIVE_DECLARE(Equals___STATIC__BOOLEAN__STRING__STRING);
241+
NANOCLR_NATIVE_DECLARE(op_Equality___STATIC__BOOLEAN__STRING__STRING);
242+
NANOCLR_NATIVE_DECLARE(op_Inequality___STATIC__BOOLEAN__STRING__STRING);
243+
NANOCLR_NATIVE_DECLARE(Compare___STATIC__I4__STRING__STRING);
244+
NANOCLR_NATIVE_DECLARE(Concat___STATIC__STRING__STRING__STRING);
245+
NANOCLR_NATIVE_DECLARE(Concat___STATIC__STRING__STRING__STRING__STRING);
246+
NANOCLR_NATIVE_DECLARE(Concat___STATIC__STRING__STRING__STRING__STRING__STRING);
247+
NANOCLR_NATIVE_DECLARE(Concat___STATIC__STRING__SZARRAY_STRING);
248+
249+
#else
250+
251+
NANOCLR_NATIVE_DECLARE(CompareTo___I4__OBJECT);
252+
NANOCLR_NATIVE_DECLARE(get_Chars___CHAR__I4);
253+
NANOCLR_NATIVE_DECLARE(ToCharArray___SZARRAY_CHAR);
254+
NANOCLR_NATIVE_DECLARE(ToCharArray___SZARRAY_CHAR__I4__I4);
255+
NANOCLR_NATIVE_DECLARE(get_Length___I4);
256+
NANOCLR_NATIVE_DECLARE(Split___SZARRAY_STRING__SZARRAY_CHAR);
257+
NANOCLR_NATIVE_DECLARE(Split___SZARRAY_STRING__SZARRAY_CHAR__I4);
258+
NANOCLR_NATIVE_DECLARE(Substring___STRING__I4);
259+
NANOCLR_NATIVE_DECLARE(Substring___STRING__I4__I4);
260+
NANOCLR_NATIVE_DECLARE(Trim___STRING);
261+
NANOCLR_NATIVE_DECLARE(Trim___STRING__SZARRAY_CHAR);
262+
NANOCLR_NATIVE_DECLARE(TrimStart___STRING__SZARRAY_CHAR);
263+
NANOCLR_NATIVE_DECLARE(TrimEnd___STRING__SZARRAY_CHAR);
264+
NANOCLR_NATIVE_DECLARE(_ctor___VOID__SZARRAY_CHAR__I4__I4);
265+
NANOCLR_NATIVE_DECLARE(_ctor___VOID__SZARRAY_CHAR);
266+
NANOCLR_NATIVE_DECLARE(_ctor___VOID__CHAR__I4);
267+
NANOCLR_NATIVE_DECLARE(CompareTo___I4__STRING);
268+
NANOCLR_NATIVE_DECLARE(IndexOf___I4__CHAR);
269+
NANOCLR_NATIVE_DECLARE(IndexOf___I4__CHAR__I4);
270+
NANOCLR_NATIVE_DECLARE(IndexOf___I4__CHAR__I4__I4);
221271
NANOCLR_NATIVE_DECLARE(IndexOf___I4__STRING);
222272
NANOCLR_NATIVE_DECLARE(IndexOf___I4__STRING__I4);
223273
NANOCLR_NATIVE_DECLARE(IndexOf___I4__STRING__I4__I4);
274+
NANOCLR_NATIVE_DECLARE(IndexOfAny___I4__SZARRAY_CHAR);
275+
NANOCLR_NATIVE_DECLARE(IndexOfAny___I4__SZARRAY_CHAR__I4);
276+
NANOCLR_NATIVE_DECLARE(IndexOfAny___I4__SZARRAY_CHAR__I4__I4);
224277
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__CHAR);
225278
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__CHAR__I4);
226279
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__CHAR__I4__I4);
@@ -232,7 +285,6 @@ struct Library_corlib_native_System_String
232285
NANOCLR_NATIVE_DECLARE(LastIndexOf___I4__STRING__I4__I4);
233286
NANOCLR_NATIVE_DECLARE(ToLower___STRING);
234287
NANOCLR_NATIVE_DECLARE(ToUpper___STRING);
235-
NANOCLR_NATIVE_DECLARE(Trim___STRING);
236288
NANOCLR_NATIVE_DECLARE(Equals___STATIC__BOOLEAN__STRING__STRING);
237289
NANOCLR_NATIVE_DECLARE(op_Equality___STATIC__BOOLEAN__STRING__STRING);
238290
NANOCLR_NATIVE_DECLARE(op_Inequality___STATIC__BOOLEAN__STRING__STRING);
@@ -242,6 +294,7 @@ struct Library_corlib_native_System_String
242294
NANOCLR_NATIVE_DECLARE(Concat___STATIC__STRING__STRING__STRING__STRING__STRING);
243295
NANOCLR_NATIVE_DECLARE(Concat___STATIC__STRING__SZARRAY_STRING);
244296

297+
#endif
245298
//--//
246299

247300
static const int c_IndexOf__SingleChar = 0x00000001;

src/CLR/CorLib/corlib_native_System_String.cpp

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@ HRESULT Library_corlib_native_System_String::Substring___STRING__I4__I4(CLR_RT_S
140140
NANOCLR_NOCLEANUP();
141141
}
142142

143+
HRESULT Library_corlib_native_System_String::Trim___STRING(CLR_RT_StackFrame &stack)
144+
{
145+
NANOCLR_HEADER();
146+
147+
NANOCLR_SET_AND_LEAVE(Trim(stack, nullptr, true, true));
148+
149+
NANOCLR_NOCLEANUP();
150+
}
151+
143152
HRESULT Library_corlib_native_System_String::Trim___STRING__SZARRAY_CHAR(CLR_RT_StackFrame &stack)
144153
{
145154
NATIVE_PROFILE_CLR_CORE();
@@ -150,6 +159,19 @@ HRESULT Library_corlib_native_System_String::Trim___STRING__SZARRAY_CHAR(CLR_RT_
150159
NANOCLR_NOCLEANUP();
151160
}
152161

162+
#if (NANOCLR_REFLECTION == TRUE)
163+
164+
HRESULT Library_corlib_native_System_String::TrimStart___STRING(CLR_RT_StackFrame &stack)
165+
{
166+
NANOCLR_HEADER();
167+
168+
NANOCLR_SET_AND_LEAVE(Trim(stack, nullptr, true, false));
169+
170+
NANOCLR_NOCLEANUP();
171+
}
172+
173+
#endif
174+
153175
HRESULT Library_corlib_native_System_String::TrimStart___STRING__SZARRAY_CHAR(CLR_RT_StackFrame &stack)
154176
{
155177
NATIVE_PROFILE_CLR_CORE();
@@ -160,6 +182,19 @@ HRESULT Library_corlib_native_System_String::TrimStart___STRING__SZARRAY_CHAR(CL
160182
NANOCLR_NOCLEANUP();
161183
}
162184

185+
#if (NANOCLR_REFLECTION == TRUE)
186+
187+
HRESULT Library_corlib_native_System_String::TrimEnd___STRING(CLR_RT_StackFrame &stack)
188+
{
189+
NANOCLR_HEADER();
190+
191+
NANOCLR_SET_AND_LEAVE(Trim(stack, nullptr, false, true));
192+
193+
NANOCLR_NOCLEANUP();
194+
}
195+
196+
#endif
197+
163198
HRESULT Library_corlib_native_System_String::TrimEnd___STRING__SZARRAY_CHAR(CLR_RT_StackFrame &stack)
164199
{
165200
NATIVE_PROFILE_CLR_CORE();
@@ -233,8 +268,10 @@ HRESULT Library_corlib_native_System_String::CompareTo___I4__STRING(CLR_RT_Stack
233268
NATIVE_PROFILE_CLR_CORE();
234269
NANOCLR_HEADER();
235270

236-
CLR_RT_HeapBlock &pThis = stack.Arg0(); // String references are special, they don't point to an object, they are
237-
// the object. So use stack.Arg0() instead of stack.This()
271+
// String references are special, they don't point to an object, they are
272+
// the object. So use stack.Arg0() instead of stack.This()
273+
CLR_RT_HeapBlock &pThis = stack.Arg0();
274+
238275
CLR_RT_HeapBlock &pArg = stack.Arg1();
239276

240277
stack.SetResult_I4(CLR_RT_HeapBlock::Compare_Unsigned_Values(pThis, pArg));
@@ -445,16 +482,6 @@ HRESULT Library_corlib_native_System_String::ToUpper___STRING(CLR_RT_StackFrame
445482
NANOCLR_NOCLEANUP();
446483
}
447484

448-
HRESULT Library_corlib_native_System_String::Trim___STRING(CLR_RT_StackFrame &stack)
449-
{
450-
NATIVE_PROFILE_CLR_CORE();
451-
NANOCLR_HEADER();
452-
453-
NANOCLR_SET_AND_LEAVE(Trim(stack, nullptr, true, true));
454-
455-
NANOCLR_NOCLEANUP();
456-
}
457-
458485
HRESULT Library_corlib_native_System_String::Equals___STATIC__BOOLEAN__STRING__STRING(CLR_RT_StackFrame &stack)
459486
{
460487
NATIVE_PROFILE_CLR_CORE();
@@ -894,10 +921,11 @@ HRESULT Library_corlib_native_System_String::ChangeCase(CLR_RT_StackFrame &stack
894921
*ptr++ = c;
895922
}
896923

897-
NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_String::CreateInstance(
898-
stack.PushValue(),
899-
(CLR_UINT16 *)arrayTmp->GetFirstElement(),
900-
arrayTmp->m_numOfElements));
924+
NANOCLR_CHECK_HRESULT(
925+
CLR_RT_HeapBlock_String::CreateInstance(
926+
stack.PushValue(),
927+
(CLR_UINT16 *)arrayTmp->GetFirstElement(),
928+
arrayTmp->m_numOfElements));
901929

902930
NANOCLR_NOCLEANUP();
903931
}
@@ -928,10 +956,11 @@ HRESULT Library_corlib_native_System_String::Substring(CLR_RT_StackFrame &stack,
928956
NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
929957
}
930958

931-
NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_String::CreateInstance(
932-
stack.PushValue(),
933-
(CLR_UINT16 *)arrayTmp->GetElement(startIndex),
934-
length));
959+
NANOCLR_CHECK_HRESULT(
960+
CLR_RT_HeapBlock_String::CreateInstance(
961+
stack.PushValue(),
962+
(CLR_UINT16 *)arrayTmp->GetElement(startIndex),
963+
length));
935964

936965
NANOCLR_NOCLEANUP();
937966
}
@@ -1107,10 +1136,11 @@ HRESULT Library_corlib_native_System_String::Split(CLR_RT_StackFrame &stack, CLR
11071136
{
11081137
CLR_RT_HeapBlock *str = (CLR_RT_HeapBlock *)arrayDst->GetElement(count);
11091138

1110-
NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_String::CreateInstance(
1111-
*str,
1112-
pSrcStart,
1113-
(CLR_UINT32)(pSrc - pSrcStart)));
1139+
NANOCLR_CHECK_HRESULT(
1140+
CLR_RT_HeapBlock_String::CreateInstance(
1141+
*str,
1142+
pSrcStart,
1143+
(CLR_UINT32)(pSrc - pSrcStart)));
11141144

11151145
pSrcStart = pSrc + 1;
11161146
}

0 commit comments

Comments
 (0)