Copy ctor handling for crossgen2#40113
Merged
davidwrighton merged 2 commits intodotnet:masterfrom Jul 30, 2020
Merged
Conversation
- Add IL based test for copy ctor to allow testing in Crossgen2 which doesn't yet support IJW - Add api to determine proper EmbeddedSignatureData index for these - And tests to ensure this remains functional - Marshaller changes to recognize copy constructor cases - Note that there isn't actual marshaller support. Instead the compiler can now able to detect when copy ctors should be used, and falls back to the runtime interop layer
Member
Author
|
@dotnet/crossgen-contrib |
Member
Author
|
@jkoritzinsky I've added this IL only copy ctor test in order to get coverage on this form of marshalling in crossgen2. |
jkoritzinsky
approved these changes
Jul 30, 2020
MichalStrehovsky
approved these changes
Jul 30, 2020
| internal static MarshallerKind GetMarshallerKind( | ||
| TypeDesc type, | ||
| MarshalAsDescriptor marshalAs, | ||
| int? parameterIndex, |
Member
There was a problem hiding this comment.
Indentation looks off.
|
|
||
| type = type.GetParameterType(); | ||
|
|
||
| if (!type.IsPrimitive && type.IsValueType && !(marshallerType == MarshallerType.Field) |
Member
There was a problem hiding this comment.
Suggested change
| if (!type.IsPrimitive && type.IsValueType && !(marshallerType == MarshallerType.Field) | |
| if (!type.IsPrimitive && type.IsValueType && marshallerType != MarshallerType.Field |
| // Parameter index 0 represents the return type, and indices 1-n represent the parameters to the signature | ||
| public static string GetIndexOfCustomModifierOnPointedAtTypeByParameterIndex(int parameterIndex) | ||
| { | ||
| return $"0.1.1.2.{(parameterIndex + 1).ToStringInvariant()}.1"; |
Member
There was a problem hiding this comment.
Not reviewing this part. I don't want to spend time learning how this address is computed because that code upsets me.
| if (nativeType == NativeTypeKind.Default) | ||
| { | ||
| var pointedAtType = type.GetParameterType(); | ||
| if (!pointedAtType.IsPrimitive && !type.IsEnum && !(marshallerType == MarshallerType.Field) |
Member
There was a problem hiding this comment.
Suggested change
| if (!pointedAtType.IsPrimitive && !type.IsEnum && !(marshallerType == MarshallerType.Field) | |
| if (!pointedAtType.IsPrimitive && !type.IsEnum && marshallerType != MarshallerType.Field |
Jacksondr5
pushed a commit
to Jacksondr5/runtime
that referenced
this pull request
Aug 10, 2020
- Add IL based test for copy ctor to allow testing in Crossgen2 which doesn't yet support IJW - Add api to determine proper EmbeddedSignatureData index for these - And tests to ensure this remains functional - Marshaller changes to recognize copy constructor cases - Note that there isn't actual marshaller support. Instead the compiler can now able to detect when copy ctors should be used, and falls back to the runtime interop layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #39423
Note that with this change there is only one more case of custom modifier examination that is used to affect runtime codegen. (The use of the IsCXXReferenceModifier type when searching for destructors to implement this form of marshalling.) Also, as that syntax hasn't been generated from a C++/CLI compiler in many years, it is unlikely that it will ever need to be implemented.