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

Thu, 19 Mar 2015 15:25:54 +0100

author
brutisso
date
Thu, 19 Mar 2015 15:25:54 +0100
changeset 7660
3ca53859c3c7
parent 7659
38d6febe66af
child 8070
c0205eddb317
permissions
-rw-r--r--

8027962: Per-phase timing measurements for strong roots processing
Reviewed-by: tschatzl, ecaspole

mgerdin@7659 1 /*
mgerdin@7659 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
mgerdin@7659 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mgerdin@7659 4 *
mgerdin@7659 5 * This code is free software; you can redistribute it and/or modify it
mgerdin@7659 6 * under the terms of the GNU General Public License version 2 only, as
mgerdin@7659 7 * published by the Free Software Foundation.
mgerdin@7659 8 *
mgerdin@7659 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mgerdin@7659 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mgerdin@7659 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mgerdin@7659 12 * version 2 for more details (a copy is included in the LICENSE file that
mgerdin@7659 13 * accompanied this code).
mgerdin@7659 14 *
mgerdin@7659 15 * You should have received a copy of the GNU General Public License version
mgerdin@7659 16 * 2 along with this work; if not, write to the Free Software Foundation,
mgerdin@7659 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mgerdin@7659 18 *
mgerdin@7659 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
mgerdin@7659 20 * or visit www.oracle.com if you need additional information or have any
mgerdin@7659 21 * questions.
mgerdin@7659 22 *
mgerdin@7659 23 */
mgerdin@7659 24
mgerdin@7659 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_ROOTPROCESSOR_HPP
mgerdin@7659 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_ROOTPROCESSOR_HPP
mgerdin@7659 27
mgerdin@7659 28 #include "memory/allocation.hpp"
mgerdin@7659 29 #include "memory/sharedHeap.hpp"
mgerdin@7659 30 #include "runtime/mutex.hpp"
mgerdin@7659 31
mgerdin@7659 32 class CLDClosure;
mgerdin@7659 33 class CodeBlobClosure;
mgerdin@7659 34 class G1CollectedHeap;
brutisso@7660 35 class G1GCPhaseTimes;
mgerdin@7659 36 class G1ParPushHeapRSClosure;
mgerdin@7659 37 class Monitor;
mgerdin@7659 38 class OopClosure;
mgerdin@7659 39 class SubTasksDone;
mgerdin@7659 40
mgerdin@7659 41 // Scoped object to assist in applying oop, CLD and code blob closures to
mgerdin@7659 42 // root locations. Handles claiming of different root scanning tasks
mgerdin@7659 43 // and takes care of global state for root scanning via a StrongRootsScope.
mgerdin@7659 44 // In the parallel case there is a shared G1RootProcessor object where all
mgerdin@7659 45 // worker thread call the process_roots methods.
mgerdin@7659 46 class G1RootProcessor : public StackObj {
mgerdin@7659 47 G1CollectedHeap* _g1h;
mgerdin@7659 48 SubTasksDone* _process_strong_tasks;
mgerdin@7659 49 SharedHeap::StrongRootsScope _srs;
mgerdin@7659 50
mgerdin@7659 51 // Used to implement the Thread work barrier.
mgerdin@7659 52 Monitor _lock;
mgerdin@7659 53 volatile jint _n_workers_discovered_strong_classes;
mgerdin@7659 54
mgerdin@7659 55 enum G1H_process_roots_tasks {
mgerdin@7659 56 G1RP_PS_Universe_oops_do,
mgerdin@7659 57 G1RP_PS_JNIHandles_oops_do,
mgerdin@7659 58 G1RP_PS_ObjectSynchronizer_oops_do,
mgerdin@7659 59 G1RP_PS_FlatProfiler_oops_do,
mgerdin@7659 60 G1RP_PS_Management_oops_do,
mgerdin@7659 61 G1RP_PS_SystemDictionary_oops_do,
mgerdin@7659 62 G1RP_PS_ClassLoaderDataGraph_oops_do,
mgerdin@7659 63 G1RP_PS_jvmti_oops_do,
mgerdin@7659 64 G1RP_PS_CodeCache_oops_do,
mgerdin@7659 65 G1RP_PS_filter_satb_buffers,
mgerdin@7659 66 G1RP_PS_refProcessor_oops_do,
mgerdin@7659 67 // Leave this one last.
mgerdin@7659 68 G1RP_PS_NumElements
mgerdin@7659 69 };
mgerdin@7659 70
mgerdin@7659 71 void worker_has_discovered_all_strong_classes();
mgerdin@7659 72 void wait_until_all_strong_classes_discovered();
mgerdin@7659 73
mgerdin@7659 74 void process_java_roots(OopClosure* scan_non_heap_roots,
mgerdin@7659 75 CLDClosure* thread_stack_clds,
mgerdin@7659 76 CLDClosure* scan_strong_clds,
mgerdin@7659 77 CLDClosure* scan_weak_clds,
brutisso@7660 78 CodeBlobClosure* scan_strong_code,
brutisso@7660 79 G1GCPhaseTimes* phase_times,
brutisso@7660 80 uint worker_i);
mgerdin@7659 81
mgerdin@7659 82 void process_vm_roots(OopClosure* scan_non_heap_roots,
brutisso@7660 83 OopClosure* scan_non_heap_weak_roots,
brutisso@7660 84 G1GCPhaseTimes* phase_times,
brutisso@7660 85 uint worker_i);
mgerdin@7659 86
mgerdin@7659 87 public:
mgerdin@7659 88 G1RootProcessor(G1CollectedHeap* g1h);
mgerdin@7659 89
mgerdin@7659 90 // Apply closures to the strongly and weakly reachable roots in the system
mgerdin@7659 91 // in a single pass.
mgerdin@7659 92 // Record and report timing measurements for sub phases using the worker_i
mgerdin@7659 93 void evacuate_roots(OopClosure* scan_non_heap_roots,
mgerdin@7659 94 OopClosure* scan_non_heap_weak_roots,
mgerdin@7659 95 CLDClosure* scan_strong_clds,
mgerdin@7659 96 CLDClosure* scan_weak_clds,
mgerdin@7659 97 bool trace_metadata,
mgerdin@7659 98 uint worker_i);
mgerdin@7659 99
mgerdin@7659 100 // Apply oops, clds and blobs to all strongly reachable roots in the system
mgerdin@7659 101 void process_strong_roots(OopClosure* oops,
mgerdin@7659 102 CLDClosure* clds,
mgerdin@7659 103 CodeBlobClosure* blobs);
mgerdin@7659 104
mgerdin@7659 105 // Apply oops, clds and blobs to strongly and weakly reachable roots in the system
mgerdin@7659 106 void process_all_roots(OopClosure* oops,
mgerdin@7659 107 CLDClosure* clds,
mgerdin@7659 108 CodeBlobClosure* blobs);
mgerdin@7659 109
mgerdin@7659 110 // Apply scan_rs to all locations in the union of the remembered sets for all
mgerdin@7659 111 // regions in the collection set
mgerdin@7659 112 // (having done "set_region" to indicate the region in which the root resides),
mgerdin@7659 113 void scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs,
mgerdin@7659 114 OopClosure* scan_non_heap_weak_roots,
mgerdin@7659 115 uint worker_i);
mgerdin@7659 116
mgerdin@7659 117 // Inform the root processor about the number of worker threads
mgerdin@7659 118 void set_num_workers(int active_workers);
mgerdin@7659 119 };
mgerdin@7659 120
mgerdin@7659 121 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_ROOTPROCESSOR_HPP

mercurial