il2cpp-class-internals.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. #pragma once
  2. #include "il2cpp-config.h"
  3. #include <stdint.h>
  4. #include "il2cpp-runtime-metadata.h"
  5. #include "il2cpp-metadata.h"
  6. #include "il2cpp-pinvoke-support.h"
  7. #define THREAD_LOCAL_STATIC_MASK (int32_t)0x80000000
  8. #define IL2CPP_CLASS_IS_ARRAY(c) ((c)->rank)
  9. struct Il2CppCodeGenModule;
  10. struct Il2CppMetadataRegistration;
  11. struct Il2CppCodeRegistration;
  12. typedef struct Il2CppClass Il2CppClass;
  13. typedef struct Il2CppGuid Il2CppGuid;
  14. typedef struct Il2CppImage Il2CppImage;
  15. typedef struct Il2CppAppDomain Il2CppAppDomain;
  16. typedef struct Il2CppAppDomainSetup Il2CppAppDomainSetup;
  17. typedef struct Il2CppDelegate Il2CppDelegate;
  18. typedef struct Il2CppAppContext Il2CppAppContext;
  19. typedef struct Il2CppNameToTypeHandleHashTable Il2CppNameToTypeHandleHashTable;
  20. typedef struct Il2CppCodeGenModule Il2CppCodeGenModule;
  21. typedef struct Il2CppMetadataRegistration Il2CppMetadataRegistration;
  22. typedef struct Il2CppCodeRegistration Il2CppCodeRegistration;
  23. #if RUNTIME_TINY
  24. typedef Il2CppMethodPointer VirtualInvokeData;
  25. #else
  26. typedef struct VirtualInvokeData
  27. {
  28. Il2CppMethodPointer methodPtr;
  29. const MethodInfo* method;
  30. } VirtualInvokeData;
  31. #endif
  32. typedef enum Il2CppTypeNameFormat
  33. {
  34. IL2CPP_TYPE_NAME_FORMAT_IL,
  35. IL2CPP_TYPE_NAME_FORMAT_REFLECTION,
  36. IL2CPP_TYPE_NAME_FORMAT_FULL_NAME,
  37. IL2CPP_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
  38. } Il2CppTypeNameFormat;
  39. typedef struct Il2CppDefaults
  40. {
  41. Il2CppImage *corlib;
  42. Il2CppImage *corlib_gen;
  43. Il2CppClass *object_class;
  44. Il2CppClass *byte_class;
  45. Il2CppClass *void_class;
  46. Il2CppClass *boolean_class;
  47. Il2CppClass *sbyte_class;
  48. Il2CppClass *int16_class;
  49. Il2CppClass *uint16_class;
  50. Il2CppClass *int32_class;
  51. Il2CppClass *uint32_class;
  52. Il2CppClass *int_class;
  53. Il2CppClass *uint_class;
  54. Il2CppClass *int64_class;
  55. Il2CppClass *uint64_class;
  56. Il2CppClass *single_class;
  57. Il2CppClass *double_class;
  58. Il2CppClass *char_class;
  59. Il2CppClass *string_class;
  60. Il2CppClass *enum_class;
  61. Il2CppClass *array_class;
  62. Il2CppClass *delegate_class;
  63. Il2CppClass *multicastdelegate_class;
  64. Il2CppClass *asyncresult_class;
  65. Il2CppClass *manualresetevent_class;
  66. Il2CppClass *typehandle_class;
  67. Il2CppClass *fieldhandle_class;
  68. Il2CppClass *methodhandle_class;
  69. Il2CppClass *systemtype_class;
  70. Il2CppClass *monotype_class;
  71. Il2CppClass *exception_class;
  72. Il2CppClass *threadabortexception_class;
  73. Il2CppClass *thread_class;
  74. Il2CppClass *internal_thread_class;
  75. /*Il2CppClass *transparent_proxy_class;
  76. Il2CppClass *real_proxy_class;
  77. Il2CppClass *mono_method_message_class;*/
  78. Il2CppClass *appdomain_class;
  79. Il2CppClass *appdomain_setup_class;
  80. Il2CppClass *member_info_class;
  81. Il2CppClass *field_info_class;
  82. Il2CppClass *method_info_class;
  83. Il2CppClass *property_info_class;
  84. Il2CppClass *event_info_class;
  85. Il2CppClass *stringbuilder_class;
  86. /*Il2CppClass *math_class;*/
  87. Il2CppClass *stack_frame_class;
  88. Il2CppClass *stack_trace_class;
  89. Il2CppClass *marshal_class;
  90. /*Il2CppClass *iserializeable_class;
  91. Il2CppClass *serializationinfo_class;
  92. Il2CppClass *streamingcontext_class;*/
  93. Il2CppClass *typed_reference_class;
  94. /*Il2CppClass *argumenthandle_class;*/
  95. Il2CppClass *marshalbyrefobject_class;
  96. /*Il2CppClass *monitor_class;
  97. Il2CppClass *iremotingtypeinfo_class;
  98. Il2CppClass *runtimesecurityframe_class;
  99. Il2CppClass *executioncontext_class;
  100. Il2CppClass *internals_visible_class;*/
  101. Il2CppClass *generic_ilist_class;
  102. Il2CppClass *generic_icollection_class;
  103. Il2CppClass *generic_ienumerable_class;
  104. Il2CppClass *generic_ireadonlylist_class;
  105. Il2CppClass *generic_ireadonlycollection_class;
  106. Il2CppClass *runtimetype_class;
  107. Il2CppClass *generic_nullable_class;
  108. /*Il2CppClass *variant_class;
  109. Il2CppClass *com_object_class;*/
  110. Il2CppClass *il2cpp_com_object_class;
  111. /*Il2CppClass *com_interop_proxy_class;
  112. Il2CppClass *iunknown_class;
  113. Il2CppClass *idispatch_class;
  114. Il2CppClass *safehandle_class;
  115. Il2CppClass *handleref_class;*/
  116. Il2CppClass *attribute_class;
  117. Il2CppClass *customattribute_data_class;
  118. Il2CppClass *customattribute_typed_argument_class;
  119. Il2CppClass *customattribute_named_argument_class;
  120. //Il2CppClass *critical_finalizer_object;
  121. Il2CppClass *version;
  122. Il2CppClass *culture_info;
  123. Il2CppClass *async_call_class;
  124. Il2CppClass *assembly_class;
  125. Il2CppClass *assembly_name_class;
  126. Il2CppClass *parameter_info_class;
  127. Il2CppClass *module_class;
  128. Il2CppClass *system_exception_class;
  129. Il2CppClass *argument_exception_class;
  130. Il2CppClass *wait_handle_class;
  131. Il2CppClass *safe_handle_class;
  132. Il2CppClass *sort_key_class;
  133. Il2CppClass *dbnull_class;
  134. Il2CppClass *error_wrapper_class;
  135. Il2CppClass *missing_class;
  136. Il2CppClass *value_type_class;
  137. // Stuff used by the mono code
  138. Il2CppClass *threadpool_wait_callback_class;
  139. MethodInfo *threadpool_perform_wait_callback_method;
  140. Il2CppClass *mono_method_message_class;
  141. #if !IL2CPP_TRIM_COM
  142. // Windows.Foundation.IReference`1<T>
  143. Il2CppClass* ireference_class;
  144. // Windows.Foundation.IReferenceArray`1<T>
  145. Il2CppClass* ireferencearray_class;
  146. // Windows.Foundation.Collections.IKeyValuePair`2<K, V>
  147. Il2CppClass* ikey_value_pair_class;
  148. // Windows.Foundation.Uri
  149. Il2CppClass* windows_foundation_uri_class;
  150. // Windows.Foundation.IUriRuntimeClass
  151. Il2CppClass* windows_foundation_iuri_runtime_class_class;
  152. #endif
  153. // System.Collections.Generic.KeyValuePair`2<K, V>
  154. Il2CppClass* key_value_pair_class;
  155. // System.Uri
  156. Il2CppClass* system_uri_class;
  157. // System.Guid
  158. Il2CppClass* system_guid_class;
  159. Il2CppClass* sbyte_shared_enum;
  160. Il2CppClass* int16_shared_enum;
  161. Il2CppClass* int32_shared_enum;
  162. Il2CppClass* int64_shared_enum;
  163. Il2CppClass* byte_shared_enum;
  164. Il2CppClass* uint16_shared_enum;
  165. Il2CppClass* uint32_shared_enum;
  166. Il2CppClass* uint64_shared_enum;
  167. Il2CppClass* il2cpp_fully_shared_type;
  168. Il2CppClass* il2cpp_fully_shared_struct_type;
  169. } Il2CppDefaults;
  170. extern LIBIL2CPP_CODEGEN_API Il2CppDefaults il2cpp_defaults;
  171. struct Il2CppClass;
  172. struct MethodInfo;
  173. struct FieldInfo;
  174. struct Il2CppObject;
  175. struct MemberInfo;
  176. #ifndef THREAD_STATIC_FIELD_OFFSET
  177. #define THREAD_STATIC_FIELD_OFFSET -1
  178. #endif
  179. typedef struct FieldInfo
  180. {
  181. const char* name;
  182. const Il2CppType* type;
  183. Il2CppClass *parent;
  184. int32_t offset; // If offset is -1, then it's thread static
  185. uint32_t token;
  186. } FieldInfo;
  187. typedef struct PropertyInfo
  188. {
  189. Il2CppClass *parent;
  190. const char *name;
  191. const MethodInfo *get;
  192. const MethodInfo *set;
  193. uint32_t attrs;
  194. uint32_t token;
  195. } PropertyInfo;
  196. typedef struct EventInfo
  197. {
  198. const char* name;
  199. const Il2CppType* eventType;
  200. Il2CppClass* parent;
  201. const MethodInfo* add;
  202. const MethodInfo* remove;
  203. const MethodInfo* raise;
  204. uint32_t token;
  205. } EventInfo;
  206. typedef void (*InvokerMethod)(Il2CppMethodPointer, const MethodInfo*, void*, void**, void*);
  207. typedef enum MethodVariableKind
  208. {
  209. kMethodVariableKind_This,
  210. kMethodVariableKind_Parameter,
  211. kMethodVariableKind_LocalVariable
  212. } MethodVariableKind;
  213. typedef enum SequencePointKind
  214. {
  215. kSequencePointKind_Normal,
  216. kSequencePointKind_StepOut
  217. } SequencePointKind;
  218. typedef struct Il2CppMethodExecutionContextInfo
  219. {
  220. TypeIndex typeIndex;
  221. int32_t nameIndex;
  222. int32_t scopeIndex;
  223. } Il2CppMethodExecutionContextInfo;
  224. typedef struct Il2CppMethodExecutionContextInfoIndex
  225. {
  226. int32_t startIndex;
  227. int32_t count;
  228. } Il2CppMethodExecutionContextInfoIndex;
  229. typedef struct Il2CppMethodScope
  230. {
  231. int32_t startOffset;
  232. int32_t endOffset;
  233. } Il2CppMethodScope;
  234. typedef struct Il2CppMethodHeaderInfo
  235. {
  236. int32_t code_size;
  237. int32_t startScope;
  238. int32_t numScopes;
  239. } Il2CppMethodHeaderInfo;
  240. typedef struct Il2CppSequencePointSourceFile
  241. {
  242. const char *file;
  243. uint8_t hash[16];
  244. } Il2CppSequencePointSourceFile;
  245. typedef struct Il2CppTypeSourceFilePair
  246. {
  247. TypeDefinitionIndex __klassIndex;
  248. int32_t sourceFileIndex;
  249. } Il2CppTypeSourceFilePair;
  250. typedef struct Il2CppSequencePoint
  251. {
  252. MethodIndex __methodDefinitionIndex;
  253. int32_t sourceFileIndex;
  254. int32_t lineStart, lineEnd;
  255. int32_t columnStart, columnEnd;
  256. int32_t ilOffset;
  257. SequencePointKind kind;
  258. int32_t isActive;
  259. int32_t id;
  260. } Il2CppSequencePoint;
  261. typedef struct Il2CppCatchPoint
  262. {
  263. MethodIndex __methodDefinitionIndex;
  264. TypeIndex catchTypeIndex;
  265. int32_t ilOffset;
  266. int32_t tryId;
  267. int32_t parentTryId;
  268. } Il2CppCatchPoint;
  269. typedef struct Il2CppDebuggerMetadataRegistration
  270. {
  271. Il2CppMethodExecutionContextInfo* methodExecutionContextInfos;
  272. Il2CppMethodExecutionContextInfoIndex* methodExecutionContextInfoIndexes;
  273. Il2CppMethodScope* methodScopes;
  274. Il2CppMethodHeaderInfo* methodHeaderInfos;
  275. Il2CppSequencePointSourceFile* sequencePointSourceFiles;
  276. int32_t numSequencePoints;
  277. Il2CppSequencePoint* sequencePoints;
  278. int32_t numCatchPoints;
  279. Il2CppCatchPoint* catchPoints;
  280. int32_t numTypeSourceFileEntries;
  281. Il2CppTypeSourceFilePair* typeSourceFiles;
  282. const char** methodExecutionContextInfoStrings;
  283. } Il2CppDebuggerMetadataRegistration;
  284. typedef union Il2CppRGCTXData
  285. {
  286. void* rgctxDataDummy;
  287. const MethodInfo* method;
  288. const Il2CppType* type;
  289. Il2CppClass* klass;
  290. } Il2CppRGCTXData;
  291. typedef struct MethodInfo
  292. {
  293. Il2CppMethodPointer methodPointer;
  294. Il2CppMethodPointer virtualMethodPointer;
  295. InvokerMethod invoker_method;
  296. const char* name;
  297. Il2CppClass *klass;
  298. const Il2CppType *return_type;
  299. const Il2CppType** parameters;
  300. union
  301. {
  302. const Il2CppRGCTXData* rgctx_data; /* is_inflated is true and is_generic is false, i.e. a generic instance method */
  303. Il2CppMetadataMethodDefinitionHandle methodMetadataHandle;
  304. };
  305. /* note, when is_generic == true and is_inflated == true the method represents an uninflated generic method on an inflated type. */
  306. union
  307. {
  308. const Il2CppGenericMethod* genericMethod; /* is_inflated is true */
  309. Il2CppMetadataGenericContainerHandle genericContainerHandle; /* is_inflated is false and is_generic is true */
  310. };
  311. uint32_t token;
  312. uint16_t flags;
  313. uint16_t iflags;
  314. uint16_t slot;
  315. uint8_t parameters_count;
  316. uint8_t is_generic : 1; /* true if method is a generic method definition */
  317. uint8_t is_inflated : 1; /* true if declaring_type is a generic instance or if method is a generic instance*/
  318. uint8_t wrapper_type : 1; /* always zero (MONO_WRAPPER_NONE) needed for the debugger */
  319. uint8_t has_full_generic_sharing_signature : 1;
  320. // ==={{ hybridclr
  321. void* interpData;
  322. Il2CppMethodPointer methodPointerCallByInterp;
  323. Il2CppMethodPointer virtualMethodPointerCallByInterp;
  324. bool initInterpCallMethodPointer;
  325. bool isInterpterImpl;
  326. // ===}} hybridclr
  327. } MethodInfo;
  328. typedef struct Il2CppRuntimeInterfaceOffsetPair
  329. {
  330. Il2CppClass* interfaceType;
  331. int32_t offset;
  332. } Il2CppRuntimeInterfaceOffsetPair;
  333. #if IL2CPP_COMPILER_MSVC
  334. #pragma warning( push )
  335. #pragma warning( disable : 4200 )
  336. #elif defined(__clang__)
  337. #pragma clang diagnostic push
  338. #pragma clang diagnostic ignored "-Winvalid-offsetof"
  339. #endif
  340. typedef struct Il2CppClass
  341. {
  342. // The following fields are always valid for a Il2CppClass structure
  343. const Il2CppImage* image;
  344. void* gc_desc;
  345. const char* name;
  346. const char* namespaze;
  347. Il2CppType byval_arg;
  348. Il2CppType this_arg;
  349. Il2CppClass* element_class;
  350. Il2CppClass* castClass;
  351. Il2CppClass* declaringType;
  352. Il2CppClass* parent;
  353. Il2CppGenericClass *generic_class;
  354. Il2CppMetadataTypeHandle typeMetadataHandle; // non-NULL for Il2CppClass's constructed from type defintions
  355. const Il2CppInteropData* interopData;
  356. #if !IL2CPP_SLIM_CLASS
  357. Il2CppClass* klass; // hack to pretend we are a MonoVTable. Points to ourself
  358. #endif
  359. // End always valid fields
  360. // The following fields need initialized before access. This can be done per field or as an aggregate via a call to Class::Init
  361. FieldInfo* fields; // Initialized in SetupFields
  362. const EventInfo* events; // Initialized in SetupEvents
  363. const PropertyInfo** properties; // Initialized in SetupProperties
  364. const MethodInfo** methods; // Initialized in SetupMethods
  365. Il2CppClass** nestedTypes; // Initialized in SetupNestedTypes
  366. Il2CppClass** implementedInterfaces; // Initialized in SetupInterfaces
  367. Il2CppRuntimeInterfaceOffsetPair* interfaceOffsets; // Initialized in Init
  368. void* static_fields; // Initialized in Init
  369. const Il2CppRGCTXData* rgctx_data; // Initialized in Init
  370. // used for fast parent checks
  371. Il2CppClass** typeHierarchy; // Initialized in SetupTypeHierachy
  372. // End initialization required fields
  373. void *unity_user_data;
  374. uint32_t initializationExceptionGCHandle;
  375. #if !IL2CPP_SLIM_CLASS
  376. uint32_t cctor_started;
  377. uint32_t cctor_finished_or_no_cctor;
  378. ALIGN_TYPE(8) size_t cctor_thread;
  379. #endif //IL2CPP_SLIM_CLASS
  380. // Remaining fields are always valid except where noted
  381. Il2CppMetadataGenericContainerHandle genericContainerHandle;
  382. uint32_t instance_size; // valid when size_inited is true
  383. uint32_t stack_slot_size; // valid when size_inited is true
  384. uint32_t actualSize;
  385. uint32_t element_size;
  386. int32_t native_size;
  387. uint32_t static_fields_size;
  388. uint32_t thread_static_fields_size;
  389. int32_t thread_static_fields_offset;
  390. uint32_t flags;
  391. uint32_t token;
  392. uint16_t method_count; // lazily calculated for arrays, i.e. when rank > 0
  393. uint16_t property_count;
  394. uint16_t field_count;
  395. uint16_t event_count;
  396. uint16_t nested_type_count;
  397. uint16_t vtable_count; // lazily calculated for arrays, i.e. when rank > 0
  398. uint16_t interfaces_count;
  399. uint16_t interface_offsets_count; // lazily calculated for arrays, i.e. when rank > 0
  400. uint8_t typeHierarchyDepth; // Initialized in SetupTypeHierachy
  401. uint8_t genericRecursionDepth;
  402. uint8_t rank;
  403. uint8_t minimumAlignment; // Alignment of this type
  404. uint8_t packingSize;
  405. // this is critical for performance of Class::InitFromCodegen. Equals to initialized && !initializationExceptionGCHandle at all times.
  406. // Use Class::PublishInitialized to update
  407. uint8_t initialized_and_no_error : 1;
  408. uint8_t initialized : 1;
  409. uint8_t enumtype : 1;
  410. uint8_t nullabletype : 1;
  411. uint8_t is_generic : 1;
  412. uint8_t has_references : 1; // valid when size_inited is true
  413. uint8_t init_pending : 1;
  414. uint8_t size_init_pending : 1;
  415. uint8_t size_inited : 1;
  416. uint8_t has_finalize : 1;
  417. uint8_t has_cctor : 1;
  418. uint8_t is_blittable : 1;
  419. uint8_t is_import_or_windows_runtime : 1;
  420. uint8_t is_vtable_initialized : 1;
  421. uint8_t is_byref_like : 1;
  422. #if IL2CPP_SLIM_CLASS
  423. uint8_t cctor_finished_or_no_cctor : 1;
  424. #endif
  425. VirtualInvokeData vtable[IL2CPP_ZERO_LEN_ARRAY];
  426. } Il2CppClass;
  427. #if IL2CPP_COMPILER_MSVC
  428. #pragma warning( pop )
  429. #elif defined(__clang__)
  430. #pragma clang diagnostic pop
  431. #endif
  432. // compiler calcualted values
  433. typedef struct Il2CppTypeDefinitionSizes
  434. {
  435. uint32_t instance_size;
  436. int32_t native_size;
  437. uint32_t static_fields_size;
  438. uint32_t thread_static_fields_size;
  439. } Il2CppTypeDefinitionSizes;
  440. typedef struct Il2CppDomain
  441. {
  442. Il2CppAppDomain* domain;
  443. Il2CppAppDomainSetup* setup;
  444. Il2CppAppContext* default_context;
  445. Il2CppObject* ephemeron_tombstone;
  446. const char* friendly_name;
  447. uint32_t domain_id;
  448. volatile int threadpool_jobs;
  449. void* agent_info;
  450. } Il2CppDomain;
  451. typedef struct Il2CppAssemblyName
  452. {
  453. const char* name;
  454. const char* culture;
  455. const uint8_t* public_key;
  456. uint32_t hash_alg;
  457. int32_t hash_len;
  458. uint32_t flags;
  459. int32_t major;
  460. int32_t minor;
  461. int32_t build;
  462. int32_t revision;
  463. uint8_t public_key_token[PUBLIC_KEY_BYTE_LENGTH];
  464. } Il2CppAssemblyName;
  465. typedef struct Il2CppImage
  466. {
  467. const char* name;
  468. const char *nameNoExt;
  469. Il2CppAssembly* assembly;
  470. uint32_t typeCount;
  471. uint32_t exportedTypeCount;
  472. uint32_t customAttributeCount;
  473. Il2CppMetadataImageHandle metadataHandle;
  474. #ifdef __cplusplus
  475. mutable
  476. #endif
  477. Il2CppNameToTypeHandleHashTable * nameToClassHashTable;
  478. const Il2CppCodeGenModule* codeGenModule;
  479. uint32_t token;
  480. uint8_t dynamic;
  481. } Il2CppImage;
  482. typedef struct Il2CppAssembly
  483. {
  484. Il2CppImage* image;
  485. uint32_t token;
  486. int32_t referencedAssemblyStart;
  487. int32_t referencedAssemblyCount;
  488. Il2CppAssemblyName aname;
  489. } Il2CppAssembly;
  490. typedef struct Il2CppCodeGenOptions
  491. {
  492. bool enablePrimitiveValueTypeGenericSharing;
  493. int maximumRuntimeGenericDepth;
  494. int recursiveGenericIterations;
  495. } Il2CppCodeGenOptions;
  496. typedef struct Il2CppRange
  497. {
  498. int32_t start;
  499. int32_t length;
  500. } Il2CppRange;
  501. typedef struct Il2CppTokenRangePair
  502. {
  503. uint32_t token;
  504. Il2CppRange range;
  505. } Il2CppTokenRangePair;
  506. typedef struct Il2CppTokenIndexMethodTuple
  507. {
  508. uint32_t token;
  509. int32_t index;
  510. void** method;
  511. uint32_t __genericMethodIndex;
  512. } Il2CppTokenIndexMethodTuple;
  513. typedef struct Il2CppTokenAdjustorThunkPair
  514. {
  515. uint32_t token;
  516. Il2CppMethodPointer adjustorThunk;
  517. } Il2CppTokenAdjustorThunkPair;
  518. typedef struct Il2CppWindowsRuntimeFactoryTableEntry
  519. {
  520. const Il2CppType* type;
  521. Il2CppMethodPointer createFactoryFunction;
  522. } Il2CppWindowsRuntimeFactoryTableEntry;
  523. typedef struct Il2CppCodeGenModule
  524. {
  525. const char* moduleName;
  526. const uint32_t methodPointerCount;
  527. const Il2CppMethodPointer* methodPointers;
  528. const uint32_t adjustorThunkCount;
  529. const Il2CppTokenAdjustorThunkPair* adjustorThunks;
  530. const int32_t* invokerIndices;
  531. const uint32_t reversePInvokeWrapperCount;
  532. const Il2CppTokenIndexMethodTuple* reversePInvokeWrapperIndices;
  533. const uint32_t rgctxRangesCount;
  534. const Il2CppTokenRangePair* rgctxRanges;
  535. const uint32_t rgctxsCount;
  536. const Il2CppRGCTXDefinition* rgctxs;
  537. const Il2CppDebuggerMetadataRegistration *debuggerMetadata;
  538. const Il2CppMethodPointer moduleInitializer;
  539. TypeDefinitionIndex* staticConstructorTypeIndices;
  540. const Il2CppMetadataRegistration* metadataRegistration; // Per-assembly mode only
  541. const Il2CppCodeRegistration* codeRegistaration; // Per-assembly mode only
  542. } Il2CppCodeGenModule;
  543. typedef struct Il2CppCodeRegistration
  544. {
  545. uint32_t reversePInvokeWrapperCount;
  546. const Il2CppMethodPointer* reversePInvokeWrappers;
  547. uint32_t genericMethodPointersCount;
  548. const Il2CppMethodPointer* genericMethodPointers;
  549. const Il2CppMethodPointer* genericAdjustorThunks;
  550. uint32_t invokerPointersCount;
  551. const InvokerMethod* invokerPointers;
  552. uint32_t unresolvedIndirectCallCount;
  553. const Il2CppMethodPointer* unresolvedVirtualCallPointers;
  554. const Il2CppMethodPointer* unresolvedInstanceCallPointers;
  555. const Il2CppMethodPointer* unresolvedStaticCallPointers;
  556. uint32_t interopDataCount;
  557. Il2CppInteropData* interopData;
  558. uint32_t windowsRuntimeFactoryCount;
  559. Il2CppWindowsRuntimeFactoryTableEntry* windowsRuntimeFactoryTable;
  560. uint32_t codeGenModulesCount;
  561. const Il2CppCodeGenModule** codeGenModules;
  562. } Il2CppCodeRegistration;
  563. typedef struct Il2CppMetadataRegistration
  564. {
  565. int32_t genericClassesCount;
  566. Il2CppGenericClass* const * genericClasses;
  567. int32_t genericInstsCount;
  568. const Il2CppGenericInst* const * genericInsts;
  569. int32_t genericMethodTableCount;
  570. const Il2CppGenericMethodFunctionsDefinitions* genericMethodTable;
  571. int32_t typesCount;
  572. const Il2CppType* const * types;
  573. int32_t methodSpecsCount;
  574. const Il2CppMethodSpec* methodSpecs;
  575. FieldIndex fieldOffsetsCount;
  576. const int32_t** fieldOffsets;
  577. TypeDefinitionIndex typeDefinitionsSizesCount;
  578. const Il2CppTypeDefinitionSizes** typeDefinitionsSizes;
  579. const size_t metadataUsagesCount;
  580. void** const* metadataUsages;
  581. } Il2CppMetadataRegistration;
  582. /*
  583. * new structure to hold performance counters values that are exported
  584. * to managed code.
  585. * Note: never remove fields from this structure and only add them to the end.
  586. * Size of fields and type should not be changed as well.
  587. */
  588. typedef struct Il2CppPerfCounters
  589. {
  590. /* JIT category */
  591. uint32_t jit_methods;
  592. uint32_t jit_bytes;
  593. uint32_t jit_time;
  594. uint32_t jit_failures;
  595. /* Exceptions category */
  596. uint32_t exceptions_thrown;
  597. uint32_t exceptions_filters;
  598. uint32_t exceptions_finallys;
  599. uint32_t exceptions_depth;
  600. uint32_t aspnet_requests_queued;
  601. uint32_t aspnet_requests;
  602. /* Memory category */
  603. uint32_t gc_collections0;
  604. uint32_t gc_collections1;
  605. uint32_t gc_collections2;
  606. uint32_t gc_promotions0;
  607. uint32_t gc_promotions1;
  608. uint32_t gc_promotion_finalizers;
  609. uint32_t gc_gen0size;
  610. uint32_t gc_gen1size;
  611. uint32_t gc_gen2size;
  612. uint32_t gc_lossize;
  613. uint32_t gc_fin_survivors;
  614. uint32_t gc_num_handles;
  615. uint32_t gc_allocated;
  616. uint32_t gc_induced;
  617. uint32_t gc_time;
  618. uint32_t gc_total_bytes;
  619. uint32_t gc_committed_bytes;
  620. uint32_t gc_reserved_bytes;
  621. uint32_t gc_num_pinned;
  622. uint32_t gc_sync_blocks;
  623. /* Remoting category */
  624. uint32_t remoting_calls;
  625. uint32_t remoting_channels;
  626. uint32_t remoting_proxies;
  627. uint32_t remoting_classes;
  628. uint32_t remoting_objects;
  629. uint32_t remoting_contexts;
  630. /* Loader category */
  631. uint32_t loader_classes;
  632. uint32_t loader_total_classes;
  633. uint32_t loader_appdomains;
  634. uint32_t loader_total_appdomains;
  635. uint32_t loader_assemblies;
  636. uint32_t loader_total_assemblies;
  637. uint32_t loader_failures;
  638. uint32_t loader_bytes;
  639. uint32_t loader_appdomains_uloaded;
  640. /* Threads and Locks category */
  641. uint32_t thread_contentions;
  642. uint32_t thread_queue_len;
  643. uint32_t thread_queue_max;
  644. uint32_t thread_num_logical;
  645. uint32_t thread_num_physical;
  646. uint32_t thread_cur_recognized;
  647. uint32_t thread_num_recognized;
  648. /* Interop category */
  649. uint32_t interop_num_ccw;
  650. uint32_t interop_num_stubs;
  651. uint32_t interop_num_marshals;
  652. /* Security category */
  653. uint32_t security_num_checks;
  654. uint32_t security_num_link_checks;
  655. uint32_t security_time;
  656. uint32_t security_depth;
  657. uint32_t unused;
  658. /* Threadpool */
  659. uint64_t threadpool_workitems;
  660. uint64_t threadpool_ioworkitems;
  661. unsigned int threadpool_threads;
  662. unsigned int threadpool_iothreads;
  663. } Il2CppPerfCounters;