Several small changes

This commit is contained in:
mterwoord_cp 2008-05-15 12:39:06 +00:00
parent 486983c8fe
commit 71197e000a
4 changed files with 110 additions and 69 deletions

View file

@ -153,58 +153,74 @@ namespace Cosmos.Build.Windows {
byte mComport; byte mComport;
protected void DoBuild() { protected void DoBuild() {
SaveSettingsToRegistry(); try
{
SaveSettingsToRegistry();
mComport = (byte)cmboDebugPort.SelectedIndex; mComport = (byte)cmboDebugPort.SelectedIndex;
if (mComport > 3) { if (mComport > 3)
throw new Exception("Debug port not supported yet!"); {
} throw new Exception("Debug port not supported yet!");
mComport++; }
string xDebugMode = (string)cmboDebugMode.SelectedValue; mComport++;
mDebugMode = DebugModeEnum.None; string xDebugMode = (string)cmboDebugMode.SelectedValue;
if (xDebugMode == "IL") { mDebugMode = DebugModeEnum.None;
mDebugMode = DebugModeEnum.IL; if (xDebugMode == "IL")
} else if (xDebugMode == "Source") { {
mDebugMode = DebugModeEnum.Source; mDebugMode = DebugModeEnum.IL;
mComport = 1; }
} else if (xDebugMode == "None") { else if (xDebugMode == "Source")
mDebugMode = DebugModeEnum.None; {
} else { mDebugMode = DebugModeEnum.Source;
throw new Exception("Selected debug mode not supported!"); mComport = 1;
} }
else if (xDebugMode == "None")
if (chckCompileIL.IsChecked.Value) { {
Console.WriteLine("Compiling..."); mDebugMode = DebugModeEnum.None;
var xBuildWindow = new BuildWindow(); }
mBuilder.DebugLog += xBuildWindow.DoDebugMessage; else
mBuilder.ProgressChanged += delegate(int aMax, int aCurrent) { {
xBuildWindow.ProgressMax = aMax; throw new Exception("Selected debug mode not supported!");
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;
}
}
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) { if (rdioQEMU.IsChecked.Value) {
mBuilder.MakeQEMU(chckQEMUUseHD.IsChecked.Value, chckQEMUUseGDB.IsChecked.Value, mDebugMode != DebugModeEnum.None, mDebugMode != DebugModeEnum.None); mBuilder.MakeQEMU(chckQEMUUseHD.IsChecked.Value, chckQEMUUseGDB.IsChecked.Value, mDebugMode != DebugModeEnum.None, mDebugMode != DebugModeEnum.None);
} else if (rdioVMWare.IsChecked.Value) { } else if (rdioVMWare.IsChecked.Value) {

View file

@ -23,8 +23,13 @@ namespace Indy.IL2CPU.IL.X86 {
} }
var right = Assembler.StackContents.Pop(); var right = Assembler.StackContents.Pop();
var left = Assembler.StackContents.Pop(); var left = Assembler.StackContents.Pop();
if (right.Size != left.Size) if (right.Size != left.Size)
throw new NotImplementedException("mixed size operations are not implemented"); {
if (right.Size > 4 || left.Size > 4)
{
throw new NotImplementedException("mixed size operations are not implemented! (" + left.Size + "/" + right.Size + ")");
}
}
int xSize = right.Size; int xSize = right.Size;

View file

@ -206,22 +206,6 @@ namespace Indy.IL2CPU.IL {
{ {
MethodBase xMethod = xEmittedMethods.Keys[j]; MethodBase xMethod = xEmittedMethods.Keys[j];
var xMethodId = GetMethodIdentifier(xMethod); 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) if (mDebugMode)
{ {
xDebug.WriteStartElement("Method"); xDebug.WriteStartElement("Method");
@ -231,7 +215,38 @@ namespace Indy.IL2CPU.IL {
} }
if (!xType.IsInterface) 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" + i.ToString("X") + "h");
Pushd("0" + j.ToString("X") + "h"); Pushd("0" + j.ToString("X") + "h");

View file

@ -331,7 +331,11 @@ namespace Indy.IL2CPU {
GenerateVMT(mDebugMode != DebugModeEnum.None); GenerateVMT(mDebugMode != DebugModeEnum.None);
} }
mMap.PostProcess(mAssembler); mMap.PostProcess(mAssembler);
ProcessAllStaticFields(); try
{
ProcessAllStaticFields();
}
catch (Exception E) { mDebugLog(LogSeverityEnum.Error, E.Message); }
if (mSymbols != null) { if (mSymbols != null) {
string xOutputFile = Path.Combine(mOutputDir, string xOutputFile = Path.Combine(mOutputDir,
"debug.cxdb"); "debug.cxdb");
@ -858,6 +862,7 @@ namespace Indy.IL2CPU {
string xFileName = Path.Combine(mOutputDir, (xCurrentField.DeclaringType.Assembly.FullName + "__" + xManifestResourceName).Replace(",", "_") + ".res"); string xFileName = Path.Combine(mOutputDir, (xCurrentField.DeclaringType.Assembly.FullName + "__" + xManifestResourceName).Replace(",", "_") + ".res");
using (var xStream = xCurrentField.DeclaringType.Assembly.GetManifestResourceStream(xManifestResourceName)) using (var xStream = xCurrentField.DeclaringType.Assembly.GetManifestResourceStream(xManifestResourceName))
{ {
if (xStream == null) { throw new Exception("Resource '" + xManifestResourceName + "' not found!"); }
using (var xTarget = File.Create(xFileName)) using (var xTarget = File.Create(xFileName))
{ {
// todo: abstract this array code out. // todo: abstract this array code out.