src/hotspot/share/gc/g1/g1RootProcessor.cpp
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 58375 a1eba2e37671
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
     1
/*
53536
482109fae02b 8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents: 51959
diff changeset
     2
 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
     4
 *
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
     8
 *
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    13
 * accompanied this code).
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    14
 *
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    18
 *
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    21
 * questions.
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    22
 *
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    23
 */
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    24
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    25
#include "precompiled.hpp"
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41077
diff changeset
    26
#include "aot/aotLoader.hpp"
51959
db0c3952de52 8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents: 51598
diff changeset
    27
#include "classfile/classLoaderDataGraph.hpp"
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    28
#include "classfile/stringTable.hpp"
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    29
#include "classfile/systemDictionary.hpp"
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    30
#include "code/codeCache.hpp"
49751
c3a10df652c0 8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents: 49643
diff changeset
    31
#include "gc/g1/g1BarrierSet.hpp"
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents: 32348
diff changeset
    32
#include "gc/g1/g1CodeBlobClosure.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30585
diff changeset
    33
#include "gc/g1/g1CollectedHeap.inline.hpp"
31331
a7c714b6cfb3 7097567: G1: abstract and encapsulate collector phases and transitions between them
drwhite
parents: 30869
diff changeset
    34
#include "gc/g1/g1CollectorState.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30585
diff changeset
    35
#include "gc/g1/g1GCPhaseTimes.hpp"
49911
358be4680d12 6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents: 49751
diff changeset
    36
#include "gc/g1/g1ParScanThreadState.inline.hpp"
37985
539c597ee0fa 8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents: 33213
diff changeset
    37
#include "gc/g1/g1Policy.hpp"
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
    38
#include "gc/g1/g1RootClosures.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30585
diff changeset
    39
#include "gc/g1/g1RootProcessor.hpp"
32185
49a57ff2c3cb 8073052: Rename and clean up the allocation manager hierarchy in g1Allocator.?pp
tschatzl
parents: 31331
diff changeset
    40
#include "gc/g1/heapRegion.inline.hpp"
49982
9042ffe5b7fe 8200729: Conditional compilation of GCs
stefank
parents: 49911
diff changeset
    41
#include "gc/shared/referenceProcessor.hpp"
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    42
#include "memory/allocation.inline.hpp"
54786
ebf733a324d4 8223624: Cleanup includes of universe.hpp
stefank
parents: 54713
diff changeset
    43
#include "memory/universe.hpp"
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    44
#include "runtime/mutex.hpp"
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    45
#include "services/management.hpp"
46681
f17cefd211b4 8183935: G1GCPhaseTimes and G1RootProcessor do not include macros.hpp
mgerdin
parents: 42650
diff changeset
    46
#include "utilities/macros.hpp"
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    47
58263
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
    48
