mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 04:48:53 +00:00
fix non virtual calls to virtual methods.
This commit is contained in:
parent
8f1178d019
commit
07276bf2fa
4 changed files with 32 additions and 13 deletions
|
|
@ -1,4 +1,5 @@
|
|||
//#define OUTPUT_ELF
|
||||
// leave the use of the following directive in: it eases a LOT during development, as it lets you use gdb for debugging
|
||||
#define OUTPUT_ELF
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using System.Security.Cryptography;
|
|||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using Cosmos.Sys.Network;
|
||||
using Cosmos.Hardware;
|
||||
|
||||
namespace MatthijsTest
|
||||
{
|
||||
|
|
@ -26,16 +27,28 @@ namespace MatthijsTest
|
|||
|
||||
var xBoot = new Cosmos.Sys.Boot();
|
||||
xBoot.Execute();
|
||||
Console.WriteLine("Echoing started.");
|
||||
do
|
||||
|
||||
//TCPIPStack.Init();
|
||||
|
||||
//TCPIPStack.ConfigIP(
|
||||
var xCount = 0;
|
||||
for (int i = 0; i < Device.Devices.Count; i++)
|
||||
{
|
||||
var xString = Console.ReadLine();
|
||||
if (xString.Length > 2)
|
||||
var xItem = Device.Devices[i];
|
||||
if (xItem == null)
|
||||
{
|
||||
Console.WriteLine(xString);
|
||||
Console.WriteLine("NULL item!");
|
||||
continue;
|
||||
}
|
||||
} while (true);
|
||||
var xType = Device.Devices[i].Type;
|
||||
if (Device.Devices[i].Type == Device.DeviceType.Network)
|
||||
{
|
||||
xCount++;
|
||||
}
|
||||
}
|
||||
Console.Write("Network cards found: ");
|
||||
Console.WriteLine(xCount.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,10 +64,10 @@ namespace Cosmos.IL2CPU.X86.IL {
|
|||
}
|
||||
|
||||
public static void DoExecute(Assembler Assembler, MethodInfo aCurrentMethod, MethodBase aTargetMethod, uint aTargetMethodUID, int aCurrentPosition) {
|
||||
if (aTargetMethod.IsVirtual) {
|
||||
Callvirt.DoExecute(Assembler, aCurrentMethod, aTargetMethod, aTargetMethodUID, aCurrentPosition);
|
||||
return;
|
||||
}
|
||||
//if (aTargetMethod.IsVirtual) {
|
||||
// Callvirt.DoExecute(Assembler, aCurrentMethod, aTargetMethod, aTargetMethodUID, aCurrentPosition);
|
||||
// return;
|
||||
//}
|
||||
var xMethodInfo = aTargetMethod as System.Reflection.MethodInfo;
|
||||
string xCurrentMethodLabel = MethodInfoLabelGenerator.GenerateLabelName(aCurrentMethod.MethodBase);
|
||||
|
||||
|
|
@ -77,7 +77,8 @@ namespace Cosmos.IL2CPU.X86.IL {
|
|||
if (aTargetMethod.IsStatic || !aTargetMethod.IsVirtual || aTargetMethod.IsFinal) {
|
||||
xNormalAddress = MethodInfoLabelGenerator.GenerateLabelName(aTargetMethod);
|
||||
} else {
|
||||
throw new Exception("Call: non-concrete method called!");
|
||||
xNormalAddress = MethodInfoLabelGenerator.GenerateLabelName(aTargetMethod);
|
||||
//throw new Exception("Call: non-concrete method called!");
|
||||
}
|
||||
var xParameters = aTargetMethod.GetParameters();
|
||||
int xArgCount = xParameters.Length;
|
||||
|
|
|
|||
|
|
@ -543,6 +543,10 @@ namespace Cosmos.IL2CPU {
|
|||
if (xVirtMethod != null) {
|
||||
Queue(xVirtMethod, aMethod, "Virtual Base");
|
||||
mVirtuals.Add(xVirtMethod);
|
||||
if (aMethod.Name == "ToString")
|
||||
{
|
||||
Console.Write("");
|
||||
}
|
||||
|
||||
// List changes as we go, cant be foreach
|
||||
for (int i = 0; i < mItemsList.Count; i++) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue