From: Eliot M. <mo...@cs...> - 2009-06-26 02:50:49
|
Xinwei Xie wrote: > Hi All, > Thanks for your attention. > > I'd like to know whether I can add some extra customized structure into > current object layout. As far as I know, MiscHeader provides an alternative > way to accomplish this, however, it lacks of flexibility and can only add > words in the object level. My point is I want to do some profiling to each > field of an object, for example, I want to trace when and who did an > operation (read/write) to a corresponding field and update it at each access > operation site. > class TraceInfo{ > int tid; > int when; > } > Where can I add this extra information to each field of an object? Can I > just add an instance of this structure to the RVMField? Or an alternative > way is to add it into TIB? > Will it break the current object layout? How to initialize it correctly? > Thanks very much. Xinwie -- Why not write this information to a log? Trying to inject it into the object format is going to be a lot more work, I suspect. You'll have to modify the object layout part of the compiler. And then there's dealing with the objects that get passed via JNI, and system internal objects, etc. It could get tricky. Not so pleasant for arrays either. An alternative approach -- still not easy though -- would be to use a tool like valgrind. You'd have to notify it of object creations, etc., so it could keep shadow information. Again, probably a lot of work. Perhaps others can comment on the viability of that approach. Overall I think logging will be easiest. What do you hope to do with the information? Generally, the more you tell us about your real objective, the more helpful the discussion list can be to you .... Best wishes -- Eliot Moss |