src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.hpp
author rkennke
Wed, 29 Aug 2018 20:15:09 +0200
changeset 51578 31b159f30fb2
parent 51332 c25572739e7c
child 53244 9807daeb47c4
permissions -rw-r--r--
8180193: Make marking bitmap code available to other GCs Reviewed-by: shade, stefank
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
/*
49392
2956d0ece7a9 8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
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
#ifndef SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_HPP
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    26
#define SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_HPP
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    27
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    28
#include "gc/g1/g1RegionToSpaceMapper.hpp"
51578
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 51332
diff changeset
    29
#include "gc/shared/markBitMap.hpp"
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    30
#include "memory/memRegion.hpp"
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    31
#include "oops/oopsHierarchy.hpp"
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    32
#include "utilities/bitMap.hpp"
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    33
#include "utilities/globalDefinitions.hpp"
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    34
#include "utilities/macros.hpp"
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
class G1CMBitMap;
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    37
class G1CMTask;
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    38
class G1ConcurrentMark;
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    39
class HeapRegion;
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    40
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    41
// Closure for iteration over bitmaps
49392
2956d0ece7a9 8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents: 47885
diff changeset
    42
class G1CMBitMapClosure {
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    43
  G1ConcurrentMark* const _cm;
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    44
  G1CMTask* const _task;
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    45
public:
51332
c25572739e7c 8208669: GC changes to allow enabling -Wreorder
tschatzl
parents: 49644
diff changeset
    46
  G1CMBitMapClosure(G1CMTask *task, G1ConcurrentMark* cm) : _cm(cm), _task(task) { }
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    47
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    48
  bool do_addr(HeapWord* const addr);
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    49
};
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    50
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    51
class G1CMBitMapMappingChangedListener : public G1MappingChangedListener {
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    52
  G1CMBitMap* _bm;
49644
50a01910e00a 8151171: Bring g1ConcurrentMark files up to current coding conventions
tschatzl
parents: 49392
diff changeset
    53
public:
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    54
  G1CMBitMapMappingChangedListener() : _bm(NULL) {}
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    55
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    56
  void set_bitmap(G1CMBitMap* bm) { _bm = bm; }
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    57
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    58
  virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    59
};
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    60
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    61
// A generic mark bitmap for concurrent marking.  This is essentially a wrapper
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    62
// around the BitMap class that is based on HeapWords, with one bit per (1 << _shifter) HeapWords.
51578
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 51332
diff changeset
    63
class G1CMBitMap : public MarkBitMap {
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    64
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    65
  G1CMBitMapMappingChangedListener _listener;
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    66
51578
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 51332
diff changeset
    67
protected:
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    68
51578
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 51332
diff changeset
    69
  virtual void check_mark(HeapWord* addr) NOT_DEBUG_RETURN;
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 51332
diff changeset
    70
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    71
public:
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    72
51578
31b159f30fb2 8180193: Make marking bitmap code available to other GCs
rkennke
parents: 51332
diff changeset
    73
  G1CMBitMap() : MarkBitMap(), _listener() { _listener.set_bitmap(this); }
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    74
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    75
  // Initializes the underlying BitMap to cover the given area.
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    76
  void initialize(MemRegion heap, G1RegionToSpaceMapper* storage);
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    77
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    78
  // Apply the closure to the addresses that correspond to marked bits in the bitmap.
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    79
  inline bool iterate(G1CMBitMapClosure* cl, MemRegion mr);
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    80
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    81
  void clear_region(HeapRegion* hr);
46751
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    82
};
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    83
d2e0cecdbcb0 8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
diff changeset
    84
#endif // SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_HPP