-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimized the generated filename of CLRBinding
- Loading branch information
Showing
20 changed files
with
391 additions
and
47 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
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
File renamed without changes.
61 changes: 61 additions & 0 deletions
61
ILRuntimeTest/AutoGenerate/ILRuntimeTest_TestFramework_TestCLREnumClass_Binding.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,61 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
using ILRuntime.CLR.TypeSystem; | ||
using ILRuntime.CLR.Method; | ||
using ILRuntime.Runtime.Enviorment; | ||
using ILRuntime.Runtime.Intepreter; | ||
using ILRuntime.Runtime.Stack; | ||
using ILRuntime.Reflection; | ||
using ILRuntime.CLR.Utils; | ||
|
||
namespace ILRuntime.Runtime.Generated | ||
{ | ||
unsafe class ILRuntimeTest_TestFramework_TestCLREnumClass_Binding | ||
{ | ||
public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) | ||
{ | ||
BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; | ||
MethodBase method; | ||
FieldInfo field; | ||
Type[] args; | ||
Type type = typeof(ILRuntimeTest.TestFramework.TestCLREnumClass); | ||
args = new Type[]{}; | ||
method = type.GetMethod("get_Test2", flag, null, args, null); | ||
app.RegisterCLRMethodRedirection(method, get_Test2_0); | ||
|
||
field = type.GetField("Test", flag); | ||
app.RegisterCLRFieldGetter(field, get_Test_0); | ||
app.RegisterCLRFieldSetter(field, set_Test_0); | ||
|
||
|
||
} | ||
|
||
|
||
static StackObject* get_Test2_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) | ||
{ | ||
ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; | ||
StackObject* __ret = ILIntepreter.Minus(__esp, 0); | ||
|
||
|
||
var result_of_this_method = ILRuntimeTest.TestFramework.TestCLREnumClass.Test2; | ||
|
||
return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); | ||
} | ||
|
||
|
||
static object get_Test_0(ref object o) | ||
{ | ||
return ILRuntimeTest.TestFramework.TestCLREnumClass.Test; | ||
} | ||
static void set_Test_0(ref object o, object v) | ||
{ | ||
ILRuntimeTest.TestFramework.TestCLREnumClass.Test = (ILRuntimeTest.TestFramework.TestCLREnum)v; | ||
} | ||
|
||
|
||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
ILRuntimeTest/AutoGenerate/ILRuntimeTest_TestFramework_TestVector3NoBinding_Binding.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,136 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
using ILRuntime.CLR.TypeSystem; | ||
using ILRuntime.CLR.Method; | ||
using ILRuntime.Runtime.Enviorment; | ||
using ILRuntime.Runtime.Intepreter; | ||
using ILRuntime.Runtime.Stack; | ||
using ILRuntime.Reflection; | ||
using ILRuntime.CLR.Utils; | ||
|
||
namespace ILRuntime.Runtime.Generated | ||
{ | ||
unsafe class ILRuntimeTest_TestFramework_TestVector3NoBinding_Binding | ||
{ | ||
public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) | ||
{ | ||
BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; | ||
MethodBase method; | ||
FieldInfo field; | ||
Type[] args; | ||
Type type = typeof(ILRuntimeTest.TestFramework.TestVector3NoBinding); | ||
|
||
field = type.GetField("y", flag); | ||
app.RegisterCLRFieldGetter(field, get_y_0); | ||
app.RegisterCLRFieldSetter(field, set_y_0); | ||
|
||
app.RegisterCLRMemberwiseClone(type, PerformMemberwiseClone); | ||
|
||
app.RegisterCLRCreateDefaultInstance(type, () => new ILRuntimeTest.TestFramework.TestVector3NoBinding()); | ||
|
||
args = new Type[]{typeof(System.Single), typeof(System.Single), typeof(System.Single)}; | ||
method = type.GetConstructor(flag, null, args, null); | ||
app.RegisterCLRMethodRedirection(method, Ctor_0); | ||
|
||
} | ||
|
||
static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref ILRuntimeTest.TestFramework.TestVector3NoBinding instance_of_this_method) | ||
{ | ||
ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); | ||
switch(ptr_of_this_method->ObjectType) | ||
{ | ||
case ObjectTypes.Object: | ||
{ | ||
__mStack[ptr_of_this_method->Value] = instance_of_this_method; | ||
} | ||
break; | ||
case ObjectTypes.FieldReference: | ||
{ | ||
var ___obj = __mStack[ptr_of_this_method->Value]; | ||
if(___obj is ILTypeInstance) | ||
{ | ||
((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method; | ||
} | ||
else | ||
{ | ||
var t = __domain.GetType(___obj.GetType()) as CLRType; | ||
t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method); | ||
} | ||
} | ||
break; | ||
case ObjectTypes.StaticFieldReference: | ||
{ | ||
var t = __domain.GetType(ptr_of_this_method->Value); | ||
if(t is ILType) | ||
{ | ||
((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method; | ||
} | ||
else | ||
{ | ||
((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method); | ||
} | ||
} | ||
break; | ||
case ObjectTypes.ArrayReference: | ||
{ | ||
var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ILRuntimeTest.TestFramework.TestVector3NoBinding[]; | ||
instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method; | ||
} | ||
break; | ||
} | ||
} | ||
|
||
|
||
static object get_y_0(ref object o) | ||
{ | ||
return ((ILRuntimeTest.TestFramework.TestVector3NoBinding)o).y; | ||
} | ||
static void set_y_0(ref object o, object v) | ||
{ | ||
var h = GCHandle.Alloc(o, GCHandleType.Pinned); | ||
ILRuntimeTest.TestFramework.TestVector3NoBinding* p = (ILRuntimeTest.TestFramework.TestVector3NoBinding *)(void *)h.AddrOfPinnedObject(); | ||
p->y = (System.Single)v; | ||
h.Free(); | ||
} | ||
|
||
static object PerformMemberwiseClone(ref object o) | ||
{ | ||
var ins = new ILRuntimeTest.TestFramework.TestVector3NoBinding(); | ||
ins = (ILRuntimeTest.TestFramework.TestVector3NoBinding)o; | ||
return ins; | ||
} | ||
|
||
static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) | ||
{ | ||
ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; | ||
StackObject* ptr_of_this_method; | ||
StackObject* __ret = ILIntepreter.Minus(__esp, 3); | ||
ptr_of_this_method = ILIntepreter.Minus(__esp, 1); | ||
System.Single @z = *(float*)&ptr_of_this_method->Value; | ||
|
||
ptr_of_this_method = ILIntepreter.Minus(__esp, 2); | ||
System.Single @y = *(float*)&ptr_of_this_method->Value; | ||
|
||
ptr_of_this_method = ILIntepreter.Minus(__esp, 3); | ||
System.Single @x = *(float*)&ptr_of_this_method->Value; | ||
|
||
|
||
var result_of_this_method = new ILRuntimeTest.TestFramework.TestVector3NoBinding(@x, @y, @z); | ||
|
||
if(!isNewObj) | ||
{ | ||
__ret--; | ||
WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method); | ||
return __ret; | ||
} | ||
|
||
return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); | ||
} | ||
|
||
|
||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
ILRuntimeTest/AutoGenerate/System_AccessViolationException_Binding.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,46 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
using ILRuntime.CLR.TypeSystem; | ||
using ILRuntime.CLR.Method; | ||
using ILRuntime.Runtime.Enviorment; | ||
using ILRuntime.Runtime.Intepreter; | ||
using ILRuntime.Runtime.Stack; | ||
using ILRuntime.Reflection; | ||
using ILRuntime.CLR.Utils; | ||
|
||
namespace ILRuntime.Runtime.Generated | ||
{ | ||
unsafe class System_AccessViolationException_Binding | ||
{ | ||
public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) | ||
{ | ||
BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; | ||
MethodBase method; | ||
Type[] args; | ||
Type type = typeof(System.AccessViolationException); | ||
|
||
args = new Type[]{}; | ||
method = type.GetConstructor(flag, null, args, null); | ||
app.RegisterCLRMethodRedirection(method, Ctor_0); | ||
|
||
} | ||
|
||
|
||
|
||
static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) | ||
{ | ||
ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; | ||
StackObject* __ret = ILIntepreter.Minus(__esp, 0); | ||
|
||
var result_of_this_method = new System.AccessViolationException(); | ||
|
||
return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); | ||
} | ||
|
||
|
||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.