This commit is contained in:
mterwoord_cp 2010-08-17 12:29:54 +00:00
parent e8fa807b82
commit e722622bdf
17 changed files with 28 additions and 64 deletions

View file

@ -22,7 +22,7 @@ namespace Cosmos.Debug {
//xSingleString = "Message Module: \"" + aModule + "\"";
//xSingleString += " Data: \"" + aData + "\"";
//Send(xSingleString);
}
}
public static unsafe void SendError(string aModule, string aData)
{

View file

@ -45,7 +45,8 @@ namespace Cosmos.IL2CPU.X86
new ConditionalJump { Condition = ConditionalTestEnum.Equal, DestinationLabel = ".BeforeQuickReturn" };
new Move { DestinationRef = ElementReference.New(xName), DestinationIsIndirect = true, Size = 8, SourceValue = 1 };
new Jump { DestinationLabel = ".AfterCCTorAlreadyCalledCheck"};
new Label(".BeforeQuickReturn");
new Label(".BeforeQuickReturn");
new Move { DestinationReg = RegistersEnum.ECX, SourceValue = 0 };
new Return { };
new Label(".AfterCCTorAlreadyCalledCheck");
}

View file

@ -112,12 +112,6 @@ namespace Cosmos.IL2CPU.X86.IL
default:
throw new Exception("Remainder size " + xFieldInfo.FieldType.ToString() + (xSize) + " not supported!");
}
#if! SKIP_GC_CODE
if (xNeedsGC) {
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true };
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName(GCImplementationRefs.IncRefCountRef) };
}
#endif
Assembler.Stack.Push(new StackContents.Item((int)xSize, xFieldInfo.FieldType));
}

View file

@ -52,11 +52,6 @@ namespace Cosmos.IL2CPU.X86.IL
}
}
new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
if(!xVar.LocalType.IsValueType)
{
new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
new CPUx86.Call { DestinationLabel =MethodAndTypeLabelsHolder.GC_IncRefLabel };
}
}
Assembler.Stack.Push((int)xSize, xVar.LocalType);
}

View file

@ -23,7 +23,7 @@ namespace Cosmos.IL2CPU.X86.IL
System.Reflection.FieldInfo xField = xOpCode.Value;
// call cctor:
var xCctor = (xType.GetConstructors(BindingFlags.Static | BindingFlags.NonPublic) ?? new ConstructorInfo[0]).SingleOrDefault();
var xCctor = (xField.DeclaringType.GetConstructors(BindingFlags.Static | BindingFlags.NonPublic) ?? new ConstructorInfo[0]).SingleOrDefault();
if (xCctor != null)
{
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName(xCctor) };
@ -107,14 +107,6 @@ namespace Cosmos.IL2CPU.X86.IL
}
Assembler.Stack.Push( new StackContents.Item( ( int )xSize, null ) );
if( xNeedsGC )
{
new Dup( Assembler ).Execute( aMethod, aOpCode );
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName( GCImplementationRefs.IncRefCountRef ) };
Assembler.Stack.Pop();
}
}

View file

@ -44,11 +44,6 @@ namespace Cosmos.IL2CPU.X86.IL
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName( GCImplementationRefs.AllocNewObjectRef ) };
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true };
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true };
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true };
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true };
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName( GCImplementationRefs.IncRefCountRef ) };
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName( GCImplementationRefs.IncRefCountRef ) };
Assembler.Stack.Push( new StackContents.Item( 4, typeof( Array ) ) );
new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };

View file

@ -92,17 +92,7 @@ namespace Cosmos.IL2CPU.X86.IL
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName( GCImplementationRefs.AllocNewObjectRef ) };
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true };
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true };
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true };
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true };
// We IncRef here twice because it's effectively pushed on the stack twice:
// * once for the .ctor parameter
// * once for the "returnvalue" of the newobj il op
// todo: probably we want to check for exceptions after calling IncRef
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName( GCImplementationRefs.IncRefCountRef ) };
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName( GCImplementationRefs.IncRefCountRef ) };
uint xObjSize = 0;
//int xGCFieldCount = ( from item in aCtorDeclTypeInfo.Fields.Values
//where item.NeedsGC

View file

@ -20,9 +20,9 @@ namespace Cosmos.IL2CPU.X86.IL {
aAssembler.Stack.Pop();
aAssembler.Stack.Pop();
aAssembler.Stack.Pop();
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, DestinationDisplacement = (int)(xStackSize + 4) };
//new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, DestinationDisplacement = (int)(xStackSize + 4) };
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName(GCImplementationRefs.DecRefCountRef) };
//new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName(GCImplementationRefs.DecRefCountRef) };
new CPUx86.Move { DestinationReg = CPUx86.Registers.EBX, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true, SourceDisplacement = (int)xStackSize }; // the index
new CPUx86.Move { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true, SourceDisplacement = (int)xStackSize + 4 }; // the index

