annotate src/share/vm/memory/iterator.hpp @ 20543:e7d0505c8a30

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