TASEmulators / TASEmulators/BizHawk
AOT Compilation Support
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 468
- PR merge metrics
- No merged PRs in 30d
Description
Something to look at wrt .NET6 (or more I guess really .NET 7/8; see #1415). This could be required for some platforms in a moonshot future (iOS/iPad/Apple TV support, lol) and very good for a WASM build due to performance. Perhaps this would be more performant for us due to p/invoke often being used for emulation?
This however has several limitations:
- Blocked by #3767
- No dynamic loading
- Similar to the trimming limitation, but this just outright disallows dynamic loading from working at all. External Tools would have to be re-worked to not rely on .NET dynamic assembly loading at all, or simply be unavailable for use.
- No run-time code generation
- i.e.
Reflection.Emit - Used in
SettingsUtil.cs,BinaryQuickSerializer.cs, BizInvoker.cs, BizInvokeUtilities.cs, andBizExvoker.cs. SettingsUtil is probably easy enough to replace with source generators?replaced with source generator in f2a47941058e0582c44014138911120ccce7d410BinaryQuickSerializer is only used in WonderSwan.IStatable.cs and probably could be easily factored out.removed in 8941bac1cedc3fda4c78c85713ca4bb72c49def2- BizInvoker could probably be replaced using source generators and .NET function pointers.
BizExvoker is not actually used anymore (remnant of C# waterbox days), so that can just be removed.removed in 5c475ce8989367c5836499e50afbeb7265fcb36cNLua also uses it technically, but the code is unused and can be easily removed.removed in 582446651fb8eb7dfc4be056c6838c9e5cd308e6
- i.e.
Various other limitations also exist but don't appear to apply to BizHawk (or are just implied by trimming requirement).
see .NET Blog post on this subject
see Meziantou's blog post Accessing private members without reflection in C# re: [UnsafeAccessor]
see also #2654 and Yoshi's notes re: Web target
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with blocker #3767, then inspect BizInvoker.cs and BizInvokeUtilities.cs, the remaining files explicitly identified as using Reflection.Emit. Review the Native AOT limitations and determine the scope needed for BizHawk's build. Done means a supported AOT build works without the listed dynamic-loading or runtime-code-generation dependencies, with affected functionality verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, wasm
- Domain
- build-system, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100