[Mono-devel-list] Re: [Mono-hackers-list] Simple patch for the runtime

Lluis Sanchez lluis at ideary.com
Wed Apr 9 17:01:30 EDT 2003


Hi,

Thanks. I've made the changes you proposed. Do you feel it is ok?

- Lluis.

----- Original Message -----
From: "Paolo Molaro" <lupus at ximian.com>
To: <mono-devel-list at lists.ximian.com>
Sent: Tuesday, April 08, 2003 11:36 AM
Subject: Re: [Mono-devel-list] Re: [Mono-hackers-list] Simple patch for the
runtime


> On 04/07/03 Lluis Sanchez wrote:
> > > 3) I don't like much the fact that we enter unmanaged code to go back
to
> > > managed twice anyway. The icall could be:
> > > ves_icall_System_AppDomain_InternalGetProcessGuid (MonoGuid *guid);
> > > and
> > > InternalGetProcessGuid (out Guid guid); in the C# side
> > > so you can easily invoke at least the ToString() in C# code.
> >
> > Hmm, this would make things more complex, unless I can safely use one
Guid
> > created in one domain in another domain. That's why I use an string, it
is
> > easy to make a copy of it for each domain.
>
> A Guid is a struct with no domain-dependent fields, so, once created,
> you just keep the Guid data, ie no object at all, and in the icall you
> copy it to the passed-in pointer with a simple memcpy.
> Or a better way may be to do this:
> *) use a static string process_guid in AppDomain.cs.
> *) if the string is non-null, return it
> *) otherwise build a Guid and call ToString in it
> *) pass this string to a icall like this:
>
>
> // maybe this can be an array to avoid the need to malloc memory
> // for it; need to adjust the check in the icall accordingly
> static gunichar2 *process_guid = NULL;
>
> MonoString *
> InternalGetProcessGuid (MonoString *newid) {
>
> lock ();
> if (process_guid) {
> unlock ();
> return mono_string_new_utf16 (process_guid, GUID_LEN);
> }
> copy from newid->chars to process_guid
> unlock ();
> return newid;
> }
>
> *) set the static field with the result of the InternalGetProcessGuid()
> icall.
>
> I think this would make the code cleaner, both in the C and the C# side
> and there is no unnecessary managed<->unmanaged transitions.
>
> lupus
>
> --
> -----------------------------------------------------------------
> lupus at debian.org                                     debian/rules
> lupus at ximian.com                             Monkeys do it better
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: runtime.diff
Type: application/octet-stream
Size: 3065 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030409/c58ba263/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AppDomain.diff
Type: application/octet-stream
Size: 1064 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030409/c58ba263/attachment-0001.obj 


More information about the Mono-devel-list mailing list