hotspot/src/share/vm/memory/iterator.hpp
author stefank
Tue, 24 Jun 2014 16:20:15 +0200
changeset 25356 4a4a482298a6
parent 23539 6382fd0ea303
child 25490 59f226da8d81
permissions -rw-r--r--
8046670: Make CMS metadata aware closures applicable for other collectors Reviewed-by: ehelin, mgerdin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
22234
da823d78ad65 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 17625
diff changeset
     2
 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4738
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4738
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4738
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_MEMORY_ITERATOR_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_MEMORY_ITERATOR_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/memRegion.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "utilities/top.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
    32
class CodeBlob;
3913
e049e6b81e11 6885169: merge of 4957990 and 6863023 causes conflict on do_nmethods
jrose
parents: 3912
diff changeset
    33
class nmethod;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
class ReferenceProcessor;
3696
9e5d9b5e1049 4957990: Perm heap bloat in JVM
ysr
parents: 3690
diff changeset
    35
class DataLayout;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    36
class KlassClosure;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    37
class ClassLoaderData;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
23538
2518569e1e01 8038628: Remove unused Closure::abort()
stefank
parents: 23535
diff changeset
    39
// The following classes are C++ `closures` for iterating over objects, roots and spaces
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    40
23538
2518569e1e01 8038628: Remove unused Closure::abort()
stefank
parents: 23535
diff changeset
    41
