-
Notifications
You must be signed in to change notification settings - Fork 508
Conversation
|
||
public override MethodIL EmitIL() | ||
{ | ||
// TODO: Emit marshaling stub |
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.
Fixing this TODO is about refactoring the marshaling code generator. I am leaving it for follow up PR.
Depends on dotnet/coreclr#18534 |
for (int i = 0; i < _targetSignature.Length; i++) | ||
blittable = blittable && MarshalHelpers.IsBlittableType(_targetSignature[i]); | ||
if (!blittable) | ||
throw new NotSupportedException("PInvoke Calli with non-blittable type"); |
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.
Depending on how long term this code is expected to stay - maybe this could generate a throwing body. I think throwing this exception type here will lead to a compilation failure.
var emitter = new ILEmitter(); | ||
var stream = emitter.NewCodeStream(); | ||
|
||
for (int i = 0; i < _signature.Length; i++) |
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 should probably access the property to avoid reading uninitialized value.
namespace Internal.TypeSystem | ||
{ | ||
/// <summary> | ||
/// When implemented by a <see cref="TypeDesc"/> or <see cref="MethodDesc"/>, instructs a name mangler to use the same mangled name |
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.
Nit: the comment should probably say this is only for methods.
src/JitInterface/src/CorInfoImpl.cs
Outdated
Debug.Assert(callConv != CorInfoCallConv.CORINFO_CALLCONV_C || | ||
callConv != CorInfoCallConv.CORINFO_CALLCONV_STDCALL || | ||
callConv != CorInfoCallConv.CORINFO_CALLCONV_THISCALL || | ||
callConv != CorInfoCallConv.CORINFO_CALLCONV_FASTCALL); |
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.
Should these be ==
? This is always true.
This is a building block to be able to write a repro case for #5587 in C#. With this, it's possible to use `AddrOf` intrinsic in connection with `StdCall` to hit the unimplemented functionality with pure C#.
@dotnet-bot test this please |
All ducks should be in a row now. @MichalStrehovsky Could you please take a look one more time? |
Please don't shoot the ducks 😁 |
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 is huge, thanks!
Replace PInvoke calli with a regular call to a marshaling stub as necessary.
Fixes #5587