diff --git a/ILRuntime/Runtime/CLRBinding/BindingGeneratorExtensions.cs b/ILRuntime/Runtime/CLRBinding/BindingGeneratorExtensions.cs index e71588ed..934dd4af 100755 --- a/ILRuntime/Runtime/CLRBinding/BindingGeneratorExtensions.cs +++ b/ILRuntime/Runtime/CLRBinding/BindingGeneratorExtensions.cs @@ -39,8 +39,8 @@ internal static bool ShouldSkipMethod(this Type type, MethodBase i) if (i.IsSpecialName) { string[] t = i.Name.Split('_'); - //if (t[0] == "add" || t[0] == "remove") - // return true; + if (t[0] == "add" || t[0] == "remove") + return false; if (t[0] == "get" || t[0] == "set") { Type[] ts; diff --git a/ILRuntimeTestBase/Adapters/helper.cs b/ILRuntimeTestBase/Adapters/helper.cs index aa65bb8e..8ea9c76d 100644 --- a/ILRuntimeTestBase/Adapters/helper.cs +++ b/ILRuntimeTestBase/Adapters/helper.cs @@ -66,6 +66,7 @@ public static void Init(ILRuntime.Runtime.Enviorment.AppDomain app) app.DelegateManager.RegisterMethodDelegate(); app.DelegateManager.RegisterFunctionDelegate(); app.DelegateManager.RegisterFunctionDelegate(); + app.DelegateManager.RegisterMethodDelegate(); // delegate convertor app.DelegateManager.RegisterDelegateConvertor>((act) => { diff --git a/ILRuntimeTestBase/AutoGenerate/CLRBindings.cs b/ILRuntimeTestBase/AutoGenerate/CLRBindings.cs index 98d1af59..43c7054d 100644 --- a/ILRuntimeTestBase/AutoGenerate/CLRBindings.cs +++ b/ILRuntimeTestBase/AutoGenerate/CLRBindings.cs @@ -26,6 +26,8 @@ static private void RegisterBindingAction() internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder> s_System_Collections_Generic_KeyValuePair_2_UInt32_ILTypeInstance_Binding_Binder = null; internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder s_ILRuntimeTest_TestFramework_TestStructA_Binding_Binder = null; internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder s_ILRuntimeTest_TestFramework_TestStructB_Binding_Binder = null; + internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder = null; + internal static ILRuntime.Runtime.Enviorment.ValueTypeBinder s_ILRuntimeTest_TestFramework_Fixed64Vector2_Binding_Binder = null; /// /// Initialize the CLR binding, please invoke this AFTER CLR Redirection registration @@ -103,6 +105,8 @@ public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) System_Reflection_ParameterInfo_Binding.Register(app); System_Reflection_MethodInfo_Binding.Register(app); ILRuntimeTest_TestFramework_BindableProperty_1_Int64_Binding.Register(app); + System_Threading_Interlocked_Binding.Register(app); + System_Action_3_Single_Double_Int32_Binding.Register(app); System_Action_Binding.Register(app); System_Collections_Generic_Dictionary_2_Int64_Int32_Binding.Register(app); System_Enum_Binding.Register(app); @@ -155,6 +159,7 @@ public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) ILRuntimeTest_TestFramework_TestCLRAttribute_Binding.Register(app); System_Reflection_PropertyInfo_Binding.Register(app); System_Collections_Generic_List_1_String_Binding.Register(app); + System_Collections_Generic_List_1_FieldInfo_Binding.Register(app); ILRuntimeTest_TestFramework_TestCLREnumClass_Binding.Register(app); System_Nullable_1_Int32_Binding.Register(app); System_Collections_Generic_Dictionary_2_Int32_List_1_String_Binding.Register(app); @@ -195,6 +200,8 @@ public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) System_Collections_Generic_List_1_TestVector3NoBinding_Binding.Register(app); ILRuntimeTest_TestFramework_TestStructA_Binding.Register(app); ILRuntimeTest_TestFramework_TestStructB_Binding.Register(app); + ILRuntimeTest_TestFramework_Fixed64_Binding.Register(app); + ILRuntimeTest_TestFramework_Fixed64Vector2_Binding.Register(app); ILRuntime.CLR.TypeSystem.CLRType __clrType = null; __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType (typeof(ILRuntimeTest.TestFramework.TestVector3)); @@ -209,6 +216,10 @@ public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) s_ILRuntimeTest_TestFramework_TestStructA_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder; __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType (typeof(ILRuntimeTest.TestFramework.TestStructB)); s_ILRuntimeTest_TestFramework_TestStructB_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder; + __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType (typeof(ILRuntimeTest.TestFramework.Fixed64)); + s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder; + __clrType = (ILRuntime.CLR.TypeSystem.CLRType)app.GetType (typeof(ILRuntimeTest.TestFramework.Fixed64Vector2)); + s_ILRuntimeTest_TestFramework_Fixed64Vector2_Binding_Binder = __clrType.ValueTypeBinder as ILRuntime.Runtime.Enviorment.ValueTypeBinder; } /// @@ -222,6 +233,8 @@ public static void Shutdown(ILRuntime.Runtime.Enviorment.AppDomain app) s_System_Collections_Generic_KeyValuePair_2_UInt32_ILTypeInstance_Binding_Binder = null; s_ILRuntimeTest_TestFramework_TestStructA_Binding_Binder = null; s_ILRuntimeTest_TestFramework_TestStructB_Binding_Binder = null; + s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder = null; + s_ILRuntimeTest_TestFramework_Fixed64Vector2_Binding_Binder = null; } } } diff --git a/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_DelegateTest_Binding.cs b/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_DelegateTest_Binding.cs index ed480906..412a3d34 100644 --- a/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_DelegateTest_Binding.cs +++ b/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_DelegateTest_Binding.cs @@ -51,6 +51,18 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{}; method = type.GetMethod("TestEnumDelegate2", flag, null, args, null); app.RegisterCLRMethodRedirection(method, TestEnumDelegate2_7); + args = new Type[]{typeof(System.Action)}; + method = type.GetMethod("add_OnIntEvent", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, add_OnIntEvent_8); + args = new Type[]{typeof(System.Single), typeof(System.Double), typeof(System.Int32)}; + method = type.GetMethod("TestEvent3", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, TestEvent3_9); + args = new Type[]{typeof(System.Action)}; + method = type.GetMethod("remove_OnIntEvent", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, remove_OnIntEvent_10); + args = new Type[]{}; + method = type.GetMethod("TestEvent4", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, TestEvent4_11); field = type.GetField("IntDelegateTest", flag); app.RegisterCLRFieldGetter(field, get_IntDelegateTest_0); @@ -202,6 +214,72 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret; } + static StackObject* add_OnIntEvent_8(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Action @value = (System.Action)typeof(System.Action).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + __intp.Free(ptr_of_this_method); + + + ILRuntimeTest.TestFramework.DelegateTest.OnIntEvent += value; + + return __ret; + } + + static StackObject* TestEvent3_9(ILIntepreter __intp, StackObject* __esp, AutoList __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.Int32 @c = ptr_of_this_method->Value; + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Double @b = *(double*)&ptr_of_this_method->Value; + + ptr_of_this_method = ILIntepreter.Minus(__esp, 3); + System.Single @a = *(float*)&ptr_of_this_method->Value; + + + ILRuntimeTest.TestFramework.DelegateTest.TestEvent3(@a, @b, @c); + + return __ret; + } + + static StackObject* remove_OnIntEvent_10(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Action @value = (System.Action)typeof(System.Action).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + __intp.Free(ptr_of_this_method); + + + ILRuntimeTest.TestFramework.DelegateTest.OnIntEvent -= value; + + return __ret; + } + + static StackObject* TestEvent4_11(ILIntepreter __intp, StackObject* __esp, AutoList __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.DelegateTest.TestEvent4(); + + __ret->ObjectType = ObjectTypes.Integer; + __ret->Value = result_of_this_method ? 1 : 0; + return __ret + 1; + } + static object get_IntDelegateTest_0(ref object o) { diff --git a/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_Fixed64Vector2_Binding.cs b/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_Fixed64Vector2_Binding.cs new file mode 100644 index 00000000..d0e3c0c8 --- /dev/null +++ b/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_Fixed64Vector2_Binding.cs @@ -0,0 +1,174 @@ +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; +#if DEBUG && !DISABLE_ILRUNTIME_DEBUG +using AutoList = System.Collections.Generic.List; +#else +using AutoList = ILRuntime.Other.UncheckedList; +#endif +namespace ILRuntime.Runtime.Generated +{ + unsafe class ILRuntimeTest_TestFramework_Fixed64Vector2_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.Fixed64Vector2); + + field = type.GetField("x", flag); + app.RegisterCLRFieldGetter(field, get_x_0); + app.RegisterCLRFieldSetter(field, set_x_0); + app.RegisterCLRFieldBinding(field, CopyToStack_x_0, AssignFromStack_x_0); + + app.RegisterCLRMemberwiseClone(type, PerformMemberwiseClone); + + app.RegisterCLRCreateDefaultInstance(type, () => new ILRuntimeTest.TestFramework.Fixed64Vector2()); + + args = new Type[]{typeof(System.Int32), typeof(System.Int32)}; + 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, AutoList __mStack, ref ILRuntimeTest.TestFramework.Fixed64Vector2 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.Fixed64Vector2[]; + instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method; + } + break; + } + } + + + static object get_x_0(ref object o) + { + return ((ILRuntimeTest.TestFramework.Fixed64Vector2)o).x; + } + + static StackObject* CopyToStack_x_0(ref object o, ILIntepreter __intp, StackObject* __ret, AutoList __mStack) + { + var result_of_this_method = ((ILRuntimeTest.TestFramework.Fixed64Vector2)o).x; + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.PushValue(ref result_of_this_method, __intp, __ret, __mStack); + return __ret + 1; + } else { + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + } + + static void set_x_0(ref object o, object v) + { + ILRuntimeTest.TestFramework.Fixed64Vector2 ins =(ILRuntimeTest.TestFramework.Fixed64Vector2)o; + ins.x = (ILRuntimeTest.TestFramework.Fixed64)v; + o = ins; + } + + static StackObject* AssignFromStack_x_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, AutoList __mStack) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + ILRuntimeTest.TestFramework.Fixed64 @x = new ILRuntimeTest.TestFramework.Fixed64(); + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.ParseValue(ref @x, __intp, ptr_of_this_method, __mStack, true); + } else { + @x = (ILRuntimeTest.TestFramework.Fixed64)typeof(ILRuntimeTest.TestFramework.Fixed64).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); + } + ILRuntimeTest.TestFramework.Fixed64Vector2 ins =(ILRuntimeTest.TestFramework.Fixed64Vector2)o; + ins.x = @x; + o = ins; + return ptr_of_this_method; + } + + + static object PerformMemberwiseClone(ref object o) + { + var ins = new ILRuntimeTest.TestFramework.Fixed64Vector2(); + ins = (ILRuntimeTest.TestFramework.Fixed64Vector2)o; + return ins; + } + + static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Int32 @y = ptr_of_this_method->Value; + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Int32 @x = ptr_of_this_method->Value; + + + var result_of_this_method = new ILRuntimeTest.TestFramework.Fixed64Vector2(@x, @y); + + if(!isNewObj) + { + __ret--; + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64Vector2_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64Vector2_Binding_Binder.WriteBackValue(__domain, __ret, __mStack, ref result_of_this_method); + } else { + WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method); + } + return __ret; + } + + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64Vector2_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64Vector2_Binding_Binder.PushValue(ref result_of_this_method, __intp, __ret, __mStack); + return __ret + 1; + } else { + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + } + + + } +} diff --git a/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_Fixed64_Binding.cs b/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_Fixed64_Binding.cs new file mode 100644 index 00000000..99b4a854 --- /dev/null +++ b/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_Fixed64_Binding.cs @@ -0,0 +1,220 @@ +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; +#if DEBUG && !DISABLE_ILRUNTIME_DEBUG +using AutoList = System.Collections.Generic.List; +#else +using AutoList = ILRuntime.Other.UncheckedList; +#endif +namespace ILRuntime.Runtime.Generated +{ + unsafe class ILRuntimeTest_TestFramework_Fixed64_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(ILRuntimeTest.TestFramework.Fixed64); + args = new Type[]{}; + method = type.GetMethod("get_RawValue", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, get_RawValue_0); + args = new Type[]{typeof(ILRuntimeTest.TestFramework.Fixed64), typeof(ILRuntimeTest.TestFramework.Fixed64)}; + method = type.GetMethod("op_LessThan", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, op_LessThan_1); + args = new Type[]{typeof(ILRuntimeTest.TestFramework.Fixed64), typeof(ILRuntimeTest.TestFramework.Fixed64)}; + method = type.GetMethod("op_GreaterThan", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, op_GreaterThan_2); + + app.RegisterCLRCreateDefaultInstance(type, () => new ILRuntimeTest.TestFramework.Fixed64()); + + args = new Type[]{typeof(System.Int64)}; + 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, AutoList __mStack, ref ILRuntimeTest.TestFramework.Fixed64 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.Fixed64[]; + instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method; + } + break; + } + } + + static StackObject* get_RawValue_0(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + ILRuntimeTest.TestFramework.Fixed64 instance_of_this_method = new ILRuntimeTest.TestFramework.Fixed64(); + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.ParseValue(ref instance_of_this_method, __intp, ptr_of_this_method, __mStack, false); + } else { + ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); + instance_of_this_method = (ILRuntimeTest.TestFramework.Fixed64)typeof(ILRuntimeTest.TestFramework.Fixed64).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); + } + + var result_of_this_method = instance_of_this_method.RawValue; + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.WriteBackValue(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); + } else { + WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); + } + + __intp.Free(ptr_of_this_method); + __ret->ObjectType = ObjectTypes.Long; + *(long*)&__ret->Value = result_of_this_method; + return __ret + 1; + } + + static StackObject* op_LessThan_1(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + ILRuntimeTest.TestFramework.Fixed64 @y = new ILRuntimeTest.TestFramework.Fixed64(); + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.ParseValue(ref @y, __intp, ptr_of_this_method, __mStack, true); + } else { + @y = (ILRuntimeTest.TestFramework.Fixed64)typeof(ILRuntimeTest.TestFramework.Fixed64).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); + __intp.Free(ptr_of_this_method); + } + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + ILRuntimeTest.TestFramework.Fixed64 @x = new ILRuntimeTest.TestFramework.Fixed64(); + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.ParseValue(ref @x, __intp, ptr_of_this_method, __mStack, true); + } else { + @x = (ILRuntimeTest.TestFramework.Fixed64)typeof(ILRuntimeTest.TestFramework.Fixed64).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); + __intp.Free(ptr_of_this_method); + } + + + var result_of_this_method = x < y; + + __ret->ObjectType = ObjectTypes.Integer; + __ret->Value = result_of_this_method ? 1 : 0; + return __ret + 1; + } + + static StackObject* op_GreaterThan_2(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + ILRuntimeTest.TestFramework.Fixed64 @y = new ILRuntimeTest.TestFramework.Fixed64(); + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.ParseValue(ref @y, __intp, ptr_of_this_method, __mStack, true); + } else { + @y = (ILRuntimeTest.TestFramework.Fixed64)typeof(ILRuntimeTest.TestFramework.Fixed64).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); + __intp.Free(ptr_of_this_method); + } + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + ILRuntimeTest.TestFramework.Fixed64 @x = new ILRuntimeTest.TestFramework.Fixed64(); + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.ParseValue(ref @x, __intp, ptr_of_this_method, __mStack, true); + } else { + @x = (ILRuntimeTest.TestFramework.Fixed64)typeof(ILRuntimeTest.TestFramework.Fixed64).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); + __intp.Free(ptr_of_this_method); + } + + + var result_of_this_method = x > y; + + __ret->ObjectType = ObjectTypes.Integer; + __ret->Value = result_of_this_method ? 1 : 0; + return __ret + 1; + } + + + static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Int64 @value = *(long*)&ptr_of_this_method->Value; + + + var result_of_this_method = new ILRuntimeTest.TestFramework.Fixed64(@value); + + if(!isNewObj) + { + __ret--; + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.WriteBackValue(__domain, __ret, __mStack, ref result_of_this_method); + } else { + WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method); + } + return __ret; + } + + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_Fixed64_Binding_Binder.PushValue(ref result_of_this_method, __intp, __ret, __mStack); + return __ret + 1; + } else { + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + } + + + } +} diff --git a/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_TestVectorClass_Binding.cs b/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_TestVectorClass_Binding.cs index 8164e9fd..be83489a 100644 --- a/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_TestVectorClass_Binding.cs +++ b/ILRuntimeTestBase/AutoGenerate/ILRuntimeTest_TestFramework_TestVectorClass_Binding.cs @@ -33,15 +33,15 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{typeof(System.Int32), typeof(System.String), typeof(ILRuntimeTest.TestFramework.TestVector3), typeof(ILRuntimeTest.TestFramework.TestVectorClass)}; method = type.GetMethod("ValueTypePerfTest", flag, null, args, null); app.RegisterCLRMethodRedirection(method, ValueTypePerfTest_1); + args = new Type[]{typeof(ILRuntimeTest.TestFramework.TestVector3)}; + method = type.GetMethod("set_Vector2", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, set_Vector2_2); args = new Type[]{}; method = type.GetMethod("get_Obj", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, get_Obj_2); + app.RegisterCLRMethodRedirection(method, get_Obj_3); args = new Type[]{typeof(System.Int32), typeof(System.String), typeof(ILRuntimeTest.TestFramework.TestVectorClass), typeof(ILRuntimeTest.TestFramework.TestVectorClass)}; method = type.GetMethod("ValueTypePerfTest2", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, ValueTypePerfTest2_3); - args = new Type[]{typeof(ILRuntimeTest.TestFramework.TestVector3)}; - method = type.GetMethod("set_Vector2", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, set_Vector2_4); + app.RegisterCLRMethodRedirection(method, ValueTypePerfTest2_4); field = type.GetField("vector", flag); app.RegisterCLRFieldGetter(field, get_vector_0); @@ -107,7 +107,31 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret; } - static StackObject* get_Obj_2(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* set_Vector2_2(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + ILRuntimeTest.TestFramework.TestVector3 @value = new ILRuntimeTest.TestFramework.TestVector3(); + if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_TestVector3_Binding_Binder != null) { + ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_TestVector3_Binding_Binder.ParseValue(ref @value, __intp, ptr_of_this_method, __mStack, true); + } else { + @value = (ILRuntimeTest.TestFramework.TestVector3)typeof(ILRuntimeTest.TestFramework.TestVector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); + __intp.Free(ptr_of_this_method); + } + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + ILRuntimeTest.TestFramework.TestVectorClass instance_of_this_method = (ILRuntimeTest.TestFramework.TestVectorClass)typeof(ILRuntimeTest.TestFramework.TestVectorClass).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + instance_of_this_method.Vector2 = value; + + return __ret; + } + + static StackObject* get_Obj_3(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -122,7 +146,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* ValueTypePerfTest2_3(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* ValueTypePerfTest2_4(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -149,30 +173,6 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret; } - static StackObject* set_Vector2_4(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) - { - ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; - StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 2); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - ILRuntimeTest.TestFramework.TestVector3 @value = new ILRuntimeTest.TestFramework.TestVector3(); - if (ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_TestVector3_Binding_Binder != null) { - ILRuntime.Runtime.Generated.CLRBindings.s_ILRuntimeTest_TestFramework_TestVector3_Binding_Binder.ParseValue(ref @value, __intp, ptr_of_this_method, __mStack, true); - } else { - @value = (ILRuntimeTest.TestFramework.TestVector3)typeof(ILRuntimeTest.TestFramework.TestVector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); - __intp.Free(ptr_of_this_method); - } - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - ILRuntimeTest.TestFramework.TestVectorClass instance_of_this_method = (ILRuntimeTest.TestFramework.TestVectorClass)typeof(ILRuntimeTest.TestFramework.TestVectorClass).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); - __intp.Free(ptr_of_this_method); - - instance_of_this_method.Vector2 = value; - - return __ret; - } - static object get_vector_0(ref object o) { diff --git a/ILRuntimeTestBase/AutoGenerate/System_Action_3_Single_Double_Int32_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Action_3_Single_Double_Int32_Binding.cs new file mode 100644 index 00000000..11a328c0 --- /dev/null +++ b/ILRuntimeTestBase/AutoGenerate/System_Action_3_Single_Double_Int32_Binding.cs @@ -0,0 +1,64 @@ +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; +#if DEBUG && !DISABLE_ILRUNTIME_DEBUG +using AutoList = System.Collections.Generic.List; +#else +using AutoList = ILRuntime.Other.UncheckedList; +#endif +namespace ILRuntime.Runtime.Generated +{ + unsafe class System_Action_3_Single_Double_Int32_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.Action); + args = new Type[]{typeof(System.Single), typeof(System.Double), typeof(System.Int32)}; + method = type.GetMethod("Invoke", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, Invoke_0); + + + } + + + static StackObject* Invoke_0(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 4); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Int32 @arg3 = ptr_of_this_method->Value; + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Double @arg2 = *(double*)&ptr_of_this_method->Value; + + ptr_of_this_method = ILIntepreter.Minus(__esp, 3); + System.Single @arg1 = *(float*)&ptr_of_this_method->Value; + + ptr_of_this_method = ILIntepreter.Minus(__esp, 4); + System.Action instance_of_this_method = (System.Action)typeof(System.Action).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + __intp.Free(ptr_of_this_method); + + instance_of_this_method.Invoke(@arg1, @arg2, @arg3); + + return __ret; + } + + + + } +} diff --git a/ILRuntimeTestBase/AutoGenerate/System_Collections_Generic_List_1_FieldInfo_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Collections_Generic_List_1_FieldInfo_Binding.cs new file mode 100644 index 00000000..b63811ca --- /dev/null +++ b/ILRuntimeTestBase/AutoGenerate/System_Collections_Generic_List_1_FieldInfo_Binding.cs @@ -0,0 +1,57 @@ +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; +#if DEBUG && !DISABLE_ILRUNTIME_DEBUG +using AutoList = System.Collections.Generic.List; +#else +using AutoList = ILRuntime.Other.UncheckedList; +#endif +namespace ILRuntime.Runtime.Generated +{ + unsafe class System_Collections_Generic_List_1_FieldInfo_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.Collections.Generic.List); + args = new Type[]{}; + method = type.GetMethod("get_Count", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, get_Count_0); + + + } + + + static StackObject* get_Count_0(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Collections.Generic.List instance_of_this_method = (System.Collections.Generic.List)typeof(System.Collections.Generic.List).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + var result_of_this_method = instance_of_this_method.Count; + + __ret->ObjectType = ObjectTypes.Integer; + __ret->Value = result_of_this_method; + return __ret + 1; + } + + + + } +} diff --git a/ILRuntimeTestBase/AutoGenerate/System_Collections_Generic_List_1_ILTypeInstance_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Collections_Generic_List_1_ILTypeInstance_Binding.cs index 502e438b..11efaa31 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Collections_Generic_List_1_ILTypeInstance_Binding.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Collections_Generic_List_1_ILTypeInstance_Binding.cs @@ -41,6 +41,9 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{}; method = type.GetMethod("GetEnumerator", flag, null, args, null); app.RegisterCLRMethodRedirection(method, GetEnumerator_4); + args = new Type[]{typeof(System.Comparison)}; + method = type.GetMethod("Sort", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, Sort_5); args = new Type[]{}; method = type.GetConstructor(flag, null, args, null); @@ -142,6 +145,25 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } + static StackObject* Sort_5(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Comparison @comparison = (System.Comparison)typeof(System.Comparison).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + __intp.Free(ptr_of_this_method); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Collections.Generic.List instance_of_this_method = (System.Collections.Generic.List)typeof(System.Collections.Generic.List).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + instance_of_this_method.Sort(@comparison); + + return __ret; + } + static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { diff --git a/ILRuntimeTestBase/AutoGenerate/System_Linq_Enumerable_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Linq_Enumerable_Binding.cs index 117241eb..a3bed95d 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Linq_Enumerable_Binding.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Linq_Enumerable_Binding.cs @@ -109,6 +109,34 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) } } } + args = new Type[]{typeof(System.Reflection.FieldInfo)}; + if (genericMethods.TryGetValue("ToList", out lst)) + { + foreach(var m in lst) + { + if(m.MatchGenericParameters(args, typeof(System.Collections.Generic.List), typeof(System.Collections.Generic.IEnumerable))) + { + method = m.MakeGenericMethod(args); + app.RegisterCLRMethodRedirection(method, ToList_5); + + break; + } + } + } + args = new Type[]{typeof(System.Reflection.FieldInfo), typeof(System.String)}; + if (genericMethods.TryGetValue("Select", out lst)) + { + foreach(var m in lst) + { + if(m.MatchGenericParameters(args, typeof(System.Collections.Generic.IEnumerable), typeof(System.Collections.Generic.IEnumerable), typeof(System.Func))) + { + method = m.MakeGenericMethod(args); + app.RegisterCLRMethodRedirection(method, Select_6); + + break; + } + } + } args = new Type[]{typeof(System.Int32[])}; if (genericMethods.TryGetValue("Contains", out lst)) { @@ -117,7 +145,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(System.Boolean), typeof(System.Collections.Generic.IEnumerable), typeof(System.Int32[]))) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, Contains_5); + app.RegisterCLRMethodRedirection(method, Contains_7); break; } @@ -131,7 +159,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(System.Collections.Generic.IEnumerable), typeof(System.Collections.Generic.IEnumerable), typeof(System.Func))) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, Where_6); + app.RegisterCLRMethodRedirection(method, Where_8); break; } @@ -145,7 +173,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(System.Collections.Generic.IEnumerable>), typeof(System.Collections.Generic.IEnumerable), typeof(System.Func))) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, GroupBy_7); + app.RegisterCLRMethodRedirection(method, GroupBy_9); break; } @@ -159,7 +187,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(System.Collections.Generic.IEnumerable), typeof(System.Collections.Generic.IEnumerable>), typeof(System.Func, ILRuntime.Runtime.Intepreter.ILTypeInstance>))) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, Select_8); + app.RegisterCLRMethodRedirection(method, Select_10); break; } @@ -173,7 +201,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(System.Linq.IOrderedEnumerable), typeof(System.Collections.Generic.IEnumerable), typeof(System.Func))) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, OrderBy_9); + app.RegisterCLRMethodRedirection(method, OrderBy_11); break; } @@ -187,7 +215,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance[]), typeof(System.Collections.Generic.IEnumerable))) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, ToArray_10); + app.RegisterCLRMethodRedirection(method, ToArray_12); break; } @@ -201,7 +229,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(System.Int32), typeof(System.Collections.Generic.IEnumerable))) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, Count_11); + app.RegisterCLRMethodRedirection(method, Count_13); break; } @@ -215,7 +243,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(System.Int32), typeof(System.Collections.Generic.IEnumerable))) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, Count_12); + app.RegisterCLRMethodRedirection(method, Count_14); break; } @@ -322,7 +350,43 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* Contains_5(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* ToList_5(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Collections.Generic.IEnumerable @source = (System.Collections.Generic.IEnumerable)typeof(System.Collections.Generic.IEnumerable).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + + var result_of_this_method = System.Linq.Enumerable.ToList(@source); + + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + + static StackObject* Select_6(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Func @selector = (System.Func)typeof(System.Func).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + __intp.Free(ptr_of_this_method); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Collections.Generic.IEnumerable @source = (System.Collections.Generic.IEnumerable)typeof(System.Collections.Generic.IEnumerable).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + + var result_of_this_method = System.Linq.Enumerable.Select(@source, @selector); + + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + + static StackObject* Contains_7(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -344,7 +408,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret + 1; } - static StackObject* Where_6(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Where_8(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -364,7 +428,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* GroupBy_7(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* GroupBy_9(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -384,7 +448,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* Select_8(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Select_10(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -404,7 +468,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* OrderBy_9(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* OrderBy_11(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -424,7 +488,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* ToArray_10(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* ToArray_12(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -440,7 +504,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* Count_11(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Count_13(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -458,7 +522,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret + 1; } - static StackObject* Count_12(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Count_14(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; diff --git a/ILRuntimeTestBase/AutoGenerate/System_Reflection_MethodBase_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Reflection_MethodBase_Binding.cs index ce943fc6..f7802efb 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Reflection_MethodBase_Binding.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Reflection_MethodBase_Binding.cs @@ -35,6 +35,12 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{}; method = type.GetMethod("get_IsStatic", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_IsStatic_2); + args = new Type[]{}; + method = type.GetMethod("get_IsGenericMethodDefinition", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, get_IsGenericMethodDefinition_3); + args = new Type[]{}; + method = type.GetMethod("get_IsGenericMethod", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, get_IsGenericMethod_4); } @@ -100,6 +106,40 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret + 1; } + static StackObject* get_IsGenericMethodDefinition_3(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Reflection.MethodBase instance_of_this_method = (System.Reflection.MethodBase)typeof(System.Reflection.MethodBase).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + var result_of_this_method = instance_of_this_method.IsGenericMethodDefinition; + + __ret->ObjectType = ObjectTypes.Integer; + __ret->Value = result_of_this_method ? 1 : 0; + return __ret + 1; + } + + static StackObject* get_IsGenericMethod_4(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Reflection.MethodBase instance_of_this_method = (System.Reflection.MethodBase)typeof(System.Reflection.MethodBase).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + var result_of_this_method = instance_of_this_method.IsGenericMethod; + + __ret->ObjectType = ObjectTypes.Integer; + __ret->Value = result_of_this_method ? 1 : 0; + return __ret + 1; + } + } diff --git a/ILRuntimeTestBase/AutoGenerate/System_Reflection_MethodInfo_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Reflection_MethodInfo_Binding.cs index 433147b9..f4f27091 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Reflection_MethodInfo_Binding.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Reflection_MethodInfo_Binding.cs @@ -32,6 +32,9 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{typeof(System.Type)}; method = type.GetMethod("CreateDelegate", flag, null, args, null); app.RegisterCLRMethodRedirection(method, CreateDelegate_1); + args = new Type[]{typeof(System.Type[])}; + method = type.GetMethod("MakeGenericMethod", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, MakeGenericMethod_2); } @@ -79,6 +82,25 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } + static StackObject* MakeGenericMethod_2(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Type[] @typeArguments = (System.Type[])typeof(System.Type[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Reflection.MethodInfo instance_of_this_method = (System.Reflection.MethodInfo)typeof(System.Reflection.MethodInfo).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + var result_of_this_method = instance_of_this_method.MakeGenericMethod(@typeArguments); + + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + } diff --git a/ILRuntimeTestBase/AutoGenerate/System_Reflection_PropertyInfo_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Reflection_PropertyInfo_Binding.cs index 5fc0479d..c3c2bfa6 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Reflection_PropertyInfo_Binding.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Reflection_PropertyInfo_Binding.cs @@ -47,6 +47,12 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{}; method = type.GetMethod("get_PropertyType", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_PropertyType_6); + args = new Type[]{typeof(System.Object)}; + method = type.GetMethod("GetValue", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, GetValue_7); + args = new Type[]{typeof(System.Object), typeof(System.Object)}; + method = type.GetMethod("SetValue", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, SetValue_8); } @@ -184,6 +190,53 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } + static StackObject* GetValue_7(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Object @obj = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Reflection.PropertyInfo instance_of_this_method = (System.Reflection.PropertyInfo)typeof(System.Reflection.PropertyInfo).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + var result_of_this_method = instance_of_this_method.GetValue(@obj); + + object obj_result_of_this_method = result_of_this_method; + if(obj_result_of_this_method is CrossBindingAdaptorType) + { + return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance, true); + } + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method, true); + } + + static StackObject* SetValue_8(ILIntepreter __intp, StackObject* __esp, AutoList __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.Object @value = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Object @obj = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 3); + System.Reflection.PropertyInfo instance_of_this_method = (System.Reflection.PropertyInfo)typeof(System.Reflection.PropertyInfo).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + instance_of_this_method.SetValue(@obj, @value); + + return __ret; + } + } diff --git a/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_ILT.cs b/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_ILT.cs index 067773b5..46bd2a74 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_ILT.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_ILT.cs @@ -66,9 +66,6 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance)}; method = type.GetMethod("SetResult", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetResult_4); - args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)}; - method = type.GetMethod("SetStateMachine", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, SetStateMachine_5); app.RegisterCLRCreateDefaultInstance(type, () => new System.Runtime.CompilerServices.AsyncTaskMethodBuilder()); @@ -277,29 +274,6 @@ static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, S return __ret; } - static StackObject* SetStateMachine_5(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) - { - ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; - StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 2); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); - __intp.Free(ptr_of_this_method); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); - System.Runtime.CompilerServices.AsyncTaskMethodBuilder instance_of_this_method = (System.Runtime.CompilerServices.AsyncTaskMethodBuilder)typeof(System.Runtime.CompilerServices.AsyncTaskMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); - - instance_of_this_method.SetStateMachine(@stateMachine); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); - - __intp.Free(ptr_of_this_method); - return __ret; - } - } diff --git a/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_Int.cs b/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_Int.cs index f824307f..53e7ed26 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_Int.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_Int.cs @@ -80,9 +80,6 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{typeof(System.Int32)}; method = type.GetMethod("SetResult", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetResult_5); - args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)}; - method = type.GetMethod("SetStateMachine", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, SetStateMachine_6); args = new Type[]{typeof(System.Runtime.CompilerServices.TaskAwaiter), typeof(ILRuntimeTest.TestFramework.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)}; if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst)) { @@ -91,7 +88,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(void), typeof(System.Runtime.CompilerServices.TaskAwaiter).MakeByRefType(), typeof(ILRuntimeTest.TestFramework.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType())) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7); + app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6); break; } @@ -439,30 +436,7 @@ static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, S return __ret; } - static StackObject* SetStateMachine_6(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) - { - ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; - StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 2); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); - __intp.Free(ptr_of_this_method); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); - System.Runtime.CompilerServices.AsyncTaskMethodBuilder instance_of_this_method = (System.Runtime.CompilerServices.AsyncTaskMethodBuilder)typeof(System.Runtime.CompilerServices.AsyncTaskMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); - - instance_of_this_method.SetStateMachine(@stateMachine); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); - - __intp.Free(ptr_of_this_method); - return __ret; - } - - static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* AwaitUnsafeOnCompleted_6(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; diff --git a/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_Bindi.cs b/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_Bindi.cs index b16672b3..be3f8818 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_Bindi.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncTaskMethodBuilder_Bindi.cs @@ -80,9 +80,6 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{}; method = type.GetMethod("SetResult", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetResult_5); - args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)}; - method = type.GetMethod("SetStateMachine", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, SetStateMachine_6); args = new Type[]{typeof(System.Runtime.CompilerServices.TaskAwaiter), typeof(ILRuntimeTest.TestFramework.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)}; if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst)) { @@ -91,7 +88,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(void), typeof(System.Runtime.CompilerServices.TaskAwaiter).MakeByRefType(), typeof(ILRuntimeTest.TestFramework.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType())) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7); + app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6); break; } @@ -436,30 +433,7 @@ static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, S return __ret; } - static StackObject* SetStateMachine_6(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) - { - ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; - StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 2); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); - __intp.Free(ptr_of_this_method); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); - System.Runtime.CompilerServices.AsyncTaskMethodBuilder instance_of_this_method = (System.Runtime.CompilerServices.AsyncTaskMethodBuilder)typeof(System.Runtime.CompilerServices.AsyncTaskMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); - - instance_of_this_method.SetStateMachine(@stateMachine); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); - - __intp.Free(ptr_of_this_method); - return __ret; - } - - static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* AwaitUnsafeOnCompleted_6(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; diff --git a/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncVoidMethodBuilder_Bindi.cs b/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncVoidMethodBuilder_Bindi.cs index 982a4d3a..99406103 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncVoidMethodBuilder_Bindi.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Runtime_CompilerServices_AsyncVoidMethodBuilder_Bindi.cs @@ -77,9 +77,6 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{}; method = type.GetMethod("SetResult", flag, null, args, null); app.RegisterCLRMethodRedirection(method, SetResult_4); - args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)}; - method = type.GetMethod("SetStateMachine", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, SetStateMachine_5); args = new Type[]{typeof(System.Runtime.CompilerServices.TaskAwaiter), typeof(ILRuntimeTest.TestFramework.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)}; if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst)) { @@ -88,7 +85,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(void), typeof(System.Runtime.CompilerServices.TaskAwaiter).MakeByRefType(), typeof(ILRuntimeTest.TestFramework.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType())) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6); + app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_5); break; } @@ -102,7 +99,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) if(m.MatchGenericParameters(args, typeof(void), typeof(System.Runtime.CompilerServices.TaskAwaiter).MakeByRefType(), typeof(ILRuntimeTest.TestFramework.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType())) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7); + app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6); break; } @@ -423,30 +420,7 @@ static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, S return __ret; } - static StackObject* SetStateMachine_5(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) - { - ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; - StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 2); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); - __intp.Free(ptr_of_this_method); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); - System.Runtime.CompilerServices.AsyncVoidMethodBuilder instance_of_this_method = (System.Runtime.CompilerServices.AsyncVoidMethodBuilder)typeof(System.Runtime.CompilerServices.AsyncVoidMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16); - - instance_of_this_method.SetStateMachine(@stateMachine); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); - - __intp.Free(ptr_of_this_method); - return __ret; - } - - static StackObject* AwaitUnsafeOnCompleted_6(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* AwaitUnsafeOnCompleted_5(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -581,7 +555,7 @@ static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, S return __ret; } - static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* AwaitUnsafeOnCompleted_6(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; diff --git a/ILRuntimeTestBase/AutoGenerate/System_Threading_Interlocked_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Threading_Interlocked_Binding.cs new file mode 100644 index 00000000..ff4b250c --- /dev/null +++ b/ILRuntimeTestBase/AutoGenerate/System_Threading_Interlocked_Binding.cs @@ -0,0 +1,144 @@ +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; +#if DEBUG && !DISABLE_ILRUNTIME_DEBUG +using AutoList = System.Collections.Generic.List; +#else +using AutoList = ILRuntime.Other.UncheckedList; +#endif +namespace ILRuntime.Runtime.Generated +{ + unsafe class System_Threading_Interlocked_Binding + { + public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) + { + MethodBase method; + Type[] args; + Type type = typeof(System.Threading.Interlocked); + Dictionary> genericMethods = new Dictionary>(); + List lst = null; + foreach(var m in type.GetMethods()) + { + if(m.IsGenericMethodDefinition) + { + if (!genericMethods.TryGetValue(m.Name, out lst)) + { + lst = new List(); + genericMethods[m.Name] = lst; + } + lst.Add(m); + } + } + args = new Type[]{typeof(System.Action)}; + if (genericMethods.TryGetValue("CompareExchange", out lst)) + { + foreach(var m in lst) + { + if(m.MatchGenericParameters(args, typeof(System.Action), typeof(System.Action).MakeByRefType(), typeof(System.Action), typeof(System.Action))) + { + method = m.MakeGenericMethod(args); + app.RegisterCLRMethodRedirection(method, CompareExchange_0); + + break; + } + } + } + + + } + + + static StackObject* CompareExchange_0(ILIntepreter __intp, StackObject* __esp, AutoList __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.Action @comparand = (System.Action)typeof(System.Action).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Action @value = (System.Action)typeof(System.Action).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 3); + System.Action @location1 = (System.Action)typeof(System.Action).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + + + var result_of_this_method = System.Threading.Interlocked.CompareExchange>(ref @location1, @value, @comparand); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + __intp.Free(ptr_of_this_method); + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + __intp.Free(ptr_of_this_method); + ptr_of_this_method = ILIntepreter.Minus(__esp, 3); + switch(ptr_of_this_method->ObjectType) + { + case ObjectTypes.StackObjectReference: + { + var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method); + object ___obj = @location1; + if (___dst->ObjectType >= ObjectTypes.Object) + { + if (___obj is CrossBindingAdaptorType) + ___obj = ((CrossBindingAdaptorType)___obj).ILInstance; + __mStack[___dst->Value] = ___obj; + } + else + { + ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain); + } + } + break; + case ObjectTypes.FieldReference: + { + var ___obj = __mStack[ptr_of_this_method->Value]; + if(___obj is ILTypeInstance) + { + ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @location1; + } + else + { + var ___type = __domain.GetType(___obj.GetType()) as CLRType; + ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @location1); + } + } + break; + case ObjectTypes.StaticFieldReference: + { + var ___type = __domain.GetType(ptr_of_this_method->Value); + if(___type is ILType) + { + ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @location1; + } + else + { + ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @location1); + } + } + break; + case ObjectTypes.ArrayReference: + { + var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Action[]; + instance_of_arrayReference[ptr_of_this_method->ValueLow] = @location1; + } + break; + } + + __intp.Free(ptr_of_this_method); + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + + + + } +} diff --git a/ILRuntimeTestBase/AutoGenerate/System_Threading_Tasks_Task_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Threading_Tasks_Task_Binding.cs index 33e771ae..8a91e38b 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Threading_Tasks_Task_Binding.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Threading_Tasks_Task_Binding.cs @@ -35,6 +35,9 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{}; method = type.GetMethod("GetAwaiter", flag, null, args, null); app.RegisterCLRMethodRedirection(method, GetAwaiter_2); + args = new Type[]{typeof(System.Int32)}; + method = type.GetMethod("Delay", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, Delay_3); Dictionary> genericMethods = new Dictionary>(); List lst = null; foreach(var m in type.GetMethods()) @@ -54,24 +57,21 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) { foreach(var m in lst) { - if(m.MatchGenericParameters(args, typeof(System.Threading.Tasks.Task), typeof(System.Func))) + if(m.MatchGenericParameters(args, typeof(System.Threading.Tasks.Task), typeof(System.Func>))) { method = m.MakeGenericMethod(args); - app.RegisterCLRMethodRedirection(method, Run_3); + app.RegisterCLRMethodRedirection(method, Run_4); break; } } } args = new Type[]{typeof(System.Int32)}; - method = type.GetMethod("Delay", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Delay_4); - args = new Type[]{typeof(System.Int32)}; if (genericMethods.TryGetValue("Run", out lst)) { foreach(var m in lst) { - if(m.MatchGenericParameters(args, typeof(System.Threading.Tasks.Task), typeof(System.Func>))) + if(m.MatchGenericParameters(args, typeof(System.Threading.Tasks.Task), typeof(System.Func))) { method = m.MakeGenericMethod(args); app.RegisterCLRMethodRedirection(method, Run_5); @@ -151,18 +151,17 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* Run_3(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Delay_3(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Func @function = (System.Func)typeof(System.Func).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); - __intp.Free(ptr_of_this_method); + System.Int32 @millisecondsDelay = ptr_of_this_method->Value; - var result_of_this_method = System.Threading.Tasks.Task.Run(@function); + var result_of_this_method = System.Threading.Tasks.Task.Delay(@millisecondsDelay); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) @@ -172,17 +171,18 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* Delay_4(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Run_4(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Int32 @millisecondsDelay = ptr_of_this_method->Value; + System.Func> @function = (System.Func>)typeof(System.Func>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + __intp.Free(ptr_of_this_method); - var result_of_this_method = System.Threading.Tasks.Task.Delay(@millisecondsDelay); + var result_of_this_method = System.Threading.Tasks.Task.Run(@function); object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) @@ -199,7 +199,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Func> @function = (System.Func>)typeof(System.Func>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); + System.Func @function = (System.Func)typeof(System.Func).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8); __intp.Free(ptr_of_this_method); diff --git a/ILRuntimeTestBase/AutoGenerate/System_Type_Binding.cs b/ILRuntimeTestBase/AutoGenerate/System_Type_Binding.cs index 6771a4a8..af4505ae 100644 --- a/ILRuntimeTestBase/AutoGenerate/System_Type_Binding.cs +++ b/ILRuntimeTestBase/AutoGenerate/System_Type_Binding.cs @@ -56,27 +56,33 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{typeof(System.String)}; method = type.GetMethod("GetType", flag, null, args, null); app.RegisterCLRMethodRedirection(method, GetType_9); - args = new Type[]{typeof(System.String)}; + args = new Type[]{typeof(System.String), typeof(System.Reflection.BindingFlags)}; method = type.GetMethod("GetField", flag, null, args, null); app.RegisterCLRMethodRedirection(method, GetField_10); args = new Type[]{}; method = type.GetMethod("GetFields", flag, null, args, null); app.RegisterCLRMethodRedirection(method, GetFields_11); args = new Type[]{typeof(System.String)}; + method = type.GetMethod("GetField", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, GetField_12); + args = new Type[]{typeof(System.String)}; method = type.GetMethod("GetProperty", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, GetProperty_12); + app.RegisterCLRMethodRedirection(method, GetProperty_13); args = new Type[]{}; method = type.GetMethod("GetProperties", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, GetProperties_13); + app.RegisterCLRMethodRedirection(method, GetProperties_14); args = new Type[]{typeof(System.Reflection.BindingFlags)}; method = type.GetMethod("GetProperties", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, GetProperties_14); + app.RegisterCLRMethodRedirection(method, GetProperties_15); args = new Type[]{typeof(System.Type)}; method = type.GetMethod("IsAssignableFrom", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, IsAssignableFrom_15); + app.RegisterCLRMethodRedirection(method, IsAssignableFrom_16); + args = new Type[]{typeof(System.Reflection.BindingFlags)}; + method = type.GetMethod("GetFields", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, GetFields_17); args = new Type[]{typeof(System.Type)}; method = type.GetMethod("IsSubclassOf", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, IsSubclassOf_16); + app.RegisterCLRMethodRedirection(method, IsSubclassOf_18); app.RegisterCLRCreateArrayInstance(type, s => new System.Type[s]); @@ -280,17 +286,21 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 2); + StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.String @name = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + System.Reflection.BindingFlags @bindingAttr = (System.Reflection.BindingFlags)typeof(System.Reflection.BindingFlags).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)20); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.String @name = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Type instance_of_this_method = (System.Type)typeof(System.Type).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); __intp.Free(ptr_of_this_method); - var result_of_this_method = instance_of_this_method.GetField(@name); + var result_of_this_method = instance_of_this_method.GetField(@name, @bindingAttr); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } @@ -310,7 +320,26 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* GetProperty_12(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* GetField_12(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.String @name = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Type instance_of_this_method = (System.Type)typeof(System.Type).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + var result_of_this_method = instance_of_this_method.GetField(@name); + + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + + static StackObject* GetProperty_13(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -329,7 +358,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* GetProperties_13(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* GetProperties_14(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -344,7 +373,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* GetProperties_14(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* GetProperties_15(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -363,7 +392,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* IsAssignableFrom_15(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* IsAssignableFrom_16(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -384,7 +413,26 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret + 1; } - static StackObject* IsSubclassOf_16(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* GetFields_17(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 2); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Reflection.BindingFlags @bindingAttr = (System.Reflection.BindingFlags)typeof(System.Reflection.BindingFlags).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)20); + __intp.Free(ptr_of_this_method); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.Type instance_of_this_method = (System.Type)typeof(System.Type).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); + __intp.Free(ptr_of_this_method); + + var result_of_this_method = instance_of_this_method.GetFields(@bindingAttr); + + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + + static StackObject* IsSubclassOf_18(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; diff --git a/ILRuntimeTestBase/TestFramework/DelegateTest.cs b/ILRuntimeTestBase/TestFramework/DelegateTest.cs index 03ace12a..46c79eb3 100644 --- a/ILRuntimeTestBase/TestFramework/DelegateTest.cs +++ b/ILRuntimeTestBase/TestFramework/DelegateTest.cs @@ -92,6 +92,7 @@ public DelegateTest() public static Func DelegatePerformanceTest; public static Action EnumDelegateTest; public static Func EnumDelegateTest2; + public static event Action OnIntEvent; public static void TestEvent() { @@ -103,6 +104,16 @@ public void TestEvent2() IntDelegateEventTest2(22222); } + public static void TestEvent3(float a, double b, int c) + { + OnIntEvent(a, b, c); + } + + public static bool TestEvent4() + { + return OnIntEvent == null; + } + public static void TestEnumDelegate() { EnumDelegateTest(TestCLREnum.Test1); diff --git a/TestCases/DelegateTest.cs b/TestCases/DelegateTest.cs index 6471f23f..a8825610 100644 --- a/TestCases/DelegateTest.cs +++ b/TestCases/DelegateTest.cs @@ -690,5 +690,19 @@ static void DelegateTest43Sub(float a, double b, int c) throw new Exception(); Console.WriteLine($"a={a}, b={b}, c={c}"); } + public static void DelegateTest44() + { + ILRuntimeTest.TestBase.TestSession.LastSession.Appdomain.AllowUnboundCLRMethod = false; + } + + public static void DelegateTest45() + { + ILRuntimeTest.TestFramework.DelegateTest.OnIntEvent += DelegateTest43Sub; + ILRuntimeTest.TestFramework.DelegateTest.TestEvent3(1, 2, 3); + ILRuntimeTest.TestFramework.DelegateTest.OnIntEvent -= DelegateTest43Sub; + ILRuntimeTest.TestBase.TestSession.LastSession.Appdomain.AllowUnboundCLRMethod = true; + if (!ILRuntimeTest.TestFramework.DelegateTest.TestEvent4()) + throw new Exception(); + } } }