CosmosOS / IL2CPU

IL2CPU is a compiler for .NET IL code to compile to assembly language for direct booting.
BSD 3-Clause "New" or "Revised" License
278 stars 71 forks source link

Added generic interface support for arrays #111

Closed quajak closed 2 years ago

quajak commented 3 years ago

Fixes #15 The approach taken is to implement the required methods in a static class(SZArrayImpl) and when creating the virtual method table separately link them to the typed array class. At runtime in CallVirt it checks if a method in one of the generic interfaces is called and then converts the type of array from System.Array to T[] before searching for the method in the VMT. Currently all methods are always added but more intelligent queueing could be done in the future.

The implementation for Equals and IndexOf does not currently work but the necessary fix for CallVirt and ValueType should be part of the work for .Net 5.0

quajak commented 3 years ago

We may need to check what is already possible after just merging the Net 5 changes. Since some work was already done there.