« Return to Thread: Add metadata to each field of an object?

Re: [rvm-research] Add metadata to each field of an object?

by Colin(Du Li) :: Rate this Message:

Reply to Author | View in Thread

Hi, Michael,

    Which project did you use the MiscHeader? I would like to know more detail about the project.
    I also have two questions as follows.
    1. If we use MiscHeader to expand the object size, can GC automatically adapt to this changes, that is, can GC trace and collect objects using the new object size?
    2. Is that possible to expand header for part of objects (to save space), or all the objects should expand header?

    Thanks a lot!

    Du Li
Michael Bond wrote:
Hi Xinwei,

The suggestions by Steve and Eliot sound good.  Another possibility is to
add a single word to each header, using MiscHeader, and make this word be
a pointer to an array where there is one element in the array per field in
the object.  You can initialize this array at object allocation time, or
you can just do it lazily in your read and write barriers, i.e., if the
header word is null, create a new array on the first access, and use a CAS
to initialize the word to avoid racing.  (The latter approach has worked
for me; it has space advantages if you don't end up needing the metadata
for many objects.  It can be problematic because creating a new array
might trigger a GC.  I avoided this by having a per-thread flag that gets
set during such allocations, and by having Plan.poll() check this flag and
defer GC if the flag is set.  There's a similar existing mechanism to
avoid GCs due to remembered set updates.)

A few tricky things: (1) It's important to modify GC tracing so it also
traces the header pointer :)  (2) If objects have differently sized
fields, it may be tricky to pick the array element that corresponds to a
field, but this can probably be figured out at compile time (when add read
and write barriers) by just counting the number of the field that's being
accessed by the read or write.  (In my case, I just needed one word per
word, which may be want you want for race detection?)

Hope that helps,
Mike

On Thu, 25 Jun 2009, 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.
>
> Regards,
> --
> Xinwei XIE
> --
> View this message in context: http://www.nabble.com/Add-metadata-to-each-field-of-an-object--tp24213344p24213344.html
> Sent from the jikesrvm-researchers mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Jikesrvm-researchers mailing list
> Jikesrvm-researchers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
>

------------------------------------------------------------------------------
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

 « Return to Thread: Add metadata to each field of an object?