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

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,81 @@
     1.4 +/*
     1.5 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSMARKSWEEPDECORATOR_HPP
    1.29 +#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSMARKSWEEPDECORATOR_HPP
    1.30 +
    1.31 +#include "gc_implementation/shared/mutableSpace.hpp"
    1.32 +
    1.33 +//
    1.34 +// A PSMarkSweepDecorator is used to add "ParallelScavenge" style mark sweep operations
    1.35 +// to a MutableSpace.
    1.36 +//
    1.37 +
    1.38 +class ObjectStartArray;
    1.39 +
    1.40 +class PSMarkSweepDecorator: public CHeapObj<mtGC> {
    1.41 + private:
    1.42 +  static PSMarkSweepDecorator* _destination_decorator;
    1.43 +
    1.44 + protected:
    1.45 +  MutableSpace* _space;
    1.46 +  ObjectStartArray* _start_array;
    1.47 +  HeapWord* _first_dead;
    1.48 +  HeapWord* _end_of_live;
    1.49 +  HeapWord* _compaction_top;
    1.50 +  size_t _allowed_dead_ratio;
    1.51 +
    1.52 +  bool insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q,
    1.53 +                        size_t word_len);
    1.54 +
    1.55 + public:
    1.56 +  PSMarkSweepDecorator(MutableSpace* space, ObjectStartArray* start_array,
    1.57 +                       size_t allowed_dead_ratio) :
    1.58 +    _space(space), _start_array(start_array),
    1.59 +    _allowed_dead_ratio(allowed_dead_ratio) { }
    1.60 +
    1.61 +  // During a compacting collection, we need to collapse objects into
    1.62 +  // spaces in a given order. We want to fill space A, space B, and so
    1.63 +  // on. The code that controls that order is in the following methods.
    1.64 +  static void set_destination_decorator_tenured();
    1.65 +  static void advance_destination_decorator();
    1.66 +  static PSMarkSweepDecorator* destination_decorator();
    1.67 +
    1.68 +  // Accessors
    1.69 +  MutableSpace* space()                     { return _space; }
    1.70 +  ObjectStartArray* start_array()           { return _start_array; }
    1.71 +
    1.72 +  HeapWord* compaction_top()                { return _compaction_top; }
    1.73 +  void set_compaction_top(HeapWord* value)  { _compaction_top = value; }
    1.74 +
    1.75 +  size_t allowed_dead_ratio()               { return _allowed_dead_ratio; }
    1.76 +  void set_allowed_dead_ratio(size_t value) { _allowed_dead_ratio = value; }
    1.77 +
    1.78 +  // Work methods
    1.79 +  void adjust_pointers();
    1.80 +  void precompact();
    1.81 +  void compact(bool mangle_free_space);
    1.82 +};
    1.83 +
    1.84 +#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSMARKSWEEPDECORATOR_HPP

mercurial