Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Runtime.Base')
-rw-r--r--src/Runtime.Base/src/System/Object.cs22
-rw-r--r--src/Runtime.Base/src/System/Runtime/EETypePtr.cs8
2 files changed, 30 insertions, 0 deletions
diff --git a/src/Runtime.Base/src/System/Object.cs b/src/Runtime.Base/src/System/Object.cs
index 7d5475228..2e541f303 100644
--- a/src/Runtime.Base/src/System/Object.cs
+++ b/src/Runtime.Base/src/System/Object.cs
@@ -19,6 +19,7 @@ using System.Runtime.InteropServices;
// TODO: remove when m_pEEType becomes EETypePtr
using EEType = Internal.Runtime.EEType;
+using ObjHeader = Internal.Runtime.ObjHeader;
namespace System
{
@@ -69,15 +70,36 @@ namespace System
}
}
+ internal EETypePtr EETypePtr
+ {
+ get
+ {
+ return new EETypePtr(new IntPtr(m_pEEType));
+ }
+ }
+
[StructLayout(LayoutKind.Sequential)]
private class RawData
{
public byte Data;
}
+ /// <summary>
+ /// Return beginning of all data (excluding ObjHeader and EEType*) within this object.
+ /// Note that for strings/arrays this would include the Length as well.
+ /// </summary>
internal ref byte GetRawData()
{
return ref Unsafe.As<RawData>(this).Data;
}
+
+ /// <summary>
+ /// Return size of all data (excluding ObjHeader and EEType*).
+ /// Note that for strings/arrays this would include the Length as well.
+ /// </summary>
+ internal uint GetRawDataSize()
+ {
+ return EETypePtr.BaseSize - (uint)sizeof(ObjHeader) - (uint)sizeof(EEType*);
+ }
}
}
diff --git a/src/Runtime.Base/src/System/Runtime/EETypePtr.cs b/src/Runtime.Base/src/System/Runtime/EETypePtr.cs
index b8bc5e4cd..26355a84a 100644
--- a/src/Runtime.Base/src/System/Runtime/EETypePtr.cs
+++ b/src/Runtime.Base/src/System/Runtime/EETypePtr.cs
@@ -49,6 +49,14 @@ namespace System
throw new NotImplementedException();
}
#endif
+
+ internal unsafe uint BaseSize
+ {
+ get
+ {
+ return ToPointer()->BaseSize;
+ }
+ }
}
}