Hi Sam,

That's pretty much exactly what I had in mind.  :-)   Whether it is the best strategy, I can't say, but it seems like a reasonable place to start!

--Steve

On 26/06/2012, at 10:49 AM, Sam Guyer wrote:

Hi Joao,

We had to do something similar for one of our projects. Here's what we did:

We added a method to ObjectModel (MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ObjectModel.java) to trace the extra word (which is called the "forwarding word" in our project):

 /**                                                                                                                                       
  * Trace forwarding word in object header                                                                                                 
  *                                                                                                                                        
  * @param object The object whose forwarding word to trace                                                                                
  * @param trace The trace to use                                                                                                          
  */                                                                                                                                       
 @Inline                                                                                                                                   
 public void traceForwardingWord(ObjectReference object, TraceLocal trace) {                                                               
   Address slot = object.toAddress().plus(MiscHeader.FORWARDING_WORD_OFFSET);                                                            
   trace.processEdge(object, slot);                                                                                                        
 }

We called this method at the end of scanObject in org.mmtk.plan.TraceLocal:

  protected void scanObject(ObjectReference object) {
    if (specializedScan >= 0) {
      VM.scanning.specializedScanObject(specializedScan, this, object);
    } else {
      VM.scanning.scanObject(this, object);
    }
    VM.objectModel.traceForwardingWord(object, this);
  }

Maybe Steve can comment on whether that strategy is good, from an MMTk achitecture standpoint.

-Sam

On Mon, Jun 25, 2012 at 7:39 PM, Steve Blackburn <Steve.Blackburn@anu.edu.au> wrote:
Hi Joćo,

Your idea sounds OK.   The GC word won't be scanned because it not part of the object.   I'm not sure exactly what you're doing, but you may be able to make things work via a simple hack to TraceLocal.scanObject() to explicitly trace your hidden field before (or after) the normal scan takes place (pass your pointer as an argument to the processEdge() method on the trace object).   Try it out with a simple BaseBase system before testing it with production.

--Steve


On 26/06/2012, at 8:18 AM, Joćo Silva wrote:

> Greetings,
>
> I have added a word-sized field to the miscellaneous header of objects
> and would like to store object references in it.
>
> Unfortunately, the GC does not scan this field, which means the
> referenced objects are not kept alive.
>
> Is there a way I could overcome this problem or should I abandon the
> idea entirely?
>
> Thank you.
>
> Joćo Silva
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Jikesrvm-researchers mailing list
> Jikesrvm-researchers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers



--
Samuel Z. Guyer
Assistant Professor
Dept of Computer Science
Tufts University

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers