src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp
author tschatzl
Wed, 17 Jul 2019 16:33:19 +0200
changeset 55722 5ee183a90e65
parent 51578 31b159f30fb2
permissions -rw-r--r--
8227084: Add timing information for merge heap root preparation Reviewed-by: sangheki, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
     1
/*
51578
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
     2
 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
     4
 *
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
     8
 *
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    14
 *
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    18
 *
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    21
 * questions.
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    22
 *
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    23
 */
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    24
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    25
#include "precompiled.hpp"
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    26
#include "gc/g1/g1CollectedHeap.inline.hpp"
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    27
#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    28
#include "gc/g1/heapRegion.hpp"
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    29
#include "memory/virtualspace.hpp"
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    30
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    31
void G1CMBitMap::initialize(MemRegion heap, G1RegionToSpaceMapper* storage) {
51578
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
    32
  MarkBitMap::initialize(heap, storage->reserved());
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    33
  storage->set_mapping_changed_listener(&_listener);
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    34
}
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    35
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    36
void G1CMBitMapMappingChangedListener::on_commit(uint start_region, size_t num_regions, bool zero_filled) {
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    37
  if (zero_filled) {
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    38
    return;
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    39
  }
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    40
  // We need to clear the bitmap on commit, removing any existing information.
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    41
  MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_region), num_regions * HeapRegion::GrainWords);
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    42
  _bm->clear_range(mr);
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    43
}
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    44
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    45
void G1CMBitMap::clear_region(HeapRegion* region) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    46
 if (!region->is_empty()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    47
   MemRegion mr(region->bottom(), region->top());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    48
   clear_range(mr);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    49
 }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    50
}
51578
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
    51
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
    52
#ifdef ASSERT
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
    53
void G1CMBitMap::check_mark(HeapWord* addr) {
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
    54
  assert(G1CollectedHeap::heap()->is_in_exact(addr),
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
    55
         "Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.",
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
    56
         p2i(this), p2i(addr));
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
    57
}
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 47885
diff changeset
    58
#endif