Move Span/ReadOnlySpan to shared CoreLib partition#10988
Conversation
Fix a few method names to better names used in CoreRT Contributes to dotnet/corert#2966
| private extern static bool IsAddressInStack(IntPtr ptr); | ||
| #endif | ||
|
|
||
| static internal bool ByRefLessThan<T>(ref T refA, ref T refB) |
There was a problem hiding this comment.
What is the rationale for removing this?
| DEFINE_FIELD(PINNING_HELPER, M_DATA, m_data) | ||
|
|
||
| DEFINE_CLASS(ARRAY_PINNING_HELPER, CompilerServices, ArrayPinningHelper) | ||
| DEFINE_FIELD(ARRAY_PINNING_HELPER, M_ARRAY_DATA, m_arrayData) |
There was a problem hiding this comment.
Removing this is causing CI build errors. Also it is used here:
mdToken tokArrayPinningHelper = MscorlibBinder::GetField(FIELD__ARRAY_PINNING_HELPER__M_ARRAY_DATA)->GetMemberDef();d:\j\workspace\debug_windows---17180f1b\src\vm\jitinterface.cpp(6926): error C2065: 'FIELD__ARRAY_PINNING_HELPER__M_ARRAY_DATA': undeclared identifier [D:\j\workspace\debug_windows---17180f1b\bin\obj\Windows_NT.x64.Debug\src\vm\crossgen\cee_crossgen.vcxproj]
There was a problem hiding this comment.
Accidental change ... fixed.
|
|
||
| internal static class SpanHelper |
There was a problem hiding this comment.
Should we separate the Span/SpanHelper class into a separate file, esp since it has internal statics used by both Span and ReadOnlySpan?
| } | ||
|
|
||
| static internal ref T GetArrayData<T>(T[] array) | ||
| static internal ref byte GetRawSzArrayData(this Array array) |
There was a problem hiding this comment.
METHOD__JIT_HELPERS__GET_ARRAY_DATA and
METHOD__JIT_HELPERS__GET_RAW_SZ_ARRAY_DATA case both point to the same code and yet one returns a ref T while the other returns a ref byte? How does that work?
else if (tk == MscorlibBinder::GetMethod(METHOD__JIT_HELPERS__GET_ARRAY_DATA)->GetMemberDef())
{
mdToken tokArrayPinningHelper = MscorlibBinder::GetField(FIELD__ARRAY_PINNING_HELPER__M_ARRAY_DATA)->GetMemberDef();
static BYTE ilcode[] = { CEE_LDARG_0,
CEE_LDFLDA,0,0,0,0,
CEE_RET };
ilcode[2] = (BYTE)(tokArrayPinningHelper);
ilcode[3] = (BYTE)(tokArrayPinningHelper >> 8);
ilcode[4] = (BYTE)(tokArrayPinningHelper >> 16);
ilcode[5] = (BYTE)(tokArrayPinningHelper >> 24);
methInfo->ILCode = const_cast<BYTE*>(ilcode);
methInfo->ILCodeSize = sizeof(ilcode);
methInfo->maxStack = 1;
methInfo->EHcount = 0;
methInfo->options = (CorInfoOptions)0;
return true;
}There was a problem hiding this comment.
The IL is same for both cases because of it depends on unsafe casts.
| ThrowHelper.ThrowArgumentOutOfRangeException(); | ||
|
|
||
| _pointer = new ByReference<T>(ref Unsafe.Add(ref JitHelpers.GetArrayData(array), start)); | ||
| _pointer = new ByReference<T>(ref Unsafe.Add(ref Unsafe.As<byte, T>(ref array.GetRawSzArrayData()), start)); |
There was a problem hiding this comment.
Does having to pass ref array.GetRawSzArrayData() to Unsafe.As<byte, T> incur significant performance cost?
There was a problem hiding this comment.
The JITed code is the same in both cases.
|
@dotnet-bot test Ubuntu16.04 arm Cross Debug Build |
|
@dotnet-bot test Ubuntu arm Cross Release Build |
|
LGTM |
) Fix a few method names to better names used in CoreRT Contributes to #2966 Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
) Fix a few method names to better names used in CoreRT Contributes to #2966 Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
) Fix a few method names to better names used in CoreRT Contributes to dotnet/corert#2966 Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
) Fix a few method names to better names used in CoreRT Contributes to dotnet/corert#2966 Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
) Fix a few method names to better names used in CoreRT Contributes to dotnet/corert#2966 Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
) Fix a few method names to better names used in CoreRT Contributes to dotnet/corert#2966 Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
Fix a few method names to better names used in CoreRT
Contributes to dotnet/corert#2966