GenericSharing.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "il2cpp-config.h"
  2. #include "metadata/GenericSharing.h"
  3. #include "vm/Type.h"
  4. #include "il2cpp-runtime-metadata.h"
  5. using il2cpp::vm::Type;
  6. namespace il2cpp
  7. {
  8. namespace metadata
  9. {
  10. bool GenericSharing::IsShareable(Il2CppGenericClass* gclass)
  11. {
  12. const Il2CppGenericInst* classInst = gclass->context.class_inst;
  13. if (classInst)
  14. {
  15. for (uint32_t i = 0; i < classInst->type_argc; ++i)
  16. {
  17. if (!Type::IsReference(classInst->type_argv[i]))
  18. return false;
  19. }
  20. }
  21. return true;
  22. }
  23. bool GenericSharing::IsShareable(Il2CppGenericMethod* gmethod)
  24. {
  25. const Il2CppGenericInst* methodInst = gmethod->context.method_inst;
  26. if (methodInst)
  27. {
  28. for (uint32_t i = 0; i < methodInst->type_argc; ++i)
  29. {
  30. if (!Type::IsReference(methodInst->type_argv[i]))
  31. return false;
  32. }
  33. }
  34. return true;
  35. }
  36. } /* namespace vm */
  37. } /* namespace il2cpp */