From 71197e000aeac94c567bb79d8ae50d93affdc7bc Mon Sep 17 00:00:00 2001 From: mterwoord_cp <7cd3fd84a0151ea055c2f79e4d2eef9576fe9afesxUZAwxD> Date: Thu, 15 May 2008 12:39:06 +0000 Subject: [PATCH] Several small changes --- .../OptionsWindow.xaml.cs | 116 ++++++++++-------- source/Indy.IL2CPU.IL.X86/Blt.cs | 9 +- .../Indy.IL2CPU.IL/InitVmtImplementationOp.cs | 47 ++++--- source/Indy.IL2CPU/Engine.cs | 7 +- 4 files changed, 110 insertions(+), 69 deletions(-) diff --git a/source/Cosmos.Build.Windows/OptionsWindow.xaml.cs b/source/Cosmos.Build.Windows/OptionsWindow.xaml.cs index c3b617286..70b1f7cd4 100644 --- a/source/Cosmos.Build.Windows/OptionsWindow.xaml.cs +++ b/source/Cosmos.Build.Windows/OptionsWindow.xaml.cs @@ -153,58 +153,74 @@ namespace Cosmos.Build.Windows { byte mComport; protected void DoBuild() { - SaveSettingsToRegistry(); + try + { + SaveSettingsToRegistry(); - mComport = (byte)cmboDebugPort.SelectedIndex; - if (mComport > 3) { - throw new Exception("Debug port not supported yet!"); - } - mComport++; - string xDebugMode = (string)cmboDebugMode.SelectedValue; - mDebugMode = DebugModeEnum.None; - if (xDebugMode == "IL") { - mDebugMode = DebugModeEnum.IL; - } else if (xDebugMode == "Source") { - mDebugMode = DebugModeEnum.Source; - mComport = 1; - } else if (xDebugMode == "None") { - mDebugMode = DebugModeEnum.None; - } else { - throw new Exception("Selected debug mode not supported!"); - } - - if (chckCompileIL.IsChecked.Value) { - Console.WriteLine("Compiling..."); - var xBuildWindow = new BuildWindow(); - mBuilder.DebugLog += xBuildWindow.DoDebugMessage; - mBuilder.ProgressChanged += delegate(int aMax, int aCurrent) { - xBuildWindow.ProgressMax = aMax; - xBuildWindow.ProgressCurrent = aCurrent; - var xFrame = new DispatcherFrame(); - Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object aParam) { - xFrame.Continue = false; - return null; - }), null); - Dispatcher.PushFrame(xFrame); - }; - xBuildWindow.Show(); - mBuilder.Compile(mDebugMode, mComport); - mBuilder.DebugLog -= xBuildWindow.DoDebugMessage; - var xMessages = (from item in xBuildWindow.Messages - where item.Severity != LogSeverityEnum.Informational - select item); - xBuildWindow.Close(); - if (xMessages.Count() > 0) { - xBuildWindow = new BuildWindow(); - xBuildWindow.Messages.Clear(); - foreach (var item in xMessages) { - xBuildWindow.Messages.Add(item); - } - xBuildWindow.ShowDialog(); - return; - } - } + mComport = (byte)cmboDebugPort.SelectedIndex; + if (mComport > 3) + { + throw new Exception("Debug port not supported yet!"); + } + mComport++; + string xDebugMode = (string)cmboDebugMode.SelectedValue; + mDebugMode = DebugModeEnum.None; + if (xDebugMode == "IL") + { + mDebugMode = DebugModeEnum.IL; + } + else if (xDebugMode == "Source") + { + mDebugMode = DebugModeEnum.Source; + mComport = 1; + } + else if (xDebugMode == "None") + { + mDebugMode = DebugModeEnum.None; + } + else + { + throw new Exception("Selected debug mode not supported!"); + } + if (chckCompileIL.IsChecked.Value) + { + Console.WriteLine("Compiling..."); + var xBuildWindow = new BuildWindow(); + mBuilder.DebugLog += xBuildWindow.DoDebugMessage; + mBuilder.ProgressChanged += delegate(int aMax, int aCurrent) + { + xBuildWindow.ProgressMax = aMax; + xBuildWindow.ProgressCurrent = aCurrent; + var xFrame = new DispatcherFrame(); + Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object aParam) + { + xFrame.Continue = false; + return null; + }), null); + Dispatcher.PushFrame(xFrame); + }; + xBuildWindow.Show(); + mBuilder.Compile(mDebugMode, mComport); + mBuilder.DebugLog -= xBuildWindow.DoDebugMessage; + var xMessages = (from item in xBuildWindow.Messages + where item.Severity != LogSeverityEnum.Informational + select item); + xBuildWindow.Close(); + if (xMessages.Count() > 0) + { + xBuildWindow = new BuildWindow(); + xBuildWindow.Messages.Clear(); + foreach (var item in xMessages) + { + xBuildWindow.Messages.Add(item); + } + xBuildWindow.ShowDialog(); + return; + } + } + } + catch (Exception E) { System.Diagnostics.Debugger.Break(); } if (rdioQEMU.IsChecked.Value) { mBuilder.MakeQEMU(chckQEMUUseHD.IsChecked.Value, chckQEMUUseGDB.IsChecked.Value, mDebugMode != DebugModeEnum.None, mDebugMode != DebugModeEnum.None); } else if (rdioVMWare.IsChecked.Value) { diff --git a/source/Indy.IL2CPU.IL.X86/Blt.cs b/source/Indy.IL2CPU.IL.X86/Blt.cs index 976aa4812..65758bcc5 100644 --- a/source/Indy.IL2CPU.IL.X86/Blt.cs +++ b/source/Indy.IL2CPU.IL.X86/Blt.cs @@ -23,8 +23,13 @@ namespace Indy.IL2CPU.IL.X86 { } var right = Assembler.StackContents.Pop(); var left = Assembler.StackContents.Pop(); - if (right.Size != left.Size) - throw new NotImplementedException("mixed size operations are not implemented"); + if (right.Size != left.Size) + { + if (right.Size > 4 || left.Size > 4) + { + throw new NotImplementedException("mixed size operations are not implemented! (" + left.Size + "/" + right.Size + ")"); + } + } int xSize = right.Size; diff --git a/source/Indy.IL2CPU.IL/InitVmtImplementationOp.cs b/source/Indy.IL2CPU.IL/InitVmtImplementationOp.cs index 5e32f1be1..7db14a2c8 100644 --- a/source/Indy.IL2CPU.IL/InitVmtImplementationOp.cs +++ b/source/Indy.IL2CPU.IL/InitVmtImplementationOp.cs @@ -206,22 +206,6 @@ namespace Indy.IL2CPU.IL { { MethodBase xMethod = xEmittedMethods.Keys[j]; var xMethodId = GetMethodIdentifier(xMethod); - if (xEmittedMethods.Values[j]) - { - var xNewMethod = xType.GetMethod(xMethod.DeclaringType.FullName + "." + xMethod.Name, - (from xParam in xMethod.GetParameters() - select xParam.ParameterType).ToArray()); - - if (xNewMethod == null) - { - // get private implemenation - xNewMethod = xType.GetMethod(xMethod.Name, - (from xParam in xMethod.GetParameters() - select xParam.ParameterType).ToArray()); - } - if (xNewMethod == null) { System.Diagnostics.Debugger.Break(); } - xMethod = xNewMethod; - } if (mDebugMode) { xDebug.WriteStartElement("Method"); @@ -231,7 +215,38 @@ namespace Indy.IL2CPU.IL { } if (!xType.IsInterface) { + if (xEmittedMethods.Values[j]) + { + var xNewMethod = xType.GetMethod(xMethod.DeclaringType.FullName + "." + xMethod.Name, + (from xParam in xMethod.GetParameters() + select xParam.ParameterType).ToArray()); + if (xNewMethod == null) + { + // get private implemenation + xNewMethod = xType.GetMethod(xMethod.Name, + (from xParam in xMethod.GetParameters() + select xParam.ParameterType).ToArray()); + } + if (xNewMethod == null) + { + try + { + var xMap = xType.GetInterfaceMap(xMethod.DeclaringType); + for (int k = 0; k < xMap.InterfaceMethods.Length; k++) + { + if (xMap.InterfaceMethods[k] == xMethod) + { + xNewMethod = xMap.TargetMethods[k]; + break; + } + } + } + catch { } + } + if (xNewMethod == null) { System.Diagnostics.Debugger.Break(); } + xMethod = xNewMethod; + } Pushd("0" + i.ToString("X") + "h"); Pushd("0" + j.ToString("X") + "h"); diff --git a/source/Indy.IL2CPU/Engine.cs b/source/Indy.IL2CPU/Engine.cs index 297192cfe..2fc46b33a 100644 --- a/source/Indy.IL2CPU/Engine.cs +++ b/source/Indy.IL2CPU/Engine.cs @@ -331,7 +331,11 @@ namespace Indy.IL2CPU { GenerateVMT(mDebugMode != DebugModeEnum.None); } mMap.PostProcess(mAssembler); - ProcessAllStaticFields(); + try + { + ProcessAllStaticFields(); + } + catch (Exception E) { mDebugLog(LogSeverityEnum.Error, E.Message); } if (mSymbols != null) { string xOutputFile = Path.Combine(mOutputDir, "debug.cxdb"); @@ -858,6 +862,7 @@ namespace Indy.IL2CPU { string xFileName = Path.Combine(mOutputDir, (xCurrentField.DeclaringType.Assembly.FullName + "__" + xManifestResourceName).Replace(",", "_") + ".res"); using (var xStream = xCurrentField.DeclaringType.Assembly.GetManifestResourceStream(xManifestResourceName)) { + if (xStream == null) { throw new Exception("Resource '" + xManifestResourceName + "' not found!"); } using (var xTarget = File.Create(xFileName)) { // todo: abstract this array code out.