SuperSetAOTHomologousImage.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #pragma once
  2. #include "AOTHomologousImage.h"
  3. #include "utils/Il2CppHashMap.h"
  4. #include "utils/HashUtils.h"
  5. namespace hybridclr
  6. {
  7. namespace metadata
  8. {
  9. struct SuperSetTypeIntermediateInfo
  10. {
  11. bool inited;
  12. //uint32_t homoRowIndex;
  13. uint32_t homoParentRowIndex;
  14. uint32_t homoMethodStartIndex; // start from 1
  15. uint32_t homoFieldStartIndex; // start from 1
  16. //const char* name;
  17. //const char* namespaze;
  18. //int32_t aotTypeIndex; // il2cpp type index
  19. const Il2CppType* aotIl2CppType;
  20. const Il2CppTypeDefinition* aotTypeDef;
  21. //const Il2CppClass* aotKlass;
  22. };
  23. struct SuperSetTypeDefDetail
  24. {
  25. //bool inited;
  26. //uint32_t homoRowIndex;
  27. //uint32_t homoParentRowIndex;
  28. //uint32_t homoMethodStartIndex; // start from 1
  29. //uint32_t homoFieldStartIndex; // start from 1
  30. //const char* name;
  31. //const char* namespaze;
  32. //int32_t aotTypeIndex; // il2cpp type index
  33. const Il2CppType* aotIl2CppType;
  34. //const Il2CppTypeDefinition* aotTypeDef;
  35. //const Il2CppClass* aotKlass;
  36. };
  37. struct SuperSetMethodDefDetail
  38. {
  39. //uint32_t homoRowIndex;
  40. //MethodRefSig signature;
  41. //const Il2CppTypeDefinition* declaringTypeDef;
  42. //const Il2CppClass* declaringKlass;
  43. //const char* name;
  44. const Il2CppMethodDefinition* aotMethodDef;
  45. };
  46. struct SuperSetFieldDefDetail
  47. {
  48. //uint32_t homoRowIndex;
  49. //const char* name;
  50. //Il2CppType type;
  51. //const Il2CppTypeDefinition* declaringTypeDef;
  52. const Il2CppType* declaringIl2CppType;
  53. const Il2CppFieldDefinition* aotFieldDef;
  54. };
  55. class SuperSetAOTHomologousImage : public AOTHomologousImage
  56. {
  57. public:
  58. SuperSetAOTHomologousImage() : AOTHomologousImage() {}
  59. void InitRuntimeMetadatas() override;
  60. const Il2CppType* ReadTypeFromResolutionScope(uint32_t scope, uint32_t typeNamespace, uint32_t typeName) override;
  61. MethodBody* GetMethodBody(uint32_t token) override;
  62. const Il2CppType* GetIl2CppTypeFromRawTypeDefIndex(uint32_t index) override;
  63. Il2CppGenericContainer* GetGenericContainerByRawIndex(uint32_t index) override;
  64. Il2CppGenericContainer* GetGenericContainerByTypeDefRawIndex(int32_t typeDefIndex) override;
  65. const Il2CppMethodDefinition* GetMethodDefinitionFromRawIndex(uint32_t index) override;
  66. void ReadFieldRefInfoFromFieldDefToken(uint32_t rowIndex, FieldRefInfo& ret) override;
  67. private:
  68. void InitTypes0(std::vector<SuperSetTypeIntermediateInfo>& typeIntermediateInfos);
  69. void InitNestedClass(std::vector<SuperSetTypeIntermediateInfo>& typeIntermediateInfos);
  70. void InitType(std::vector<SuperSetTypeIntermediateInfo>& typeIntermediateInfos, SuperSetTypeIntermediateInfo& type);
  71. void InitTypes1(std::vector<SuperSetTypeIntermediateInfo>& typeIntermediateInfos);
  72. void ReadMethodDefSig(BlobReader& reader, MethodRefSig& method);
  73. void InitMethods(std::vector<SuperSetTypeIntermediateInfo>& typeIntermediateInfos);
  74. void InitFields(std::vector<SuperSetTypeIntermediateInfo>& typeIntermediateInfos);
  75. const Il2CppType* _defaultIl2CppType;
  76. std::vector<SuperSetTypeDefDetail> _typeDefs;
  77. Il2CppHashMap<int32_t, SuperSetTypeDefDetail*, il2cpp::utils::PassThroughHash<int32_t>> _aotTypeIndex2TypeDefs;
  78. Il2CppHashMap<uint32_t, SuperSetMethodDefDetail*, il2cpp::utils::PassThroughHash<uint32_t>> _token2MethodDefs;
  79. std::vector<SuperSetMethodDefDetail> _methodDefs;
  80. std::vector<SuperSetFieldDefDetail> _fields;
  81. };
  82. }
  83. }