View file

@ -47,15 +47,6 @@ namespace Cosmos.IL2CPU.X86.IL
uint xRoundedSize = Align(xSize, 4);
#if! SKIP_GC_CODE
if (aNeedsGC) {
new CPUx86.Push { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, DestinationDisplacement = 4 };
//Ldfld(aAssembler, aType, aField, false);
new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX, DestinationIsIndirect = true, DestinationDisplacement = (int)(xActualOffset) };
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName(GCImplementationRefs.DecRefCountRef) };
}
#endif
new CPUx86.Move { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true, SourceDisplacement = (int)xRoundedSize };
new CPUx86.Add {
DestinationReg = CPUx86.Registers.ECX,

View file

@ -20,13 +20,7 @@ namespace Cosmos.IL2CPU.X86.IL
var xField = aOpCode as ILOpCodes.OpVar;
var xFieldInfo = aMethod.MethodBase.GetMethodBody().LocalVariables[xField.Value];
var xEBPOffset = ((int)GetEBPOffsetForLocal(aMethod, xField));
#if !SKIP_GC_CODE
if (!xFieldInfo.LocalType.IsValueType)
{
new CPUx86.Push { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement =(int) 0 - xEBPOffset };
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName(GCImplementationRefs.DecRefCountRef) };
}
#endif
new Comment("EBPOffset = " + xEBPOffset);
for (int i = (int)GetStackCountForLocal(aMethod, xFieldInfo) - 1; i >= 0; i--)
{

View file

@ -50,11 +50,6 @@ namespace Cosmos.IL2CPU.X86.IL
xOffset += SizeOfType( xInfo.FieldType );
}
string xDataName = DataMember.GetStaticFieldName(xField);
if( xNeedsGC )
{
new CPUx86.Push { DestinationRef = ElementReference.New( xDataName ), DestinationIsIndirect = true };
new CPUx86.Call { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName( GCImplementationRefs.DecRefCountRef ) };
}
for( int i = 0; i < ( xSize / 4 ); i++ )
{
new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };

View file

@ -72,7 +72,7 @@ namespace Cosmos.IL2CPU {
// WriteNumber(xCount, false);
// Console.WriteLine();
//#endif
throw new NotImplementedException();
//throw new NotImplementedException();
}
@ -136,7 +136,7 @@ namespace Cosmos.IL2CPU {
//#endif
//// }
///
throw new NotImplementedException();
//throw new NotImplementedException();
}
#if GC_DEBUG

View file

@ -5,6 +5,10 @@ using System.Text;
namespace Cosmos.System {
public class Console {
public Console()
{
Cosmos.Debug.Debugger.Send("Cosmos.System..ctor()");
}
protected int mX = 0;
public int X {
get { return mX; }

View file

@ -56,6 +56,10 @@
<Content Include="Kernel.html" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\source\Cosmos\Cosmos.Kernel\Cosmos.Kernel.csproj">
<Project>{A1F83D9F-2D44-4264-A08B-416797123018}</Project>
<Name>Cosmos.Kernel</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\source\Cosmos\Cosmos.System\Cosmos.Sys.csproj">
<Project>{819DB8FC-5DA1-461F-83C9-2F5C88088C94}</Project>
<Name>Cosmos.Sys</Name>

View file

@ -16,7 +16,10 @@ namespace Cosmos.System {
// Start the system up using the properties for configuration.
public void Start() {
if (mStarted) {
Cosmos.Debug.Debugger.Send("Starting kernel");
if (mStarted)
{
Cosmos.Debug.Debugger.Send("ERROR: Kernel Already Started");
throw new Exception("Kernel has already been started. A kernel cannot be started twice.");
}
mStarted = true;
@ -25,6 +28,7 @@ namespace Cosmos.System {
//Hardware.VGAScreen.SetTextMode(VGAScreen.TextSize.Size80x25);
// Clear before booting
Cosmos.Debug.Debugger.Send("Clearing screen");
Global.Console.Clear();
WriteLine("Cosmos kernel boot initiated.");

View file

@ -14,6 +14,7 @@ namespace Cosmos.Hardware {
protected readonly MemoryBlock08 mMemory08;
public TextScreen() {
Cosmos.Debug.Debugger.Send("Cosmos.Hardware.TextScreen");
//Use Changeset 64921
//This gets called before at least one of the initializers.
//1) This is a bug.

View file

@ -6,6 +6,10 @@ using Sys = Cosmos.System;
namespace BreakpointsKernel {
public class BreakpointsOS : Sys.Kernel {
public BreakpointsOS()
{
Debugger.Send("BreakpointsKernel.BreakpointOS..ctor()");
}
protected override void BeforeRun() {
Console.WriteLine("Test");
Debugger.Send("Hello from Cosmos!");