hotspot/src/share/vm/gc/g1/g1CardCounts.cpp
author tschatzl
Wed, 25 Nov 2015 14:43:29 +0100
changeset 34300 6075c1e0e913
parent 33105 294e48b4f704
child 37985 539c597ee0fa
permissions -rw-r--r--
8136679: JFR event for adaptive IHOP Reviewed-by: tbenson, mgerdin, sangheki, ehelin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
     1
/*
30565
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
     4
 *
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
     8
 *
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    13
 * accompanied this code).
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    14
 *
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    18
 *
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    21
 * questions.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    22
 *
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    23
 */
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    24
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    25
#include "precompiled.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30565
diff changeset
    26
#include "gc/g1/g1CardCounts.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30565
diff changeset
    27
#include "gc/g1/g1CollectedHeap.inline.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30565
diff changeset
    28
#include "gc/g1/g1CollectorPolicy.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30565
diff changeset
    29
#include "gc/g1/g1GCPhaseTimes.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30565
diff changeset
    30
#include "gc/shared/cardTableModRefBS.hpp"
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    31
#include "services/memTracker.hpp"
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    32
#include "utilities/copy.hpp"
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    33
27149
9246fc481aa3 8059758: Footprint regressions with JDK-8038423
tschatzl
parents: 26160
diff changeset
    34
void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) {
9246fc481aa3 8059758: Footprint regressions with JDK-8038423
tschatzl
parents: 26160
diff changeset
    35
  if (zero_filled) {
9246fc481aa3 8059758: Footprint regressions with JDK-8038423
tschatzl
parents: 26160
diff changeset
    36
    return;
9246fc481aa3 8059758: Footprint regressions with JDK-8038423
tschatzl
parents: 26160
diff changeset
    37
  }
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    38
  MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_idx), num_regions * HeapRegion::GrainWords);
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    39
  _counts->clear_range(mr);
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    40
}
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    41
30565
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    42
size_t G1CardCounts::compute_size(size_t mem_region_size_in_words) {
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    43
  // We keep card counts for every card, so the size of the card counts table must
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    44
  // be the same as the card table.
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    45
  return G1SATBCardTableLoggingModRefBS::compute_size(mem_region_size_in_words);
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    46
}
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    47
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    48
size_t G1CardCounts::heap_map_factor() {
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    49
  // See G1CardCounts::compute_size() why we reuse the card table value.
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    50
  return G1SATBCardTableLoggingModRefBS::heap_map_factor();
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    51
}
ebd5af27fe02 8073632: Make auxiliary data structures know their own translation factor
tschatzl
parents: 29796
diff changeset
    52
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    53
void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    54
  if (has_count_table()) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    55
    assert(from_card_num < to_card_num,
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
    56
           "Wrong order? from: " SIZE_FORMAT ", to: " SIZE_FORMAT,
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
    57
           from_card_num, to_card_num);
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    58
    Copy::fill_to_bytes(&_card_counts[from_card_num], (to_card_num - from_card_num));
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    59
  }
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    60
}
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    61
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    62
G1CardCounts::G1CardCounts(G1CollectedHeap *g1h):
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    63
  _listener(), _g1h(g1h), _card_counts(NULL), _reserved_max_card_num(0) {
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    64
  _listener.set_cardcounts(this);
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    65
}
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    66
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    67
void G1CardCounts::initialize(G1RegionToSpaceMapper* mapper) {
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    68
  assert(_g1h->max_capacity() > 0, "initialization order");
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    69
  assert(_g1h->capacity() == 0, "initialization order");
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    70
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    71
  if (G1ConcRSHotCardLimit > 0) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    72
    // The max value we can store in the counts table is
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    73
    // max_jubyte. Guarantee the value of the hot
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    74
    // threshold limit is no more than this.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    75
    guarantee(G1ConcRSHotCardLimit <= max_jubyte, "sanity");
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    76
20309
7445302daff6 8025305: Cleanup CardTableModRefBS usage in G1
mgerdin
parents: 19994
diff changeset
    77
    _ct_bs = _g1h->g1_barrier_set();
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    78
    _ct_bot = _ct_bs->byte_for_const(_g1h->reserved_region().start());
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    79
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    80
    _card_counts = (jubyte*) mapper->reserved().start();
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    81
    _reserved_max_card_num = mapper->reserved().byte_size();
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    82
    mapper->set_mapping_changed_listener(&_listener);
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    83
  }
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    84
}
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    85
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    86
uint G1CardCounts::add_card_count(jbyte* card_ptr) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    87
  // Returns the number of times the card has been refined.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    88
  // If we failed to reserve/commit the counts table, return 0.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    89
  // If card_ptr is beyond the committed end of the counts table,
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    90
  // return 0.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    91
  // Otherwise return the actual count.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    92
  // Unless G1ConcRSHotCardLimit has been set appropriately,
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    93
  // returning 0 will result in the card being considered
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    94
  // cold and will be refined immediately.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    95
  uint count = 0;
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    96
  if (has_count_table()) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
    97
    size_t card_num = ptr_2_card_num(card_ptr);
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
    98
    assert(card_num < _reserved_max_card_num,
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
    99
           "Card " SIZE_FORMAT " outside of card counts table (max size " SIZE_FORMAT ")",
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
   100
           card_num, _reserved_max_card_num);
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   101
    count = (uint) _card_counts[card_num];
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   102
    if (count < G1ConcRSHotCardLimit) {
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   103
      _card_counts[card_num] =
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   104
        (jubyte)(MIN2((uintx)(_card_counts[card_num] + 1), G1ConcRSHotCardLimit));
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   105
    }
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   106
  }
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   107
  return count;
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   108
}
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   109
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   110
bool G1CardCounts::is_hot(uint count) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   111
  return (count >= G1ConcRSHotCardLimit);
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   112
}
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   113
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   114
void G1CardCounts::clear_region(HeapRegion* hr) {
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   115
  MemRegion mr(hr->bottom(), hr->end());
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   116
  clear_range(mr);
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   117
}
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   118
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   119
void G1CardCounts::clear_range(MemRegion mr) {
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   120
  if (has_count_table()) {
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   121
    const jbyte* from_card_ptr = _ct_bs->byte_for_const(mr.start());
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   122
    // We use the last address in the range as the range could represent the
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   123
    // last region in the heap. In which case trying to find the card will be an
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   124
    // OOB access to the card table.
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   125
    const jbyte* last_card_ptr = _ct_bs->byte_for_const(mr.last());
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   126
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   127
#ifdef ASSERT
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   128
    HeapWord* start_addr = _ct_bs->addr_for(from_card_ptr);
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   129
    assert(start_addr == mr.start(), "MemRegion start must be aligned to a card.");
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   130
    HeapWord* last_addr = _ct_bs->addr_for(last_card_ptr);
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   131
    assert((last_addr + CardTableModRefBS::card_size_in_words) == mr.end(), "MemRegion end must be aligned to a card.");
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   132
#endif // ASSERT
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   133
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   134
    // Clear the counts for the (exclusive) card range.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   135
    size_t from_card_num = ptr_2_card_num(from_card_ptr);
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   136
    size_t to_card_num = ptr_2_card_num(last_card_ptr) + 1;
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   137
    clear_range(from_card_num, to_card_num);
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   138
  }
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   139
}
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   140
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   141
class G1CardCountsClearClosure : public HeapRegionClosure {
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   142
 private:
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   143
  G1CardCounts* _card_counts;
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   144
 public:
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   145
  G1CardCountsClearClosure(G1CardCounts* card_counts) :
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   146
    HeapRegionClosure(), _card_counts(card_counts) { }
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   147
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   148
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   149
  virtual bool doHeapRegion(HeapRegion* r) {
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   150
    _card_counts->clear_region(r);
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   151
    return false;
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   152
  }
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   153
};
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   154
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   155
void G1CardCounts::clear_all() {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   156
  assert(SafepointSynchronize::is_at_safepoint(), "don't call this otherwise");
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   157
  G1CardCountsClearClosure cl(this);
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 24424
diff changeset
   158
  _g1h->heap_region_iterate(&cl);
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
diff changeset
   159
}