-
Notifications
You must be signed in to change notification settings - Fork 5.3k
ILASM - Fixing ILASM roundtrip issue with vararg calling convention
#73273
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
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsShould resolve: #72759 Description ILASM was failing to emit the correct callsite signature for a method with a This is what
In ILASM method
So I think the reason it couldn't find the member reference is because getting the fixed signature is effectively the member definition and despite being in the same assembly, the member reference and member definition signatures are different. Now, there is logic to create a member reference if we could not find it in the member reference list, but it seems we lost some information when getting the fixed signature and it creates a bad signature for the new member reference. The solution seems to be to simply remove this special handling as we already have the correct signature from I manually tested this and it resolves the issue reported. I also tried this scenario: using System.Runtime.Intrinsics;
namespace ClassLibrary1
{
public class Class1
{
public static int paramLength(Vector128<int> arg, __arglist)
{
ArgIterator iterator = new ArgIterator(__arglist);
return iterator.GetRemainingCount();
}
}
}vararg_test.exe using ClassLibrary1;
using System.Runtime.Intrinsics;
Console.WriteLine(Class1.paramLength(Vector128<int>.AllBitsSet, __arglist(1, 2)));This scenario works with the PR changes, so this gives me confidence in the change as this is across assembly boundaries. Acceptance Criteria
|
|
@dotnet/jit-contrib This is ready, pending CI runs |
There are other uses of this If I understand the fix here right it will cause ilasm to unnecessarily create |
It looks suspect to me that |
Possibly, I didn't know exactly what might need to be handled in there and I think the runtime uses this as well. To minimize any risk, I went with just the change only in ILASM.
Is this when the
I think this might be it. I just tried to handle this, and when checking it under ILDASM I can see the parameter type starting to form: I'll see if I can get it working. |
vararg calling convention
|
Updated the PR to handle @dotnet/jit-contrib ready for review again pending CI runs. |
Should resolve: #72759
Description
ILASM was failing to emit the correct callsite signature for a method with a
varargcalling convention if one of the parameters was generic instantiation of a type.In
ResolveLocalMemberRefs, it seems we lost some information when getting the fixed signature forvarargcallconv and it creates a bad signature for the new member reference.There are two solutions:
varargcallconv inResolveLocalMemberRefsas we already have the correct signature fromm_LocalMethodRefDList.CountBytesOfOneArgto handleELEMENT_TYPE_GENERICINSTas described by @jakobbotschThe PR is now using solution number 2.
I manually tested this and it resolves the issue reported. I also tried this scenario:
ClassLibrary1.dll
vararg_test.exe
This scenario works with the PR changes, so this gives me confidence in the change as this is across assembly boundaries.
Acceptance Criteria