il2cpp-class-internals.h 22 KB

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