VInt3_Binding.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Reflection;
  4. using System.Runtime.InteropServices;
  5. using ILRuntime.CLR.TypeSystem;
  6. using ILRuntime.CLR.Method;
  7. using ILRuntime.Runtime.Enviorment;
  8. using ILRuntime.Runtime.Intepreter;
  9. using ILRuntime.Runtime.Stack;
  10. using ILRuntime.Reflection;
  11. using ILRuntime.CLR.Utils;
  12. namespace ILRuntime.Runtime.Generated
  13. {
  14. unsafe class VInt3_Binding
  15. {
  16. public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
  17. {
  18. BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
  19. MethodBase method;
  20. Type[] args;
  21. Type type = typeof(VInt3);
  22. app.RegisterCLRCreateDefaultInstance(type, () => new VInt3());
  23. args = new Type[]{typeof(System.Int32), typeof(System.Int32), typeof(System.Int32)};
  24. method = type.GetConstructor(flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, Ctor_0);
  26. }
  27. static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref VInt3 instance_of_this_method)
  28. {
  29. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  30. switch(ptr_of_this_method->ObjectType)
  31. {
  32. case ObjectTypes.Object:
  33. {
  34. __mStack[ptr_of_this_method->Value] = instance_of_this_method;
  35. }
  36. break;
  37. case ObjectTypes.FieldReference:
  38. {
  39. var ___obj = __mStack[ptr_of_this_method->Value];
  40. if(___obj is ILTypeInstance)
  41. {
  42. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
  43. }
  44. else
  45. {
  46. var t = __domain.GetType(___obj.GetType()) as CLRType;
  47. t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
  48. }
  49. }
  50. break;
  51. case ObjectTypes.StaticFieldReference:
  52. {
  53. var t = __domain.GetType(ptr_of_this_method->Value);
  54. if(t is ILType)
  55. {
  56. ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
  57. }
  58. else
  59. {
  60. ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
  61. }
  62. }
  63. break;
  64. case ObjectTypes.ArrayReference:
  65. {
  66. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as VInt3[];
  67. instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
  68. }
  69. break;
  70. }
  71. }
  72. static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  73. {
  74. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  75. StackObject* ptr_of_this_method;
  76. StackObject* __ret = ILIntepreter.Minus(__esp, 3);
  77. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  78. System.Int32 @_z = ptr_of_this_method->Value;
  79. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  80. System.Int32 @_y = ptr_of_this_method->Value;
  81. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  82. System.Int32 @_x = ptr_of_this_method->Value;
  83. var result_of_this_method = new VInt3(@_x, @_y, @_z);
  84. if(!isNewObj)
  85. {
  86. __ret--;
  87. WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method);
  88. return __ret;
  89. }
  90. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  91. }
  92. }
  93. }