summaryrefslogtreecommitdiff
path: root/src/vm/ilmarshalers.h
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>2019-03-19 16:22:47 -0700
committerGitHub <noreply@github.com>2019-03-19 16:22:47 -0700
commit4bca72836811aa1b82389c50dc4f2bcae222bdc0 (patch)
tree6852f8c74ddd435a7ebc59867b00ca310a5c0c06 /src/vm/ilmarshalers.h
parentaccc6eb0f0f669494bee0788884b5a10101f1243 (diff)
downloadcoreclr-4bca72836811aa1b82389c50dc4f2bcae222bdc0.tar.gz
coreclr-4bca72836811aa1b82389c50dc4f2bcae222bdc0.tar.bz2
coreclr-4bca72836811aa1b82389c50dc4f2bcae222bdc0.zip
Implement support for copy constructors when marshalling in IJW (#22805)
Fixes #22219. I decided to try simplifying the code when bringing this feature over from .NET Framework. The .NETFX x86 implementation of this marshaler adds a lot of extra code-paths, and intercepts the calling stub to enable it to exactly replicate the behavior of what would be the native code by copy-constructing an object in-place where it goes on the stack for the native call. Instead of adding all of that extra goo, I decided to keep the implementation much more similar to the non-x86 implementation from .NETFX. Instead of intercepting the call and adding bookkeeping helper stubs, the marshaler just copies to a local in the IL stub, just like non-x86. When calling the native function, it just loads the local onto the IL stack and calls the native function as a normal function. There is a difference there, but I cannot think of a way that the difference is observable to the user. The non-x86 implementation is identical to the .NETFX implementation.
Diffstat (limited to 'src/vm/ilmarshalers.h')
-rw-r--r--src/vm/ilmarshalers.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/vm/ilmarshalers.h b/src/vm/ilmarshalers.h
index 99a3d8f8d6..c892ae66a9 100644
--- a/src/vm/ilmarshalers.h
+++ b/src/vm/ilmarshalers.h
@@ -2725,8 +2725,40 @@ protected:
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
+class ILBlittableValueClassWithCopyCtorMarshaler : public ILMarshaler
+{
+public:
+ enum
+ {
+ c_fInOnly = TRUE,
+ c_nativeSize = VARIABLESIZE,
+ c_CLRSize = sizeof(OBJECTREF),
+ };
+ LocalDesc GetManagedType()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return LocalDesc();
+ }
+ LocalDesc GetNativeType()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return LocalDesc();
+ }
+
+ static MarshalerOverrideStatus ArgumentOverride(NDirectStubLinker* psl,
+ BOOL byref,
+ BOOL fin,
+ BOOL fout,
+ BOOL fManagedToNative,
+ OverrideProcArgs* pargs,
+ UINT* pResID,
+ UINT argidx,
+ UINT nativeStackOffset);
+
+
+};
class ILArgIteratorMarshaler : public ILMarshaler
{