From e6dedfbba92f58c50d9c45ff7154b4e737c2a2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro?= Date: Sun, 19 Feb 2017 01:55:02 +0000 Subject: [PATCH] Fixed Stind_I1 and Stind_I2. --- Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs | 4 ++++ Tests/Cosmos.TestRunner.UnitTest/project.json | 13 ++++++------- Tests/Cosmos.TestRunner/project.json | 8 ++++---- source/Cosmos.Core.Plugs/System/StringImpl.cs | 8 ++++---- source/Cosmos.IL2CPU/IL/Stind_I1.cs | 16 +++++++++++----- source/Cosmos.IL2CPU/IL/Stind_I2.cs | 16 +++++++++++----- 6 files changed, 40 insertions(+), 25 deletions(-) diff --git a/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs b/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs index ce107fc26..b49d7ef48 100644 --- a/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs +++ b/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs @@ -249,6 +249,10 @@ namespace Cosmos.TestRunner.Core } else { + File.Copy(@"..\..\source\IL2CPU\bin\Debug\netcoreapp1.0\IL2CPU.deps.json", @"bin\Debug\netcoreapp1.0\IL2CPU.deps.json", true); + File.Copy(@"..\..\source\IL2CPU\bin\Debug\netcoreapp1.0\IL2CPU.runtimeconfig.json", @"bin\Debug\netcoreapp1.0\IL2CPU.runtimeconfig.json", true); + File.Copy(@"..\..\source\IL2CPU\bin\Debug\netcoreapp1.0\IL2CPU.runtimeconfig.dev.json", @"bin\Debug\netcoreapp1.0\IL2CPU.runtimeconfig.dev.json", true); + xArguments.Insert(0, typeof(Program).GetTypeInfo().Assembly.Location); RunIL2CPUProcess("dotnet", mBaseWorkingDirectory, diff --git a/Tests/Cosmos.TestRunner.UnitTest/project.json b/Tests/Cosmos.TestRunner.UnitTest/project.json index 94e1ed700..17fb3c2f8 100644 --- a/Tests/Cosmos.TestRunner.UnitTest/project.json +++ b/Tests/Cosmos.TestRunner.UnitTest/project.json @@ -2,22 +2,21 @@ "version": "1.0.0-*", "testRunner": "nunit", "dependencies": { - "NETStandard.Library": "1.6.1", - "Microsoft.DotNet.InternalAbstractions": "1.0.500-preview2-1-003177", + "Microsoft.DotNet.InternalAbstractions": "1.0.1-beta-003206", "NUnit": "3.6.0", "dotnet-test-nunit": "3.4.0-beta-3" }, "frameworks": { - "netstandard1.6": { - "imports": "netcoreapp1.0", + "netcoreapp1.0": { "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.1.0" + }, "Cosmos.TestRunner.Core": { "target": "project" } } } - }, - "runtimes": { - "win7-x64": {} } } diff --git a/Tests/Cosmos.TestRunner/project.json b/Tests/Cosmos.TestRunner/project.json index aa169cf91..6375eca93 100644 --- a/Tests/Cosmos.TestRunner/project.json +++ b/Tests/Cosmos.TestRunner/project.json @@ -7,7 +7,10 @@ "debugType": "portable" }, "dependencies": { - "Microsoft.NETCore.App": "1.1.0" + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.1.0" + } }, "frameworks": { "netcoreapp1.0": { @@ -17,8 +20,5 @@ } } } - }, - "runtimes": { - "win7-x64": {} } } diff --git a/source/Cosmos.Core.Plugs/System/StringImpl.cs b/source/Cosmos.Core.Plugs/System/StringImpl.cs index 2e6848ebf..9677f4f2f 100644 --- a/source/Cosmos.Core.Plugs/System/StringImpl.cs +++ b/source/Cosmos.Core.Plugs/System/StringImpl.cs @@ -775,10 +775,10 @@ namespace Cosmos.Core.Plugs.System return true; } - public static string Remove(string aThis, int aStart, int aCount) - { - return aThis.Substring(0, aStart) + aThis.Substring(aStart + aCount, aThis.Length - (aStart + aCount)); - } + //public static string Remove(string aThis, int aStart, int aCount) + //{ + // return aThis.Substring(0, aStart) + aThis.Substring(aStart + aCount, aThis.Length - (aStart + aCount)); + //} public static string Replace(string aThis, string oldValue, string newValue) { diff --git a/source/Cosmos.IL2CPU/IL/Stind_I1.cs b/source/Cosmos.IL2CPU/IL/Stind_I1.cs index c50cc2409..c47635ac9 100644 --- a/source/Cosmos.IL2CPU/IL/Stind_I1.cs +++ b/source/Cosmos.IL2CPU/IL/Stind_I1.cs @@ -1,4 +1,5 @@ -using System; +using XSharp.Compiler; +using static XSharp.Compiler.XSRegisters; namespace Cosmos.IL2CPU.X86.IL { @@ -12,16 +13,21 @@ namespace Cosmos.IL2CPU.X86.IL public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode ) { - Stind_I.Assemble(Assembler, 1, DebugEnabled); + XS.Pop(EAX); + XS.Pop(EBX); + + XS.Set(EBX, AL, destinationIsIndirect: true); + + //Stind_I.Assemble(Assembler, 1, DebugEnabled); } // using System; // using System.IO; - // - // + // + // // using CPU = Cosmos.Assembler.x86; - // + // // namespace Cosmos.IL2CPU.IL.X86 { // [Cosmos.Assembler.OpCode(OpCodeEnum.Stind_I1)] // public class Stind_I1: Op { diff --git a/source/Cosmos.IL2CPU/IL/Stind_I2.cs b/source/Cosmos.IL2CPU/IL/Stind_I2.cs index 67a372f14..14dade108 100644 --- a/source/Cosmos.IL2CPU/IL/Stind_I2.cs +++ b/source/Cosmos.IL2CPU/IL/Stind_I2.cs @@ -1,4 +1,5 @@ -using System; +using XSharp.Compiler; +using static XSharp.Compiler.XSRegisters; namespace Cosmos.IL2CPU.X86.IL { @@ -12,16 +13,21 @@ namespace Cosmos.IL2CPU.X86.IL public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode ) { - Stind_I.Assemble(Assembler, 2, DebugEnabled); + XS.Pop(EAX); + XS.Pop(EBX); + + XS.Set(EBX, AX, destinationIsIndirect: true); + + //Stind_I.Assemble(Assembler, 2, DebugEnabled); } // using System; // using System.IO; - // - // + // + // // using CPU = Cosmos.Assembler.x86; - // + // // namespace Cosmos.IL2CPU.IL.X86 { // [Cosmos.Assembler.OpCode(OpCodeEnum.Stind_I2)] // public class Stind_I2: Op {