Deep-dive Hotspot stuff

GC flags in the source files in the hotspot folder

Neat piece of HotSpot code block - see how branching occurs depending on the type of GC you have selected

TYPE OF GC Young Generation Old Generation
SerialGC (-XX:+UseSerialGC) Serial Serial
ParallGC (-XX:+UseParallelGC) Parallel Serial
Parallel Compacting(-XX:+UseParallelOldGC) Parallel Parallel
Concurrent Mark Sweep GC (-XX:+UseConcMarkSweepGC) Parallel CMS

(http://www.weblogic-training.com/performance-tuning/difference-between-serial-gc-parallgc-cms-(-concurrent-mark-sweep)-gc/)

Code snippet from ./hotspot/src/share/vm/memory/universe.cpp

.
.
.
Universe::initialize_heap()
if (UseParallelGC) {
    #ifndef SERIALGC
    Universe::_collectedHeap = new ParallelScavengeHeap();
    #else // SERIALGC
        fatal("UseParallelGC not supported in this VM.");
    #endif // SERIALGC
} else if (UseG1GC) {
    #ifndef SERIALGC
    G1CollectorPolicy* g1p = new G1CollectorPolicy();
    G1CollectedHeap* g1h = new G1CollectedHeap(g1p);
    Universe::_collectedHeap = g1h;
    #else // SERIALGC
        fatal("UseG1GC not supported in java kernel vm.");
    #endif // SERIALGC
} else {
    GenCollectorPolicy* gc_policy;
    if (UseSerialGC) {
        gc_policy = new MarkSweepPolicy();
    } else if (UseConcMarkSweepGC) {
        #ifndef SERIALGC
        if (UseAdaptiveSizePolicy) {
            gc_policy = new ASConcurrentMarkSweepPolicy();
        } else {
            gc_policy = new ConcurrentMarkSweepPolicy();
        }
        #else // SERIALGC
            fatal("UseConcMarkSweepGC not supported in this VM.");
        #endif // SERIALGC
    } else { // default old generation
        gc_policy = new MarkSweepPolicy();
    }
    Universe::_collectedHeap = new GenCollectedHeap(gc_policy);
}


SERIALGC switched ON - platforms that only support SERIAL GC?
.
.
.
Universe::initialize_heap()
if (UseParallelGC) {
        fatal("UseParallelGC not supported in this VM.");
} else if (UseG1GC) {
        fatal("UseG1GC not supported in java kernel vm.");
} else {
    GenCollectorPolicy* gc_policy;
    if (UseSerialGC) {
        gc_policy = new MarkSweepPolicy();
    } else if (UseConcMarkSweepGC) {
            fatal("UseConcMarkSweepGC not supported in this VM.");
    } else { // default old generation
        gc_policy = new MarkSweepPolicy();
    }
    Universe::_collectedHeap = new GenCollectedHeap(gc_policy);
}
.
.
.


SERIALGC switched OFF - platforms that support both types of GC?
.
.
.

Universe::initialize_heap()

if (UseParallelGC) {
    Universe::_collectedHeap = new ParallelScavengeHeap();
} else if (UseG1GC) {
    G1CollectorPolicy* g1p = new G1CollectorPolicy();
    G1CollectedHeap* g1h = new G1CollectedHeap(g1p);
    Universe::_collectedHeap = g1h;
} else {
    GenCollectorPolicy* gc_policy;

    if (UseSerialGC) {
        gc_policy = new MarkSweepPolicy();
    } else if (UseConcMarkSweepGC) {
        if (UseAdaptiveSizePolicy) {
            gc_policy = new ASConcurrentMarkSweepPolicy();
        } else {
            gc_policy = new ConcurrentMarkSweepPolicy();
        }
    } else { // default old generation
        gc_policy = new MarkSweepPolicy();
    }

    Universe::_collectedHeap = new GenCollectedHeap(gc_policy);
}
.
.
.

results matching ""

    No results matching ""