Add new PlugMethodAttributes:

*RequiresPlug - Indicates that method requires a plug, and  throws a compiler exception if none exists.

*PlugNotImplemented - Method is plugged, but throws a compiler error if plug is not implemented correctly.
This commit is contained in:
sgetaz 2015-08-13 00:41:22 +02:00
parent 1c710704fb
commit b9800b52b7
4 changed files with 1000 additions and 984 deletions

View file

@ -21,11 +21,12 @@ namespace Cosmos.Core.Plugs
//}
return Heap.MemAlloc(aSize);
}
[PlugMethod(PlugNotImplemented = true)]
public static void IncRefCount(uint aObject)
{
//
}
[PlugMethod(PlugNotImplemented = true)]
public static void DecRefCount(uint aObject)
{
//

View file

@ -9,7 +9,8 @@ namespace Cosmos.IL2CPU.Plugs
public Type Assembler = null;
public bool IsMonoOnly = false;
public bool IsMicrosoftdotNETOnly = false;
public bool RequiresPlug = false;
public bool PlugNotImplemented = false;
public bool IsWildcard = false;
public bool WildcardMatchParameters = false;
}

View file

@ -9,23 +9,24 @@ using System.Text;
using System.Threading;
using System.Diagnostics;
using Cosmos.Common;
using Cosmos.IL2CPU.Plugs;
namespace Cosmos.IL2CPU {
[DebuggerStepThrough]
public static class GCImplementation {
[PlugMethod(RequiresPlug = true)]
private static void AcquireLock() {
// do {
// } while (Interlocked.CompareExchange(ref mLock, 1, 0) != 0);
throw new NotImplementedException();
}
private static void ReleaseLock() {
[PlugMethod(RequiresPlug = true)]
private static void ReleaseLock() {
// do {
// } while (Interlocked.CompareExchange(ref mLock, 0, 1) != 1);
throw new NotImplementedException();
}
public static uint AllocNewObject(uint aSize) {
[PlugMethod(RequiresPlug = true)]
public static uint AllocNewObject(uint aSize) {
// uint xNewObject = RuntimeEngine.Heap_AllocNewObject(aSize + 4);
//#if GC_DEBUG
// Console.Write("New Object allocated: ");
@ -37,11 +38,12 @@ namespace Cosmos.IL2CPU {
}
/// <summary>
/// This function gets the pointer to the memory location of where it's stored.
/// </summary>
/// <param name="aObject"></param>
public static unsafe void IncRefCount(uint aObject) {
/// <summary>
/// This function gets the pointer to the memory location of where it's stored.
/// </summary>
/// <param name="aObject"></param>
[PlugMethod(RequiresPlug = true)]
public static unsafe void IncRefCount(uint aObject) {
//// if (aObject == 0) {
//// return;
//// }
@ -77,11 +79,13 @@ namespace Cosmos.IL2CPU {
}
/// <summary>
/// This function gets the pointer to the memory location of where it's stored.
/// </summary>
/// <param name="aObject"></param>
public static unsafe void DecRefCount(uint aObject) {
/// <summary>
/// This function gets the pointer to the memory location of where it's stored.
/// </summary>
/// <param name="aObject"></param>
///
[PlugMethod(RequiresPlug = true)]
public static unsafe void DecRefCount(uint aObject) {
//// if (aObject == 0) {
//// return;
//// }

File diff suppressed because it is too large Load diff