src/hotspot/share/gc/g1/g1FullCollector.cpp
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 57777 90ead0febf56
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     1
/*
53536
482109fae02b 8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents: 52904
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     4
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     8
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    13
 * accompanied this code).
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    14
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    18
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    21
 * questions.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    22
 *
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    23
 */
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    24
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    25
#include "precompiled.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    26
#include "code/codeCache.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    27
#include "gc/g1/g1CollectedHeap.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    28
#include "gc/g1/g1FullCollector.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    29
#include "gc/g1/g1FullGCAdjustTask.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    30
#include "gc/g1/g1FullGCCompactTask.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    31
#include "gc/g1/g1FullGCMarker.inline.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    32
#include "gc/g1/g1FullGCMarkTask.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    33
#include "gc/g1/g1FullGCPrepareTask.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    34
#include "gc/g1/g1FullGCReferenceProcessorExecutor.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    35
#include "gc/g1/g1FullGCScope.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    36
#include "gc/g1/g1OopClosures.hpp"
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
    37
#include "gc/g1/g1Policy.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    38
#include "gc/g1/g1StringDedup.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    39
#include "gc/shared/gcTraceTime.inline.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    40
#include "gc/shared/preservedMarks.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    41
#include "gc/shared/referenceProcessor.hpp"
54781
f3f07c76d3d1 8223619: Move VerifyOption out of Universe
stefank
parents: 54716
diff changeset
    42
#include "gc/shared/verifyOption.hpp"
51546
b9f6a4427da9 8072498: Multi-thread JNI weak reference processing
kbarrett
parents: 51497
diff changeset
    43
#include "gc/shared/weakProcessor.inline.hpp"
52904
d2f118d3f8e7 8213224: Move code related to GC threads calculation out of AdaptiveSizePolicy
manc
parents: 51546
diff changeset
    44
#include "gc/shared/workerPolicy.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    45
#include "logging/log.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    46
#include "runtime/biasedLocking.hpp"
49361
1956d0ec092a 8199319: Remove handles.inline.hpp include from reflectionUtils.hpp
stefank
parents: 49320
diff changeset
    47
#include "runtime/handles.inline.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    48
#include "utilities/debug.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    49
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    50
static void clear_and_activate_derived_pointers() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    51
#if COMPILER2_OR_JVMCI
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    52
  DerivedPointerTable::clear();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    53
#endif
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    54
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    55
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    56
static void deactivate_derived_pointers() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    57
#if COMPILER2_OR_JVMCI
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    58
  DerivedPointerTable::set_active(false);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    59
#endif
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    60
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    61
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    62
static void update_derived_pointers() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    63
#if COMPILER2_OR_JVMCI
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    64
  DerivedPointerTable::update_pointers();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    65
#endif
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    66
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    67
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
    68
G1CMBitMap* G1FullCollector::mark_bitmap() {
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
    69
  return _heap->concurrent_mark()->next_mark_bitmap();
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
    70
}
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
    71
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
    72
ReferenceProcessor* G1FullCollector::reference_processor() {
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
    73
  return _heap->ref_processor_stw();
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
    74
}
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
    75
