src/share/vm/gc_implementation/parallelScavenge/psTasks.hpp

changeset 3294
bca17e38de00
parent 2314
f95d63e2154a
child 4128
f81a7c0c618d
     1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psTasks.hpp	Tue Nov 22 04:47:10 2011 -0500
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psTasks.hpp	Tue Aug 09 10:16:01 2011 -0700
     1.3 @@ -135,16 +135,63 @@
     1.4  // OldToYoungRootsTask
     1.5  //
     1.6  // This task is used to scan old to young roots in parallel
     1.7 +//
     1.8 +// A GC thread executing this tasks divides the generation (old gen)
     1.9 +// into slices and takes a stripe in the slice as its part of the
    1.10 +// work.
    1.11 +//
    1.12 +//      +===============+        slice 0
    1.13 +//      |  stripe 0     |
    1.14 +//      +---------------+
    1.15 +//      |  stripe 1     |
    1.16 +//      +---------------+
    1.17 +//      |  stripe 2     |
    1.18 +//      +---------------+
    1.19 +//      |  stripe 3     |
    1.20 +//      +===============+        slice 1
    1.21 +//      |  stripe 0     |
    1.22 +//      +---------------+
    1.23 +//      |  stripe 1     |
    1.24 +//      +---------------+
    1.25 +//      |  stripe 2     |
    1.26 +//      +---------------+
    1.27 +//      |  stripe 3     |
    1.28 +//      +===============+        slice 2
    1.29 +//      ...
    1.30 +//
    1.31 +// A task is created for each stripe.  In this case there are 4 tasks
    1.32 +// created.  A GC thread first works on its stripe within slice 0
    1.33 +// and then moves to its stripe in the next slice until all stripes
    1.34 +// exceed the top of the generation.  Note that having fewer GC threads
    1.35 +// than stripes works because all the tasks are executed so all stripes
    1.36 +// will be covered.  In this example if 4 tasks have been created to cover
    1.37 +// all the stripes and there are only 3 threads, one of the threads will
    1.38 +// get the tasks with the 4th stripe.  However, there is a dependence in
    1.39 +// CardTableExtension::scavenge_contents_parallel() on the number
    1.40 +// of tasks created.  In scavenge_contents_parallel the distance
    1.41 +// to the next stripe is calculated based on the number of tasks.
    1.42 +// If the stripe width is ssize, a task's next stripe is at
    1.43 +// ssize * number_of_tasks (= slice_stride).  In this case after
    1.44 +// finishing stripe 0 in slice 0, the thread finds the stripe 0 in slice1
    1.45 +// by adding slice_stride to the start of stripe 0 in slice 0 to get
    1.46 +// to the start of stride 0 in slice 1.
    1.47  
    1.48  class OldToYoungRootsTask : public GCTask {
    1.49   private:
    1.50    PSOldGen* _gen;
    1.51    HeapWord* _gen_top;
    1.52    uint _stripe_number;
    1.53 +  uint _stripe_total;
    1.54  
    1.55   public:
    1.56 -  OldToYoungRootsTask(PSOldGen *gen, HeapWord* gen_top, uint stripe_number) :
    1.57 -    _gen(gen), _gen_top(gen_top), _stripe_number(stripe_number) { }
    1.58 +  OldToYoungRootsTask(PSOldGen *gen,
    1.59 +                      HeapWord* gen_top,
    1.60 +                      uint stripe_number,
    1.61 +                      uint stripe_total) :
    1.62 +    _gen(gen),
    1.63 +    _gen_top(gen_top),
    1.64 +    _stripe_number(stripe_number),
    1.65 +    _stripe_total(stripe_total) { }
    1.66  
    1.67    char* name() { return (char *)"old-to-young-roots-task"; }
    1.68  

mercurial