-
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
Move GetRefAny (with FCThrow) to managed #110344
Conversation
Tagging subscribers to this area: @mangod9 |
42664f6
to
6f3f4cc
Compare
@EgorBot -windows_intel using System;
using BenchmarkDotNet.Attributes;
public class Bench
{
[Benchmark]
public byte GetRef()
{
MyStruct myStruct = new MyStruct(42);
TypedReference tr = __makeref(myStruct);
byte fieldValue = __refvalue(tr, MyStruct).Field;
return fieldValue;
}
}
public struct MyStruct
{
public byte Field;
public MyStruct(byte value)
{
Field = value;
}
} |
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/TypedReference.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/TypedReference.CoreCLR.cs
Outdated
Show resolved
Hide resolved
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.
Thanks
} | ||
HCIMPLEND | ||
|
||
|
||
/*************************************************************/ | ||
HCIMPL2(BOOL, JIT_IsInstanceOfException, CORINFO_CLASS_HANDLE type, Object* obj) |
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.
@jkotas, there is a QCall ThrowInvalidCastException
below this one which uses COMPlusThrowInvalidCastException
. Should we:
- keep it; in favor of asm helpers Improve software exception handling performance #108480 (comment)
- return the intermediate result from QCall and throw the actual exception from managed
- pass a callback from managed to QCall
(sourceType, targetType) => throw new InvalidCastExcep..
like some existing GC config QCalls etc. have
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.
I think ThrowInvalidCastException
QCall is fine as is. I do not see what we would gain by "return the intermediate result" or "pass a callback from managed" refactoring. It would just make the code more complicated.
in favor of asm helpers
I am not sure what you mean by this. This QCall is not related to any asm helpers.
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.
his QCall is not related to any asm helpers.
Ah, sorry I thought COMPlusThrow ends up using C++ exception and confusing it with your comment in earlier PR #109087 (comment).
* Move GetRefAny (with FCThrow) to managed * Move impl. to TypeReference
* Move GetRefAny (with FCThrow) to managed * Move impl. to TypeReference
No description provided.