49826
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    76
uint G1FullCollector::calc_active_workers() {
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    77
  G1CollectedHeap* heap = G1CollectedHeap::heap();
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    78
  uint max_worker_count = heap->workers()->total_workers();
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    79
  // Only calculate number of workers if UseDynamicNumberOfGCThreads
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    80
  // is enabled, otherwise use max.
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    81
  if (!UseDynamicNumberOfGCThreads) {
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    82
    return max_worker_count;
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    83
  }
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    84
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    85
  // Consider G1HeapWastePercent to decide max number of workers. Each worker
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    86
  // will in average cause half a region waste.
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    87
  uint max_wasted_regions_allowed = ((heap->num_regions() * G1HeapWastePercent) / 100);
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    88
  uint waste_worker_count = MAX2((max_wasted_regions_allowed * 2) , 1u);
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    89
  uint heap_waste_worker_limit = MIN2(waste_worker_count, max_worker_count);
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    90
52904
d2f118d3f8e7 8213224: Move code related to GC threads calculation out of AdaptiveSizePolicy
manc
parents: 51546
diff changeset
    91
  // Also consider HeapSizePerGCThread by calling WorkerPolicy to calculate
49826
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    92
  // the number of workers.
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    93
  uint current_active_workers = heap->workers()->active_workers();
52904
d2f118d3f8e7 8213224: Move code related to GC threads calculation out of AdaptiveSizePolicy
manc
parents: 51546
diff changeset
    94
  uint active_worker_limit = WorkerPolicy::calc_active_workers(max_worker_count, current_active_workers, 0);
49826
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    95
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    96
  // Update active workers to the lower of the limits.
52904
d2f118d3f8e7 8213224: Move code related to GC threads calculation out of AdaptiveSizePolicy
manc
parents: 51546
diff changeset
    97
  uint worker_count = MIN2(heap_waste_worker_limit, active_worker_limit);
49826
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
    98
  log_debug(gc, task)("Requesting %u active workers for full compaction (waste limited workers: %u, adaptive workers: %u)",
52904
d2f118d3f8e7 8213224: Move code related to GC threads calculation out of AdaptiveSizePolicy
manc
parents: 51546
diff changeset
    99
                      worker_count, heap_waste_worker_limit, active_worker_limit);
49826
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
   100
  worker_count = heap->workers()->update_active_workers(worker_count);
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
   101
  log_info(gc, task)("Using %u workers of %u for full compaction", worker_count, max_worker_count);
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
   102
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
   103
  return worker_count;
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
   104
}
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
   105
51497
ec014e5694ec 8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents: 51405
diff changeset
   106
G1FullCollector::G1FullCollector(G1CollectedHeap* heap, bool explicit_gc, bool clear_soft_refs) :
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   107
    _heap(heap),
51497
ec014e5694ec 8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents: 51405
diff changeset
   108
    _scope(heap->g1mm(), explicit_gc, clear_soft_refs),
49826
ad1a5f49b8ae 8196071: Change G1 Full GC heap and thread sizing ergonomics
sjohanss
parents: 49607
diff changeset
   109
    _num_workers(calc_active_workers()),
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   110
    _oop_queue_set(_num_workers),
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   111
    _array_queue_set(_num_workers),
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   112
    _preserved_marks_set(true),
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   113
    _serial_compaction_point(),
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   114
    _is_alive(heap->concurrent_mark()->next_mark_bitmap()),
49964
99e698e94cc7 8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents: 49826
diff changeset
   115
    _is_alive_mutator(heap->ref_processor_stw(), &_is_alive),
99e698e94cc7 8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents: 49826
diff changeset
   116
    _always_subject_to_discovery(),
