Skip to content
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

Merged
merged 7 commits into from
Dec 4, 2024

Conversation

am11
Copy link
Member

@am11 am11 commented Dec 3, 2024

No description provided.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Dec 3, 2024
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@am11
Copy link
Member Author

am11 commented Dec 3, 2024

@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;
    }
}

@am11 am11 marked this pull request as ready for review December 3, 2024 13:14
src/coreclr/vm/binder.h Outdated Show resolved Hide resolved
Copy link
Member

@jkotas jkotas left a 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)
Copy link
Member Author

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:

Copy link
Member

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.

Copy link
Member Author

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).

eduardo-vp pushed a commit to eduardo-vp/runtime that referenced this pull request Dec 5, 2024
* Move GetRefAny (with FCThrow) to managed

* Move impl. to TypeReference
mikelle-rogers pushed a commit to mikelle-rogers/runtime that referenced this pull request Dec 10, 2024
* Move GetRefAny (with FCThrow) to managed

* Move impl. to TypeReference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-VM-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants