[Mono-dev] Ping on nternal call builders

Kornél Pál kornelpal at gmail.com
Wed Jul 30 15:38:25 EDT 2008


Paolo Molaro wrote:
> If you propose a considerable amount of increased complexity and your
> reference 'improvements' are actually a lot worse you should at least
> choose better references to show.

My goal would be to make some icalls execute faster. Of course I don't 
want to cripple the JIT. (I may have tried but I was convinced not to do 
that each time.:)

> There are not many cases like UnsafeAddrOfPinnedArrayElement (the
> implementation also likely needs security checks, so in the end the
> implementation will be more complex and the transition overhead will be
> less significant).

This one needs no security checks because this is intended to be fast 
but unsafe (unpinned, unchecked) pointer access.

Note that I've chosen those three methods as reference implementatios 
because they are different and require really few opcodes to implement 
so that I don't waste time on implementing them if the patch don't get 
approved.

I've created a list about methods that could be implemented using 
managed code.

Also note that there are methods that probably should be implemented in 
C# with some inlined helpers.

Some of these may not be used in real world applications but Array, 
Buffer, MonoType and Marshal methods are in use for sure.

System.Array:
- GetLength
- GetLongLength
- GetLowerBound

System.Buffer
- all methods

System.MonoType
- GetArrayRank
- IsByRefImpl
- IsCOMObjectImpl
- IsPointerImpl
- IsPrimitiveImpl
- get_IsGenericParameter
- get_attributes

System.Object
- obj_address

System.Reflection.Emit.TypeBuilder
- get_IsGenericParameter

System.Reflection.Module
- GetGuidInternal
- GetHINSTANCE
- GetMDStreamVersion
- GetPEKind

System.Reflection.MonoField
- GetFieldOffset

System.Runtime.InteropServices.Marshal
- ReadByte
- ReadInt16
- ReadInt32
- ReadInt64
- ReadIntPtr
- UnsafeAddrOfPinnedArrayElement
- WriteByte
- WriteInt16
- WriteInt32
- WriteInt64
- WriteIntPtr
- copy_from_unmanaged (overloads lead there)
- copy_to_unmanaged (overloads lead there)

System.Threading.Thread
- VolatileRead (overloaded)
- VolatileWrite (overloaded)


More information about the Mono-devel-list mailing list