Added a new Attribute called DebugStub. Has a property Off which when set to true specifies that no debugstub calls should be inserted for code in this function. NOT FOR GENERAL USE!! CAUTION: No debugging what so ever is possible on a function with this attribute applied. Useful for large loops of tested code where speed is of the essence

This commit is contained in:
sschocke_cp 2012-02-03 17:32:53 +00:00
parent f29819a67e
commit 262f0080df
7 changed files with 43 additions and 5 deletions

View file

@ -65,6 +65,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblerMethod.cs" />
<Compile Include="DebugStubAttribute.cs" />
<Compile Include="FieldTypeAttribute.cs" />
<Compile Include="FieldAccessAttribute.cs" />
<Compile Include="InlineAttribute.cs" />

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cosmos.IL2CPU.Plugs
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class DebugStubAttribute : Attribute
{
public bool Off = false;
}
}

View file

@ -456,6 +456,12 @@ namespace Cosmos.IL2CPU.X86 {
}
}
// Check if the DebugStub has been disabled for this method
if (aMethod.DebugStubOff)
{
return;
}
// Check options for Debug Level
// Set based on TracedAssemblies
if (TraceAssemblies == TraceAssemblies.Cosmos || TraceAssemblies == TraceAssemblies.User) {

View file

@ -16,20 +16,22 @@ namespace Cosmos.IL2CPU
public readonly MethodInfo PlugMethod;
public readonly Type MethodAssembler;
public readonly bool IsInlineAssembler = false;
public readonly bool DebugStubOff;
public MethodInfo PluggedMethod;
public MethodInfo(MethodBase aMethodBase, UInt32 aUID, TypeEnum aType, MethodInfo aPlugMethod, Type aMethodAssembler) : this(aMethodBase, aUID, aType, aPlugMethod)
public MethodInfo(MethodBase aMethodBase, UInt32 aUID, TypeEnum aType, MethodInfo aPlugMethod, Type aMethodAssembler) : this(aMethodBase, aUID, aType, aPlugMethod, false)
{
MethodAssembler = aMethodAssembler;
}
public MethodInfo(MethodBase aMethodBase, UInt32 aUID, TypeEnum aType, MethodInfo aPlugMethod)
: this(aMethodBase, aUID, aType, aPlugMethod, false)
{
MethodBase = aMethodBase;
UID = aUID;
Type = aType;
PlugMethod = aPlugMethod;
//MethodBase = aMethodBase;
//UID = aUID;
//Type = aType;
//PlugMethod = aPlugMethod;
}
public MethodInfo(MethodBase aMethodBase, UInt32 aUID, TypeEnum aType, MethodInfo aPlugMethod, bool isInlineAssembler)
@ -39,6 +41,13 @@ namespace Cosmos.IL2CPU
Type = aType;
PlugMethod = aPlugMethod;
IsInlineAssembler = isInlineAssembler;
Object[] attribs = this.MethodBase.GetCustomAttributes(typeof(Cosmos.IL2CPU.Plugs.DebugStubAttribute), false);
if (attribs.Length > 0)
{
Cosmos.IL2CPU.Plugs.DebugStubAttribute attrib = attribs[0] as Cosmos.IL2CPU.Plugs.DebugStubAttribute;
DebugStubOff = attrib.Off;
}
}
}

View file

@ -102,6 +102,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\IL2CPU\Cosmos.IL2CPU.Plugs\Cosmos.IL2CPU.Plugs.csproj">
<Project>{C801F19C-A9D3-42D5-9A57-9FFDF9B4D05E}</Project>
<Name>Cosmos.IL2CPU.Plugs</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Common\Cosmos.Common.Extensions\Cosmos.Common.Extensions.csproj">
<Project>{1FAC100C-D732-4EA4-B518-5AF4BAF64F2E}</Project>
<Name>Cosmos.Common.Extensions</Name>

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using Cosmos.Common.Extensions;
using System.Linq;
using System.Text;
using Cosmos.IL2CPU.Plugs;
namespace Cosmos.Core
{
@ -53,6 +54,7 @@ namespace Cosmos.Core
Fill(0, Size / 4, aData);
}
[DebugStub(Off = true)]
public unsafe void Fill(UInt32 aStart, UInt32 aCount, UInt32 aData)
{
//TODO: before next step can at least check bounds here and do the addition just once to
@ -70,6 +72,7 @@ namespace Cosmos.Core
Fill(0, Size, aData);
}
[DebugStub(Off = true)]
public unsafe void Fill(UInt32 aStart, UInt32 aCount, byte aData)
{
//TODO: before next step can at least check bounds here and do the addition just once to
@ -83,6 +86,7 @@ namespace Cosmos.Core
}
}
[DebugStub(Off = true)]
public unsafe void MoveDown(UInt32 aDest, UInt32 aSrc, UInt32 aCount)
{
byte* xDest = (byte*)(this.Base + aDest);

View file

@ -33,6 +33,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Cosmos.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=x86">