Skip to content

Commit

Permalink
Performance enhancements by using set not list, bugfix for explicit o…
Browse files Browse the repository at this point in the history
…verrides
  • Loading branch information
Sam Byass committed Oct 18, 2021
1 parent 9f9f6cc commit 8df2dca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Cpp2IL.Core/AssemblyPopulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ private static void FixupExplicitOverridesInType(TypeDefinition ilTypeDefinition
if (gParams.Length > 0)
{
var parameterRefs = gParams.Select(ResolveGenericParameter).ToArray();

if (parameterRefs.Any(gp => gp == null))
return null;

return ilTypeDefinition.Module.ImportRecursive(type.MakeGenericInstanceType(parameterRefs));
}

Expand Down
2 changes: 1 addition & 1 deletion Cpp2IL.Core/Cpp2IlApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public static void RunAttributeRestorationForAllAssemblies(BaseKeyFunctionAddres
{
CheckLibInitialized();

SharedState.AttributeGeneratorStarts = LibCpp2IlMain.Binary!.AllCustomAttributeGenerators.ToList();
LibCpp2IlMain.Binary!.AllCustomAttributeGenerators.ToList().ForEach(ptr => SharedState.AttributeGeneratorStarts.Add(ptr));

var enumerable = (IEnumerable<AssemblyDefinition>) SharedState.AssemblyList;

Expand Down
2 changes: 1 addition & 1 deletion Cpp2IL.Core/SharedState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static class SharedState
internal static readonly List<AssemblyDefinition> AssemblyList = new List<AssemblyDefinition>();
internal static readonly Dictionary<AssemblyDefinition, Il2CppImageDefinition> ManagedToUnmanagedAssemblies = new Dictionary<AssemblyDefinition, Il2CppImageDefinition>();

internal static List<ulong> AttributeGeneratorStarts = new();
internal static HashSet<ulong> AttributeGeneratorStarts = new();

internal static void Clear()
{
Expand Down

0 comments on commit 8df2dca

Please sign in to comment.