-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Helper Method Frames (HMF) from Reflection #109996
base: main
Are you sure you want to change the base?
Conversation
Tagging subscribers to this area: @mangod9 |
@EgorBot -intel -arm64 -perf
|
@EgorBot -x64 -arm64 -profiler using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
public class Bench
{
struct S;
[Benchmark]
public Type Nested() => typeof(S).DeclaringType;
[Benchmark]
public Type NotNested() => typeof(Bench).DeclaringType;
[Benchmark]
public Type RefElementType() => typeof(Bench[]).GetElementType();
[Benchmark]
public Type ValueElementType() => typeof(S[]).GetElementType();
} |
@AaronRobinsonMSFT the bot complained that |
@EgorBot -x64 -arm64 using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
public class Bench
{
struct S;
[Benchmark]
public Type Nested() => typeof(S).DeclaringType;
[Benchmark]
public Type NotNested() => typeof(Bench).DeclaringType;
[Benchmark]
public Type RefElementType() => typeof(Bench[]).GetElementType();
[Benchmark]
public Type ValueElementType() => typeof(S[]).GetElementType();
} |
@EgorBot -x64 -arm64 -profiler using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
public class Bench
{
struct S;
[Benchmark]
public Type RefElementType() => typeof(Bench[]).GetElementType();
[Benchmark]
public Type ValueElementType() => typeof(S[]).GetElementType();
} |
if (pMT->IsArray) | ||
{ | ||
IntPtr handle = GetHandleForArray(pMT); | ||
return RuntimeTypeHandle.GetRuntimeTypeFromHandle(handle); | ||
} | ||
else | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (pMT->IsArray) | |
{ | |
IntPtr handle = GetHandleForArray(pMT); | |
return RuntimeTypeHandle.GetRuntimeTypeFromHandle(handle); | |
} | |
else | |
{ |
I do not think that this is needed. We got rid of the sharing of methodtable for arrays.
FCALL_CHECK; | ||
} | ||
CONTRACTL_END; | ||
extern "C" TADDR QCALLTYPE RuntimeTypeHandle_GetDeclaringTypeHandleForGenericVariable(EnregisteredTypeHandle pTypeHandle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extern "C" TADDR QCALLTYPE RuntimeTypeHandle_GetDeclaringTypeHandleForGenericVariable(EnregisteredTypeHandle pTypeHandle) | |
extern "C" EnregisteredTypeHandle QCALLTYPE RuntimeTypeHandle_GetDeclaringTypeHandleForGenericVariable(EnregisteredTypeHandle pTypeHandle) |
Should this return EnregisteredTypeHandle
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same for RuntimeTypeHandle::GetElementTypeHandleFromHandle
)
CONTRACTL_END; | ||
|
||
REFLECTCLASSBASEREF refType = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(pTypeUNSAFE); | ||
FCIMPL1(TADDR, RuntimeTypeHandle::GetElementTypeHandleFromHandle, EnregisteredTypeHandle th) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FCIMPL1(TADDR, RuntimeTypeHandle::GetElementTypeHandleFromHandle, EnregisteredTypeHandle th) | |
FCIMPL1(TADDR, RuntimeTypeHandle::GetElementTypeHandle, EnregisteredTypeHandle th) |
Omit FromHandle
suffix? RuntimeTypeHandle_GetDeclaringTypeHandle
does not have it.
Convert
RuntimeMethodHandle.GetDeclaringType()
to managed and QCall.Convert
RuntimeTypeHandle.GetElementType()
to managed.Correct nullability in signature and usage.
Convert
RuntimeTypeHandle.GetDeclaringType()
to managed and QCalls.Remove
GetRuntimeTypeHelper()
.