diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Clt.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Clt.cs index c3c69f611..89022de58 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Clt.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Clt.cs @@ -68,7 +68,7 @@ namespace Cosmos.IL2CPU.X86.IL //new CPUx86.Jump { DestinationLabel = NextInstructionLabel }; Jump_End( aMethod ); - + new CPU.Label( LabelFalse ); new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, SourceValue = 4 }; new CPUx86.Push { DestinationValue = 0 }; diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOp.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOp.cs index 7cfb94250..e686f5011 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOp.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/ILOp.cs @@ -23,8 +23,10 @@ namespace Cosmos.IL2CPU.X86 new CPU.Jump { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName(aMethod.MethodBase) + "___EXCEPTION___EXIT" }; } - protected void Jump_End(MethodInfo aMethod) { - throw new NotImplementedException(); + protected void Jump_End(MethodInfo aMethod) + { +#warning todo: Jump_End jumps to ___EXCEPTION___EXIT + new CPU.Jump { DestinationLabel = MethodInfoLabelGenerator.GenerateLabelName( aMethod.MethodBase ) + "___EXCEPTION___EXIT" }; } protected uint GetStackCountForLocal(MethodInfo aMethod, LocalVariableInfo aField) diff --git a/source2/IL2PCU/Cosmos.IL2CPU/Assembler.cs b/source2/IL2PCU/Cosmos.IL2CPU/Assembler.cs index 9ccdc1e2d..9349d9fc0 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/Assembler.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/Assembler.cs @@ -17,7 +17,7 @@ namespace Cosmos.IL2CPU { private static SortedList> mCurrentInstance = new SortedList>(); protected internal List mInstructions = new List(); private List mDataMembers = new List(); - + private System.IO.TextWriter mLog; #region Properties public static Stack CurrentInstance @@ -56,6 +56,7 @@ namespace Cosmos.IL2CPU { public Assembler() { + mLog = new System.IO.StreamWriter( "Cosmos.Assembler.Log" ); InitILOps(); CurrentInstance.Push( this ); } @@ -149,7 +150,10 @@ namespace Cosmos.IL2CPU { } else { xILOp = mILOpsHi[xOpCodeVal & 0xFF]; } + mLog.Write ( "[" + xOpCode.ToString() + "] \t Stack start: " + Stack.Count.ToString() ); xILOp.Execute(aMethod, xOpCode); + mLog.WriteLine( " end: " + Stack.Count.ToString() ); + mLog.Flush(); } } diff --git a/source2/IL2PCU/Cosmos.IL2CPU/StackContents.cs b/source2/IL2PCU/Cosmos.IL2CPU/StackContents.cs index 2d5863a7c..31b886794 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/StackContents.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/StackContents.cs @@ -56,6 +56,8 @@ namespace Cosmos.IL2CPU { private Stack mStack = new Stack(); + + public int Count {get { return mStack.Count; } } public Item Peek() { return mStack.Peek(); }