If you are an iOS developer, you probably know of our battles to tame the AOT compiler. If you are not aware of the issues, here is a summary:
- On iOS, it is illegal for any application to generate code and execute it on the fly. For this reason, the AOT (ahead-of-time, as opposed to just-in-time) compiler is used.
- A few of C#’s features rely on JIT behaviour for them to work. Two in particular affect Grids:
- Some data structures that do comparisons usually generate equality operations on the fly for certain operations if the comparisons need to be performed on structs. For example, removing a point from a list requires this auto-generated equality operation.
- Generic methods that take structs as type parameters are not compiled further than one level deep.
We have found workarounds for all these issues. The first issue requires us to rewrite some of the library data structures and so prevent any automatic equality operation generation. We have already done this for Lists, and in 1.10, we also provide a AOT-safe implementation for Stack. It’s basically a drop-in replacement for the existing Stack class – it supports the same interfaces and operations. Underneath, we use a system stack and delegate all methods appropriately, except the Contains method, where we use a simple (and safe) replacement.Find out more about Grids 1.10 Buy Grids now