99e698e94cc7 8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents: 49826
diff changeset
   117
    _is_subject_mutator(heap->ref_processor_stw(), &_always_subject_to_discovery) {
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   118
  assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   119
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   120
  _preserved_marks_set.init(_num_workers);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   121
  _markers = NEW_C_HEAP_ARRAY(G1FullGCMarker*, _num_workers, mtGC);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   122
  _compaction_points = NEW_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _num_workers, mtGC);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   123
  for (uint i = 0; i < _num_workers; i++) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   124
    _markers[i] = new G1FullGCMarker(i, _preserved_marks_set.get(i), mark_bitmap());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   125
    _compaction_points[i] = new G1FullGCCompactionPoint();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   126
    _oop_queue_set.register_queue(i, marker(i)->oop_stack());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   127
    _array_queue_set.register_queue(i, marker(i)->objarray_stack());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   128
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   129
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   130
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   131
G1FullCollector::~G1FullCollector() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   132
  for (uint i = 0; i < _num_workers; i++) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   133
    delete _markers[i];
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   134
    delete _compaction_points[i];
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   135
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   136
  FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   137
  FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   138
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   139
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   140
void G1FullCollector::prepare_collection() {
53985
0da5c17f5e43 8219747: Remove g1_ prefix to g1_remset and g1_policy members in G1CollectedHeap
tschatzl
parents: 53536
diff changeset
   141
  _heap->policy()->record_full_collection_start();
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   142
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   143
  _heap->print_heap_before_gc();
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   144
  _heap->print_heap_regions();
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   145
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   146
  _heap->abort_concurrent_cycle();
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   147
  _heap->verify_before_full_collection(scope()->is_explicit_gc());
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   148
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   149
  _heap->gc_prologue(true);
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   150
  _heap->prepare_heap_for_full_collection();
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   151
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   152
  reference_processor()->enable_discovery();
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   153
  reference_processor()->setup_policy(scope()->should_clear_soft_refs());
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   154
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   155
  // We should save the marks of the currently locked biased monitors.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   156
  // The marking doesn't preserve the marks of biased objects.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   157
  BiasedLocking::preserve_marks();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   158
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   159
  // Clear and activate derived pointer collection.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   160
  clear_and_activate_derived_pointers();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   161
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   162
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   163
void G1FullCollector::collect() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   164
  phase1_mark_live_objects();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   165
  verify_after_marking();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   166
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   167
  // Don't add any more derived pointers during later phases
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   168
  deactivate_derived_pointers();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   169
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   170
  phase2_prepare_compaction();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   171
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   172
  phase3_adjust_pointers();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   173
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   174
  phase4_do_compaction();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   175
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   176
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   177
void G1FullCollector::complete_collection() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   178
  // Restore all marks.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   179
  restore_marks();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   180
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   181
  // When the pointers have been adjusted and moved, we can
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   182
  // update the derived pointer table.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   183
  update_derived_pointers();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   184
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   185
  BiasedLocking::restore_marks();
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   186
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   187
  _heap->prepare_heap_for_mutators();
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   188
53985
0da5c17f5e43 8219747: Remove g1_ prefix to g1_remset and g1_policy members in G1CollectedHeap
tschatzl
parents: 53536
diff changeset
   189
  _heap->policy()->record_full_collection_end();
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   190
  _heap->gc_epilogue(true);
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   191
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   192
  _heap->verify_after_full_collection();
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   193
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   194
  _heap->print_heap_after_full_collection(scope()->heap_transition());
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   195
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   196
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   197
void G1FullCollector::phase1_mark_live_objects() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   198
  // Recursively traverse all live objects and mark them.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   199
  GCTraceTime(Info, gc, phases) info("Phase 1: Mark live objects", scope()->timer());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   200
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   201
  // Do the actual marking.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   202
  G1FullGCMarkTask marking_task(this);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   203
  run_task(&marking_task);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   204
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   205
  // Process references discovered during marking.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   206
  G1FullGCReferenceProcessingExecutor reference_processing(this);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   207
  reference_processing.execute(scope()->timer(), scope()->tracer());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   208
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   209
  // Weak oops cleanup.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   210
  {
51546
b9f6a4427da9 8072498: Multi-thread JNI weak reference processing
kbarrett
parents: 51497
diff changeset
   211
    GCTraceTime(Debug, gc, phases) debug("Phase 1: Weak Processing", scope()->timer());
b9f6a4427da9 8072498: Multi-thread JNI weak reference processing
kbarrett
parents: 51497
diff changeset
   212
    WeakProcessor::weak_oops_do(_heap->workers(), &_is_alive, &do_nothing_cl, 1);
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   213
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   214
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   215
  // Class unloading and cleanup.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   216
  if (ClassUnloading) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   217
    GCTraceTime(Debug, gc, phases) debug("Phase 1: Class Unloading and Cleanup", scope()->timer());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   218
    // Unload classes and purge the SystemDictionary.
50297
580744d900c8 8202813: Move vm_weak processing from SystemDictionary to WeakProcessor
coleenp
parents: 49964
diff changeset
   219
    bool purged_class = SystemDictionary::do_unloading(scope()->timer());
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   220
    _heap->complete_cleaning(&_is_alive, purged_class);
53536
482109fae02b 8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents: 52904
diff changeset
   221
  } else if (G1StringDedup::is_enabled()) {
482109fae02b 8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents: 52904
diff changeset
   222
    GCTraceTime(Debug, gc, phases) debug("Phase 1: String Dedup Cleanup", scope()->timer());
482109fae02b 8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents: 52904
diff changeset
   223
    // If no class unloading just clean out string deduplication data.
482109fae02b 8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents: 52904
diff changeset
   224
    _heap->string_dedup_cleaning(&_is_alive, NULL);
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   225
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   226
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   227
  scope()->tracer()->report_object_count_after_gc(&_is_alive);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   228
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   229
49320
0e79ce03b7a2 8198431: Remove G1FullCollector extension point
sjohanss
parents: 48179
diff changeset
   230
void G1FullCollector::phase2_prepare_compaction() {
0e79ce03b7a2 8198431: Remove G1FullCollector extension point
sjohanss
parents: 48179
diff changeset
   231
  GCTraceTime(Info, gc, phases) info("Phase 2: Prepare for compaction", scope()->timer());
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   232
  G1FullGCPrepareTask task(this);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   233
  run_task(&task);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   234
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   235
  // To avoid OOM when there is memory left.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   236
  if (!task.has_freed_regions()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   237
    task.prepare_serial_compaction();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   238
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   239
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   240
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   241
void G1FullCollector::phase3_adjust_pointers() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   242
  // Adjust the pointers to reflect the new locations
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 49361
diff changeset
   243
  GCTraceTime(Info, gc, phases) info("Phase 3: Adjust pointers", scope()->timer());
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   244
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   245
  G1FullGCAdjustTask task(this);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   246
  run_task(&task);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   247
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   248
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   249
void G1FullCollector::phase4_do_compaction() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   250
  // Compact the heap using the compaction queues created in phase 2.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   251
  GCTraceTime(Info, gc, phases) info("Phase 4: Compact heap", scope()->timer());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   252
  G1FullGCCompactTask task(this);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   253
  run_task(&task);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   254
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   255
  // Serial compact to avoid OOM when very few free regions.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   256
  if (serial_compaction_point()->has_regions()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   257
    task.serial_compaction();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   258
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   259
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   260
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   261
void G1FullCollector::restore_marks() {
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   262
  SharedRestorePreservedMarksTaskExecutor task_executor(_heap->workers());
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   263
  _preserved_marks_set.restore(&task_executor);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   264
  _preserved_marks_set.reclaim();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   265
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   266
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   267
void G1FullCollector::run_task(AbstractGangTask* task) {
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   268
  _heap->workers()->run_task(task, _num_workers);
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   269
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   270
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   271
void G1FullCollector::verify_after_marking() {
48179
34fe70d22e9c 8191821: Finer granularity for GC verification
sjohanss
parents: 48168
diff changeset
   272
  if (!VerifyDuringGC || !_heap->verifier()->should_verify(G1HeapVerifier::G1VerifyFull)) {
34fe70d22e9c 8191821: Finer granularity for GC verification
sjohanss
parents: 48168
diff changeset
   273
    // Only do verification if VerifyDuringGC and G1VerifyFull is set.
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   274
    return;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   275
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   276
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   277
  HandleMark hm;  // handle scope
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   278
#if COMPILER2_OR_JVMCI
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   279
  DerivedPointerTableDeactivate dpt_deact;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   280
#endif
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   281
  _heap->prepare_for_verify();
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   282
  // Note: we can verify only the heap here. When an object is
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   283
  // marked, the previous value of the mark word (including
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   284
  // identity hash values, ages, etc) is preserved, and the mark
57777
90ead0febf56 8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents: 55513
diff changeset
   285
  // word is set to markWord::marked_value - effectively removing
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   286
  // any hash values from the mark word. These hash values are
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   287
  // used when verifying the dictionaries and so removing them
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   288
  // from the mark word can make verification of the dictionaries
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   289
  // fail. At the end of the GC, the original mark word values
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   290
  // (including hash values) are restored to the appropriate
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   291
  // objects.
54716
61d0e96a6b2d 8223267: Fix incorrect usage of GCTraceTime in g1FullCollector and g1CollectedHeap
manc
parents: 54678
diff changeset
   292
  GCTraceTime(Info, gc, verify) tm("Verifying During GC (full)");
48100
ab188c22d4b6 8189733: Cleanup Full GC setup and tear down
sjohanss
parents: 47885
diff changeset
   293
  _heap->verify(VerifyOption_G1UseFullMarking);
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   294
}