Skip to content

Commit

Permalink
Added back the MemberwiseClone plug.
Browse files Browse the repository at this point in the history
Fixed issue with dotnet sdk version.
  • Loading branch information
jp2masa committed May 16, 2017
1 parent 2826446 commit 490506e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cosmos.sln
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Compiler.Tests.Singl
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FD6DCBF5-6451-4CA0-BD5D-5637BC846929}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
nuget.config = nuget.config
EndProjectSection
EndProject
Expand Down
1 change: 1 addition & 0 deletions Tests/Cosmos.TestRunner.Core/Cosmos.TestRunner.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<ProjectReference Include="..\Cosmos.Compiler.Tests.SingleEchoTest\Cosmos.Compiler.Tests.SingleEchoTest.csproj" />
<ProjectReference Include="..\Cosmos.Kernel.Tests.Fat\Cosmos.Kernel.Tests.Fat.csproj" />
<ProjectReference Include="..\Cosmos.Kernel.Tests.IO\Cosmos.Kernel.Tests.IO.csproj" />
<ProjectReference Include="..\GraphicTest\GraphicTest.csproj" />
<ProjectReference Include="..\SimpleStructsAndArraysTest\SimpleStructsAndArraysTest.csproj" />
<ProjectReference Include="..\VGACompilerCrash\VGACompilerCrash.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Tests/GraphicTest/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* it exists to make easier tests while changing low level stuff (it would be better and faster to use the Demo kernel but
* sometimes it is a problem to make it see modifications done at low level)
*
* Remember to comment this test again on TestKernelSet.cs when you are ready to merge your modifications!
* Remember to comment this test again on TestKernelSets.cs when you are ready to merge your modifications!
*/
namespace GraphicTest
{
Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "1.0.4"
}
}
21 changes: 21 additions & 0 deletions source/Cosmos.Core.Plugs/System/ObjectImpl.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Cosmos.Core.Common;
using Cosmos.Debug.Kernel;
using Cosmos.IL2CPU.Plugs;

Expand Down Expand Up @@ -28,5 +29,25 @@ public static int GetHashCode(object aThis)
{
return (int)aThis;
}

public static unsafe ulong MemberwiseClone([ObjectPointerAccess] uint aThis)
{
var xThisPointer = (uint*)aThis;
var xSize = ObjectUtilities.FieldDataOffset + xThisPointer[2];

var xResult = GCImplementation.AllocNewObject(xSize);

var xThisPointerByte = (byte*)xThisPointer;
var xThatPointerByte = (byte*)xResult;

for (int i = 0; i < xSize; i++)
{
xThatPointerByte[i] = xThisPointerByte[i];
}

ulong xReturn = ((ulong)xResult) << (sizeof(ulong) / 2 * 8);

return xReturn;
}
}
}

0 comments on commit 490506e

Please sign in to comment.