mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-08 01:02:25 +00:00
parent
b9800b52b7
commit
8247a90484
4 changed files with 984 additions and 1000 deletions
|
|
@ -21,12 +21,11 @@ namespace Cosmos.Core.Plugs
|
||||||
//}
|
//}
|
||||||
return Heap.MemAlloc(aSize);
|
return Heap.MemAlloc(aSize);
|
||||||
}
|
}
|
||||||
[PlugMethod(PlugNotImplemented = true)]
|
|
||||||
public static void IncRefCount(uint aObject)
|
public static void IncRefCount(uint aObject)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
[PlugMethod(PlugNotImplemented = true)]
|
|
||||||
public static void DecRefCount(uint aObject)
|
public static void DecRefCount(uint aObject)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@ namespace Cosmos.IL2CPU.Plugs
|
||||||
public Type Assembler = null;
|
public Type Assembler = null;
|
||||||
public bool IsMonoOnly = false;
|
public bool IsMonoOnly = false;
|
||||||
public bool IsMicrosoftdotNETOnly = false;
|
public bool IsMicrosoftdotNETOnly = false;
|
||||||
public bool RequiresPlug = false;
|
|
||||||
public bool PlugNotImplemented = false;
|
|
||||||
public bool IsWildcard = false;
|
public bool IsWildcard = false;
|
||||||
public bool WildcardMatchParameters = false;
|
public bool WildcardMatchParameters = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,24 +9,23 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Cosmos.Common;
|
using Cosmos.Common;
|
||||||
using Cosmos.IL2CPU.Plugs;
|
|
||||||
namespace Cosmos.IL2CPU {
|
namespace Cosmos.IL2CPU {
|
||||||
[DebuggerStepThrough]
|
[DebuggerStepThrough]
|
||||||
public static class GCImplementation {
|
public static class GCImplementation {
|
||||||
[PlugMethod(RequiresPlug = true)]
|
|
||||||
private static void AcquireLock() {
|
private static void AcquireLock() {
|
||||||
// do {
|
// do {
|
||||||
// } while (Interlocked.CompareExchange(ref mLock, 1, 0) != 0);
|
// } while (Interlocked.CompareExchange(ref mLock, 1, 0) != 0);
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
[PlugMethod(RequiresPlug = true)]
|
|
||||||
private static void ReleaseLock() {
|
private static void ReleaseLock() {
|
||||||
// do {
|
// do {
|
||||||
// } while (Interlocked.CompareExchange(ref mLock, 0, 1) != 1);
|
// } while (Interlocked.CompareExchange(ref mLock, 0, 1) != 1);
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
[PlugMethod(RequiresPlug = true)]
|
|
||||||
public static uint AllocNewObject(uint aSize) {
|
public static uint AllocNewObject(uint aSize) {
|
||||||
// uint xNewObject = RuntimeEngine.Heap_AllocNewObject(aSize + 4);
|
// uint xNewObject = RuntimeEngine.Heap_AllocNewObject(aSize + 4);
|
||||||
//#if GC_DEBUG
|
//#if GC_DEBUG
|
||||||
// Console.Write("New Object allocated: ");
|
// Console.Write("New Object allocated: ");
|
||||||
|
|
@ -38,12 +37,11 @@ namespace Cosmos.IL2CPU {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function gets the pointer to the memory location of where it's stored.
|
/// This function gets the pointer to the memory location of where it's stored.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="aObject"></param>
|
/// <param name="aObject"></param>
|
||||||
[PlugMethod(RequiresPlug = true)]
|
public static unsafe void IncRefCount(uint aObject) {
|
||||||
public static unsafe void IncRefCount(uint aObject) {
|
|
||||||
//// if (aObject == 0) {
|
//// if (aObject == 0) {
|
||||||
//// return;
|
//// return;
|
||||||
//// }
|
//// }
|
||||||
|
|
@ -79,13 +77,11 @@ namespace Cosmos.IL2CPU {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function gets the pointer to the memory location of where it's stored.
|
/// This function gets the pointer to the memory location of where it's stored.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="aObject"></param>
|
/// <param name="aObject"></param>
|
||||||
///
|
public static unsafe void DecRefCount(uint aObject) {
|
||||||
[PlugMethod(RequiresPlug = true)]
|
|
||||||
public static unsafe void DecRefCount(uint aObject) {
|
|
||||||
//// if (aObject == 0) {
|
//// if (aObject == 0) {
|
||||||
//// return;
|
//// return;
|
||||||
//// }
|
//// }
|
||||||
|
|
|
||||||
|
|
@ -874,11 +874,6 @@ namespace Cosmos.IL2CPU
|
||||||
mAsmblr.ProcessMethod(xPlugInfo, xInstructions);
|
mAsmblr.ProcessMethod(xPlugInfo, xInstructions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (xAttrib != null && xAttrib.PlugNotImplemented)
|
|
||||||
{
|
|
||||||
//Method is plug, but plug is not properly implemented
|
|
||||||
throw new Exception(xMethod.Name + " is plugged, but plug is not properly implemented!");
|
|
||||||
}
|
|
||||||
mAsmblr.GenerateMethodForward(xMethodInfo, xPlugInfo);
|
mAsmblr.GenerateMethodForward(xMethodInfo, xPlugInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -935,11 +930,6 @@ namespace Cosmos.IL2CPU
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (xAttrib.RequiresPlug)
|
|
||||||
{
|
|
||||||
//Plug is required, but not found for this method -> Throw an exception
|
|
||||||
throw new Exception("Plug is required for " + xMethod.Name + ", but none is found!");
|
|
||||||
}
|
|
||||||
xPlugAssembler = xAttrib.Assembler;
|
xPlugAssembler = xAttrib.Assembler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue