Sat, 01 Dec 2007 00:00:00 +0000
Initial load
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | #include "incls/_precompiled.incl" |
duke@435 | 26 | #include "incls/_compactingPermGenGen.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | |
duke@435 | 29 | // Recursively adjust all pointers in an object and all objects by |
duke@435 | 30 | // referenced it. Clear marks on objects in order to prevent visiting |
duke@435 | 31 | // any object twice. |
duke@435 | 32 | |
duke@435 | 33 | class RecursiveAdjustSharedObjectClosure : public OopClosure { |
duke@435 | 34 | public: |
duke@435 | 35 | void do_oop(oop* o) { |
duke@435 | 36 | oop obj = *o; |
duke@435 | 37 | if (obj->is_shared_readwrite()) { |
duke@435 | 38 | if (obj->mark()->is_marked()) { |
duke@435 | 39 | obj->init_mark(); // Don't revisit this object. |
duke@435 | 40 | obj->oop_iterate(this); // Recurse - adjust objects referenced. |
duke@435 | 41 | obj->adjust_pointers(); // Adjust this object's references. |
duke@435 | 42 | |
duke@435 | 43 | // Special case: if a class has a read-only constant pool, |
duke@435 | 44 | // then the read-write objects referenced by the pool must |
duke@435 | 45 | // have their marks reset. |
duke@435 | 46 | |
duke@435 | 47 | if (obj->klass() == Universe::instanceKlassKlassObj()) { |
duke@435 | 48 | instanceKlass* ik = instanceKlass::cast((klassOop)obj); |
duke@435 | 49 | constantPoolOop cp = ik->constants(); |
duke@435 | 50 | if (cp->is_shared_readonly()) { |
duke@435 | 51 | cp->oop_iterate(this); |
duke@435 | 52 | } |
duke@435 | 53 | } |
duke@435 | 54 | } |
duke@435 | 55 | } |
duke@435 | 56 | }; |
duke@435 | 57 | }; |
duke@435 | 58 | |
duke@435 | 59 | |
duke@435 | 60 | // We need to go through all placeholders in the system dictionary and |
duke@435 | 61 | // try to resolve them into shared classes. Other threads might be in |
duke@435 | 62 | // the process of loading a shared class and have strong roots on |
duke@435 | 63 | // their stack to the class without having added the class to the |
duke@435 | 64 | // dictionary yet. This means the class will be marked during phase 1 |
duke@435 | 65 | // but will not be unmarked during the application of the |
duke@435 | 66 | // RecursiveAdjustSharedObjectClosure to the SystemDictionary. Note |
duke@435 | 67 | // that we must not call find_shared_class with non-read-only symbols |
duke@435 | 68 | // as doing so can cause hash codes to be computed, destroying |
duke@435 | 69 | // forwarding pointers. |
duke@435 | 70 | class TraversePlaceholdersClosure : public OopClosure { |
duke@435 | 71 | public: |
duke@435 | 72 | void do_oop(oop* o) { |
duke@435 | 73 | oop obj = *o; |
duke@435 | 74 | if (obj->klass() == Universe::symbolKlassObj() && |
duke@435 | 75 | obj->is_shared_readonly()) { |
duke@435 | 76 | symbolHandle sym((symbolOop) obj); |
duke@435 | 77 | oop k = SystemDictionary::find_shared_class(sym); |
duke@435 | 78 | if (k != NULL) { |
duke@435 | 79 | RecursiveAdjustSharedObjectClosure clo; |
duke@435 | 80 | clo.do_oop(&k); |
duke@435 | 81 | } |
duke@435 | 82 | } |
duke@435 | 83 | } |
duke@435 | 84 | }; |
duke@435 | 85 | |
duke@435 | 86 | |
duke@435 | 87 | void CompactingPermGenGen::initialize_performance_counters() { |
duke@435 | 88 | |
duke@435 | 89 | const char* gen_name = "perm"; |
duke@435 | 90 | |
duke@435 | 91 | // Generation Counters - generation 2, 1 subspace |
duke@435 | 92 | _gen_counters = new GenerationCounters(gen_name, 2, 1, &_virtual_space); |
duke@435 | 93 | |
duke@435 | 94 | _space_counters = new CSpaceCounters(gen_name, 0, |
duke@435 | 95 | _virtual_space.reserved_size(), |
duke@435 | 96 | _the_space, _gen_counters); |
duke@435 | 97 | } |
duke@435 | 98 | |
duke@435 | 99 | void CompactingPermGenGen::update_counters() { |
duke@435 | 100 | if (UsePerfData) { |
duke@435 | 101 | _space_counters->update_all(); |
duke@435 | 102 | _gen_counters->update_all(); |
duke@435 | 103 | } |
duke@435 | 104 | } |
duke@435 | 105 | |
duke@435 | 106 | |
duke@435 | 107 | CompactingPermGenGen::CompactingPermGenGen(ReservedSpace rs, |
duke@435 | 108 | ReservedSpace shared_rs, |
duke@435 | 109 | size_t initial_byte_size, |
duke@435 | 110 | int level, GenRemSet* remset, |
duke@435 | 111 | ContiguousSpace* space, |
duke@435 | 112 | PermanentGenerationSpec* spec_) : |
duke@435 | 113 | OneContigSpaceCardGeneration(rs, initial_byte_size, MinPermHeapExpansion, |
duke@435 | 114 | level, remset, space) { |
duke@435 | 115 | |
duke@435 | 116 | set_spec(spec_); |
duke@435 | 117 | if (!UseSharedSpaces && !DumpSharedSpaces) { |
duke@435 | 118 | spec()->disable_sharing(); |
duke@435 | 119 | } |
duke@435 | 120 | |
duke@435 | 121 | // Break virtual space into address ranges for all spaces. |
duke@435 | 122 | |
duke@435 | 123 | if (spec()->enable_shared_spaces()) { |
duke@435 | 124 | shared_end = (HeapWord*)(shared_rs.base() + shared_rs.size()); |
duke@435 | 125 | misccode_end = shared_end; |
duke@435 | 126 | misccode_bottom = misccode_end - heap_word_size(spec()->misc_code_size()); |
duke@435 | 127 | miscdata_end = misccode_bottom; |
duke@435 | 128 | miscdata_bottom = miscdata_end - heap_word_size(spec()->misc_data_size()); |
duke@435 | 129 | readwrite_end = miscdata_bottom; |
duke@435 | 130 | readwrite_bottom = |
duke@435 | 131 | readwrite_end - heap_word_size(spec()->read_write_size()); |
duke@435 | 132 | readonly_end = readwrite_bottom; |
duke@435 | 133 | readonly_bottom = |
duke@435 | 134 | readonly_end - heap_word_size(spec()->read_only_size()); |
duke@435 | 135 | shared_bottom = readonly_bottom; |
duke@435 | 136 | unshared_end = shared_bottom; |
duke@435 | 137 | assert((char*)shared_bottom == shared_rs.base(), "shared space mismatch"); |
duke@435 | 138 | } else { |
duke@435 | 139 | shared_end = (HeapWord*)(rs.base() + rs.size()); |
duke@435 | 140 | misccode_end = shared_end; |
duke@435 | 141 | misccode_bottom = shared_end; |
duke@435 | 142 | miscdata_end = shared_end; |
duke@435 | 143 | miscdata_bottom = shared_end; |
duke@435 | 144 | readwrite_end = shared_end; |
duke@435 | 145 | readwrite_bottom = shared_end; |
duke@435 | 146 | readonly_end = shared_end; |
duke@435 | 147 | readonly_bottom = shared_end; |
duke@435 | 148 | shared_bottom = shared_end; |
duke@435 | 149 | unshared_end = shared_bottom; |
duke@435 | 150 | } |
duke@435 | 151 | unshared_bottom = (HeapWord*) rs.base(); |
duke@435 | 152 | |
duke@435 | 153 | // Verify shared and unshared spaces adjacent. |
duke@435 | 154 | assert((char*)shared_bottom == rs.base()+rs.size(), "shared space mismatch"); |
duke@435 | 155 | assert(unshared_end > unshared_bottom, "shared space mismatch"); |
duke@435 | 156 | |
duke@435 | 157 | // Split reserved memory into pieces. |
duke@435 | 158 | |
duke@435 | 159 | ReservedSpace ro_rs = shared_rs.first_part(spec()->read_only_size(), |
duke@435 | 160 | UseSharedSpaces); |
duke@435 | 161 | ReservedSpace tmp_rs1 = shared_rs.last_part(spec()->read_only_size()); |
duke@435 | 162 | ReservedSpace rw_rs = tmp_rs1.first_part(spec()->read_write_size(), |
duke@435 | 163 | UseSharedSpaces); |
duke@435 | 164 | ReservedSpace tmp_rs2 = tmp_rs1.last_part(spec()->read_write_size()); |
duke@435 | 165 | ReservedSpace md_rs = tmp_rs2.first_part(spec()->misc_data_size(), |
duke@435 | 166 | UseSharedSpaces); |
duke@435 | 167 | ReservedSpace mc_rs = tmp_rs2.last_part(spec()->misc_data_size()); |
duke@435 | 168 | |
duke@435 | 169 | _shared_space_size = spec()->read_only_size() |
duke@435 | 170 | + spec()->read_write_size() |
duke@435 | 171 | + spec()->misc_data_size() |
duke@435 | 172 | + spec()->misc_code_size(); |
duke@435 | 173 | |
duke@435 | 174 | // Allocate the unshared (default) space. |
duke@435 | 175 | _the_space = new ContigPermSpace(_bts, |
duke@435 | 176 | MemRegion(unshared_bottom, heap_word_size(initial_byte_size))); |
duke@435 | 177 | if (_the_space == NULL) |
duke@435 | 178 | vm_exit_during_initialization("Could not allocate an unshared" |
duke@435 | 179 | " CompactingPermGen Space"); |
duke@435 | 180 | |
duke@435 | 181 | // Allocate shared spaces |
duke@435 | 182 | if (spec()->enable_shared_spaces()) { |
duke@435 | 183 | |
duke@435 | 184 | // If mapping a shared file, the space is not committed, don't |
duke@435 | 185 | // mangle. |
duke@435 | 186 | NOT_PRODUCT(bool old_ZapUnusedHeapArea = ZapUnusedHeapArea;) |
duke@435 | 187 | NOT_PRODUCT(if (UseSharedSpaces) ZapUnusedHeapArea = false;) |
duke@435 | 188 | |
duke@435 | 189 | // Commit the memory behind the shared spaces if dumping (not |
duke@435 | 190 | // mapping). |
duke@435 | 191 | if (DumpSharedSpaces) { |
duke@435 | 192 | _ro_vs.initialize(ro_rs, spec()->read_only_size()); |
duke@435 | 193 | _rw_vs.initialize(rw_rs, spec()->read_write_size()); |
duke@435 | 194 | _md_vs.initialize(md_rs, spec()->misc_data_size()); |
duke@435 | 195 | _mc_vs.initialize(mc_rs, spec()->misc_code_size()); |
duke@435 | 196 | } |
duke@435 | 197 | |
duke@435 | 198 | // Allocate the shared spaces. |
duke@435 | 199 | _ro_bts = new BlockOffsetSharedArray( |
duke@435 | 200 | MemRegion(readonly_bottom, |
duke@435 | 201 | heap_word_size(spec()->read_only_size())), |
duke@435 | 202 | heap_word_size(spec()->read_only_size())); |
duke@435 | 203 | _ro_space = new OffsetTableContigSpace(_ro_bts, |
duke@435 | 204 | MemRegion(readonly_bottom, readonly_end)); |
duke@435 | 205 | _rw_bts = new BlockOffsetSharedArray( |
duke@435 | 206 | MemRegion(readwrite_bottom, |
duke@435 | 207 | heap_word_size(spec()->read_write_size())), |
duke@435 | 208 | heap_word_size(spec()->read_write_size())); |
duke@435 | 209 | _rw_space = new OffsetTableContigSpace(_rw_bts, |
duke@435 | 210 | MemRegion(readwrite_bottom, readwrite_end)); |
duke@435 | 211 | |
duke@435 | 212 | // Restore mangling flag. |
duke@435 | 213 | NOT_PRODUCT(ZapUnusedHeapArea = old_ZapUnusedHeapArea;) |
duke@435 | 214 | |
duke@435 | 215 | if (_ro_space == NULL || _rw_space == NULL) |
duke@435 | 216 | vm_exit_during_initialization("Could not allocate a shared space"); |
duke@435 | 217 | |
duke@435 | 218 | // Cover both shared spaces entirely with cards. |
duke@435 | 219 | _rs->resize_covered_region(MemRegion(readonly_bottom, readwrite_end)); |
duke@435 | 220 | |
duke@435 | 221 | if (UseSharedSpaces) { |
duke@435 | 222 | |
duke@435 | 223 | // Map in the regions in the shared file. |
duke@435 | 224 | FileMapInfo* mapinfo = FileMapInfo::current_info(); |
duke@435 | 225 | size_t image_alignment = mapinfo->alignment(); |
duke@435 | 226 | CollectedHeap* ch = Universe::heap(); |
duke@435 | 227 | if ((!mapinfo->map_space(ro, ro_rs, _ro_space)) || |
duke@435 | 228 | (!mapinfo->map_space(rw, rw_rs, _rw_space)) || |
duke@435 | 229 | (!mapinfo->map_space(md, md_rs, NULL)) || |
duke@435 | 230 | (!mapinfo->map_space(mc, mc_rs, NULL)) || |
duke@435 | 231 | // check the alignment constraints |
duke@435 | 232 | (ch == NULL || ch->kind() != CollectedHeap::GenCollectedHeap || |
duke@435 | 233 | image_alignment != |
duke@435 | 234 | ((GenCollectedHeap*)ch)->gen_policy()->max_alignment())) { |
duke@435 | 235 | // Base addresses didn't match; skip sharing, but continue |
duke@435 | 236 | shared_rs.release(); |
duke@435 | 237 | spec()->disable_sharing(); |
duke@435 | 238 | // If -Xshare:on is specified, print out the error message and exit VM, |
duke@435 | 239 | // otherwise, set UseSharedSpaces to false and continue. |
duke@435 | 240 | if (RequireSharedSpaces) { |
duke@435 | 241 | vm_exit_during_initialization("Unable to use shared archive.", NULL); |
duke@435 | 242 | } else { |
duke@435 | 243 | FLAG_SET_DEFAULT(UseSharedSpaces, false); |
duke@435 | 244 | } |
duke@435 | 245 | |
duke@435 | 246 | // Note: freeing the block offset array objects does not |
duke@435 | 247 | // currently free up the underlying storage. |
duke@435 | 248 | delete _ro_bts; |
duke@435 | 249 | _ro_bts = NULL; |
duke@435 | 250 | delete _ro_space; |
duke@435 | 251 | _ro_space = NULL; |
duke@435 | 252 | delete _rw_bts; |
duke@435 | 253 | _rw_bts = NULL; |
duke@435 | 254 | delete _rw_space; |
duke@435 | 255 | _rw_space = NULL; |
duke@435 | 256 | shared_end = (HeapWord*)(rs.base() + rs.size()); |
duke@435 | 257 | _rs->resize_covered_region(MemRegion(shared_bottom, shared_bottom)); |
duke@435 | 258 | } |
duke@435 | 259 | } |
duke@435 | 260 | |
duke@435 | 261 | // Reserved region includes shared spaces for oop.is_in_reserved(). |
duke@435 | 262 | _reserved.set_end(shared_end); |
duke@435 | 263 | |
duke@435 | 264 | } else { |
duke@435 | 265 | _ro_space = NULL; |
duke@435 | 266 | _rw_space = NULL; |
duke@435 | 267 | } |
duke@435 | 268 | } |
duke@435 | 269 | |
duke@435 | 270 | |
duke@435 | 271 | // Do a complete scan of the shared read write space to catch all |
duke@435 | 272 | // objects which contain references to any younger generation. Forward |
duke@435 | 273 | // the pointers. Avoid space_iterate, as actually visiting all the |
duke@435 | 274 | // objects in the space will page in more objects than we need. |
duke@435 | 275 | // Instead, use the system dictionary as strong roots into the read |
duke@435 | 276 | // write space. |
duke@435 | 277 | |
duke@435 | 278 | void CompactingPermGenGen::pre_adjust_pointers() { |
duke@435 | 279 | if (spec()->enable_shared_spaces()) { |
duke@435 | 280 | RecursiveAdjustSharedObjectClosure blk; |
duke@435 | 281 | Universe::oops_do(&blk); |
duke@435 | 282 | StringTable::oops_do(&blk); |
duke@435 | 283 | SystemDictionary::always_strong_classes_do(&blk); |
duke@435 | 284 | TraversePlaceholdersClosure tpc; |
duke@435 | 285 | SystemDictionary::placeholders_do(&tpc); |
duke@435 | 286 | } |
duke@435 | 287 | } |
duke@435 | 288 | |
duke@435 | 289 | |
duke@435 | 290 | #ifdef ASSERT |
duke@435 | 291 | class VerifyMarksClearedClosure : public ObjectClosure { |
duke@435 | 292 | public: |
duke@435 | 293 | void do_object(oop obj) { |
duke@435 | 294 | assert(SharedSkipVerify || !obj->mark()->is_marked(), |
duke@435 | 295 | "Shared oop still marked?"); |
duke@435 | 296 | } |
duke@435 | 297 | }; |
duke@435 | 298 | #endif |
duke@435 | 299 | |
duke@435 | 300 | |
duke@435 | 301 | void CompactingPermGenGen::post_compact() { |
duke@435 | 302 | #ifdef ASSERT |
duke@435 | 303 | if (!SharedSkipVerify && spec()->enable_shared_spaces()) { |
duke@435 | 304 | VerifyMarksClearedClosure blk; |
duke@435 | 305 | rw_space()->object_iterate(&blk); |
duke@435 | 306 | } |
duke@435 | 307 | #endif |
duke@435 | 308 | } |
duke@435 | 309 | |
duke@435 | 310 | |
duke@435 | 311 | void CompactingPermGenGen::space_iterate(SpaceClosure* blk, bool usedOnly) { |
duke@435 | 312 | OneContigSpaceCardGeneration::space_iterate(blk, usedOnly); |
duke@435 | 313 | if (spec()->enable_shared_spaces()) { |
duke@435 | 314 | #ifdef PRODUCT |
duke@435 | 315 | // Making the rw_space walkable will page in the entire space, and |
duke@435 | 316 | // is to be avoided. However, this is required for Verify options. |
duke@435 | 317 | ShouldNotReachHere(); |
duke@435 | 318 | #endif |
duke@435 | 319 | |
duke@435 | 320 | blk->do_space(ro_space()); |
duke@435 | 321 | blk->do_space(rw_space()); |
duke@435 | 322 | } |
duke@435 | 323 | } |
duke@435 | 324 | |
duke@435 | 325 | |
duke@435 | 326 | void CompactingPermGenGen::print_on(outputStream* st) const { |
duke@435 | 327 | OneContigSpaceCardGeneration::print_on(st); |
duke@435 | 328 | if (spec()->enable_shared_spaces()) { |
duke@435 | 329 | st->print(" ro"); |
duke@435 | 330 | ro_space()->print_on(st); |
duke@435 | 331 | st->print(" rw"); |
duke@435 | 332 | rw_space()->print_on(st); |
duke@435 | 333 | } else { |
duke@435 | 334 | st->print_cr("No shared spaces configured."); |
duke@435 | 335 | } |
duke@435 | 336 | } |
duke@435 | 337 | |
duke@435 | 338 | |
duke@435 | 339 | // References from the perm gen to the younger generation objects may |
duke@435 | 340 | // occur in static fields in Java classes or in constant pool references |
duke@435 | 341 | // to String objects. |
duke@435 | 342 | |
duke@435 | 343 | void CompactingPermGenGen::younger_refs_iterate(OopsInGenClosure* blk) { |
duke@435 | 344 | OneContigSpaceCardGeneration::younger_refs_iterate(blk); |
duke@435 | 345 | if (spec()->enable_shared_spaces()) { |
duke@435 | 346 | blk->set_generation(this); |
duke@435 | 347 | // ro_space has no younger gen refs. |
duke@435 | 348 | _rs->younger_refs_in_space_iterate(rw_space(), blk); |
duke@435 | 349 | blk->reset_generation(); |
duke@435 | 350 | } |
duke@435 | 351 | } |
duke@435 | 352 | |
duke@435 | 353 | |
duke@435 | 354 | // Shared spaces are addressed in pre_adjust_pointers. |
duke@435 | 355 | void CompactingPermGenGen::adjust_pointers() { |
duke@435 | 356 | the_space()->adjust_pointers(); |
duke@435 | 357 | } |
duke@435 | 358 | |
duke@435 | 359 | |
duke@435 | 360 | void CompactingPermGenGen::compact() { |
duke@435 | 361 | the_space()->compact(); |
duke@435 | 362 | } |
duke@435 | 363 | |
duke@435 | 364 | |
duke@435 | 365 | size_t CompactingPermGenGen::contiguous_available() const { |
duke@435 | 366 | // Don't include shared spaces. |
duke@435 | 367 | return OneContigSpaceCardGeneration::contiguous_available() |
duke@435 | 368 | - _shared_space_size; |
duke@435 | 369 | } |
duke@435 | 370 | |
duke@435 | 371 | size_t CompactingPermGenGen::max_capacity() const { |
duke@435 | 372 | // Don't include shared spaces. |
duke@435 | 373 | assert(UseSharedSpaces || (_shared_space_size == 0), |
duke@435 | 374 | "If not used, the size of shared spaces should be 0"); |
duke@435 | 375 | return OneContigSpaceCardGeneration::max_capacity() |
duke@435 | 376 | - _shared_space_size; |
duke@435 | 377 | } |
duke@435 | 378 | |
duke@435 | 379 | |
duke@435 | 380 | |
duke@435 | 381 | bool CompactingPermGenGen::grow_by(size_t bytes) { |
duke@435 | 382 | // Don't allow _virtual_size to expand into shared spaces. |
duke@435 | 383 | size_t max_bytes = _virtual_space.uncommitted_size() - _shared_space_size; |
duke@435 | 384 | if (bytes > _shared_space_size) { |
duke@435 | 385 | bytes = _shared_space_size; |
duke@435 | 386 | } |
duke@435 | 387 | return OneContigSpaceCardGeneration::grow_by(bytes); |
duke@435 | 388 | } |
duke@435 | 389 | |
duke@435 | 390 | |
duke@435 | 391 | void CompactingPermGenGen::grow_to_reserved() { |
duke@435 | 392 | // Don't allow _virtual_size to expand into shared spaces. |
duke@435 | 393 | if (_virtual_space.uncommitted_size() > _shared_space_size) { |
duke@435 | 394 | size_t remaining_bytes = |
duke@435 | 395 | _virtual_space.uncommitted_size() - _shared_space_size; |
duke@435 | 396 | bool success = OneContigSpaceCardGeneration::grow_by(remaining_bytes); |
duke@435 | 397 | DEBUG_ONLY(if (!success) warning("grow to reserved failed");) |
duke@435 | 398 | } |
duke@435 | 399 | } |
duke@435 | 400 | |
duke@435 | 401 | |
duke@435 | 402 | // No young generation references, clear this generation's main space's |
duke@435 | 403 | // card table entries. Do NOT clear the card table entries for the |
duke@435 | 404 | // read-only space (always clear) or the read-write space (valuable |
duke@435 | 405 | // information). |
duke@435 | 406 | |
duke@435 | 407 | void CompactingPermGenGen::clear_remembered_set() { |
duke@435 | 408 | _rs->clear(MemRegion(the_space()->bottom(), the_space()->end())); |
duke@435 | 409 | } |
duke@435 | 410 | |
duke@435 | 411 | |
duke@435 | 412 | // Objects in this generation's main space may have moved, invalidate |
duke@435 | 413 | // that space's cards. Do NOT invalidate the card table entries for the |
duke@435 | 414 | // read-only or read-write spaces, as those objects never move. |
duke@435 | 415 | |
duke@435 | 416 | void CompactingPermGenGen::invalidate_remembered_set() { |
duke@435 | 417 | _rs->invalidate(used_region()); |
duke@435 | 418 | } |
duke@435 | 419 | |
duke@435 | 420 | |
duke@435 | 421 | void CompactingPermGenGen::verify(bool allow_dirty) { |
duke@435 | 422 | the_space()->verify(allow_dirty); |
duke@435 | 423 | if (!SharedSkipVerify && spec()->enable_shared_spaces()) { |
duke@435 | 424 | ro_space()->verify(allow_dirty); |
duke@435 | 425 | rw_space()->verify(allow_dirty); |
duke@435 | 426 | } |
duke@435 | 427 | } |
duke@435 | 428 | |
duke@435 | 429 | |
duke@435 | 430 | HeapWord* CompactingPermGenGen::unshared_bottom; |
duke@435 | 431 | HeapWord* CompactingPermGenGen::unshared_end; |
duke@435 | 432 | HeapWord* CompactingPermGenGen::shared_bottom; |
duke@435 | 433 | HeapWord* CompactingPermGenGen::shared_end; |
duke@435 | 434 | HeapWord* CompactingPermGenGen::readonly_bottom; |
duke@435 | 435 | HeapWord* CompactingPermGenGen::readonly_end; |
duke@435 | 436 | HeapWord* CompactingPermGenGen::readwrite_bottom; |
duke@435 | 437 | HeapWord* CompactingPermGenGen::readwrite_end; |
duke@435 | 438 | HeapWord* CompactingPermGenGen::miscdata_bottom; |
duke@435 | 439 | HeapWord* CompactingPermGenGen::miscdata_end; |
duke@435 | 440 | HeapWord* CompactingPermGenGen::misccode_bottom; |
duke@435 | 441 | HeapWord* CompactingPermGenGen::misccode_end; |
duke@435 | 442 | |
duke@435 | 443 | // JVM/TI RedefineClasses() support: |
duke@435 | 444 | bool CompactingPermGenGen::remap_shared_readonly_as_readwrite() { |
duke@435 | 445 | assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); |
duke@435 | 446 | |
duke@435 | 447 | if (UseSharedSpaces) { |
duke@435 | 448 | // remap the shared readonly space to shared readwrite, private |
duke@435 | 449 | FileMapInfo* mapinfo = FileMapInfo::current_info(); |
duke@435 | 450 | if (!mapinfo->remap_shared_readonly_as_readwrite()) { |
duke@435 | 451 | return false; |
duke@435 | 452 | } |
duke@435 | 453 | } |
duke@435 | 454 | return true; |
duke@435 | 455 | } |
duke@435 | 456 | |
duke@435 | 457 | void** CompactingPermGenGen::_vtbl_list; |