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:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2017-02-15 04:01:36 +0300
committerGitHub <noreply@github.com>2017-02-15 04:01:36 +0300
commit58b440b67096f2ff73dd7c57f1868c17a61fa1ec (patch)
tree9ee19e8db3db8cd548383fd35941e91e09eeae4c /src/Test.CoreLib
parent4673ec88b91411c1e8c0996cec9a23c1478d38fa (diff)
parent5bd6c86405ae1b4f9d7d8e714eac50941935b377 (diff)
Merge pull request #2754 from dotnet/nmirror
Merge nmirror to master
Diffstat (limited to 'src/Test.CoreLib')
-rw-r--r--src/Test.CoreLib/src/System/Object.cs93
-rw-r--r--src/Test.CoreLib/src/System/Runtime/RuntimeImports.cs8
-rw-r--r--src/Test.CoreLib/src/Test.CoreLib.csproj9
3 files changed, 104 insertions, 6 deletions
diff --git a/src/Test.CoreLib/src/System/Object.cs b/src/Test.CoreLib/src/System/Object.cs
new file mode 100644
index 000000000..a6addf96b
--- /dev/null
+++ b/src/Test.CoreLib/src/System/Object.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================
+**
+**
+**
+** Object is the root class for all CLR objects. This class
+** defines only the basics.
+**
+**
+===========================================================*/
+
+using System.Runtime;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// TODO: remove when m_pEEType becomes EETypePtr
+using EEType = Internal.Runtime.EEType;
+
+namespace System
+{
+ // CONTRACT with Runtime
+ // The Object type is one of the primitives understood by the compilers and runtime
+ // Data Contract: Single field of type EEType*
+ // VTable Contract: The first vtable slot should be the finalizer for object => The first virtual method in the object class should be the Finalizer
+
+ // The Object is the root class for all object in the CLR System. Object
+ // is the super class for all other CLR objects and provide a set of methods and low level
+ // services to subclasses.
+
+ public unsafe class Object
+ {
+ // CS0649: Field '{blah}' is never assigned to, and will always have its default value
+#pragma warning disable 649
+
+ // Marked as internal for now so that some classes can use C#'s fixed statement on objects.
+ // Wouldn't have to do this if we could directly declared pinned locals.
+ // TODO: Consider making this EETypePtr instead of EEType*.
+ internal EEType* m_pEEType;
+
+#pragma warning restore
+
+ // Creates a new instance of an Object.
+ public Object()
+ {
+ }
+
+ // Allow an object to free resources before the object is reclaimed by the GC.
+ // CONTRACT with runtime: This method's virtual slot number is hardcoded in the binder. It is an
+ // implementation detail where it winds up at runtime.
+ // **** Do not add any virtual methods in this class ahead of this ****
+
+ ~Object()
+ {
+ }
+
+ public virtual bool Equals(object o)
+ {
+ return false;
+ }
+
+ public virtual int GetHashCode()
+ {
+ return 0;
+ }
+
+ internal unsafe EEType* EEType
+ {
+ get
+ {
+ // NOTE: if managed code can be run when the GC has objects marked, then this method is
+ // unsafe. But, generically, we don't expect managed code such as this to be allowed
+ // to run while the GC is running.
+ return m_pEEType;
+ //PREFER m_pEEType.ToPointer();
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private class RawData
+ {
+ public byte Data;
+ }
+
+ internal ref byte GetRawData()
+ {
+ return ref Unsafe.As<RawData>(this).Data;
+ }
+ }
+}
diff --git a/src/Test.CoreLib/src/System/Runtime/RuntimeImports.cs b/src/Test.CoreLib/src/System/Runtime/RuntimeImports.cs
index a11525da7..555420e54 100644
--- a/src/Test.CoreLib/src/System/Runtime/RuntimeImports.cs
+++ b/src/Test.CoreLib/src/System/Runtime/RuntimeImports.cs
@@ -47,11 +47,15 @@ namespace System.Runtime
[RuntimeImport(RuntimeLibrary, "RhpGetModuleSection")]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern IntPtr RhGetModuleSection(IntPtr module, ReadyToRunSectionType section, out int length);
+ internal static extern IntPtr RhGetModuleSection(TypeManagerHandle module, ReadyToRunSectionType section, out int length);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[RuntimeImport(RuntimeLibrary, "RhpCreateTypeManager")]
- internal static extern unsafe IntPtr RhpCreateTypeManager(IntPtr moduleHeader);
+ internal static extern unsafe TypeManagerHandle RhpCreateTypeManager(IntPtr osModule, IntPtr moduleHeader);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [RuntimeImport(RuntimeLibrary, "RhpRegisterOsModule")]
+ internal static extern unsafe IntPtr RhpRegisterOsModule(IntPtr osModule);
//
// calls to runtime for allocation
diff --git a/src/Test.CoreLib/src/Test.CoreLib.csproj b/src/Test.CoreLib/src/Test.CoreLib.csproj
index 1a89528ab..8bbec76b9 100644
--- a/src/Test.CoreLib/src/Test.CoreLib.csproj
+++ b/src/Test.CoreLib/src/Test.CoreLib.csproj
@@ -160,9 +160,6 @@
<Compile Include="..\..\Runtime.Base\src\System\Nullable.cs">
<Link>System\Nullable.cs</Link>
</Compile>
- <Compile Include="..\..\Runtime.Base\src\System\Object.cs">
- <Link>System\Object.cs</Link>
- </Compile>
<Compile Include="..\..\Runtime.Base\src\System\ParamArrayAttribute.cs">
<Link>System\ParamArrayAttribute.cs</Link>
</Compile>
@@ -252,6 +249,10 @@
<Compile Include="System\Runtime\RuntimeImports.cs" />
<Compile Include="System\Threading\Interlocked.cs" />
<Compile Include="System\RuntimeExceptionHelpers.cs" />
+ <Compile Include="System\Object.cs" />
+ <Compile Include="..\..\Common\src\Internal\Runtime\TypeManagerHandle.cs">
+ <Link>Internal\Runtime\TypeManagerHandle.cs</Link>
+ </Compile>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup>
@@ -259,4 +260,4 @@
<AssemblyInfoPartialFile>
</AssemblyInfoPartialFile>
</PropertyGroup>
-</Project> \ No newline at end of file
+</Project>