[Mono-devel-list] A question on the "klass" field in MonoInst

Massimiliano Mantione massi at ximian.com
Thu May 19 10:57:30 EDT 2005


I have a small issue in implementing type based alias analysis.

I need to know the class of any object reference inside the code,
but this is generally unavailable in our IR.
Note that I just need to handle references to full heap objects
(pointing to a MonoObject to be clear), while managed pointers
pointing to primitives or value types are not interesting here.

I see that in MonoInst there's the "klass" field, which would be
exactly what I need; ideally (at least for me) it should have a
meaningful value every time the type of that MonoInst is set to
"STACK_OBJ".

In practice klass is often NULL in those cases.
Other times it points to "Object", but more precise information
could be available (like after a "new").

After some code reading, it seems to me that setting "klass" to
a meaningful value would be harmless in general (I mean, nothing
would stop working because of that), so I'm doing it.

If anybody knows some reason why this should not be done, please
answer to this message ;-)

Ciao,
  Massi





More information about the Mono-devel-list mailing list