SunSPOT API V5.0


com.sun.squawk
Class Lisp2GenerationalCollector

java.lang.Object
  extended by com.sun.squawk.GarbageCollector
      extended by com.sun.squawk.Lisp2GenerationalCollector

public final class Lisp2GenerationalCollector
extends GarbageCollector

A collector based on the lisp 2 algorithm described in "Garbage Collection : Algorithms for Automatic Dynamic Memory Management" by Richard Jones, Rafael Lins.

Object Header Layout

For objects that move during a collection, forwarding offsets are installed in high bits of the class word in the object's header. The class pointer is made relative to the space in which the class lies (i.e. ROM, NVM or RAM) and this offset is stored in the lower bits. the two lowest bits of the class word are used as a determine if the object has forwarded ('00' if not) and if so, where is the class located ('01' in the heap, '11' in NVM and '10' in ROM). The forwarding offset is relative to the start of a "slice" with the absolute offset of the slice stored in a fixed size "slice offset table".

       <-------------- (W-C-2) ---------> <------ C ------> <-2->
      +----------------------------------+-----------------+-----+
      |  forwarding offset               | class offset    | tag |
      +----------------------------------+-----------------+-----+
       <--------------------------- w -------------------------->
                                          <-- sliceOffsetShift ->
 

Heap Layout


                      memoryEnd ->
                                    Slice table


                                    Bitmap


                                    Fixed marking stack

                        heapEnd ->                                                 --+
                                                                                     |
                                    Unused heap (except as extra marking stack)      |
                                                                                     |
              youngGenerationEnd ->                                                  |
                                                                                     |
                                    Young Generation                                 |
                                                                                     |
            youngGenerationStart ->                                                  | Covered by bitmap
                                                                                     |
                                    Old Generation                                   |
                                                                                     |
                       heapStart ->                                                  |
                                                                                     |
                                    {unused space to align heapStart for bitmap}     |
                                                                                     |
                     memoryStart ->                                                  |
                                                                                     |
                                    Permanent space                                  |
                                                                                     |
            permanentMemoryStart ->                                                --+
 


Field Summary
 
Fields inherited from class com.sun.squawk.GarbageCollector
NATIVE_GC_ONLY
 
Method Summary
 int getIdealYoungGenerationSize()
          Gets a size for the young generation based on its ideal ratio to the heap size.
 int getYoungGenerationSize()
          Gets the actual size (in bytes) of the young generation based on the current start address of the young generation, the ideal young generation size and the remaining amount of free memory in the heap.
 void setIdealYoungGenerationSizePercent(int ygPct)
          Sets the size for the young generation based on its ideal ratio to the heap size.
 
Methods inherited from class com.sun.squawk.GarbageCollector
getBytesAllocatedSinceLastGC, getBytesAllocatedTotal, getBytesFreedTotal, getBytesLastFreed, getBytesLastScanned, getLastGCTime, getMaxFullGCTime, getMaxGCTime, getMaxPartialGCTime, getTotalFullGCTime, getTotalGCTime, getTotalPartialGCTime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getIdealYoungGenerationSize

public int getIdealYoungGenerationSize()
Gets a size for the young generation based on its ideal ratio to the heap size.

Returns:
the ideal young generation size

getYoungGenerationSize

public int getYoungGenerationSize()
Gets the actual size (in bytes) of the young generation based on the current start address of the young generation, the ideal young generation size and the remaining amount of free memory in the heap.

Returns:
the minimum of the ideal young generation size and the amount of memory between the current start of the young generation and the end of the heap

setIdealYoungGenerationSizePercent

public void setIdealYoungGenerationSizePercent(int ygPct)
Sets the size for the young generation based on its ideal ratio to the heap size.

Parameters:
ygPct - the new young generation percent

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.