diff options
Diffstat (limited to 'src/Runtime.Base')
-rw-r--r-- | src/Runtime.Base/src/System/Runtime/RuntimeExports.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Runtime.Base/src/System/Runtime/RuntimeExports.cs b/src/Runtime.Base/src/System/Runtime/RuntimeExports.cs index eb5c5e432..3c8868bf5 100644 --- a/src/Runtime.Base/src/System/Runtime/RuntimeExports.cs +++ b/src/Runtime.Base/src/System/Runtime/RuntimeExports.cs @@ -270,6 +270,25 @@ namespace System.Runtime return new Wrapper(); } + // RhAllocLocal2 helper returns the pointer to the data region directly + // instead of relying on the code generator to offset the local by the + // size of a pointer to get the data region. + [RuntimeExport("RhAllocLocal2")] + public static unsafe ref byte RhAllocLocal2(EETypePtr pEEType) + { + EEType* ptrEEType = (EEType*)pEEType.ToPointer(); + if (ptrEEType->IsValueType) + { +#if FEATURE_64BIT_ALIGNMENT + if (ptrEEType->RequiresAlign8) + return ref InternalCalls.RhpNewFastMisalign(ptrEEType).GetRawData(); +#endif + return ref InternalCalls.RhpNewFast(ptrEEType).GetRawData(); + } + else + return ref new Wrapper().GetRawData(); + } + [RuntimeExport("RhMemberwiseClone")] public static unsafe object RhMemberwiseClone(object src) { |