[Mono-dev] [PATCH] Implement internal call builders

Kornél Pál kornelpal at gmail.com
Sat Jun 21 07:19:39 EDT 2008


Hi,

There are a lot of internal calls that could be implemented entirely 
using managed code.

Usually the problem is that they require information about internal data 
structures of the runtime. Sharing internal structures between native 
and managed code is problematic because two declarations has to be kept 
in sync.

Other problem may be that the required opcodes cannot be expressed in C#.

The current solution is to use mini_get_inst_for_method that started to 
get quite big and because it always gets inlined only a small amount of 
code is accepted to this function.

My proposed solution is to introduce internal call builders that 
generate managed code themselves of type MONO_WRAPPER_MANAGED_TO_MANAGED.

My patch contains three reference internal call builder implementations:
- RuntimeHelpers.OffsetToStringData: that is currently implemented in 
mini_get_inst_for_method
- Marshal.UnsafeAddrOfPinnedArrayElement: that is currently implemented 
using native code
- String..ctor: that is currenly implemented as a hack in 
mono_marshal_get_native_wrapper

If internal calls of type MONO_WRAPPER_MANAGED_TO_MANAGED were permitted 
to be inlined there could be more performance gain from this new feature.

If you like this new feature please approve the code. Otherwise please 
help me to improve it.

Thanks.

Kornél
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: icall_builder.diff.txt
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080621/1c6235d5/attachment-0001.txt 


More information about the Mono-devel-list mailing list