mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-23 06:18:54 +00:00
Several small changes
This commit is contained in:
parent
486983c8fe
commit
71197e000a
4 changed files with 110 additions and 69 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue