src/hotspot/share/gc/g1/g1FullGCOopClosures.hpp
author tschatzl
Mon, 26 Mar 2018 16:51:43 +0200
changeset 49607 acffe6ff3ae7
parent 47885 5caa1d5f74c1
child 49827 a4672513d6e3
permissions -rw-r--r--
8180415: Rebuild remembered sets during the concurrent cycle Summary: In general maintain remembered sets of old regions only from the start of the concurrent cycle to the mixed gc they are used, at most until the end of the mixed phase. Reviewed-by: sjohanss, sangheki
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
/*
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 47885
diff changeset
     2
 * Copyright (c) 2017, 2018, 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
#ifndef SHARE_GC_G1_G1FULLGCOOPCLOSURES_HPP
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    26
#define SHARE_GC_G1_G1FULLGCOOPCLOSURES_HPP
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    27
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    28
#include "memory/iterator.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    29
#include "memory/universe.hpp"
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    30
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    31
class G1CollectedHeap;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    32
class G1FullCollector;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    33
class G1CMBitMap;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    34
class G1FullGCMarker;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    35
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    36
// Below are closures used by the G1 Full GC.
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    37
class G1IsAliveClosure : public BoolObjectClosure {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    38
  G1CMBitMap* _bitmap;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    39
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    40
public:
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    41
  G1IsAliveClosure(G1CMBitMap* bitmap) : _bitmap(bitmap) { }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    42
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    43
  virtual bool do_object_b(oop p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    44
};
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    45
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    46
class G1FullKeepAliveClosure: public OopClosure {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    47
  G1FullGCMarker* _marker;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    48
  template <class T>
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    49
  inline void do_oop_work(T* p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    50
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    51
public:
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    52
  G1FullKeepAliveClosure(G1FullGCMarker* pm) : _marker(pm) { }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    53
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    54
  virtual void do_oop(oop* p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    55
  virtual void do_oop(narrowOop* p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    56
};
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    57
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    58
class G1MarkAndPushClosure : public ExtendedOopClosure {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    59
  G1FullGCMarker* _marker;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    60
  uint _worker_id;
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
public:
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    63
  G1MarkAndPushClosure(uint worker, G1FullGCMarker* marker, ReferenceProcessor* ref) :
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    64
    _marker(marker),
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    65
    _worker_id(worker),
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    66
    ExtendedOopClosure(ref) { }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    67
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    68
  template <class T> inline void do_oop_nv(T* p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    69
  virtual void do_oop(oop* p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    70
  virtual void do_oop(narrowOop* p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    71
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    72
  virtual bool do_metadata();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    73
  bool do_metadata_nv();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    74
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    75
  virtual void do_klass(Klass* k);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    76
  void do_klass_nv(Klass* k);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    77
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    78
  virtual void do_cld(ClassLoaderData* cld);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    79
  void do_cld_nv(ClassLoaderData* cld);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    80
};
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    81
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 47885
diff changeset
    82
class G1AdjustClosure : public ExtendedOopClosure {
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 47885
diff changeset
    83
  template <class T> static inline void adjust_pointer(T* p);
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    84
public:
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 47885
diff changeset
    85
  template <class T> void do_oop_nv(T* p) { adjust_pointer(p); }
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    86
  virtual void do_oop(oop* p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    87
  virtual void do_oop(narrowOop* p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    88
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    89
  virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    90
};
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    91
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    92
class G1VerifyOopClosure: public OopClosure {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    93
private:
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    94
  G1CollectedHeap* _g1h;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    95
  bool             _failures;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    96
  oop              _containing_obj;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    97
  VerifyOption     _verify_option;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    98
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
    99
public:
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   100
  int _cc;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   101
  G1VerifyOopClosure(VerifyOption option);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   102
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   103
  void set_containing_obj(oop obj) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   104
    _containing_obj = obj;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   105
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   106
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   107
  bool failures() { return _failures; }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   108
  void print_object(outputStream* out, oop obj);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   109
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   110
  template <class T> void do_oop_nv(T* p);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   111
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   112
  void do_oop(oop* p)       { do_oop_nv(p); }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   113
  void do_oop(narrowOop* p) { do_oop_nv(p); }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   114
};
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   115
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   116
class G1FollowStackClosure: public VoidClosure {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   117
  G1FullGCMarker* _marker;
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   118
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   119
public:
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   120
  G1FollowStackClosure(G1FullGCMarker* marker) : _marker(marker) {}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   121
  virtual void do_void();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   122
};
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   123
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
diff changeset
   124
#endif // SHARE_GC_G1_G1FULLGCOOPCLOSURES_HPP