[Mono-dev] memcpy and memset (opcodes, C#, marshaling)

Miguel de Icaza miguel at novell.com
Mon Mar 26 00:03:17 EDT 2007


> Mono's String class has great managed memcpy and memset methods that 
> internal. cpblk and initblk opcodes map to these two methods when cannot be 
> easily inlined. But I know no way to make a C# compiler emit either cpblk or 
> initblk using my own pointer parameters.

Which ones do you have in mind?    

Extending the C# compiler to support a special syntax for this would be
trivial and incompatible with CSC.   But I guess that internally there
is no point in limiting ourselves to what CSC can do.

What would you like to use these for?

> System.Runtime.InteropServices.Marshal currently uses internal calls for 
> methods I think are not doing any managed-to-unmanaged marshaling at all: 
> Copy, Read... and Write... methods. Could these methods be implemented using 
> enirely managed code (inline implemenation or a managed-to-managed)?

I think most of the internal calls there could be moved to managed code.
Some might be using unmanaged code as the performance would be higher.

Some other routines could be completely done without internal calls
(some string conversion helper routines).


More information about the Mono-devel-list mailing list