src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP
aoqi@0 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP
aoqi@0 27
aoqi@0 28 #include "gc_implementation/g1/g1HotCardCache.hpp"
aoqi@0 29 #include "memory/allocation.hpp"
aoqi@0 30 #include "runtime/thread.hpp"
aoqi@0 31 #include "utilities/globalDefinitions.hpp"
aoqi@0 32
aoqi@0 33 // Forward decl
aoqi@0 34 class ConcurrentG1RefineThread;
aoqi@0 35 class G1CollectedHeap;
aoqi@0 36 class G1HotCardCache;
aoqi@0 37 class G1RemSet;
aoqi@0 38 class DirtyCardQueue;
aoqi@0 39
aoqi@0 40 class ConcurrentG1Refine: public CHeapObj<mtGC> {
aoqi@0 41 ConcurrentG1RefineThread** _threads;
aoqi@0 42 uint _n_threads;
aoqi@0 43 uint _n_worker_threads;
aoqi@0 44 /*
aoqi@0 45 * The value of the update buffer queue length falls into one of 3 zones:
aoqi@0 46 * green, yellow, red. If the value is in [0, green) nothing is
aoqi@0 47 * done, the buffers are left unprocessed to enable the caching effect of the
aoqi@0 48 * dirtied cards. In the yellow zone [green, yellow) the concurrent refinement
aoqi@0 49 * threads are gradually activated. In [yellow, red) all threads are
aoqi@0 50 * running. If the length becomes red (max queue length) the mutators start
aoqi@0 51 * processing the buffers.
aoqi@0 52 *
aoqi@0 53 * There are some interesting cases (when G1UseAdaptiveConcRefinement
aoqi@0 54 * is turned off):
aoqi@0 55 * 1) green = yellow = red = 0. In this case the mutator will process all
aoqi@0 56 * buffers. Except for those that are created by the deferred updates
aoqi@0 57 * machinery during a collection.
aoqi@0 58 * 2) green = 0. Means no caching. Can be a good way to minimize the
aoqi@0 59 * amount of time spent updating rsets during a collection.
aoqi@0 60 */
aoqi@0 61 int _green_zone;
aoqi@0 62 int _yellow_zone;
aoqi@0 63 int _red_zone;
aoqi@0 64
aoqi@0 65 int _thread_threshold_step;
aoqi@0 66
aoqi@0 67 // We delay the refinement of 'hot' cards using the hot card cache.
aoqi@0 68 G1HotCardCache _hot_card_cache;
aoqi@0 69
aoqi@0 70 // Reset the threshold step value based of the current zone boundaries.
aoqi@0 71 void reset_threshold_step();
aoqi@0 72
aoqi@0 73 public:
aoqi@0 74 ConcurrentG1Refine(G1CollectedHeap* g1h);
aoqi@0 75 ~ConcurrentG1Refine();
aoqi@0 76
aoqi@0 77 void init(); // Accomplish some initialization that has to wait.
aoqi@0 78 void stop();
aoqi@0 79
aoqi@0 80 void reinitialize_threads();
aoqi@0 81
aoqi@0 82 // Iterate over all concurrent refinement threads
aoqi@0 83 void threads_do(ThreadClosure *tc);
aoqi@0 84
aoqi@0 85 // Iterate over all worker refinement threads
aoqi@0 86 void worker_threads_do(ThreadClosure * tc);
aoqi@0 87
aoqi@0 88 // The RS sampling thread
aoqi@0 89 ConcurrentG1RefineThread * sampling_thread() const;
aoqi@0 90
aoqi@0 91 static uint thread_num();
aoqi@0 92
aoqi@0 93 void print_worker_threads_on(outputStream* st) const;
aoqi@0 94
aoqi@0 95 void set_green_zone(int x) { _green_zone = x; }
aoqi@0 96 void set_yellow_zone(int x) { _yellow_zone = x; }
aoqi@0 97 void set_red_zone(int x) { _red_zone = x; }
aoqi@0 98
aoqi@0 99 int green_zone() const { return _green_zone; }
aoqi@0 100 int yellow_zone() const { return _yellow_zone; }
aoqi@0 101 int red_zone() const { return _red_zone; }
aoqi@0 102
aoqi@0 103 uint total_thread_num() const { return _n_threads; }
aoqi@0 104 uint worker_thread_num() const { return _n_worker_threads; }
aoqi@0 105
aoqi@0 106 int thread_threshold_step() const { return _thread_threshold_step; }
aoqi@0 107
aoqi@0 108 G1HotCardCache* hot_card_cache() { return &_hot_card_cache; }
aoqi@0 109 };
aoqi@0 110
aoqi@0 111 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP

mercurial