Il2CppCompatibleDef.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "Il2CppCompatibleDef.h"
  2. #include "vm/Runtime.h"
  3. #include "metadata/MetadataModule.h"
  4. #include "interpreter/InterpreterModule.h"
  5. namespace hybridclr
  6. {
  7. Il2CppMethodPointer InitAndGetInterpreterDirectlyCallMethodPointerSlow(MethodInfo* method)
  8. {
  9. IL2CPP_ASSERT(!method->initInterpCallMethodPointer);
  10. method->initInterpCallMethodPointer = true;
  11. bool isAdjustorThunkMethod = IS_CLASS_VALUE_TYPE(method->klass) && hybridclr::metadata::IsInstanceMethod(method);
  12. if (hybridclr::metadata::MetadataModule::IsImplementedByInterpreter(method))
  13. {
  14. method->methodPointerCallByInterp = interpreter::InterpreterModule::GetMethodPointer(method);
  15. if (isAdjustorThunkMethod)
  16. {
  17. method->virtualMethodPointerCallByInterp = interpreter::InterpreterModule::GetAdjustThunkMethodPointer(method);
  18. }
  19. else
  20. {
  21. method->virtualMethodPointerCallByInterp = method->methodPointerCallByInterp;
  22. }
  23. if (method->invoker_method == nullptr
  24. #if HYBRIDCLR_UNITY_2021_OR_NEW
  25. || method->invoker_method == il2cpp::vm::Runtime::GetMissingMethodInvoker()
  26. || method->has_full_generic_sharing_signature
  27. #endif
  28. )
  29. {
  30. method->invoker_method = hybridclr::interpreter::InterpreterModule::GetMethodInvoker(method);
  31. }
  32. #if HYBRIDCLR_UNITY_2021_OR_NEW
  33. if (method->methodPointer == nullptr || method->has_full_generic_sharing_signature)
  34. {
  35. method->methodPointer = method->methodPointerCallByInterp;
  36. }
  37. if (method->virtualMethodPointer == nullptr || method->has_full_generic_sharing_signature)
  38. {
  39. method->virtualMethodPointer = method->virtualMethodPointerCallByInterp;
  40. }
  41. #else
  42. if (method->methodPointer == nullptr)
  43. {
  44. method->methodPointer = method->virtualMethodPointerCallByInterp;
  45. }
  46. #endif
  47. method->isInterpterImpl = true;
  48. }
  49. return method->methodPointerCallByInterp;
  50. }
  51. }