4 ms·
AOT not supporting generics? that's a pretty bad reading/summary of the webpage you link to (not to mention, that page may be a bit outdates, and more cases are
by knocte 8y ago
AOT not supporting generics? that's a pretty bad reading/summary of the webpage you link to (not to mention, that page may be a bit outdates, and more cases are supported by AOT now; take in account this is the mode that iOS apps developed with Xamarin need to use).
- atombender 8y ago"As of Mono 2.0, AOT compilation is only supported for non-generic methods. support for generics is currently under development."
- knocte 8y agoMono 2.0 is ancient, nowadays the version is 5.16. That webpage is not worth looking at.
- atombender 8y agoSo where should I look? It doesn't seem to be a particularly popular or well-documented topic. The best I've found is this [1]. [1] https://mattwarren.org/2018/06/07/CoreRT-.NET-Runtime-for-AOT/ https://mattwarren.org/2018/06/07/CoreRT-.NET-Runtime-for-AO...
- knocte 8y agoRight, maybe the best way to figure out its completeness is just testing it. AOT has received a lot of love these days, the runtime accepts many flags when dealing with it, e.g. "fullaot".
- knocte 8y agoFYI a Mono dev removed those old statements about AOT+generics from the page because he agreed with me that they were outdated.
- akoeplinger 8y agoThis was outdated info on the website, I've updated the page. Generics are supported with FullAOT nowadays.
- algorithmsRcool 8y agoIn dotnet land generics are JITted on demand at runtime when you first execute a specific instance of that generic type. So List<int> doesn't necessarily get JItted even though List<long> has been. This poses a bit of a problem for AOT compilation. You would essentially have to either A) Trace all possible execution paths and determine every needed generic instantiation and precompile and ship them all. This ain't easy, and it might be impossible. Also expect massive binaries due to all those types. B) Bundle a JIT and lazily emit code as needed. C) No generics?
- knocte 8y ago> So List<int> doesn't necessarily get JItted It does, if the AOT compiler is advanced enough to examine all code and determine that `int` is a possible type being used with List<T>. Mono has had a lot of advancements on these techniques over the years, as it's the only way for them to let Xamarin devs deploy apps on the iPhone.
- piaste 8y agoIn regular .NET you can instantiate generic types with a type parameter provided at runtime. Of course it's not something you should ever do in regular code, but it can be useful for deserialization and stuff like that, so you can create e.g. a list of arbitrary types received over the wire. Does the AOT compiler just crash if asked to compile a project that uses reflection?
- pjmlp 8y agoNote that since Windows 8, .NET Store apps are fully AOT to native code, there is no JIT. Window 8.x used the cloud compiler with MDIL deployments (based on Bartok MDIL from Singularity), doing on-device linking. Windows 10 makes use of .NET Native toolchain. The only restriction is reflection, all classes that are accessed via reflection need to be explicitly mentioned on a rd.xml file, otherwise the linker might prune them.