forked from CosmosOS/Cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/CosmosOS/master'
- Loading branch information
Showing
17 changed files
with
456 additions
and
468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
source/Cosmos.Core.Plugs/System/Assemblers/DelegateImpl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
|
||
using Cosmos.IL2CPU.Plugs; | ||
using Cosmos.IL2CPU.Plugs.Assemblers; | ||
|
||
namespace Cosmos.Core.Plugs.System.Assemblers | ||
{ | ||
[Plug(Target = typeof(Delegate), Inheritable = true)] | ||
[PlugField(FieldType = typeof(int), FieldId = "$$ArgSize$$")] | ||
public static class DelegateImpl | ||
{ | ||
|
||
[PlugMethod(Assembler = typeof(CtorImplAssembler), IsWildcard = true, WildcardMatchParameters = true)] | ||
public static void Ctor(Delegate aThis, object aTarget, IntPtr aMethod) | ||
{ | ||
//aFldTarget = aObject; | ||
//aFldMethod = aMethod; | ||
throw new NotImplementedException("Implemented by method assembler"); | ||
} | ||
|
||
[PlugMethod(IsWildcard = true, Assembler = typeof(InvokeImplAssembler))] | ||
public static void Invoke() | ||
{ | ||
throw new NotImplementedException("Implemented by method assembler"); | ||
} | ||
} | ||
} |
8 changes: 6 additions & 2 deletions
8
...Assemblers/GetMulticastInvokeAssembler.cs → ...Assemblers/GetMulticastInvokeAssembler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
315 changes: 315 additions & 0 deletions
315
source/Cosmos.Core.Plugs/System/Assemblers/InvokeImplAssembler.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
|
||
using Cosmos.IL2CPU; | ||
using Cosmos.IL2CPU.Plugs; | ||
|
||
namespace Cosmos.Core.Plugs.System | ||
{ | ||
[Plug(Target = typeof(Delegate))] | ||
//[PlugField(FieldId = "$$Method$$", FieldType = typeof(object))] | ||
//[PlugField(FieldId = "$$Object$$", FieldType = typeof(object))] | ||
[PlugField(FieldType = typeof(int), FieldId = "$$ReturnsValue$$")] | ||
public static class DelegateImpl | ||
{ | ||
|
||
[PlugMethod(Signature = "System_MulticastDelegate__System_Delegate_InternalAllocLike_System_Delegate_")] | ||
public unsafe static uint InternalAllocLike(uint* aDelegate) | ||
{ | ||
uint xNeededSize = 1024; // 24 is needed fields for Multicast Delegate | ||
xNeededSize += 12; | ||
uint xResultAddr = GCImplementation.AllocNewObject(xNeededSize); | ||
byte* xResult = (byte*)xResultAddr; | ||
byte* xDelegateAsByte = (byte*)aDelegate; | ||
for (int i = 0; i < 1024; i++) | ||
{ | ||
xResult[i] = xDelegateAsByte[i]; | ||
} | ||
return xResultAddr; | ||
} | ||
|
||
//[PlugMethod(Signature = "System_Void__System_Delegate__ctor___")] | ||
//public static void Ctor(Delegate d, [FieldAccess(Name = "$$ReturnsValue$$")] ref bool hasReturnvalue) | ||
//{ | ||
// hasReturnvalue = d.Method.ReturnType != typeof(void); | ||
//} | ||
|
||
public static IntPtr GetInvokeMethod(Delegate aThis) | ||
{ | ||
return IntPtr.Zero; | ||
} | ||
|
||
public static bool Equals(Delegate aThis, object aThat) | ||
{ | ||
// todo: implement proper Delegate.Equals(object) | ||
return false; | ||
} | ||
} | ||
} |
42 changes: 21 additions & 21 deletions
42
...CPU/Plugs/System/MulticastDelegateImpl.cs → ...ore.Plugs/System/MulticastDelegateImpl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
using System; | ||
|
||
namespace Cosmos.IL2CPU.Plugs.System { | ||
|
||
[Plug(Target = typeof(MulticastDelegate))] | ||
// [PlugField(FieldType = typeof(int), FieldId = "$$ArgSize$$")] | ||
public class MulticastDelegateImpl { | ||
|
||
// there is no such thing as MulticastDelegate.InvokeMulticase. New scanner is more strict | ||
// so I commented this out for now. | ||
//[PlugMethod(Assembler = typeof(Assemblers.MulticastDelegate_Invoke, IsWildcard=true))] | ||
//public static void InvokeMulticast(MulticastDelegate aThis) { | ||
// throw new Exception("This method should be implemented using a MethodAssembler"); | ||
//} | ||
|
||
public static bool Equals(MulticastDelegate aThis, object aThat) { | ||
// todo: implement MulticastDelegate.Equals(MulticastDelegate) | ||
return false; | ||
} | ||
} | ||
} | ||
using System; | ||
|
||
namespace Cosmos.IL2CPU.Plugs.System { | ||
|
||
[Plug(Target = typeof(MulticastDelegate))] | ||
// [PlugField(FieldType = typeof(int), FieldId = "$$ArgSize$$")] | ||
public class MulticastDelegateImpl { | ||
|
||
// there is no such thing as MulticastDelegate.InvokeMulticase. New scanner is more strict | ||
// so I commented this out for now. | ||
//[PlugMethod(Assembler = typeof(Assemblers.MulticastDelegate_Invoke, IsWildcard=true))] | ||
//public static void InvokeMulticast(MulticastDelegate aThis) { | ||
// throw new Exception("This method should be implemented using a MethodAssembler"); | ||
//} | ||
|
||
public static bool Equals(MulticastDelegate aThis, object aThat) { | ||
// todo: implement MulticastDelegate.Equals(MulticastDelegate) | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.