[MonoDevelop] [PATCH] Fix Improper MemberNodeCommandHandling inClassPad

Michael Hutchinson m.j.hutchinson at gmail.com
Tue May 29 05:48:23 EDT 2007


On 5/29/07, Balaji Rao <balajirrao at gmail.com> wrote:
> > > One possibility is to have the pidb loading code keep a table of unique
> > > FileName strings as they are loaded from disk, and set the instance to
> > > the unique string rather than the one loaded.
>  So, I think the filename table should be maintained for each Class.
> Or do we need to have a global one? Having a per class filename table
> adds only a little overhead as it duplicates the filename between all
> classes declared in the same file. So which one would be better? If it
> is chosen to go for a global table,  is there anything wrong in making
> it have a static reference in the class 'DefaultClass' ?
>
> Can it be done in this way? Please explain.

One thing to consider is that classes can be declared in multiple
files (partial classes), so different members may be declared in
multiple files, which may themselves contain parts of other classes,
i.e. there is no hard link between classes and files at all.

If you use a global table containing all of the uniques filenames in
the project, then each member can simply hold a *reference* to one of
those filenames, so each member only needs sizeof(IntPtr) memory
rather than the full path string. They already have this allocated for
the "Filename" field anyway. You could maybe optimise it further for
64-bit machines by using an Int32 index for the filename table and
using this in the property accessor to look the string up from the
table.

A static table makes sense IMO, though not having looked at the
relevant source, I don't know where the best place would be to have
it.

As Jeff said, the pidb loading code might have to be altered too.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list