Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp
38920 views
/*1* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP25#define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP2627#include "gc_implementation/g1/g1HotCardCache.hpp"28#include "memory/allocation.hpp"29#include "runtime/thread.hpp"30#include "utilities/globalDefinitions.hpp"3132// Forward decl33class ConcurrentG1RefineThread;34class G1CollectedHeap;35class G1HotCardCache;36class G1RegionToSpaceMapper;37class G1RemSet;38class DirtyCardQueue;3940class ConcurrentG1Refine: public CHeapObj<mtGC> {41ConcurrentG1RefineThread** _threads;42uint _n_threads;43uint _n_worker_threads;44/*45* The value of the update buffer queue length falls into one of 3 zones:46* green, yellow, red. If the value is in [0, green) nothing is47* done, the buffers are left unprocessed to enable the caching effect of the48* dirtied cards. In the yellow zone [green, yellow) the concurrent refinement49* threads are gradually activated. In [yellow, red) all threads are50* running. If the length becomes red (max queue length) the mutators start51* processing the buffers.52*53* There are some interesting cases (when G1UseAdaptiveConcRefinement54* is turned off):55* 1) green = yellow = red = 0. In this case the mutator will process all56* buffers. Except for those that are created by the deferred updates57* machinery during a collection.58* 2) green = 0. Means no caching. Can be a good way to minimize the59* amount of time spent updating rsets during a collection.60*/61int _green_zone;62int _yellow_zone;63int _red_zone;6465int _thread_threshold_step;6667// We delay the refinement of 'hot' cards using the hot card cache.68G1HotCardCache _hot_card_cache;6970// Reset the threshold step value based of the current zone boundaries.71void reset_threshold_step();7273public:74ConcurrentG1Refine(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure);75~ConcurrentG1Refine();7677void init(G1RegionToSpaceMapper* card_counts_storage);78void stop();7980void reinitialize_threads();8182// Iterate over all concurrent refinement threads83void threads_do(ThreadClosure *tc);8485// Iterate over all worker refinement threads86void worker_threads_do(ThreadClosure * tc);8788// The RS sampling thread89ConcurrentG1RefineThread * sampling_thread() const;9091static uint thread_num();9293void print_worker_threads_on(outputStream* st) const;9495void set_green_zone(int x) { _green_zone = x; }96void set_yellow_zone(int x) { _yellow_zone = x; }97void set_red_zone(int x) { _red_zone = x; }9899int green_zone() const { return _green_zone; }100int yellow_zone() const { return _yellow_zone; }101int red_zone() const { return _red_zone; }102103uint total_thread_num() const { return _n_threads; }104uint worker_thread_num() const { return _n_worker_threads; }105106int thread_threshold_step() const { return _thread_threshold_step; }107108G1HotCardCache* hot_card_cache() { return &_hot_card_cache; }109};110111#endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP112113114