MetadataPool.h 689 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include "../CommonDef.h"
  3. #include "metadata/GenericMetadata.h"
  4. #include "vm/MetadataAlloc.h"
  5. namespace hybridclr
  6. {
  7. namespace metadata
  8. {
  9. template<typename T>
  10. T* MetadataMallocT()
  11. {
  12. return (T*)HYBRIDCLR_METADATA_MALLOC(sizeof(T));
  13. }
  14. template<typename T>
  15. T* MetadataCallocT(size_t count)
  16. {
  17. return (T*)HYBRIDCLR_METADATA_CALLOC(count, sizeof(T));
  18. }
  19. class MetadataPool
  20. {
  21. public:
  22. static void Initialize();
  23. static const Il2CppType* GetPooledIl2CppType(const Il2CppType& type);
  24. static Il2CppType* ShallowCloneIl2CppType(const Il2CppType* type);
  25. static const Il2CppArrayType* GetPooledIl2CppArrayType(const Il2CppType* elementType, uint32_t rank);
  26. };
  27. }
  28. }