annotate src/share/vm/memory/compactingPermGenGen.cpp @ 1972:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents c18cbe5936b8
children 3582bf76420e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2003, 2010, 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: 1051
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1051
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: 1051
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 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "classfile/symbolTable.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "classfile/systemDictionary.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "memory/compactingPermGenGen.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "memory/filemap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "memory/genOopClosures.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "memory/generation.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "memory/generationSpec.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 #include "runtime/java.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #ifndef SERIALGC
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
36 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39
47
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
40 // An ObjectClosure helper: Recursively adjust all pointers in an object
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
41 // and all objects by referenced it. Clear marks on objects in order to
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
42 // prevent visiting any object twice. This helper is used when the
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
43 // RedefineClasses() API has been called.
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
44
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
45 class AdjustSharedObjectClosure : public ObjectClosure {
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
46 public:
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
47 void do_object(oop obj) {
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
48 if (obj->is_shared_readwrite()) {
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
49 if (obj->mark()->is_marked()) {
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
50 obj->init_mark(); // Don't revisit this object.
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
51 obj->adjust_pointers(); // Adjust this object's references.
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
52 }
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
53 }
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
54 }
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
55 };
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
56
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
57
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
58 // An OopClosure helper: Recursively adjust all pointers in an object
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
59 // and all objects by referenced it. Clear marks on objects in order
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
60 // to prevent visiting any object twice.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 class RecursiveAdjustSharedObjectClosure : public OopClosure {
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
63 protected:
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
64 template <class T> inline void do_oop_work(T* p) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
65 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
66 if (obj->is_shared_readwrite()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 if (obj->mark()->is_marked()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 obj->init_mark(); // Don't revisit this object.
a61af66fc99e Initial load
duke
parents:
diff changeset
69 obj->oop_iterate(this); // Recurse - adjust objects referenced.
a61af66fc99e Initial load
duke
parents:
diff changeset
70 obj->adjust_pointers(); // Adjust this object's references.
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // Special case: if a class has a read-only constant pool,
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // then the read-write objects referenced by the pool must
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // have their marks reset.
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 if (obj->klass() == Universe::instanceKlassKlassObj()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 instanceKlass* ik = instanceKlass::cast((klassOop)obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 constantPoolOop cp = ik->constants();
a61af66fc99e Initial load
duke
parents:
diff changeset
79 if (cp->is_shared_readonly()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 cp->oop_iterate(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
85 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
86 public:
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
87 virtual void do_oop(oop* p) { RecursiveAdjustSharedObjectClosure::do_oop_work(p); }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
88 virtual void do_oop(narrowOop* p) { RecursiveAdjustSharedObjectClosure::do_oop_work(p); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
89 };
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // We need to go through all placeholders in the system dictionary and
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // try to resolve them into shared classes. Other threads might be in
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // the process of loading a shared class and have strong roots on
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // their stack to the class without having added the class to the
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // dictionary yet. This means the class will be marked during phase 1
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // but will not be unmarked during the application of the
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // RecursiveAdjustSharedObjectClosure to the SystemDictionary. Note
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // that we must not call find_shared_class with non-read-only symbols
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // as doing so can cause hash codes to be computed, destroying
a61af66fc99e Initial load
duke
parents:
diff changeset
101 // forwarding pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
102 class TraversePlaceholdersClosure : public OopClosure {
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
103 protected:
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
104 template <class T> inline void do_oop_work(T* p) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
105 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106 if (obj->klass() == Universe::symbolKlassObj() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
107 obj->is_shared_readonly()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 symbolHandle sym((symbolOop) obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
109 oop k = SystemDictionary::find_shared_class(sym);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 if (k != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 RecursiveAdjustSharedObjectClosure clo;
a61af66fc99e Initial load
duke
parents:
diff changeset
112 clo.do_oop(&k);
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114 }
a61af66fc99e Initial load
duke
parents:
diff changeset
115 }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
116 public:
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
117 virtual void do_oop(oop* p) { TraversePlaceholdersClosure::do_oop_work(p); }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
118 virtual void do_oop(narrowOop* p) { TraversePlaceholdersClosure::do_oop_work(p); }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 47
diff changeset
119
0
a61af66fc99e Initial load
duke
parents:
diff changeset
120 };
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 void CompactingPermGenGen::initialize_performance_counters() {
a61af66fc99e Initial load
duke
parents:
diff changeset
124
a61af66fc99e Initial load
duke
parents:
diff changeset
125 const char* gen_name = "perm";
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // Generation Counters - generation 2, 1 subspace
a61af66fc99e Initial load
duke
parents:
diff changeset
128 _gen_counters = new GenerationCounters(gen_name, 2, 1, &_virtual_space);
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 _space_counters = new CSpaceCounters(gen_name, 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
131 _virtual_space.reserved_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
132 _the_space, _gen_counters);
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 void CompactingPermGenGen::update_counters() {
a61af66fc99e Initial load
duke
parents:
diff changeset
136 if (UsePerfData) {
a61af66fc99e Initial load
duke
parents:
diff changeset
137 _space_counters->update_all();
a61af66fc99e Initial load
duke
parents:
diff changeset
138 _gen_counters->update_all();
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 CompactingPermGenGen::CompactingPermGenGen(ReservedSpace rs,
a61af66fc99e Initial load
duke
parents:
diff changeset
144 ReservedSpace shared_rs,
a61af66fc99e Initial load
duke
parents:
diff changeset
145 size_t initial_byte_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
146 int level, GenRemSet* remset,
a61af66fc99e Initial load
duke
parents:
diff changeset
147 ContiguousSpace* space,
a61af66fc99e Initial load
duke
parents:
diff changeset
148 PermanentGenerationSpec* spec_) :
a61af66fc99e Initial load
duke
parents:
diff changeset
149 OneContigSpaceCardGeneration(rs, initial_byte_size, MinPermHeapExpansion,
a61af66fc99e Initial load
duke
parents:
diff changeset
150 level, remset, space) {
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 set_spec(spec_);
a61af66fc99e Initial load
duke
parents:
diff changeset
153 if (!UseSharedSpaces && !DumpSharedSpaces) {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 spec()->disable_sharing();
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // Break virtual space into address ranges for all spaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
158
a61af66fc99e Initial load
duke
parents:
diff changeset
159 if (spec()->enable_shared_spaces()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
160 shared_end = (HeapWord*)(shared_rs.base() + shared_rs.size());
a61af66fc99e Initial load
duke
parents:
diff changeset
161 misccode_end = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
162 misccode_bottom = misccode_end - heap_word_size(spec()->misc_code_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
163 miscdata_end = misccode_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
164 miscdata_bottom = miscdata_end - heap_word_size(spec()->misc_data_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
165 readwrite_end = miscdata_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
166 readwrite_bottom =
a61af66fc99e Initial load
duke
parents:
diff changeset
167 readwrite_end - heap_word_size(spec()->read_write_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
168 readonly_end = readwrite_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
169 readonly_bottom =
a61af66fc99e Initial load
duke
parents:
diff changeset
170 readonly_end - heap_word_size(spec()->read_only_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
171 shared_bottom = readonly_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
172 unshared_end = shared_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 assert((char*)shared_bottom == shared_rs.base(), "shared space mismatch");
a61af66fc99e Initial load
duke
parents:
diff changeset
174 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
175 shared_end = (HeapWord*)(rs.base() + rs.size());
a61af66fc99e Initial load
duke
parents:
diff changeset
176 misccode_end = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
177 misccode_bottom = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
178 miscdata_end = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
179 miscdata_bottom = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
180 readwrite_end = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
181 readwrite_bottom = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
182 readonly_end = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
183 readonly_bottom = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
184 shared_bottom = shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
185 unshared_end = shared_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
186 }
a61af66fc99e Initial load
duke
parents:
diff changeset
187 unshared_bottom = (HeapWord*) rs.base();
a61af66fc99e Initial load
duke
parents:
diff changeset
188
a61af66fc99e Initial load
duke
parents:
diff changeset
189 // Verify shared and unshared spaces adjacent.
a61af66fc99e Initial load
duke
parents:
diff changeset
190 assert((char*)shared_bottom == rs.base()+rs.size(), "shared space mismatch");
a61af66fc99e Initial load
duke
parents:
diff changeset
191 assert(unshared_end > unshared_bottom, "shared space mismatch");
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // Split reserved memory into pieces.
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 ReservedSpace ro_rs = shared_rs.first_part(spec()->read_only_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
196 UseSharedSpaces);
a61af66fc99e Initial load
duke
parents:
diff changeset
197 ReservedSpace tmp_rs1 = shared_rs.last_part(spec()->read_only_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
198 ReservedSpace rw_rs = tmp_rs1.first_part(spec()->read_write_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
199 UseSharedSpaces);
a61af66fc99e Initial load
duke
parents:
diff changeset
200 ReservedSpace tmp_rs2 = tmp_rs1.last_part(spec()->read_write_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
201 ReservedSpace md_rs = tmp_rs2.first_part(spec()->misc_data_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
202 UseSharedSpaces);
a61af66fc99e Initial load
duke
parents:
diff changeset
203 ReservedSpace mc_rs = tmp_rs2.last_part(spec()->misc_data_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
204
a61af66fc99e Initial load
duke
parents:
diff changeset
205 _shared_space_size = spec()->read_only_size()
a61af66fc99e Initial load
duke
parents:
diff changeset
206 + spec()->read_write_size()
a61af66fc99e Initial load
duke
parents:
diff changeset
207 + spec()->misc_data_size()
a61af66fc99e Initial load
duke
parents:
diff changeset
208 + spec()->misc_code_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
209
a61af66fc99e Initial load
duke
parents:
diff changeset
210 // Allocate the unshared (default) space.
a61af66fc99e Initial load
duke
parents:
diff changeset
211 _the_space = new ContigPermSpace(_bts,
a61af66fc99e Initial load
duke
parents:
diff changeset
212 MemRegion(unshared_bottom, heap_word_size(initial_byte_size)));
a61af66fc99e Initial load
duke
parents:
diff changeset
213 if (_the_space == NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
214 vm_exit_during_initialization("Could not allocate an unshared"
a61af66fc99e Initial load
duke
parents:
diff changeset
215 " CompactingPermGen Space");
a61af66fc99e Initial load
duke
parents:
diff changeset
216
a61af66fc99e Initial load
duke
parents:
diff changeset
217 // Allocate shared spaces
a61af66fc99e Initial load
duke
parents:
diff changeset
218 if (spec()->enable_shared_spaces()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
219
a61af66fc99e Initial load
duke
parents:
diff changeset
220 // If mapping a shared file, the space is not committed, don't
a61af66fc99e Initial load
duke
parents:
diff changeset
221 // mangle.
a61af66fc99e Initial load
duke
parents:
diff changeset
222 NOT_PRODUCT(bool old_ZapUnusedHeapArea = ZapUnusedHeapArea;)
a61af66fc99e Initial load
duke
parents:
diff changeset
223 NOT_PRODUCT(if (UseSharedSpaces) ZapUnusedHeapArea = false;)
a61af66fc99e Initial load
duke
parents:
diff changeset
224
a61af66fc99e Initial load
duke
parents:
diff changeset
225 // Commit the memory behind the shared spaces if dumping (not
a61af66fc99e Initial load
duke
parents:
diff changeset
226 // mapping).
a61af66fc99e Initial load
duke
parents:
diff changeset
227 if (DumpSharedSpaces) {
a61af66fc99e Initial load
duke
parents:
diff changeset
228 _ro_vs.initialize(ro_rs, spec()->read_only_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
229 _rw_vs.initialize(rw_rs, spec()->read_write_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
230 _md_vs.initialize(md_rs, spec()->misc_data_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
231 _mc_vs.initialize(mc_rs, spec()->misc_code_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
232 }
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 // Allocate the shared spaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
235 _ro_bts = new BlockOffsetSharedArray(
a61af66fc99e Initial load
duke
parents:
diff changeset
236 MemRegion(readonly_bottom,
a61af66fc99e Initial load
duke
parents:
diff changeset
237 heap_word_size(spec()->read_only_size())),
a61af66fc99e Initial load
duke
parents:
diff changeset
238 heap_word_size(spec()->read_only_size()));
a61af66fc99e Initial load
duke
parents:
diff changeset
239 _ro_space = new OffsetTableContigSpace(_ro_bts,
a61af66fc99e Initial load
duke
parents:
diff changeset
240 MemRegion(readonly_bottom, readonly_end));
a61af66fc99e Initial load
duke
parents:
diff changeset
241 _rw_bts = new BlockOffsetSharedArray(
a61af66fc99e Initial load
duke
parents:
diff changeset
242 MemRegion(readwrite_bottom,
a61af66fc99e Initial load
duke
parents:
diff changeset
243 heap_word_size(spec()->read_write_size())),
a61af66fc99e Initial load
duke
parents:
diff changeset
244 heap_word_size(spec()->read_write_size()));
a61af66fc99e Initial load
duke
parents:
diff changeset
245 _rw_space = new OffsetTableContigSpace(_rw_bts,
a61af66fc99e Initial load
duke
parents:
diff changeset
246 MemRegion(readwrite_bottom, readwrite_end));
a61af66fc99e Initial load
duke
parents:
diff changeset
247
a61af66fc99e Initial load
duke
parents:
diff changeset
248 // Restore mangling flag.
a61af66fc99e Initial load
duke
parents:
diff changeset
249 NOT_PRODUCT(ZapUnusedHeapArea = old_ZapUnusedHeapArea;)
a61af66fc99e Initial load
duke
parents:
diff changeset
250
a61af66fc99e Initial load
duke
parents:
diff changeset
251 if (_ro_space == NULL || _rw_space == NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
252 vm_exit_during_initialization("Could not allocate a shared space");
a61af66fc99e Initial load
duke
parents:
diff changeset
253
a61af66fc99e Initial load
duke
parents:
diff changeset
254 // Cover both shared spaces entirely with cards.
a61af66fc99e Initial load
duke
parents:
diff changeset
255 _rs->resize_covered_region(MemRegion(readonly_bottom, readwrite_end));
a61af66fc99e Initial load
duke
parents:
diff changeset
256
a61af66fc99e Initial load
duke
parents:
diff changeset
257 if (UseSharedSpaces) {
a61af66fc99e Initial load
duke
parents:
diff changeset
258
a61af66fc99e Initial load
duke
parents:
diff changeset
259 // Map in the regions in the shared file.
a61af66fc99e Initial load
duke
parents:
diff changeset
260 FileMapInfo* mapinfo = FileMapInfo::current_info();
a61af66fc99e Initial load
duke
parents:
diff changeset
261 size_t image_alignment = mapinfo->alignment();
a61af66fc99e Initial load
duke
parents:
diff changeset
262 CollectedHeap* ch = Universe::heap();
a61af66fc99e Initial load
duke
parents:
diff changeset
263 if ((!mapinfo->map_space(ro, ro_rs, _ro_space)) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
264 (!mapinfo->map_space(rw, rw_rs, _rw_space)) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
265 (!mapinfo->map_space(md, md_rs, NULL)) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
266 (!mapinfo->map_space(mc, mc_rs, NULL)) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
267 // check the alignment constraints
a61af66fc99e Initial load
duke
parents:
diff changeset
268 (ch == NULL || ch->kind() != CollectedHeap::GenCollectedHeap ||
a61af66fc99e Initial load
duke
parents:
diff changeset
269 image_alignment !=
a61af66fc99e Initial load
duke
parents:
diff changeset
270 ((GenCollectedHeap*)ch)->gen_policy()->max_alignment())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
271 // Base addresses didn't match; skip sharing, but continue
a61af66fc99e Initial load
duke
parents:
diff changeset
272 shared_rs.release();
a61af66fc99e Initial load
duke
parents:
diff changeset
273 spec()->disable_sharing();
a61af66fc99e Initial load
duke
parents:
diff changeset
274 // If -Xshare:on is specified, print out the error message and exit VM,
a61af66fc99e Initial load
duke
parents:
diff changeset
275 // otherwise, set UseSharedSpaces to false and continue.
a61af66fc99e Initial load
duke
parents:
diff changeset
276 if (RequireSharedSpaces) {
a61af66fc99e Initial load
duke
parents:
diff changeset
277 vm_exit_during_initialization("Unable to use shared archive.", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
278 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
279 FLAG_SET_DEFAULT(UseSharedSpaces, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
280 }
a61af66fc99e Initial load
duke
parents:
diff changeset
281
a61af66fc99e Initial load
duke
parents:
diff changeset
282 // Note: freeing the block offset array objects does not
a61af66fc99e Initial load
duke
parents:
diff changeset
283 // currently free up the underlying storage.
a61af66fc99e Initial load
duke
parents:
diff changeset
284 delete _ro_bts;
a61af66fc99e Initial load
duke
parents:
diff changeset
285 _ro_bts = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
286 delete _ro_space;
a61af66fc99e Initial load
duke
parents:
diff changeset
287 _ro_space = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
288 delete _rw_bts;
a61af66fc99e Initial load
duke
parents:
diff changeset
289 _rw_bts = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
290 delete _rw_space;
a61af66fc99e Initial load
duke
parents:
diff changeset
291 _rw_space = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
292 shared_end = (HeapWord*)(rs.base() + rs.size());
a61af66fc99e Initial load
duke
parents:
diff changeset
293 _rs->resize_covered_region(MemRegion(shared_bottom, shared_bottom));
a61af66fc99e Initial load
duke
parents:
diff changeset
294 }
a61af66fc99e Initial load
duke
parents:
diff changeset
295 }
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // Reserved region includes shared spaces for oop.is_in_reserved().
a61af66fc99e Initial load
duke
parents:
diff changeset
298 _reserved.set_end(shared_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
299
a61af66fc99e Initial load
duke
parents:
diff changeset
300 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
301 _ro_space = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
302 _rw_space = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
303 }
a61af66fc99e Initial load
duke
parents:
diff changeset
304 }
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306
a61af66fc99e Initial load
duke
parents:
diff changeset
307 // Do a complete scan of the shared read write space to catch all
a61af66fc99e Initial load
duke
parents:
diff changeset
308 // objects which contain references to any younger generation. Forward
a61af66fc99e Initial load
duke
parents:
diff changeset
309 // the pointers. Avoid space_iterate, as actually visiting all the
a61af66fc99e Initial load
duke
parents:
diff changeset
310 // objects in the space will page in more objects than we need.
a61af66fc99e Initial load
duke
parents:
diff changeset
311 // Instead, use the system dictionary as strong roots into the read
a61af66fc99e Initial load
duke
parents:
diff changeset
312 // write space.
47
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
313 //
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
314 // If a RedefineClasses() call has been made, then we have to iterate
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
315 // over the entire shared read-write space in order to find all the
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
316 // objects that need to be forwarded. For example, it is possible for
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
317 // an nmethod to be found and marked in GC phase-1 only for the nmethod
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
318 // to be freed by the time we reach GC phase-3. The underlying method
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
319 // is still marked, but we can't (easily) find it in GC phase-3 so we
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
320 // blow up in GC phase-4. With RedefineClasses() we want replaced code
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
321 // (EMCP or obsolete) to go away (i.e., be collectible) once it is no
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
322 // longer being executed by any thread so we keep minimal attachments
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
323 // to the replaced code. However, we can't guarantee when those EMCP
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
324 // or obsolete methods will be collected so they may still be out there
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
325 // even after we've severed our minimal attachments.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
326
a61af66fc99e Initial load
duke
parents:
diff changeset
327 void CompactingPermGenGen::pre_adjust_pointers() {
a61af66fc99e Initial load
duke
parents:
diff changeset
328 if (spec()->enable_shared_spaces()) {
47
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
329 if (JvmtiExport::has_redefined_a_class()) {
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
330 // RedefineClasses() requires a brute force approach
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
331 AdjustSharedObjectClosure blk;
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
332 rw_space()->object_iterate(&blk);
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
333 } else {
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
334 RecursiveAdjustSharedObjectClosure blk;
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
335 Universe::oops_do(&blk);
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
336 StringTable::oops_do(&blk);
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
337 SystemDictionary::always_strong_classes_do(&blk);
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
338 TraversePlaceholdersClosure tpc;
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
339 SystemDictionary::placeholders_do(&tpc);
2c106685d6d0 6497639: 4/3 Profiling Swing application caused JVM crash
dcubed
parents: 0
diff changeset
340 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
341 }
a61af66fc99e Initial load
duke
parents:
diff changeset
342 }
a61af66fc99e Initial load
duke
parents:
diff changeset
343
a61af66fc99e Initial load
duke
parents:
diff changeset
344
a61af66fc99e Initial load
duke
parents:
diff changeset
345 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
346 class VerifyMarksClearedClosure : public ObjectClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
347 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
348 void do_object(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
349 assert(SharedSkipVerify || !obj->mark()->is_marked(),
a61af66fc99e Initial load
duke
parents:
diff changeset
350 "Shared oop still marked?");
a61af66fc99e Initial load
duke
parents:
diff changeset
351 }
a61af66fc99e Initial load
duke
parents:
diff changeset
352 };
a61af66fc99e Initial load
duke
parents:
diff changeset
353 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
354
a61af66fc99e Initial load
duke
parents:
diff changeset
355
a61af66fc99e Initial load
duke
parents:
diff changeset
356 void CompactingPermGenGen::post_compact() {
a61af66fc99e Initial load
duke
parents:
diff changeset
357 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
358 if (!SharedSkipVerify && spec()->enable_shared_spaces()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
359 VerifyMarksClearedClosure blk;
a61af66fc99e Initial load
duke
parents:
diff changeset
360 rw_space()->object_iterate(&blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
361 }
a61af66fc99e Initial load
duke
parents:
diff changeset
362 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
363 }
a61af66fc99e Initial load
duke
parents:
diff changeset
364
a61af66fc99e Initial load
duke
parents:
diff changeset
365
1051
26f1542097f1 6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
ysr
parents: 291
diff changeset
366 // Do not use in time-critical operations due to the possibility of paging
26f1542097f1 6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
ysr
parents: 291
diff changeset
367 // in otherwise untouched or previously unread portions of the perm gen,
26f1542097f1 6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
ysr
parents: 291
diff changeset
368 // for instance, the shared spaces. NOTE: Because CompactingPermGenGen
26f1542097f1 6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
ysr
parents: 291
diff changeset
369 // derives from OneContigSpaceCardGeneration which is supposed to have a
26f1542097f1 6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
ysr
parents: 291
diff changeset
370 // single space, and does not override its object_iterate() method,
26f1542097f1 6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
ysr
parents: 291
diff changeset
371 // object iteration via that interface does not look at the objects in
26f1542097f1 6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
ysr
parents: 291
diff changeset
372 // the shared spaces when using CDS. This should be fixed; see CR 6897798.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
373 void CompactingPermGenGen::space_iterate(SpaceClosure* blk, bool usedOnly) {
a61af66fc99e Initial load
duke
parents:
diff changeset
374 OneContigSpaceCardGeneration::space_iterate(blk, usedOnly);
a61af66fc99e Initial load
duke
parents:
diff changeset
375 if (spec()->enable_shared_spaces()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
376 // Making the rw_space walkable will page in the entire space, and
1051
26f1542097f1 6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
ysr
parents: 291
diff changeset
377 // is to be avoided in the case of time-critical operations.
26f1542097f1 6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
ysr
parents: 291
diff changeset
378 // However, this is required for Verify and heap dump operations.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
379 blk->do_space(ro_space());
a61af66fc99e Initial load
duke
parents:
diff changeset
380 blk->do_space(rw_space());
a61af66fc99e Initial load
duke
parents:
diff changeset
381 }
a61af66fc99e Initial load
duke
parents:
diff changeset
382 }
a61af66fc99e Initial load
duke
parents:
diff changeset
383
a61af66fc99e Initial load
duke
parents:
diff changeset
384
a61af66fc99e Initial load
duke
parents:
diff changeset
385 void CompactingPermGenGen::print_on(outputStream* st) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
386 OneContigSpaceCardGeneration::print_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
387 if (spec()->enable_shared_spaces()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
388 st->print(" ro");
a61af66fc99e Initial load
duke
parents:
diff changeset
389 ro_space()->print_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
390 st->print(" rw");
a61af66fc99e Initial load
duke
parents:
diff changeset
391 rw_space()->print_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
392 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
393 st->print_cr("No shared spaces configured.");
a61af66fc99e Initial load
duke
parents:
diff changeset
394 }
a61af66fc99e Initial load
duke
parents:
diff changeset
395 }
a61af66fc99e Initial load
duke
parents:
diff changeset
396
a61af66fc99e Initial load
duke
parents:
diff changeset
397
a61af66fc99e Initial load
duke
parents:
diff changeset
398 // References from the perm gen to the younger generation objects may
a61af66fc99e Initial load
duke
parents:
diff changeset
399 // occur in static fields in Java classes or in constant pool references
a61af66fc99e Initial load
duke
parents:
diff changeset
400 // to String objects.
a61af66fc99e Initial load
duke
parents:
diff changeset
401
a61af66fc99e Initial load
duke
parents:
diff changeset
402 void CompactingPermGenGen::younger_refs_iterate(OopsInGenClosure* blk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
403 OneContigSpaceCardGeneration::younger_refs_iterate(blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
404 if (spec()->enable_shared_spaces()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
405 blk->set_generation(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
406 // ro_space has no younger gen refs.
a61af66fc99e Initial load
duke
parents:
diff changeset
407 _rs->younger_refs_in_space_iterate(rw_space(), blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
408 blk->reset_generation();
a61af66fc99e Initial load
duke
parents:
diff changeset
409 }
a61af66fc99e Initial load
duke
parents:
diff changeset
410 }
a61af66fc99e Initial load
duke
parents:
diff changeset
411
a61af66fc99e Initial load
duke
parents:
diff changeset
412
a61af66fc99e Initial load
duke
parents:
diff changeset
413 // Shared spaces are addressed in pre_adjust_pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
414 void CompactingPermGenGen::adjust_pointers() {
a61af66fc99e Initial load
duke
parents:
diff changeset
415 the_space()->adjust_pointers();
a61af66fc99e Initial load
duke
parents:
diff changeset
416 }
a61af66fc99e Initial load
duke
parents:
diff changeset
417
a61af66fc99e Initial load
duke
parents:
diff changeset
418
a61af66fc99e Initial load
duke
parents:
diff changeset
419 void CompactingPermGenGen::compact() {
a61af66fc99e Initial load
duke
parents:
diff changeset
420 the_space()->compact();
a61af66fc99e Initial load
duke
parents:
diff changeset
421 }
a61af66fc99e Initial load
duke
parents:
diff changeset
422
a61af66fc99e Initial load
duke
parents:
diff changeset
423
a61af66fc99e Initial load
duke
parents:
diff changeset
424 size_t CompactingPermGenGen::contiguous_available() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
425 // Don't include shared spaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
426 return OneContigSpaceCardGeneration::contiguous_available()
a61af66fc99e Initial load
duke
parents:
diff changeset
427 - _shared_space_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
428 }
a61af66fc99e Initial load
duke
parents:
diff changeset
429
a61af66fc99e Initial load
duke
parents:
diff changeset
430 size_t CompactingPermGenGen::max_capacity() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
431 // Don't include shared spaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
432 assert(UseSharedSpaces || (_shared_space_size == 0),
a61af66fc99e Initial load
duke
parents:
diff changeset
433 "If not used, the size of shared spaces should be 0");
a61af66fc99e Initial load
duke
parents:
diff changeset
434 return OneContigSpaceCardGeneration::max_capacity()
a61af66fc99e Initial load
duke
parents:
diff changeset
435 - _shared_space_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
436 }
a61af66fc99e Initial load
duke
parents:
diff changeset
437
a61af66fc99e Initial load
duke
parents:
diff changeset
438
a61af66fc99e Initial load
duke
parents:
diff changeset
439 // No young generation references, clear this generation's main space's
a61af66fc99e Initial load
duke
parents:
diff changeset
440 // card table entries. Do NOT clear the card table entries for the
a61af66fc99e Initial load
duke
parents:
diff changeset
441 // read-only space (always clear) or the read-write space (valuable
a61af66fc99e Initial load
duke
parents:
diff changeset
442 // information).
a61af66fc99e Initial load
duke
parents:
diff changeset
443
a61af66fc99e Initial load
duke
parents:
diff changeset
444 void CompactingPermGenGen::clear_remembered_set() {
a61af66fc99e Initial load
duke
parents:
diff changeset
445 _rs->clear(MemRegion(the_space()->bottom(), the_space()->end()));
a61af66fc99e Initial load
duke
parents:
diff changeset
446 }
a61af66fc99e Initial load
duke
parents:
diff changeset
447
a61af66fc99e Initial load
duke
parents:
diff changeset
448
a61af66fc99e Initial load
duke
parents:
diff changeset
449 // Objects in this generation's main space may have moved, invalidate
a61af66fc99e Initial load
duke
parents:
diff changeset
450 // that space's cards. Do NOT invalidate the card table entries for the
a61af66fc99e Initial load
duke
parents:
diff changeset
451 // read-only or read-write spaces, as those objects never move.
a61af66fc99e Initial load
duke
parents:
diff changeset
452
a61af66fc99e Initial load
duke
parents:
diff changeset
453 void CompactingPermGenGen::invalidate_remembered_set() {
a61af66fc99e Initial load
duke
parents:
diff changeset
454 _rs->invalidate(used_region());
a61af66fc99e Initial load
duke
parents:
diff changeset
455 }
a61af66fc99e Initial load
duke
parents:
diff changeset
456
a61af66fc99e Initial load
duke
parents:
diff changeset
457
a61af66fc99e Initial load
duke
parents:
diff changeset
458 void CompactingPermGenGen::verify(bool allow_dirty) {
a61af66fc99e Initial load
duke
parents:
diff changeset
459 the_space()->verify(allow_dirty);
a61af66fc99e Initial load
duke
parents:
diff changeset
460 if (!SharedSkipVerify && spec()->enable_shared_spaces()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
461 ro_space()->verify(allow_dirty);
a61af66fc99e Initial load
duke
parents:
diff changeset
462 rw_space()->verify(allow_dirty);
a61af66fc99e Initial load
duke
parents:
diff changeset
463 }
a61af66fc99e Initial load
duke
parents:
diff changeset
464 }
a61af66fc99e Initial load
duke
parents:
diff changeset
465
a61af66fc99e Initial load
duke
parents:
diff changeset
466
a61af66fc99e Initial load
duke
parents:
diff changeset
467 HeapWord* CompactingPermGenGen::unshared_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
468 HeapWord* CompactingPermGenGen::unshared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
469 HeapWord* CompactingPermGenGen::shared_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
470 HeapWord* CompactingPermGenGen::shared_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
471 HeapWord* CompactingPermGenGen::readonly_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
472 HeapWord* CompactingPermGenGen::readonly_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
473 HeapWord* CompactingPermGenGen::readwrite_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
474 HeapWord* CompactingPermGenGen::readwrite_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
475 HeapWord* CompactingPermGenGen::miscdata_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
476 HeapWord* CompactingPermGenGen::miscdata_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
477 HeapWord* CompactingPermGenGen::misccode_bottom;
a61af66fc99e Initial load
duke
parents:
diff changeset
478 HeapWord* CompactingPermGenGen::misccode_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
479
a61af66fc99e Initial load
duke
parents:
diff changeset
480 // JVM/TI RedefineClasses() support:
a61af66fc99e Initial load
duke
parents:
diff changeset
481 bool CompactingPermGenGen::remap_shared_readonly_as_readwrite() {
a61af66fc99e Initial load
duke
parents:
diff changeset
482 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
a61af66fc99e Initial load
duke
parents:
diff changeset
483
a61af66fc99e Initial load
duke
parents:
diff changeset
484 if (UseSharedSpaces) {
a61af66fc99e Initial load
duke
parents:
diff changeset
485 // remap the shared readonly space to shared readwrite, private
a61af66fc99e Initial load
duke
parents:
diff changeset
486 FileMapInfo* mapinfo = FileMapInfo::current_info();
a61af66fc99e Initial load
duke
parents:
diff changeset
487 if (!mapinfo->remap_shared_readonly_as_readwrite()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
488 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
489 }
a61af66fc99e Initial load
duke
parents:
diff changeset
490 }
a61af66fc99e Initial load
duke
parents:
diff changeset
491 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
492 }
a61af66fc99e Initial load
duke
parents:
diff changeset
493
a61af66fc99e Initial load
duke
parents:
diff changeset
494 void** CompactingPermGenGen::_vtbl_list;