[Mono-dev] [PATCH] Redirect certain string constructors to CreateString

Paolo Molaro lupus at ximian.com
Mon Jul 17 06:32:40 EDT 2006

On 07/13/06 Kornél Pál wrote:
> I reallized that simply redirecting the method may not be a good solution 
> because the .ctor method is lost from the stack trace this way. And I think 
> other problems may occur altough I never experienced such problems.
> I attached an extended version of the previous patch that creates a wrapper.
> In addition now CreateString () methods are properly implemented and I've 
> patched ASCIIEncoding and Latin1Encoding classes so that their GetString () 
> methods no longer recurse to CreateString () methods.

I had a change similar to this in my long-term todo list, long term
because to improve performance it will need the changes in the GC that
allow object allocation completely in managed code. This way the string
ctors won't need to perform the managed <> unmanaged transitions.
The change would involve all the string ctors, of course.
Since the change would need to improve performance, using a wrapper
is not allowed, instead the Create* methods would have the same
signature as our currently used internal string ctors (taking a fake
string this first argument and returning the string instead of void).
The JIT will automatically use the method headers from the Create*
methods for the implementation of the string ctors internal calls
with trivial changes to the runtime. This implementation should cover
your needs and it will avoid having a wrapper in the middle of
performance-sensitive code.


lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list