il2cpp-class-internals.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  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. // Windows.Foundation.IReference`1<T>
  142. Il2CppClass* ireference_class;
  143. // Windows.Foundation.IReferenceArray`1<T>
  144. Il2CppClass* ireferencearray_class;
  145. // Windows.Foundation.Collections.IKeyValuePair`2<K, V>
  146. Il2CppClass* ikey_value_pair_class;
  147. // System.Collections.Generic.KeyValuePair`2<K, V>
  148. Il2CppClass* key_value_pair_class;
  149. // Windows.Foundation.Uri
  150. Il2CppClass* windows_foundation_uri_class;
  151. // Windows.Foundation.IUriRuntimeClass
  152. Il2CppClass* windows_foundation_iuri_runtime_class_class;
  153. // System.Uri
  154. Il2CppClass* system_uri_class;
  155. // System.Guid
  156. Il2CppClass* system_guid_class;
  157. Il2CppClass* sbyte_shared_enum;
  158. Il2CppClass* int16_shared_enum;
  159. Il2CppClass* int32_shared_enum;
  160. Il2CppClass* int64_shared_enum;
  161. Il2CppClass* byte_shared_enum;
  162. Il2CppClass* uint16_shared_enum;
  163. Il2CppClass* uint32_shared_enum;
  164. Il2CppClass* uint64_shared_enum;
  165. Il2CppClass* il2cpp_fully_shared_type;
  166. Il2CppClass* il2cpp_fully_shared_struct_type;
  167. } Il2CppDefaults;
  168. extern LIBIL2CPP_CODEGEN_API Il2CppDefaults il2cpp_defaults;
  169. struct Il2CppClass;
  170. struct MethodInfo;
  171. struct FieldInfo;
  172. struct Il2CppObject;
  173. struct MemberInfo;
  174. #ifndef THREAD_STATIC_FIELD_OFFSET
  175. #define THREAD_STATIC_FIELD_OFFSET -1
  176. #endif
  177. typedef struct FieldInfo
  178. {
  179. const char* name;
  180. const Il2CppType* type;
  181. Il2CppClass *parent;
  182. int32_t offset; // If offset is -1, then it's thread static
  183. uint32_t token;
  184. } FieldInfo;
  185. typedef struct PropertyInfo
  186. {
  187. Il2CppClass *parent;
  188. const char *name;
  189. const MethodInfo *get;
  190. const MethodInfo *set;
  191. uint32_t attrs;
  192. uint32_t token;
  193. } PropertyInfo;
  194. typedef struct EventInfo
  195. {
  196. const char* name;
  197. const Il2CppType* eventType;
  198. Il2CppClass* parent;
  199. const MethodInfo* add;
  200. const MethodInfo* remove;
  201. const MethodInfo* raise;
  202. uint32_t token;
  203. } EventInfo;
  204. typedef void (*InvokerMethod)(Il2CppMethodPointer, const MethodInfo*, void*, void**, void*);
  205. typedef enum MethodVariableKind
  206. {
  207. kMethodVariableKind_This,
  208. kMethodVariableKind_Parameter,
  209. kMethodVariableKind_LocalVariable
  210. } MethodVariableKind;
  211. typedef enum SequencePointKind
  212. {
  213. kSequencePointKind_Normal,
  214. kSequencePointKind_StepOut
  215. } SequencePointKind;
  216. typedef struct Il2CppMethodExecutionContextInfo
  217. {
  218. TypeIndex typeIndex;
  219. int32_t nameIndex;
  220. int32_t scopeIndex;
  221. } Il2CppMethodExecutionContextInfo;
  222. typedef struct Il2CppMethodExecutionContextInfoIndex
  223. {
  224. int32_t startIndex;
  225. int32_t count;
  226. } Il2CppMethodExecutionContextInfoIndex;
  227. typedef struct Il2CppMethodScope
  228. {
  229. int32_t startOffset;
  230. int32_t endOffset;
  231. } Il2CppMethodScope;
  232. typedef struct Il2CppMethodHeaderInfo
  233. {
  234. int32_t code_size;
  235. int32_t startScope;
  236. int32_t numScopes;
  237. } Il2CppMethodHeaderInfo;
  238. typedef struct Il2CppSequencePointSourceFile
  239. {
  240. const char *file;
  241. uint8_t hash[16];
  242. } Il2CppSequencePointSourceFile;
  243. typedef struct Il2CppTypeSourceFilePair
  244. {
  245. TypeDefinitionIndex __klassIndex;
  246. int32_t sourceFileIndex;
  247. } Il2CppTypeSourceFilePair;
  248. typedef struct Il2CppSequencePoint
  249. {
  250. MethodIndex __methodDefinitionIndex;
  251. int32_t sourceFileIndex;
  252. int32_t lineStart, lineEnd;
  253. int32_t columnStart, columnEnd;
  254. int32_t ilOffset;
  255. SequencePointKind kind;
  256. int32_t isActive;
  257. int32_t id;
  258. } Il2CppSequencePoint;
  259. typedef struct Il2CppCatchPoint
  260. {
  261. MethodIndex __methodDefinitionIndex;
  262. TypeIndex catchTypeIndex;
  263. int32_t ilOffset;
  264. int32_t tryId;
  265. int32_t parentTryId;
  266. } Il2CppCatchPoint;
  267. typedef struct Il2CppDebuggerMetadataRegistration
  268. {
  269. Il2CppMethodExecutionContextInfo* methodExecutionContextInfos;
  270. Il2CppMethodExecutionContextInfoIndex* methodExecutionContextInfoIndexes;
  271. Il2CppMethodScope* methodScopes;
  272. Il2CppMethodHeaderInfo* methodHeaderInfos;
  273. Il2CppSequencePointSourceFile* sequencePointSourceFiles;
  274. int32_t numSequencePoints;
  275. Il2CppSequencePoint* sequencePoints;
  276. int32_t numCatchPoints;
  277. Il2CppCatchPoint* catchPoints;
  278. int32_t numTypeSourceFileEntries;
  279. Il2CppTypeSourceFilePair* typeSourceFiles;
  280. const char** methodExecutionContextInfoStrings;
  281. } Il2CppDebuggerMetadataRegistration;
  282. typedef union Il2CppRGCTXData
  283. {
  284. void* rgctxDataDummy;
  285. const MethodInfo* method;
  286. const Il2CppType* type;
  287. Il2CppClass* klass;
  288. } Il2CppRGCTXData;
  289. typedef struct MethodInfo
  290. {
  291. Il2CppMethodPointer methodPointer;
  292. Il2CppMethodPointer virtualMethodPointer;
  293. InvokerMethod invoker_method;
  294. const char* name;
  295. Il2CppClass *klass;
  296. const Il2CppType *return_type;
  297. const Il2CppType** parameters;
  298. union
  299. {
  300. const Il2CppRGCTXData* rgctx_data; /* is_inflated is true and is_generic is false, i.e. a generic instance method */
  301. Il2CppMetadataMethodDefinitionHandle methodMetadataHandle;
  302. };
  303. /* note, when is_generic == true and is_inflated == true the method represents an uninflated generic method on an inflated type. */
  304. union
  305. {
  306. const Il2CppGenericMethod* genericMethod; /* is_inflated is true */
  307. Il2CppMetadataGenericContainerHandle genericContainerHandle; /* is_inflated is false and is_generic is true */
  308. };
  309. uint32_t token;
  310. uint16_t flags;
  311. uint16_t iflags;
  312. uint16_t slot;
  313. uint8_t parameters_count;
  314. uint8_t is_generic : 1; /* true if method is a generic method definition */
  315. uint8_t is_inflated : 1; /* true if declaring_type is a generic instance or if method is a generic instance*/
  316. uint8_t wrapper_type : 1; /* always zero (MONO_WRAPPER_NONE) needed for the debugger */
  317. uint8_t has_full_generic_sharing_signature : 1;
  318. } MethodInfo;
  319. typedef struct Il2CppRuntimeInterfaceOffsetPair
  320. {
  321. Il2CppClass* interfaceType;
  322. int32_t offset;
  323. } Il2CppRuntimeInterfaceOffsetPair;
  324. #if IL2CPP_COMPILER_MSVC
  325. #pragma warning( push )
  326. #pragma warning( disable : 4200 )
  327. #elif defined(__clang__)
  328. #pragma clang diagnostic push
  329. #pragma clang diagnostic ignored "-Winvalid-offsetof"
  330. #endif
  331. typedef struct Il2CppClass
  332. {
  333. // The following fields are always valid for a Il2CppClass structure
  334. const Il2CppImage* image;
  335. void* gc_desc;
  336. const char* name;
  337. const char* namespaze;
  338. Il2CppType byval_arg;
  339. Il2CppType this_arg;
  340. Il2CppClass* element_class;
  341. Il2CppClass* castClass;
  342. Il2CppClass* declaringType;
  343. Il2CppClass* parent;
  344. Il2CppGenericClass *generic_class;
  345. Il2CppMetadataTypeHandle typeMetadataHandle; // non-NULL for Il2CppClass's constructed from type defintions
  346. const Il2CppInteropData* interopData;
  347. Il2CppClass* klass; // hack to pretend we are a MonoVTable. Points to ourself
  348. // End always valid fields
  349. // The following fields need initialized before access. This can be done per field or as an aggregate via a call to Class::Init
  350. FieldInfo* fields; // Initialized in SetupFields
  351. const EventInfo* events; // Initialized in SetupEvents
  352. const PropertyInfo* properties; // Initialized in SetupProperties
  353. const MethodInfo** methods; // Initialized in SetupMethods
  354. Il2CppClass** nestedTypes; // Initialized in SetupNestedTypes
  355. Il2CppClass** implementedInterfaces; // Initialized in SetupInterfaces
  356. Il2CppRuntimeInterfaceOffsetPair* interfaceOffsets; // Initialized in Init
  357. void* static_fields; // Initialized in Init
  358. const Il2CppRGCTXData* rgctx_data; // Initialized in Init
  359. // used for fast parent checks
  360. Il2CppClass** typeHierarchy; // Initialized in SetupTypeHierachy
  361. // End initialization required fields
  362. void *unity_user_data;
  363. uint32_t initializationExceptionGCHandle;
  364. uint32_t cctor_started;
  365. uint32_t cctor_finished_or_no_cctor;
  366. ALIGN_TYPE(8) size_t cctor_thread;
  367. // Remaining fields are always valid except where noted
  368. Il2CppMetadataGenericContainerHandle genericContainerHandle;
  369. uint32_t instance_size; // valid when size_inited is true
  370. uint32_t stack_slot_size; // valid when size_inited is true
  371. uint32_t actualSize;
  372. uint32_t element_size;
  373. int32_t native_size;
  374. uint32_t static_fields_size;
  375. uint32_t thread_static_fields_size;
  376. int32_t thread_static_fields_offset;
  377. uint32_t flags;
  378. uint32_t token;
  379. uint16_t method_count; // lazily calculated for arrays, i.e. when rank > 0
  380. uint16_t property_count;
  381. uint16_t field_count;
  382. uint16_t event_count;
  383. uint16_t nested_type_count;
  384. uint16_t vtable_count; // lazily calculated for arrays, i.e. when rank > 0
  385. uint16_t interfaces_count;
  386. uint16_t interface_offsets_count; // lazily calculated for arrays, i.e. when rank > 0
  387. uint8_t typeHierarchyDepth; // Initialized in SetupTypeHierachy
  388. uint8_t genericRecursionDepth;
  389. uint8_t rank;
  390. uint8_t minimumAlignment; // Alignment of this type
  391. uint8_t packingSize;
  392. // this is critical for performance of Class::InitFromCodegen. Equals to initialized && !initializationExceptionGCHandle at all times.
  393. // Use Class::PublishInitialized to update
  394. uint8_t initialized_and_no_error : 1;
  395. uint8_t initialized : 1;
  396. uint8_t enumtype : 1;
  397. uint8_t nullabletype : 1;
  398. uint8_t is_generic : 1;
  399. uint8_t has_references : 1; // valid when size_inited is true
  400. uint8_t init_pending : 1;
  401. uint8_t size_init_pending : 1;
  402. uint8_t size_inited : 1;
  403. uint8_t has_finalize : 1;
  404. uint8_t has_cctor : 1;
  405. uint8_t is_blittable : 1;
  406. uint8_t is_import_or_windows_runtime : 1;
  407. uint8_t is_vtable_initialized : 1;
  408. uint8_t is_byref_like : 1;
  409. VirtualInvokeData vtable[IL2CPP_ZERO_LEN_ARRAY];
  410. } Il2CppClass;
  411. #if IL2CPP_COMPILER_MSVC
  412. #pragma warning( pop )
  413. #elif defined(__clang__)
  414. #pragma clang diagnostic pop
  415. #endif
  416. // compiler calcualted values
  417. typedef struct Il2CppTypeDefinitionSizes
  418. {
  419. uint32_t instance_size;
  420. int32_t native_size;
  421. uint32_t static_fields_size;
  422. uint32_t thread_static_fields_size;
  423. } Il2CppTypeDefinitionSizes;
  424. typedef struct Il2CppDomain
  425. {
  426. Il2CppAppDomain* domain;
  427. Il2CppAppDomainSetup* setup;
  428. Il2CppAppContext* default_context;
  429. Il2CppObject* ephemeron_tombstone;
  430. const char* friendly_name;
  431. uint32_t domain_id;
  432. volatile int threadpool_jobs;
  433. void* agent_info;
  434. } Il2CppDomain;
  435. typedef struct Il2CppAssemblyName
  436. {
  437. const char* name;
  438. const char* culture;
  439. const uint8_t* public_key;
  440. uint32_t hash_alg;
  441. int32_t hash_len;
  442. uint32_t flags;
  443. int32_t major;
  444. int32_t minor;
  445. int32_t build;
  446. int32_t revision;
  447. uint8_t public_key_token[PUBLIC_KEY_BYTE_LENGTH];
  448. } Il2CppAssemblyName;
  449. typedef struct Il2CppImage
  450. {
  451. const char* name;
  452. const char *nameNoExt;
  453. Il2CppAssembly* assembly;
  454. uint32_t typeCount;
  455. uint32_t exportedTypeCount;
  456. uint32_t customAttributeCount;
  457. Il2CppMetadataImageHandle metadataHandle;
  458. #ifdef __cplusplus
  459. mutable
  460. #endif
  461. Il2CppNameToTypeHandleHashTable * nameToClassHashTable;
  462. const Il2CppCodeGenModule* codeGenModule;
  463. uint32_t token;
  464. uint8_t dynamic;
  465. } Il2CppImage;
  466. typedef struct Il2CppAssembly
  467. {
  468. Il2CppImage* image;
  469. uint32_t token;
  470. int32_t referencedAssemblyStart;
  471. int32_t referencedAssemblyCount;
  472. Il2CppAssemblyName aname;
  473. } Il2CppAssembly;
  474. typedef struct Il2CppCodeGenOptions
  475. {
  476. bool enablePrimitiveValueTypeGenericSharing;
  477. int maximumRuntimeGenericDepth;
  478. int recursiveGenericIterations;
  479. } Il2CppCodeGenOptions;
  480. typedef struct Il2CppRange
  481. {
  482. int32_t start;
  483. int32_t length;
  484. } Il2CppRange;
  485. typedef struct Il2CppTokenRangePair
  486. {
  487. uint32_t token;
  488. Il2CppRange range;
  489. } Il2CppTokenRangePair;
  490. typedef struct Il2CppTokenIndexMethodTuple
  491. {
  492. uint32_t token;
  493. int32_t index;
  494. void** method;
  495. uint32_t __genericMethodIndex;
  496. } Il2CppTokenIndexMethodTuple;
  497. typedef struct Il2CppTokenAdjustorThunkPair
  498. {
  499. uint32_t token;
  500. Il2CppMethodPointer adjustorThunk;
  501. } Il2CppTokenAdjustorThunkPair;
  502. typedef struct Il2CppWindowsRuntimeFactoryTableEntry
  503. {
  504. const Il2CppType* type;
  505. Il2CppMethodPointer createFactoryFunction;
  506. } Il2CppWindowsRuntimeFactoryTableEntry;
  507. typedef struct Il2CppCodeGenModule
  508. {
  509. const char* moduleName;
  510. const uint32_t methodPointerCount;
  511. const Il2CppMethodPointer* methodPointers;
  512. const uint32_t adjustorThunkCount;
  513. const Il2CppTokenAdjustorThunkPair* adjustorThunks;
  514. const int32_t* invokerIndices;
  515. const uint32_t reversePInvokeWrapperCount;
  516. const Il2CppTokenIndexMethodTuple* reversePInvokeWrapperIndices;
  517. const uint32_t rgctxRangesCount;
  518. const Il2CppTokenRangePair* rgctxRanges;
  519. const uint32_t rgctxsCount;
  520. const Il2CppRGCTXDefinition* rgctxs;
  521. const Il2CppDebuggerMetadataRegistration *debuggerMetadata;
  522. const Il2CppMethodPointer moduleInitializer;
  523. TypeDefinitionIndex* staticConstructorTypeIndices;
  524. const Il2CppMetadataRegistration* metadataRegistration; // Per-assembly mode only
  525. const Il2CppCodeRegistration* codeRegistaration; // Per-assembly mode only
  526. } Il2CppCodeGenModule;
  527. typedef struct Il2CppCodeRegistration
  528. {
  529. uint32_t reversePInvokeWrapperCount;
  530. const Il2CppMethodPointer* reversePInvokeWrappers;
  531. uint32_t genericMethodPointersCount;
  532. const Il2CppMethodPointer* genericMethodPointers;
  533. const Il2CppMethodPointer* genericAdjustorThunks;
  534. uint32_t invokerPointersCount;
  535. const InvokerMethod* invokerPointers;
  536. uint32_t unresolvedIndirectCallCount;
  537. const Il2CppMethodPointer* unresolvedVirtualCallPointers;
  538. const Il2CppMethodPointer* unresolvedInstanceCallPointers;
  539. const Il2CppMethodPointer* unresolvedStaticCallPointers;
  540. uint32_t interopDataCount;
  541. Il2CppInteropData* interopData;
  542. uint32_t windowsRuntimeFactoryCount;
  543. Il2CppWindowsRuntimeFactoryTableEntry* windowsRuntimeFactoryTable;
  544. uint32_t codeGenModulesCount;
  545. const Il2CppCodeGenModule** codeGenModules;
  546. } Il2CppCodeRegistration;
  547. typedef struct Il2CppMetadataRegistration
  548. {
  549. int32_t genericClassesCount;
  550. Il2CppGenericClass* const * genericClasses;
  551. int32_t genericInstsCount;
  552. const Il2CppGenericInst* const * genericInsts;
  553. int32_t genericMethodTableCount;
  554. const Il2CppGenericMethodFunctionsDefinitions* genericMethodTable;
  555. int32_t typesCount;
  556. const Il2CppType* const * types;
  557. int32_t methodSpecsCount;
  558. const Il2CppMethodSpec* methodSpecs;
  559. FieldIndex fieldOffsetsCount;
  560. const int32_t** fieldOffsets;
  561. TypeDefinitionIndex typeDefinitionsSizesCount;
  562. const Il2CppTypeDefinitionSizes** typeDefinitionsSizes;
  563. const size_t metadataUsagesCount;
  564. void** const* metadataUsages;
  565. } Il2CppMetadataRegistration;
  566. /*
  567. * new structure to hold performance counters values that are exported
  568. * to managed code.
  569. * Note: never remove fields from this structure and only add them to the end.
  570. * Size of fields and type should not be changed as well.
  571. */
  572. typedef struct Il2CppPerfCounters
  573. {
  574. /* JIT category */
  575. uint32_t jit_methods;
  576. uint32_t jit_bytes;
  577. uint32_t jit_time;
  578. uint32_t jit_failures;
  579. /* Exceptions category */
  580. uint32_t exceptions_thrown;
  581. uint32_t exceptions_filters;
  582. uint32_t exceptions_finallys;
  583. uint32_t exceptions_depth;
  584. uint32_t aspnet_requests_queued;
  585. uint32_t aspnet_requests;
  586. /* Memory category */
  587. uint32_t gc_collections0;
  588. uint32_t gc_collections1;
  589. uint32_t gc_collections2;
  590. uint32_t gc_promotions0;
  591. uint32_t gc_promotions1;
  592. uint32_t gc_promotion_finalizers;
  593. uint32_t gc_gen0size;
  594. uint32_t gc_gen1size;
  595. uint32_t gc_gen2size;
  596. uint32_t gc_lossize;
  597. uint32_t gc_fin_survivors;
  598. uint32_t gc_num_handles;
  599. uint32_t gc_allocated;
  600. uint32_t gc_induced;
  601. uint32_t gc_time;
  602. uint32_t gc_total_bytes;
  603. uint32_t gc_committed_bytes;
  604. uint32_t gc_reserved_bytes;
  605. uint32_t gc_num_pinned;
  606. uint32_t gc_sync_blocks;
  607. /* Remoting category */
  608. uint32_t remoting_calls;
  609. uint32_t remoting_channels;
  610. uint32_t remoting_proxies;
  611. uint32_t remoting_classes;
  612. uint32_t remoting_objects;
  613. uint32_t remoting_contexts;
  614. /* Loader category */
  615. uint32_t loader_classes;
  616. uint32_t loader_total_classes;
  617. uint32_t loader_appdomains;
  618. uint32_t loader_total_appdomains;
  619. uint32_t loader_assemblies;
  620. uint32_t loader_total_assemblies;
  621. uint32_t loader_failures;
  622. uint32_t loader_bytes;
  623. uint32_t loader_appdomains_uloaded;
  624. /* Threads and Locks category */
  625. uint32_t thread_contentions;
  626. uint32_t thread_queue_len;
  627. uint32_t thread_queue_max;
  628. uint32_t thread_num_logical;
  629. uint32_t thread_num_physical;
  630. uint32_t thread_cur_recognized;
  631. uint32_t thread_num_recognized;
  632. /* Interop category */
  633. uint32_t interop_num_ccw;
  634. uint32_t interop_num_stubs;
  635. uint32_t interop_num_marshals;
  636. /* Security category */
  637. uint32_t security_num_checks;
  638. uint32_t security_num_link_checks;
  639. uint32_t security_time;
  640. uint32_t security_depth;
  641. uint32_t unused;
  642. /* Threadpool */
  643. uint64_t threadpool_workitems;
  644. uint64_t threadpool_ioworkitems;
  645. unsigned int threadpool_threads;
  646. unsigned int threadpool_iothreads;
  647. } Il2CppPerfCounters;