class Closure : public StackObj { };
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    42
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    43
// OopClosure is used for iterating through references to Java objects.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    44
class OopClosure : public Closure {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  virtual void do_oop(oop* o) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  virtual void do_oop_v(oop* o) { do_oop(o); }
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    48
  virtual void do_oop(narrowOop* o) = 0;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    49
  virtual void do_oop_v(narrowOop* o) { do_oop(o); }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    50
};
3690
dba50b88bd50 6798898: CMS: bugs related to class unloading
jmasa
parents: 1388
diff changeset
    51
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    52
// ExtendedOopClosure adds extra code to be run during oop iterations.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    53
// This is needed by the GC and is extracted to a separate type to not
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    54
// pollute the OopClosure interface.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    55
class ExtendedOopClosure : public OopClosure {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    56
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    57
  ReferenceProcessor* _ref_processor;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    58
  ExtendedOopClosure(ReferenceProcessor* rp) : _ref_processor(rp) { }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    59
  ExtendedOopClosure() : OopClosure(), _ref_processor(NULL) { }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    61
  // If the do_metadata functions return "true",
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    62
  // we invoke the following when running oop_iterate():
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    63
  //
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    64
  // 1) do_klass on the header klass pointer.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    65
  // 2) do_klass on the klass pointer in the mirrors.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    66
  // 3) do_class_loader_data on the class loader data in class loaders.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    67
  //
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    68
  // The virtual (without suffix) and the non-virtual (with _nv suffix) need
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    69
  // to be updated together, or else the devirtualization will break.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    70
  //
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    71
  // Providing default implementations of the _nv functions unfortunately
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    72
  // removes the compile-time safeness, but reduces the clutter for the
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    73
  // ExtendedOopClosures that don't need to walk the metadata. Currently,
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    74
  // only CMS needs these.
3696
9e5d9b5e1049 4957990: Perm heap bloat in JVM
ysr
parents: 3690
diff changeset
    75
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    76
  virtual bool do_metadata() { return do_metadata_nv(); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    77
  bool do_metadata_v()       { return do_metadata(); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    78
  bool do_metadata_nv()      { return false; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    80
  virtual void do_klass(Klass* k)   { do_klass_nv(k); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    81
  void do_klass_v(Klass* k)         { do_klass(k); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    82
  void do_klass_nv(Klass* k)        { ShouldNotReachHere(); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    83
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    84
  virtual void do_class_loader_data(ClassLoaderData* cld) { ShouldNotReachHere(); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    85
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    86
  // True iff this closure may be safely applied more than once to an oop
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    87
  // location without an intervening "major reset" (like the end of a GC).
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    88
  virtual bool idempotent() { return false; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    89
  virtual bool apply_to_weak_ref_discovered_field() { return false; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    90
};
3690
dba50b88bd50 6798898: CMS: bugs related to class unloading
jmasa
parents: 1388
diff changeset
    91
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    92
// Wrapper closure only used to implement oop_iterate_no_header().
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    93
class NoHeaderExtendedOopClosure : public ExtendedOopClosure {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    94
  OopClosure* _wrapped_closure;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    95
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    96
  NoHeaderExtendedOopClosure(OopClosure* cl) : _wrapped_closure(cl) {}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    97
  // Warning: this calls the virtual version do_oop in the the wrapped closure.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    98
  void do_oop_nv(oop* p)       { _wrapped_closure->do_oop(p); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    99
  void do_oop_nv(narrowOop* p) { _wrapped_closure->do_oop(p); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   100
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   101
  void do_oop(oop* p)          { assert(false, "Only the _nv versions should be used");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   102
                                 _wrapped_closure->do_oop(p); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   103
  void do_oop(narrowOop* p)    { assert(false, "Only the _nv versions should be used");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   104
                                 _wrapped_closure->do_oop(p);}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   105
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   106
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   107
class KlassClosure : public Closure {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   108
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   109
  virtual void do_klass(Klass* k) = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
22899
e2a6bf7f343a 8035393: Use CLDClosure instead of CLDToOopClosure in frame::oops_interpreted_do
stefank
parents: 22234
diff changeset
   112
class CLDClosure : public Closure {
e2a6bf7f343a 8035393: Use CLDClosure instead of CLDToOopClosure in frame::oops_interpreted_do
stefank
parents: 22234
diff changeset
   113
 public:
e2a6bf7f343a 8035393: Use CLDClosure instead of CLDToOopClosure in frame::oops_interpreted_do
stefank
parents: 22234
diff changeset
   114
  virtual void do_cld(ClassLoaderData* cld) = 0;
e2a6bf7f343a 8035393: Use CLDClosure instead of CLDToOopClosure in frame::oops_interpreted_do
stefank
parents: 22234
diff changeset
   115
};
e2a6bf7f343a 8035393: Use CLDClosure instead of CLDToOopClosure in frame::oops_interpreted_do
stefank
parents: 22234
diff changeset
   116
13741
e4395deb8597 7197350: NPG: jvmtiHeapReferenceCallback receives incorrect reference_kind for system class roots
stefank
parents: 13728
diff changeset
   117
class KlassToOopClosure : public KlassClosure {
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   118
  friend class MetadataAwareOopClosure;
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   119
  friend class MetadataAwareOopsInGenClosure;
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   120
13741
e4395deb8597 7197350: NPG: jvmtiHeapReferenceCallback receives incorrect reference_kind for system class roots
stefank
parents: 13728
diff changeset
   121
  OopClosure* _oop_closure;
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   122
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   123
  // Used when _oop_closure couldn't be set in an initialization list.
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   124
  void initialize(OopClosure* oop_closure) {
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   125
    assert(_oop_closure == NULL, "Should only be called once");
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   126
    _oop_closure = oop_closure;
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   127
  }
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   128
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   129
public:
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   130
  KlassToOopClosure(OopClosure* oop_closure = NULL) : _oop_closure(oop_closure) {}
13741
e4395deb8597 7197350: NPG: jvmtiHeapReferenceCallback receives incorrect reference_kind for system class roots
stefank
parents: 13728
diff changeset
   131
  virtual void do_klass(Klass* k);
e4395deb8597 7197350: NPG: jvmtiHeapReferenceCallback receives incorrect reference_kind for system class roots
stefank
parents: 13728
diff changeset
   132
};
e4395deb8597 7197350: NPG: jvmtiHeapReferenceCallback receives incorrect reference_kind for system class roots
stefank
parents: 13728
diff changeset
   133
22899
e2a6bf7f343a 8035393: Use CLDClosure instead of CLDToOopClosure in frame::oops_interpreted_do
stefank
parents: 22234
diff changeset
   134
class CLDToOopClosure : public CLDClosure {
14582
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   135
  OopClosure* _oop_closure;
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   136
  KlassToOopClosure _klass_closure;
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   137
  bool _must_claim_cld;
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   138
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   139
 public:
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   140
  CLDToOopClosure(OopClosure* oop_closure, bool must_claim_cld = true) :
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   141
      _oop_closure(oop_closure),
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   142
      _klass_closure(oop_closure),
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   143
      _must_claim_cld(must_claim_cld) {}
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   144
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   145
  void do_cld(ClassLoaderData* cld);
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   146
};
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13741
diff changeset
   147
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   148
// The base class for all concurrent marking closures,
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   149
// that participates in class unloading.
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   150
// It's used to proxy through the metadata to the oops defined in them.
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   151
class MetadataAwareOopClosure: public ExtendedOopClosure {
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   152
  KlassToOopClosure _klass_closure;
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   153
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   154
 public:
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   155
  MetadataAwareOopClosure() : ExtendedOopClosure() {
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   156
    _klass_closure.initialize(this);
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   157
  }
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   158
  MetadataAwareOopClosure(ReferenceProcessor* rp) : ExtendedOopClosure(rp) {
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   159
    _klass_closure.initialize(this);
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   160
  }
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   161
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   162
  virtual bool do_metadata()    { return do_metadata_nv(); }
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   163
  inline  bool do_metadata_nv() { return true; }
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   164
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   165
  virtual void do_klass(Klass* k);
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   166
  void do_klass_nv(Klass* k);
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   167
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   168
  virtual void do_class_loader_data(ClassLoaderData* cld);
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   169
};
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   170
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
// ObjectClosure is used for iterating through an object space
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   173
class ObjectClosure : public Closure {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  // Called for each object.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  virtual void do_object(oop obj) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
17625
3e91c67ddece 8014277: Remove ObjectClosure as base class for BoolObjectClosure
ehelin
parents: 14582
diff changeset
   180
class BoolObjectClosure : public Closure {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  virtual bool do_object_b(oop obj) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
// Applies an oop closure to all ref fields in objects iterated over in an
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
// object iteration.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
class ObjectToOopClosure: public ObjectClosure {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   188
  ExtendedOopClosure* _cl;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  void do_object(oop obj);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   191
  ObjectToOopClosure(ExtendedOopClosure* cl) : _cl(cl) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
// A version of ObjectClosure that is expected to be robust
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
// in the face of possibly uninitialized objects.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
class ObjectClosureCareful : public ObjectClosure {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  virtual size_t do_object_careful_m(oop p, MemRegion mr) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  virtual size_t do_object_careful(oop p) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
// The following are used in CompactibleFreeListSpace and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
// ConcurrentMarkSweepGeneration.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
// Blk closure (abstract class)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
class BlkClosure : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  virtual size_t do_blk(HeapWord* addr) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
// A version of BlkClosure that is expected to be robust
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
// in the face of possibly uninitialized objects.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
class BlkClosureCareful : public BlkClosure {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  size_t do_blk(HeapWord* addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    guarantee(false, "call do_blk_careful instead");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
    return 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  virtual size_t do_blk_careful(HeapWord* addr) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
// SpaceClosure is used for iterating over spaces
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
class Space;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
class CompactibleSpace;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
class SpaceClosure : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  // Called for each space
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  virtual void do_space(Space* s) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
class CompactibleSpaceClosure : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  // Called for each compactible space
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  virtual void do_space(CompactibleSpace* s) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   240
// CodeBlobClosure is used for iterating through code blobs
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   241
// in the code cache or on thread stacks
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   242
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   243
class CodeBlobClosure : public Closure {
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   244
 public:
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   245
  // Called for each code blob.
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   246
  virtual void do_code_blob(CodeBlob* cb) = 0;
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   247
};
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   248
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   249
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   250
class MarkingCodeBlobClosure : public CodeBlobClosure {
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   251
 public:
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   252
  // Called for each code blob, but at most once per unique blob.
3913
e049e6b81e11 6885169: merge of 4957990 and 6863023 causes conflict on do_nmethods
jrose
parents: 3912
diff changeset
   253
  virtual void do_newly_marked_nmethod(nmethod* nm) = 0;
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   254
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   255
  virtual void do_code_blob(CodeBlob* cb);
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   256
    // = { if (!nmethod(cb)->test_set_oops_do_mark())  do_newly_marked_nmethod(cb); }
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   257
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   258
  class MarkScope : public StackObj {
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   259
  protected:
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   260
    bool _active;
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   261
  public:
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   262
    MarkScope(bool activate = true);
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   263
      // = { if (active) nmethod::oops_do_marking_prologue(); }
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   264
    ~MarkScope();
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   265
      // = { if (active) nmethod::oops_do_marking_epilogue(); }
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   266
  };
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   267
};
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   268
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   269
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   270
// Applies an oop closure to all ref fields in code blobs
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   271
// iterated over in an object iteration.
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   272
class CodeBlobToOopClosure: public MarkingCodeBlobClosure {
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   273
  OopClosure* _cl;
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   274
  bool _do_marking;
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   275
public:
3913
e049e6b81e11 6885169: merge of 4957990 and 6863023 causes conflict on do_nmethods
jrose
parents: 3912
diff changeset
   276
  virtual void do_newly_marked_nmethod(nmethod* cb);
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   277
    // = { cb->oops_do(_cl); }
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   278
  virtual void do_code_blob(CodeBlob* cb);
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   279
    // = { if (_do_marking)  super::do_code_blob(cb); else cb->oops_do(_cl); }
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   280
  CodeBlobToOopClosure(OopClosure* cl, bool do_marking)
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   281
    : _cl(cl), _do_marking(do_marking) {}
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   282
};
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   283
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1388
diff changeset
   284
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
// MonitorClosure is used for iterating over monitors in the monitors cache
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
class ObjectMonitor;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
class MonitorClosure : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  // called for each monitor in cache
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  virtual void do_monitor(ObjectMonitor* m) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
// A closure that is applied without any arguments.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
class VoidClosure : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  // I would have liked to declare this a pure virtual, but that breaks
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  // in mysterious ways, for unknown reasons.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  virtual void do_void();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
// YieldClosure is intended for use by iteration loops
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
// to incrementalize their work, allowing interleaving
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
// of an interruptable task so as to allow other
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
// threads to run (which may not otherwise be able to access
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
// exclusive resources, for instance). Additionally, the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
// closure also allows for aborting an ongoing iteration
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
// by means of checking the return value from the polling
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
// call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
class YieldClosure : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
   virtual bool should_return() = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
// Abstract closure for serializing data (read or write).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   320
class SerializeClosure : public Closure {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  // Return bool indicating whether closure implements read or write.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  virtual bool reading() const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  // Read/write the void pointer pointed to by p.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  virtual void do_ptr(void** p) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  // Read/write the region specified.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  virtual void do_region(u_char* start, size_t size) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  // Check/write the tag.  If reading, then compare the tag against
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  // the passed in value and fail is they don't match.  This allows
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  // for verification that sections of the serialized data are of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  // correct length.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  virtual void do_tag(int tag) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
};
3690
dba50b88bd50 6798898: CMS: bugs related to class unloading
jmasa
parents: 1388
diff changeset
   337
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   338
class SymbolClosure : public StackObj {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   339
 public:
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   340
  virtual void do_symbol(Symbol**) = 0;
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   341
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   342
  // Clear LSB in symbol address; it can be set by CPSlot.
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   343
  static Symbol* load_symbol(Symbol** p) {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   344
    return (Symbol*)(intptr_t(*p) & ~1);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   345
  }
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   346
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   347
  // Store symbol, adjusting new pointer if the original pointer was adjusted
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   348
  // (symbol references in constant pool slots have their LSB set to 1).
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   349
  static void store_symbol(Symbol** p, Symbol* sym) {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   350
    *p = (Symbol*)(intptr_t(sym) | (intptr_t(*p) & 1));
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   351
  }
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   352
};
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   353
25356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   354
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   355
// Helper defines for ExtendOopClosure
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   356
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   357
#define if_do_metadata_checked(closure, nv_suffix)       \
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   358
  /* Make sure the non-virtual and the virtual versions match. */     \
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   359
  assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   360
      "Inconsistency in do_metadata");                                \
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   361
  if (closure->do_metadata##nv_suffix())
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   362
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   363
#define assert_should_ignore_metadata(closure, nv_suffix)                                  \
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   364
  assert(!closure->do_metadata##nv_suffix(), "Code to handle metadata is not implemented")
4a4a482298a6 8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents: 23539
diff changeset
   365
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   366
#endif // SHARE_VM_MEMORY_ITERATOR_HPP