src/hotspot/share/gc/shenandoah/shenandoahClosures.hpp
author stefank
Tue, 26 Nov 2019 10:47:46 +0100
changeset 59290 97d13893ec3c
parent 58686 0279391875bf
child 59296 9186be5c78ba
permissions -rw-r--r--
8234748: Clean up atomic and orderAccess includes Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     1
/*
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     2
 * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     3
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     6
 * published by the Free Software Foundation.
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     7
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    12
 * accompanied this code).
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    13
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    17
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    20
 * questions.
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    21
 *
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    22
 */
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    23
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    24
#define SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    25
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    26
#include "memory/iterator.hpp"
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    27
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    28
class ShenandoahHeap;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    29
class ShenandoahMarkingContext;
58686
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    30
class ShenandoahHeapRegionSet;
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    31
class Thread;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    32
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    33
class ShenandoahForwardedIsAliveClosure: public BoolObjectClosure {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    34
private:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    35
  ShenandoahMarkingContext* const _mark_context;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    36
public:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    37
  inline ShenandoahForwardedIsAliveClosure();
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    38
  inline bool do_object_b(oop obj);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    39
};
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    40
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    41
class ShenandoahIsAliveClosure: public BoolObjectClosure {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    42
private:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    43
  ShenandoahMarkingContext* const _mark_context;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    44
public:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    45
  inline ShenandoahIsAliveClosure();
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    46
  inline bool do_object_b(oop obj);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    47
};
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    48
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    49
class ShenandoahIsAliveSelector : public StackObj {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    50
private:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    51
  ShenandoahIsAliveClosure _alive_cl;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    52
  ShenandoahForwardedIsAliveClosure _fwd_alive_cl;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    53
public:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    54
  inline BoolObjectClosure* is_alive_closure();
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    55
};
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    56
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    57
class ShenandoahUpdateRefsClosure: public OopClosure {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    58
private:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    59
  ShenandoahHeap* _heap;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    60
public:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    61
  inline ShenandoahUpdateRefsClosure();
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    62
  inline void do_oop(oop* p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    63
  inline void do_oop(narrowOop* p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    64
private:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    65
  template <class T>
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    66
  inline void do_oop_work(T* p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    67
};
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    68
58686
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    69
class ShenandoahTraversalUpdateRefsClosure: public OopClosure {
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    70
private:
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    71
  ShenandoahHeap* const           _heap;
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    72
  ShenandoahHeapRegionSet* const  _traversal_set;
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    73
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    74
public:
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    75
  inline ShenandoahTraversalUpdateRefsClosure();
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    76
  inline void do_oop(oop* p);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    77
  inline void do_oop(narrowOop* p);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    78
private:
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    79
  template <class T>
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    80
  inline void do_oop_work(T* p);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    81
};
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 57533
diff changeset
    82
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    83
class ShenandoahEvacuateUpdateRootsClosure: public BasicOopIterateClosure {
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    84
private:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    85
  ShenandoahHeap* _heap;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    86
  Thread* _thread;
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    87
public:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    88
  inline ShenandoahEvacuateUpdateRootsClosure();
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    89
  inline void do_oop(oop* p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    90
  inline void do_oop(narrowOop* p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    91
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    92
private:
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    93
  template <class T>
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    94
  inline void do_oop_work(T* p);
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    95
};
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
    96
57533
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
    97
class ShenandoahEvacUpdateOopStorageRootsClosure : public BasicOopIterateClosure {
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
    98
private:
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
    99
  ShenandoahHeap* _heap;
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   100
  Thread* _thread;
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   101
public:
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   102
  inline ShenandoahEvacUpdateOopStorageRootsClosure();
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   103
  inline void do_oop(oop* p);
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   104
  inline void do_oop(narrowOop* p);
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   105
};
a2912ba36422 8228490: Shenandoah: Shenandoah concurrent root evacuation may race against OopStorage::release()
zgu
parents: 54687
diff changeset
   106
54687
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   107
#ifdef ASSERT
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   108
class ShenandoahAssertNotForwardedClosure : public OopClosure {
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   109
private:
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   110
  template <class T>
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   111
  inline void do_oop_work(T* p);
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   112
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   113
public:
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   114
  inline void do_oop(narrowOop* p);
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   115
  inline void do_oop(oop* p);
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   116
};
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   117
#endif // ASSERT
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54536
diff changeset
   118
54536
fb53a1c25903 8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
diff changeset
   119
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP