Object.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include <stdint.h>
  3. #include "il2cpp-config.h"
  4. struct Il2CppString;
  5. struct Il2CppObject;
  6. struct Il2CppClass;
  7. struct MethodInfo;
  8. namespace il2cpp
  9. {
  10. namespace vm
  11. {
  12. class LIBIL2CPP_CODEGEN_API Object
  13. {
  14. public:
  15. static Il2CppObject* Box(Il2CppClass *klass, void* data);
  16. static Il2CppClass* GetClass(Il2CppObject* obj);
  17. static int32_t GetHash(Il2CppObject* obj);
  18. static uint32_t GetSize(Il2CppObject* obj);
  19. static const MethodInfo* GetVirtualMethod(Il2CppObject *obj, const MethodInfo *method);
  20. static Il2CppObject * IsInst(Il2CppObject *obj, Il2CppClass *klass);
  21. static Il2CppObject* New(Il2CppClass *klass);
  22. static void* Unbox(Il2CppObject* obj);
  23. static void UnboxNullable(Il2CppObject* obj, Il2CppClass* nullableArgumentClass, void* storage);
  24. static Il2CppObject * Clone(Il2CppObject *obj);
  25. static Il2CppObject* NewPinned(Il2CppClass *klass);
  26. private:
  27. static Il2CppObject * NewAllocSpecific(Il2CppClass *klass);
  28. static Il2CppObject* NewPtrFree(Il2CppClass *klass);
  29. static Il2CppObject* Allocate(size_t size, Il2CppClass *typeInfo);
  30. static Il2CppObject* AllocatePtrFree(size_t size, Il2CppClass *typeInfo);
  31. static Il2CppObject* AllocateSpec(size_t size, Il2CppClass *typeInfo);
  32. friend class Array;
  33. friend class RCW;
  34. friend class String;
  35. };
  36. } /* namespace vm */
  37. } /* namespace il2cpp */
  38. #define IL2CPP_OBJECT_SETREF(obj, fieldname, value) do {\
  39. /*mono_gc_wbarrier_set_field ((Il2CppObject*)(obj), &((obj)->fieldname), (Il2CppObject*)value); */\
  40. (obj)->fieldname = (value); \
  41. } while (0)