src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.hpp
author stefank
Mon, 25 Nov 2019 12:33:15 +0100
changeset 59252 623722a6aeb9
parent 55476 aee0d296c0ef
child 58679 9c3209ff7550
child 59296 9186be5c78ba
permissions -rw-r--r--
8234740: Harmonize parameter order in Atomic - cmpxchg Reviewed-by: rehn, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54882
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
     1
/*
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
     2
 * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
     3
 *
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
     6
 * published by the Free Software Foundation.
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
     7
 *
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    12
 * accompanied this code).
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    13
 *
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    17
 *
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    20
 * questions.
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    21
 *
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    22
 */
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    23
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    24
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTVERIFIER_HPP
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    25
#define SHARE_GC_SHENANDOAH_SHENANDOAHROOTVERIFIER_HPP
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    26
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    27
#include "memory/allocation.hpp"
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    28
#include "memory/iterator.hpp"
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    29
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    30
class ShenandoahRootVerifier : public StackObj {
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    31
public:
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    32
  enum RootTypes {
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    33
    SerialRoots         = 1 << 0,
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    34
    ThreadRoots         = 1 << 1,
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    35
    CodeRoots           = 1 << 2,
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    36
    CLDGRoots           = 1 << 3,
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    37
    WeakRoots           = 1 << 4,
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    38
    StringDedupRoots    = 1 << 5,
55335
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55048
diff changeset
    39
    JNIHandleRoots      = 1 << 6,
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55048
diff changeset
    40
    AllRoots            = (SerialRoots | ThreadRoots | CodeRoots | CLDGRoots | WeakRoots | StringDedupRoots | JNIHandleRoots)
54882
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    41
  };
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    42
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    43
private:
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    44
  RootTypes _types;
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    45
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    46
public:
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    47
  ShenandoahRootVerifier();
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    48
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    49
  void excludes(RootTypes types);
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    50
  void oops_do(OopClosure* cl);
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    51
55048
812212323fb1 8224751: Shenandoah: Shenandoah Verifier should select proper roots according to current GC cycle
zgu
parents: 54882
diff changeset
    52
  // Used to seed ShenandoahVerifier, do not honor root type filter
812212323fb1 8224751: Shenandoah: Shenandoah Verifier should select proper roots according to current GC cycle
zgu
parents: 54882
diff changeset
    53
  void roots_do(OopClosure* cl);
812212323fb1 8224751: Shenandoah: Shenandoah Verifier should select proper roots according to current GC cycle
zgu
parents: 54882
diff changeset
    54
  void strong_roots_do(OopClosure* cl);
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55335
diff changeset
    55
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55335
diff changeset
    56
  static RootTypes combine(RootTypes t1, RootTypes t2);
54882
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    57
private:
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    58
  bool verify(RootTypes type) const;
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    59
};
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    60
b99e97bc5040 8223215: Shenandoah: Support verifying subset of roots
zgu
parents:
diff changeset
    61
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTVERIFIER_HPP