Skip to content

Commit

Permalink
Delegates issue solved.,
Browse files Browse the repository at this point in the history
  • Loading branch information
mterwoord committed Sep 5, 2015
1 parent 3cb082b commit 4469029
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 82 deletions.
36 changes: 18 additions & 18 deletions Demos/Guess/Guess.Cosmos
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Profile>VMware</Profile>
<Profile>Bochs</Profile>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<Framework>MicrosoftNET</Framework>
<UseInternalAssembler>False</UseInternalAssembler>
<EnableGDB>False</EnableGDB>
<DebugMode>Source</DebugMode>
<DebugMode>IL</DebugMode>
<TraceMode>User</TraceMode>
<BuildTarget>PXE</BuildTarget>
<VMWareFlavor>Player</VMWareFlavor>
Expand All @@ -30,8 +30,8 @@
<VMwareDeploy>ISO</VMwareDeploy>
<IgnoreDebugStubAttribute>False</IgnoreDebugStubAttribute>
<Deployment>ISO</Deployment>
<Launch>VMware</Launch>
<DebugEnabled>True</DebugEnabled>
<Launch>Bochs</Launch>
<DebugEnabled>False</DebugEnabled>
<TraceAssemblies>All</TraceAssemblies>
<PXE_Deployment>PXE</PXE_Deployment>
<PXE_Launch>None</PXE_Launch>
Expand Down Expand Up @@ -67,8 +67,8 @@
<VMware_Framework>MicrosoftNET</VMware_Framework>
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
<VMware_EnableGDB>True</VMware_EnableGDB>
<VMware_StartCosmosGDB>True</VMware_StartCosmosGDB>
<ISO_Deployment>ISO</ISO_Deployment>
<ISO_Launch>None</ISO_Launch>
<ISO_DebugEnabled>False</ISO_DebugEnabled>
Expand All @@ -82,7 +82,7 @@
<ISO_EnableGDB>False</ISO_EnableGDB>
<ISO_StartCosmosGDB>false</ISO_StartCosmosGDB>
<Name>Guess</Name>
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
<Description>Use Bochs emulator to deploy and debug.</Description>
<ISO_Name>User 001</ISO_Name>
<ISO_Description>Creates a bootable ISO image which can be burned to a DVD. After running the selected project, an explorer window will open containing the ISO file. The ISO file can then be burned to a CD or DVD and used to boot a physical or virtual system.</ISO_Description>
<USB_Name>Guess</USB_Name>
Expand Down Expand Up @@ -136,7 +136,7 @@
<Bochs_Deployment>ISO</Bochs_Deployment>
<Bochs_Launch>Bochs</Bochs_Launch>
<Bochs_ShowLaunchConsole>False</Bochs_ShowLaunchConsole>
<Bochs_DebugEnabled>True</Bochs_DebugEnabled>
<Bochs_DebugEnabled>False</Bochs_DebugEnabled>
<Bochs_StackCorruptionDetectionEnabled>True</Bochs_StackCorruptionDetectionEnabled>
<Bochs_DebugMode>IL</Bochs_DebugMode>
<Bochs_IgnoreDebugStubAttribute>False</Bochs_IgnoreDebugStubAttribute>
Expand All @@ -150,7 +150,7 @@
<Bochs_TraceAssemblies>All</Bochs_TraceAssemblies>
<Bochs_EnableGDB>False</Bochs_EnableGDB>
<Bochs_StartCosmosGDB>False</Bochs_StartCosmosGDB>
<EnableBochsDebug>False</EnableBochsDebug>
<EnableBochsDebug>True</EnableBochsDebug>
<Bochs_EnableBochsDebug>True</Bochs_EnableBochsDebug>
<PXE_StackCorruptionDetectionEnabled>False</PXE_StackCorruptionDetectionEnabled>
<PXE_EnableBochsDebug>False</PXE_EnableBochsDebug>
Expand Down Expand Up @@ -181,13 +181,13 @@
<USB_EnableBochsDebug>False</USB_EnableBochsDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Profile>VMware</Profile>
<Profile>Bochs</Profile>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<Framework>MicrosoftNET</Framework>
<UseInternalAssembler>False</UseInternalAssembler>
<EnableGDB>False</EnableGDB>
<DebugMode>Source</DebugMode>
<DebugMode>IL</DebugMode>
<TraceMode>User</TraceMode>
<BuildTarget>PXE</BuildTarget>
<VMWareFlavor>Player</VMWareFlavor>
Expand All @@ -196,8 +196,8 @@
<VMwareDeploy>ISO</VMwareDeploy>
<IgnoreDebugStubAttribute>False</IgnoreDebugStubAttribute>
<Deployment>ISO</Deployment>
<Launch>VMware</Launch>
<DebugEnabled>True</DebugEnabled>
<Launch>Bochs</Launch>
<DebugEnabled>False</DebugEnabled>
<TraceAssemblies>All</TraceAssemblies>
<PXE_Deployment>PXE</PXE_Deployment>
<PXE_Launch>None</PXE_Launch>
Expand Down Expand Up @@ -233,8 +233,8 @@
<VMware_Framework>MicrosoftNET</VMware_Framework>
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
<VMware_EnableGDB>True</VMware_EnableGDB>
<VMware_StartCosmosGDB>True</VMware_StartCosmosGDB>
<ISO_Deployment>ISO</ISO_Deployment>
<ISO_Launch>None</ISO_Launch>
<ISO_DebugEnabled>False</ISO_DebugEnabled>
Expand All @@ -248,7 +248,7 @@
<ISO_EnableGDB>False</ISO_EnableGDB>
<ISO_StartCosmosGDB>false</ISO_StartCosmosGDB>
<Name>Guess</Name>
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
<Description>Use Bochs emulator to deploy and debug.</Description>
<ISO_Name>User 001</ISO_Name>
<ISO_Description>Creates a bootable ISO image which can be burned to a DVD. After running the selected project, an explorer window will open containing the ISO file. The ISO file can then be burned to a CD or DVD and used to boot a physical or virtual system.</ISO_Description>
<USB_Name>Guess</USB_Name>
Expand Down Expand Up @@ -308,7 +308,7 @@
<Bochs_Deployment>ISO</Bochs_Deployment>
<Bochs_Launch>Bochs</Bochs_Launch>
<Bochs_ShowLaunchConsole>False</Bochs_ShowLaunchConsole>
<Bochs_DebugEnabled>True</Bochs_DebugEnabled>
<Bochs_DebugEnabled>False</Bochs_DebugEnabled>
<Bochs_StackCorruptionDetectionEnabled>True</Bochs_StackCorruptionDetectionEnabled>
<Bochs_DebugMode>IL</Bochs_DebugMode>
<Bochs_IgnoreDebugStubAttribute>False</Bochs_IgnoreDebugStubAttribute>
Expand All @@ -322,7 +322,7 @@
<Bochs_TraceAssemblies>All</Bochs_TraceAssemblies>
<Bochs_EnableGDB>False</Bochs_EnableGDB>
<Bochs_StartCosmosGDB>False</Bochs_StartCosmosGDB>
<EnableBochsDebug>False</EnableBochsDebug>
<EnableBochsDebug>True</EnableBochsDebug>
<Bochs_EnableBochsDebug>True</Bochs_EnableBochsDebug>
<PXE_StackCorruptionDetectionEnabled>False</PXE_StackCorruptionDetectionEnabled>
<PXE_EnableBochsDebug>False</PXE_EnableBochsDebug>
Expand Down
44 changes: 38 additions & 6 deletions Tests/Cosmos.Compiler.Tests.Bcl/System/DelegatesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Cosmos.Compiler.Tests.Bcl.System
{
public static class DelegatesTest
public class DelegatesTest
{
private static int mCount;

Expand All @@ -14,22 +14,54 @@ private static void IncreaseCounterOnce()
mCount++;
}

private static void IncreaseCounterTwice()

private void IncreaseCounterTwiceFromInstanceMethod()
{
mCount++;
mCount += 2;
}

public static void Execute()
{
TestDelegateWithoutArguments();
TestDelegateWithArguments();
}

private static void TestDelegateWithoutArguments()
{
mCount = 0;
Action xDelegate = IncreaseCounterOnce;

xDelegate();
Assert.AreEqual(1, mCount, "After calling delegate once, Count != 1");
//xDelegate += IncreaseCounterTwice;
//xDelegate();
//Assert.AreEqual(4, mCount, "After calling delegate second time, Count != 4");
var xTestInstance = new DelegatesTest();
xDelegate = xTestInstance.IncreaseCounterTwiceFromInstanceMethod;
mCount = 0;
xDelegate();
Assert.AreEqual(2, mCount, "After calling delegate second time, Count != 2");
}

private static void IncreaseCounter(int number)
{
mCount += number;
}

private void IncreaseCounterFromInstanceMethod(int number)
{
mCount += number;
}

private static void TestDelegateWithArguments()
{
mCount = 0;
Action<int> xDelegate = IncreaseCounter;

xDelegate(2);
Assert.AreEqual(2, mCount, "After calling delegate once, Count != 2");
var xTestInstance = new DelegatesTest();
xDelegate = xTestInstance.IncreaseCounterFromInstanceMethod;
mCount = 0;
xDelegate(3);
Assert.AreEqual(3, mCount, "After calling delegate second time, Count != 3");
}
}
}
10 changes: 5 additions & 5 deletions Tests/Cosmos.TestRunner.Core/DefaultEngineConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public static void Apply(Engine engine)
// if you're working on the compiler (or other lower parts), you can choose to run the compiler in process
// 1 thing to keep in mind though, is that this only works with 1 kernel at a time!
//engine.RunIL2CPUInProcess = true;
engine.RunWithGDB = false;
//engine.RunWithGDB = true;

engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);
engine.AddKernel(typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel).Assembly.Location);
//engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
//engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
//engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);
//engine.AddKernel(typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel).Assembly.Location);
engine.AddKernel(typeof(Cosmos.Compiler.Tests.Bcl.Kernel).Assembly.Location);

// known bugs, therefor disabled for now:
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.IL2CPU/AppAssembler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//#define VMT_DEBUG
#define VMT_DEBUG
using System;
using System.Collections.Generic;
using System.Diagnostics.SymbolStore;
Expand Down
Loading

0 comments on commit 4469029

Please sign in to comment.