void G1RootProcessor::worker_has_discovered_all_strong_nmethods() {
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    49
  assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    50
30178
33317ec95df7 8077710: BACKOUT - java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents: 30172
diff changeset
    51
  uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
30868
c1b24f26deed 8080110: Remove usage of CollectedHeap::n_par_threads() from root processing
stefank
parents: 30867
diff changeset
    52
  if (new_value == n_workers()) {
30178
33317ec95df7 8077710: BACKOUT - java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents: 30172
diff changeset
    53
    // This thread is last. Notify the others.
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54364
diff changeset
    54
    MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
30178
33317ec95df7 8077710: BACKOUT - java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents: 30172
diff changeset
    55
    _lock.notify_all();
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    56
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    57
}
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    58
58263
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
    59
void G1RootProcessor::wait_until_all_strong_nmethods_discovered() {
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    60
  assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    61
30868
c1b24f26deed 8080110: Remove usage of CollectedHeap::n_par_threads() from root processing
stefank
parents: 30867
diff changeset
    62
  if ((uint)_n_workers_discovered_strong_classes != n_workers()) {
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54364
diff changeset
    63
    MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
30868
c1b24f26deed 8080110: Remove usage of CollectedHeap::n_par_threads() from root processing
stefank
parents: 30867
diff changeset
    64
    while ((uint)_n_workers_discovered_strong_classes != n_workers()) {
54645
05aaccf7d558 8222988: Use MonitorLocker rather than MutexLocker when wait/notify used
coleenp
parents: 54623
diff changeset
    65
      ml.wait(0);
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    66
    }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    67
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    68
}
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    69
30868
c1b24f26deed 8080110: Remove usage of CollectedHeap::n_par_threads() from root processing
stefank
parents: 30867
diff changeset
    70
G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h, uint n_workers) :
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    71
    _g1h(g1h),
32348
47acdfbd402c 8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
david
parents: 32185
diff changeset
    72
    _process_strong_tasks(G1RP_PS_NumElements),
30868
c1b24f26deed 8080110: Remove usage of CollectedHeap::n_par_threads() from root processing
stefank
parents: 30867
diff changeset
    73
    _srs(n_workers),
58375
a1eba2e37671 8231472: Clean up Monitor::_safepoint_check usage to Mutex::_safepoint_check
coleenp
parents: 58264
diff changeset
    74
    _lock(Mutex::leaf, "G1 Root Scan barrier lock", false, Mutex::_safepoint_check_never),
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    75
    _n_workers_discovered_strong_classes(0) {}
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    76
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
    77
void G1RootProcessor::evacuate_roots(G1ParScanThreadState* pss, uint worker_id) {
53986
9ad20fd52b19 8219748: Add and use getter for the timing object in G1
tschatzl
parents: 53985
diff changeset
    78
  G1GCPhaseTimes* phase_times = _g1h->phase_times();
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    79
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
    80
  G1EvacPhaseTimesTracker timer(phase_times, pss, G1GCPhaseTimes::ExtRootScan, worker_id);
49911
358be4680d12 6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents: 49751
diff changeset
    81
358be4680d12 6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents: 49751
diff changeset
    82
  G1EvacuationRootClosures* closures = pss->closures();
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
    83
  process_java_roots(closures, phase_times, worker_id, closures->trace_metadata() /* notify_claimed_nmethods_done */);
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    84
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
    85
  process_vm_roots(closures, phase_times, worker_id);
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    86
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
    87
  {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
    88
    // Now the CM ref_processor roots.
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
    89
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_id);
51598
c88019b32bc4 8210119: Rename SubTasksDone::is_task_claimed
kbarrett
parents: 51546
diff changeset
    90
    if (_process_strong_tasks.try_claim_task(G1RP_PS_refProcessor_oops_do)) {
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
    91
      // We need to treat the discovered reference lists of the
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
    92
      // concurrent mark ref processor as roots and keep entries
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
    93
      // (which are added by the marking threads) on them live
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
    94
      // until they can be processed at the end of marking.
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
    95
      _g1h->ref_processor_cm()->weak_oops_do(closures->strong_oops());
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
    96
    }
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    97
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
    98
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
    99
  if (closures->trace_metadata()) {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   100
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WaitForStrongRoots, worker_id);
58263
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   101
    // Wait to make sure all workers passed the strong nmethods phase.
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   102
    wait_until_all_strong_nmethods_discovered();
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   103
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   104
32348
47acdfbd402c 8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
david
parents: 32185
diff changeset
   105
  _process_strong_tasks.all_tasks_completed(n_workers());
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   106
}
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   107
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   108
// Adaptor to pass the closures to the strong roots in the VM.
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   109
class StrongRootsClosures : public G1RootClosures {
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   110
  OopClosure* _roots;
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   111
  CLDClosure* _clds;
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   112
  CodeBlobClosure* _blobs;
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   113
public:
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   114
  StrongRootsClosures(OopClosure* roots, CLDClosure* clds, CodeBlobClosure* blobs) :
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   115
      _roots(roots), _clds(clds), _blobs(blobs) {}
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   116
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   117
  OopClosure* weak_oops()   { return NULL; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   118
  OopClosure* strong_oops() { return _roots; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   119
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   120
  CLDClosure* weak_clds()        { return NULL; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   121
  CLDClosure* strong_clds()      { return _clds; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   122
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   123
  CodeBlobClosure* strong_codeblobs() { return _blobs; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   124
};
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   125
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   126
void G1RootProcessor::process_strong_roots(OopClosure* oops,
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   127
                                           CLDClosure* clds,
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   128
                                           CodeBlobClosure* blobs) {
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   129
  StrongRootsClosures closures(oops, clds, blobs);
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   130
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   131
  process_java_roots(&closures, NULL, 0);
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   132
  process_vm_roots(&closures, NULL, 0);
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   133
32348
47acdfbd402c 8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
david
parents: 32185
diff changeset
   134
  _process_strong_tasks.all_tasks_completed(n_workers());
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   135
}
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   136
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   137
// Adaptor to pass the closures to all the roots in the VM.
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   138
class AllRootsClosures : public G1RootClosures {
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   139
  OopClosure* _roots;
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   140
  CLDClosure* _clds;
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   141
public:
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   142
  AllRootsClosures(OopClosure* roots, CLDClosure* clds) :
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   143
      _roots(roots), _clds(clds) {}
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   144
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   145
  OopClosure* weak_oops() { return _roots; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   146
  OopClosure* strong_oops() { return _roots; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   147
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   148
  // By returning the same CLDClosure for both weak and strong CLDs we ensure
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   149
  // that a single walk of the CLDG will invoke the closure on all CLDs i the
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   150
  // system.
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   151
  CLDClosure* weak_clds() { return _clds; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   152
  CLDClosure* strong_clds() { return _clds; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   153
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   154
  // We don't want to visit code blobs more than once, so we return NULL for the
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   155
  // strong case and walk the entire code cache as a separate step.
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   156
  CodeBlobClosure* strong_codeblobs() { return NULL; }
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   157
};
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   158
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   159
void G1RootProcessor::process_all_roots(OopClosure* oops,
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   160
                                        CLDClosure* clds,
53536
482109fae02b 8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents: 51959
diff changeset
   161
                                        CodeBlobClosure* blobs) {
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   162
  AllRootsClosures closures(oops, clds);
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   163
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   164
  process_java_roots(&closures, NULL, 0);
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   165
  process_vm_roots(&closures, NULL, 0);
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   166
41077
19f70464986e 8114823: G1 doesn't honor request to disable class unloading
sjohanss
parents: 38074
diff changeset
   167
  process_code_cache_roots(blobs, NULL, 0);
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   168
32348
47acdfbd402c 8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
david
parents: 32185
diff changeset
   169
  _process_strong_tasks.all_tasks_completed(n_workers());
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   170
}
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   171
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   172
void G1RootProcessor::process_java_roots(G1RootClosures* closures,
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   173
                                         G1GCPhaseTimes* phase_times,
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   174
                                         uint worker_id,
58263
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   175
                                         bool notify_claimed_nmethods_done) {
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   176
  // We need to make make sure that the "strong" nmethods are processed first
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   177
  // using the strong closure. Only after that we process the weakly reachable
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   178
  // nmethods.
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   179
  // We need to strictly separate the strong and weak nmethod processing because
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   180
  // any processing claims that nmethod, i.e. will not be iterated again.
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   181
  // Which means if an nmethod is processed first and claimed, the strong processing
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   182
  // will not happen, and the oops reachable by that nmethod will not be marked
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   183
  // properly.
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   184
  //
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   185
  // That is why we process strong nmethods first, synchronize all threads via a
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   186
  // barrier, and only then allow weak processing. To minimize the wait time at
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   187
  // that barrier we do the strong nmethod processing first, and immediately after-
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   188
  // wards indicate that that thread is done. Hopefully other root processing after
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   189
  // nmethod processing is enough so there is no need to wait.
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   190
  //
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   191
  // This is only required in the concurrent start pause with class unloading enabled.
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   192
  {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   193
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_id);
30868
c1b24f26deed 8080110: Remove usage of CollectedHeap::n_par_threads() from root processing
stefank
parents: 30867
diff changeset
   194
    bool is_par = n_workers() > 1;
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   195
    Threads::possibly_parallel_oops_do(is_par,
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   196
                                       closures->strong_oops(),
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   197
                                       closures->strong_codeblobs());
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   198
  }
58263
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   199
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   200
  // This is the point where this worker thread will not find more strong nmethods.
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   201
  // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing.
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   202
  if (notify_claimed_nmethods_done) {
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   203
    worker_has_discovered_all_strong_nmethods();
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   204
  }
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   205
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   206
  {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   207
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_id);
58263
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   208
    if (_process_strong_tasks.try_claim_task(G1RP_PS_ClassLoaderDataGraph_oops_do)) {
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   209
      ClassLoaderDataGraph::roots_cld_do(closures->strong_clds(), closures->weak_clds());
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   210
    }
4fbc534fdf69 8159984: Remove call to ClassLoaderDataGraph::clear_claimed_marks during the initial mark pause
tschatzl
parents: 55740
diff changeset
   211
  }
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   212
}
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   213
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   214
void G1RootProcessor::process_vm_roots(G1RootClosures* closures,
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   215
                                       G1GCPhaseTimes* phase_times,
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   216
                                       uint worker_id) {
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   217
  OopClosure* strong_roots = closures->strong_oops();
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
   218
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   219
  {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   220
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_id);
51598
c88019b32bc4 8210119: Rename SubTasksDone::is_task_claimed
kbarrett
parents: 51546
diff changeset
   221
    if (_process_strong_tasks.try_claim_task(G1RP_PS_Universe_oops_do)) {
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   222
      Universe::oops_do(strong_roots);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   223
    }
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   224
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   225
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   226
  {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   227
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_id);
51598
c88019b32bc4 8210119: Rename SubTasksDone::is_task_claimed
kbarrett
parents: 51546
diff changeset
   228
    if (_process_strong_tasks.try_claim_task(G1RP_PS_JNIHandles_oops_do)) {
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   229
      JNIHandles::oops_do(strong_roots);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   230
    }
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   231
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   232
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   233
  {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   234
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_id);
51598
c88019b32bc4 8210119: Rename SubTasksDone::is_task_claimed
kbarrett
parents: 51546
diff changeset
   235
    if (_process_strong_tasks.try_claim_task(G1RP_PS_ObjectSynchronizer_oops_do)) {
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   236
      ObjectSynchronizer::oops_do(strong_roots);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   237
    }
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   238
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   239
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   240
  {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   241
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_id);
51598
c88019b32bc4 8210119: Rename SubTasksDone::is_task_claimed
kbarrett
parents: 51546
diff changeset
   242
    if (_process_strong_tasks.try_claim_task(G1RP_PS_Management_oops_do)) {
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   243
      Management::oops_do(strong_roots);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   244
    }
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   245
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   246
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   247
  {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   248
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_id);
51598
c88019b32bc4 8210119: Rename SubTasksDone::is_task_claimed
kbarrett
parents: 51546
diff changeset
   249
    if (_process_strong_tasks.try_claim_task(G1RP_PS_jvmti_oops_do)) {
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   250
      JvmtiExport::oops_do(strong_roots);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   251
    }
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   252
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   253
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41077
diff changeset
   254
#if INCLUDE_AOT
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41077
diff changeset
   255
  if (UseAOT) {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   256
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::AOTCodeRoots, worker_id);
51598
c88019b32bc4 8210119: Rename SubTasksDone::is_task_claimed
kbarrett
parents: 51546
diff changeset
   257
    if (_process_strong_tasks.try_claim_task(G1RP_PS_aot_oops_do)) {
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41077
diff changeset
   258
        AOTLoader::oops_do(strong_roots);
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41077
diff changeset
   259
    }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41077
diff changeset
   260
  }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41077
diff changeset
   261
#endif
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41077
diff changeset
   262
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   263
  {
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   264
    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_id);
51598
c88019b32bc4 8210119: Rename SubTasksDone::is_task_claimed
kbarrett
parents: 51546
diff changeset
   265
    if (_process_strong_tasks.try_claim_task(G1RP_PS_SystemDictionary_oops_do)) {
50297
580744d900c8 8202813: Move vm_weak processing from SystemDictionary to WeakProcessor
coleenp
parents: 49982
diff changeset
   266
      SystemDictionary::oops_do(strong_roots);
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 29693
diff changeset
   267
    }
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   268
  }
41077
19f70464986e 8114823: G1 doesn't honor request to disable class unloading
sjohanss
parents: 38074
diff changeset
   269
}
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   270
41077
19f70464986e 8114823: G1 doesn't honor request to disable class unloading
sjohanss
parents: 38074
diff changeset
   271
void G1RootProcessor::process_code_cache_roots(CodeBlobClosure* code_closure,
19f70464986e 8114823: G1 doesn't honor request to disable class unloading
sjohanss
parents: 38074
diff changeset
   272
                                               G1GCPhaseTimes* phase_times,
58264
4e96939a5746 8231189: Rename worker_i parameters to worker_id
tschatzl
parents: 58263
diff changeset
   273
                                               uint worker_id) {
51598
c88019b32bc4 8210119: Rename SubTasksDone::is_task_claimed
kbarrett
parents: 51546
diff changeset
   274
  if (_process_strong_tasks.try_claim_task(G1RP_PS_CodeCache_oops_do)) {
41077
19f70464986e 8114823: G1 doesn't honor request to disable class unloading
sjohanss
parents: 38074
diff changeset
   275
    CodeCache::blobs_do(code_closure);
29693
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   276
  }
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   277
}
fac175f7a466 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff changeset
   278
30868
c1b24f26deed 8080110: Remove usage of CollectedHeap::n_par_threads() from root processing
stefank
parents: 30867
diff changeset
   279
uint G1RootProcessor::n_workers() const {
c1b24f26deed 8080110: Remove usage of CollectedHeap::n_par_threads() from root processing
stefank
parents: 30867
diff changeset
   280
  return _srs.n_threads();
c1b24f26deed 8080110: Remove usage of CollectedHeap::n_par_threads() from root processing
stefank
parents: 30867
diff changeset
   281
}