[Mono-dev] Inline assembly in C#

Vincent Povirk madewokherd at gmail.com
Tue May 30 17:58:42 UTC 2017


> Now that Mono is switching to platform-specific assemblies for the core
> assemblies as opposed to cross-platform assemblies that work across Windows,
> Mac and Linux (a price we pay to converge with CoreFX) it made me wonder if
> we could not reuse instead the existing support for mixed-mode assemblies in
> the CLR.

What you're suggesting are architecture-specific assemblies, not
platform-specific. So you would be multiplying the platform variations
by the set of architecture variations.

This would be a problem for Wine Mono's use case. Currently we can use
one set of class libraries with 32-bit and 64-bit Mono dll's. We would
need a mechanism to load some different class libraries based on
architecture.

> Essentially, instead of having inline assembly in the body of a method, we
> could define entire method as inline assembly, and set the method
> implementation flags in the ECMA metadata to be native and point to the
> code.   It is not as flexible, but would eliminate the need for a
> post-processor, and would merely require the C# compiler to perform the
> assembly code generation and injection.

You would also have to extend the Mono runtime to support mixed-mode
assemblies on non-Windows platforms.


More information about the Mono-devel-list mailing list