« Return to Thread: [rvm-research] Find holes in a block of SegregatedFreeListSpace

Re: [rvm-research] Find holes in a block of SegregatedFreeListSpace

by Dingwen Yuan :: Rate this Message:

Reply to Author | View in Thread

Hallo Steve,

Thank you for the reply. Some context is like this. I added some code to scan the mature space of GenMS for holes in the available list.

GenMS.collectionPhase 
  public final void collectionPhase(short phaseId) {

    if (traceFullHeap()) {
      ...........
      if (phaseId == RELEASE) {
          if (Options.verbose.getValue() > 0)
              Log.writeln("main release");
        matureTrace.release();
       
        msSpace.release();

        holes = 0;
        msSpace.linearScan();
        Log.write("holes: ");
        Log.writeln(holes);

        super.collectionPhase(phaseId);
        return;
      }
    }
  }

SegregatedFreeListSpace.linearScan

  public final void linearScan(boolean print) {
    for (int sizeClass = 0; sizeClass < sizeClassCount(); sizeClass++) {
       
        if (VM.VERIFY_ASSERTIONS) {
            VM.assertions._assert(this.flushedBlockHead.get(sizeClass).isZero());
            VM.assertions._assert(this.consumedBlockHead.get(sizeClass).isZero());
        }
       
        Address block = this.availableBlockHead.get(sizeClass);
        Extent blockSize = Extent.fromIntSignExtend(BlockAllocator.blockSize(blockSizeClass[sizeClass]));
       
        while (!block.isZero()) {
            Address next = BlockAllocator.getNext(block);
            this.auditBlock(block, sizeClass, blockSize);       
            block = next;
          }
      }
    }
  }

SegregatedFreeListSpace.auditBlock
   @Inline
   private void auditBlock (Address block, int sizeClass,
            Extent blockSize) {

    Address end = block.plus(blockSize);     
     
    Address cursor = block.plus(blockHeaderSize[sizeClass]);
    Extent cellExtent = Extent.fromIntSignExtend(cellSize[sizeClass]);
   
    while (cursor.LT(end)) {
      ObjectReference current = VM.objectModel.getObjectFromStartAddress(cursor);
      if (current.isNull() || !isCellLive(current)) {
          holes++;
      }   
      cursor = cursor.plus(cellExtent);
    }
  }
 
And I also did a very simple experiment on it. The experiment code added 20 Integer to a static arrayList. Of course, all these objects will be promoted to mature space after gc. At the end of the code I called 10 System.gc() in a sequence and I also set -X:gc:fullHeapSystemGC=true so that full gc was be triggered. The holes of these 10 gcs are
holes: 0
holes: 1367
holes: 348
holes: 1359
holes: 1011
holes: 1359
holes: 348
holes: 1359
holes: 1011
holes: 1359

This doesn't conform to my expectation. I supposed that the second to the tenth "holes" should be 0 when the first is already 0. And in addition, there seems to be some pattern in the numbers -- 1359 = 1011+348. My guess is that this may relate to the markState of MarkSweepSpace which changes from gc to gc. 

BTW, the version I used is 2.9.2

cheers,

Dingwen


2009/6/11 Steve Blackburn <Steve.Blackburn@...>
Hi Dingwen,

Sorry I have not replied earlier.

I'm afraid the specifics of the surrounding code are not at the front
of my mind right now and it's pretty tough to debug your code with so
little context.  Can you be a bit more specific about how it is failing?

For what it's worth, I strongly recommend the use of assertions,
particularly in GC code---figure out what your invariants and
preconditions are and then thrown assertions in liberally to ensure
your assumptions are holding true.   The assertions cost nothing in a
production build (they are turned off and removed statically---no
runtime checks).

--Steve

On 10/06/2009, at 6:32 PM, Dingwen Yuan wrote:

> Sorry, I hit a space and the above mail was mistakenly sent. Again,
> the code is like this:
>
> @Inline
> private void auditBlock (Address block, int sizeClass,
>             Extent blockSize) {
>
>       Extent cellBytes = Extent.fromIntSignExtend(
> cellSize[sizeClass]);
>       Address cursor = block.plus(blockHeaderSize[sizeClass]);
>       Address end = block.plus(blockSize);
>
>       while(cursor.LT(end)) {
>         ObjectReference current =
> VM.objectModel.getObjectFromStartAddress(cursor);
>         if (current == null || !this.isCellLive(current)) {
>                holes++;
>         }
>         cursor = cursor.plus(cellBytes);
>      }
>   }
>
> I call this function to scan blocks in "available list" at the
> RELEASE phase of GC directly after space.release() was called. But I
> found there should be some bug in it, but cannot tell where. Could
> anyone help me with this?
>
> Thanks in advance.
>
> Dingwen
>
> TU Darmstadt
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects_______________________________________________
> Jikesrvm-researchers mailing list
> Jikesrvm-researchers@...
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

 « Return to Thread: [rvm-research] Find holes in a block of SegregatedFreeListSpace