-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Partially allow marshalling ILSTUB compilation for ndirect methods using crossgen2 if SPC.dll is in the same bubble #54847
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -346,10 +346,8 @@ public sealed override bool GeneratesPInvoke(MethodDesc method) | |
{ | ||
// PInvokes depend on details of the core library, so for now only compile them if: | ||
// 1) We're compiling the core library module, or | ||
// 2) We're compiling any module, and no marshalling is needed | ||
// | ||
// TODO Future: consider compiling PInvokes with complex marshalling in version bubble | ||
// mode when the core library is included in the bubble. | ||
// 2) We're compiling any module, and no marshalling is needed, or | ||
// 3) We're compiling any module, and core library module is in the same bubble, and marhaller supports compilation | ||
|
||
Debug.Assert(method is EcmaMethod); | ||
|
||
|
@@ -361,6 +359,9 @@ public sealed override bool GeneratesPInvoke(MethodDesc method) | |
if (((EcmaMethod)method).Module.Equals(method.Context.SystemModule)) | ||
return true; | ||
|
||
if (_versionBubbleModuleSet.Contains(method.Context.SystemModule)) | ||
return !Marshaller.IsMarshallingNotSupported(method); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we have an existing mechanism that rejects unsupported IL stubs already. Is this one redundant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So enabling stub generation for broader scenarios uncovered other issues. So plan is to merge the fix for BStr issue, and remove other Marshallers not implemented for R2R as a separate change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mangod9 Ok, I'll update my PR when other marshallers are removed. This marshallers removal will be included in 6.0, right? Do you have milestone for correct marshallers inplementation for crossgen2? Will it be 6.0 too or 7.0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah hoping removal will be done in the next week. Correct implementation for cg2 most likely will be in 7 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gbalykov the UTF8 and Unicode marshallers have been fixed. We will evaluate how to properly generate stubs for these cases in 7 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I'll update this PR then |
||
|
||
return !Marshaller.IsMarshallingRequired(method); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,5 +141,22 @@ public static bool IsMarshallingRequired(MethodSignature methodSig, ParameterMet | |
|
||
return false; | ||
} | ||
|
||
public static bool IsMarshallingNotSupported(MethodDesc targetMethod) | ||
{ | ||
Debug.Assert(targetMethod.IsPInvoke); | ||
|
||
var marshallers = GetMarshallersForMethod(targetMethod); | ||
for (int i = 0; i < marshallers.Length; i++) | ||
{ | ||
if (marshallers[i].GetType() == typeof(NotSupportedMarshaller) | ||
// TODO: AnsiStringMarshaller can be allowed when it's logic is fixed, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to fix this. |
||
// currently it leads to free(): invalid pointer | ||
|| marshallers[i].GetType() == typeof(AnsiStringMarshaller)) | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
} |
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.
This condition is redundant