il2cpp-class-internals.h 22 KB

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