Rewrite a few more array FCalls in C##27603
Conversation
|
All affected methods got faster. Here are a few examples for different methods called on
(These numbers are collected on top of #27554.) |
src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs
Show resolved
Hide resolved
src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs
Outdated
Show resolved
Hide resolved
Fix error SA1028: Code should not contain trailing whitespace
|
@jkotas Heads up. I addressed error "SA1028: Code should not contain trailing whitespace" that was failing and committed directly into the branch. |
GrabYourPitchforks
left a comment
There was a problem hiding this comment.
LGTM, but one question on potential overflow scenarios.
src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs
Outdated
Show resolved
Hide resolved
|
As an aside, is there a test or some other check we can have that verifies that the native structs and the managed structs are in sync? I imagine the more we move traditionally native functionality into the managed world, it increases the chances of them getting out of sync at some point. |
|
Yes, it would be nice to have it. We have the same problem for number of other structures passed through FCalls. Some of it is covered via checks in vm\mscorlib.h. |
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| internal static unsafe bool ObjectHasComponentSize(object obj) | ||
| { | ||
| return GetMethodTable(obj)->HasComponentSize; |
There was a problem hiding this comment.
Why is GC.KeepAlive required in GetMultiDimensionalArrayRank but not here?
There was a problem hiding this comment.
All callers ObjectHasComponentSize keep the MethodTable alive by using the object after the calling ObjectHasComponentSize. I will add a comment or a call to GC.KeepAlive to make this clear.
No description provided.