暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

il2cpp-class-internals.h 22KB

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