Skip to content

Commit

Permalink
Try remove cctor run
Browse files Browse the repository at this point in the history
  • Loading branch information
huoyaoyuan committed Jan 23, 2024
1 parent 879c3cf commit 17c9b23
Showing 1 changed file with 0 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ ref CastHelpers.Unbox(pDestMT, obj),
}

// Will box each element in an array of value classes or primitives into an array of Objects.
[UnconditionalSuppressMessage("Trimming", "IL2059:The type passed to the RunClassConstructor is not statically known, Trimmer can't make sure that its static constructor is available.", Justification = "The type handle is retrieved from existing array.")]
private static unsafe void CopyImplBoxEachElement(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length)
{
MethodTable* pSrcArrayMT = RuntimeHelpers.GetMethodTable(sourceArray);
Expand All @@ -209,8 +208,6 @@ private static unsafe void CopyImplBoxEachElement(Array sourceArray, int sourceI

MethodTable* pSrcMT = srcTH.AsMethodTable();

RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle.FromIntPtr((nint)pSrcMT)); // pSrcMT->CheckRunClassInitThrowing

nuint srcSize = pSrcArrayMT->ComponentSize;
ref byte data = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(sourceArray), (nuint)sourceIndex * srcSize);
ref object? destData = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<object?[]>(destinationArray)), destinationIndex);
Expand Down

0 comments on commit 17c9b23

Please sign in to comment.