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