-
-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New CoreLib Symbols support #592
Conversation
Use a rw lock. Integrate into Runtime. Most of our usage is unpacking back into Type/etc. But we can work on this bit by bit.
Some obvious first things might be to eliminate the array copies that come from GetMethods, GetTypes, etc. System.Reflection mandates that these calls return a new array each time. And the caller is allowed to modify it. And IKVM does this in a few places. But, we could convert these to ImmutableArrays, and cache the results, reducing the number of array copies made, and let IKVM code make copies as it requires. Other things is perhaps sorting. .NET <= 6 does not require GetTypes or GetMethods etc to be sorted. But it looks like in .NET 7 these are now sorted. So, we could potentially sort only on < 6 and cache the results, but not sort on > 7 where it's guarenteed already sorted. |
Provides IKVM.CoreLib.Symbols, which contains facades for all of the reflection-like entities used: ITypeSymbol, IAssemblySymbol, etc. These interfaces are then implemented for System.Reflection and IKVM.Reflection. This allows us to start untying the Runtime from the IFDEFs that change which reflection interface is used.
There some overhead here since we're wrapping the entire APIs with interfaces. Virtual dispatch. But, we might be able to actually eak out some performance improvements with caching.
Additionally, now we have an API surface we can start evolving differently than System.Reflection. Once we start narrowing the interface down, removing the methods we do not use, etc, we might be able to add higher level more focused methods that we could then go directly to System.Reflection.Metadata for, ditching IKVM.Reflection completely.