[Mono-dev] Inline assembly in C#

Miguel de Icaza miguel at microsoft.com
Thu Jun 1 13:59:14 UTC 2017


Hello,

These are good observations.    If we ever do this (I am not saying we are, I just wanted to get this off my head), we would indeed require assemblies for 32/64 on the same system.

Any work that we did to support inline assembly would need some extra work on the runtime, so adding support for mixed-mode execution would fall into the sort of work we would need to do.

Anyways, this is a very good catch, and it means that the original design was probably best.   And it is still an independent issue from having an inline assembler in place.

Miguel.

On 5/30/17, 1:58 PM, "Vincent Povirk" <madewokherd at gmail.com> wrote:

    > 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