Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.squawk
Class Lisp2GenerationalCollector

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

All Implemented Interfaces:
  GlobalStaticFields

    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 ->                                                --+

ENABLE_DYNAMIC_CLASSLOADING: If the build property ENABLE_DYNAMIC_CLASSLOADING is true, then GC has to handle Klasses in the heap, and forwarded klasses. Otherwise we can assume that a Klass is in ROM (or NVM).

Field Summary

Fields inherited from class com.sun.squawk.GarbageCollector
`NATIVE_GC_ONLY, numBytesLastScanned, references`

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

### 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

### 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

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"