Commit Graph

8 Commits

Author SHA1 Message Date
Robert Xiao
193cdcdc4a Get rid of TypesByMethodSpecClassIndex.
classIndexIndex only indexes the genericInstance, not the actual generic
instance type. Therefore, for example, A<Int32,Int32> and B<Int32,Int32>
have the same classIndexIndex because the generic parameters are the
same, despite being otherwise unrelated.

Instead of TypesByMethodSpecClassIndex, we simply call MakeGenericType
each time, relying on genericTypeInstances to dedup the resulting
instances. This patch thus also adds all of the types from
genericTypeInstances to the Il2CppModel.Types listing.
2020-06-20 10:17:48 +02:00
Robert Xiao
ab5fc836a1 Introduce a cache for generic type instantiations.
Also add MakeGenericType, which creates type instances from a generic
type definition and arguments. We will use this later to build properly
fleshed out concrete generic types.
2020-06-20 10:17:48 +02:00
Robert Xiao
2c164aec02 Change generic params/args to arrays
The C# functions for GetGenericParameters/GetGenericArguments use
Type[], not lists, so we should conform to that.

Also fix the definition of IsGenericTypeDefinition - because it's
possible for a class to be instantiated with all generic parameters.
2020-06-20 10:17:48 +02:00
Robert Xiao
996fb1ff36 Avoid recreating ref'd types that already exist
Because TypesByReferenceIndex can be populated in two places
(Il2CppModel constructor and GetTypeFromVirtualAddress), we need to
avoid generating the same type multiple times.
2020-06-20 10:17:48 +02:00
Robert Xiao
71bf353ae0 Remove ResolveGenericArguments(int) entirely
It's not really needed anymore, and it is clearer without that method.
2020-06-20 10:17:48 +02:00
Robert Xiao
7797ac2506 Refactor TypeInfo constructors
This patch replaces Il2CppModel.resolveTypeReference by a static
TypeInfo constructor, and simultaneously refactors the TypeInfo
constructors to eliminate duplication between resolveTypeReference and
the original constructors. This will make future refactoring much
easier.
2020-06-20 10:17:48 +02:00
Katy Coe
9f3211281c Model: Ensure all custom attributes are loaded 2020-02-10 06:29:48 +01:00
Katy Coe
e971cb8502 Refactor solution layout 2020-02-06 02:51:42 +01:00