src/share/vm/memory/genCollectedHeap.hpp

Fri, 17 Apr 2009 12:22:18 -0700

author
never
date
Fri, 17 Apr 2009 12:22:18 -0700
changeset 1149
981375ca07b7
parent 1014
0fbdb4381b99
child 1280
df6caf649ff7
permissions
-rw-r--r--

6831604: missing null check in guarantee
Reviewed-by: kvn

duke@435 1 /*
xdono@1014 2 * Copyright 2000-2009 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 class SubTasksDone;
duke@435 26
duke@435 27 // A "GenCollectedHeap" is a SharedHeap that uses generational
duke@435 28 // collection. It is represented with a sequence of Generation's.
duke@435 29 class GenCollectedHeap : public SharedHeap {
duke@435 30 friend class GenCollectorPolicy;
duke@435 31 friend class Generation;
duke@435 32 friend class DefNewGeneration;
duke@435 33 friend class TenuredGeneration;
duke@435 34 friend class ConcurrentMarkSweepGeneration;
duke@435 35 friend class CMSCollector;
duke@435 36 friend class GenMarkSweep;
duke@435 37 friend class VM_GenCollectForAllocation;
apetrusenko@574 38 friend class VM_GenCollectForPermanentAllocation;
duke@435 39 friend class VM_GenCollectFull;
duke@435 40 friend class VM_GenCollectFullConcurrent;
duke@435 41 friend class VM_GC_HeapInspection;
duke@435 42 friend class VM_HeapDumper;
duke@435 43 friend class HeapInspection;
duke@435 44 friend class GCCauseSetter;
duke@435 45 friend class VMStructs;
duke@435 46 public:
duke@435 47 enum SomeConstants {
duke@435 48 max_gens = 10
duke@435 49 };
duke@435 50
duke@435 51 friend class VM_PopulateDumpSharedSpace;
duke@435 52
duke@435 53 protected:
duke@435 54 // Fields:
duke@435 55 static GenCollectedHeap* _gch;
duke@435 56
duke@435 57 private:
duke@435 58 int _n_gens;
duke@435 59 Generation* _gens[max_gens];
duke@435 60 GenerationSpec** _gen_specs;
duke@435 61
duke@435 62 // The generational collector policy.
duke@435 63 GenCollectorPolicy* _gen_policy;
duke@435 64
duke@435 65 // If a generation would bail out of an incremental collection,
duke@435 66 // it sets this flag. If the flag is set, satisfy_failed_allocation
duke@435 67 // will attempt allocating in all generations before doing a full GC.
duke@435 68 bool _incremental_collection_will_fail;
duke@435 69 bool _last_incremental_collection_failed;
duke@435 70
duke@435 71 // In support of ExplicitGCInvokesConcurrent functionality
duke@435 72 unsigned int _full_collections_completed;
duke@435 73
duke@435 74 // Data structure for claiming the (potentially) parallel tasks in
duke@435 75 // (gen-specific) strong roots processing.
duke@435 76 SubTasksDone* _gen_process_strong_tasks;
duke@435 77
duke@435 78 // In block contents verification, the number of header words to skip
duke@435 79 NOT_PRODUCT(static size_t _skip_header_HeapWords;)
duke@435 80
duke@435 81 // GC is not allowed during the dump of the shared classes. Keep track
duke@435 82 // of this in order to provide an reasonable error message when terminating.
duke@435 83 bool _preloading_shared_classes;
duke@435 84
duke@435 85 protected:
duke@435 86 // Directs each generation up to and including "collectedGen" to recompute
duke@435 87 // its desired size.
duke@435 88 void compute_new_generation_sizes(int collectedGen);
duke@435 89
duke@435 90 // Helper functions for allocation
duke@435 91 HeapWord* attempt_allocation(size_t size,
duke@435 92 bool is_tlab,
duke@435 93 bool first_only);
duke@435 94
duke@435 95 // Helper function for two callbacks below.
duke@435 96 // Considers collection of the first max_level+1 generations.
duke@435 97 void do_collection(bool full,
duke@435 98 bool clear_all_soft_refs,
duke@435 99 size_t size,
duke@435 100 bool is_tlab,
duke@435 101 int max_level);
duke@435 102
duke@435 103 // Callback from VM_GenCollectForAllocation operation.
duke@435 104 // This function does everything necessary/possible to satisfy an
duke@435 105 // allocation request that failed in the youngest generation that should
duke@435 106 // have handled it (including collection, expansion, etc.)
duke@435 107 HeapWord* satisfy_failed_allocation(size_t size, bool is_tlab);
duke@435 108
duke@435 109 // Callback from VM_GenCollectFull operation.
duke@435 110 // Perform a full collection of the first max_level+1 generations.
duke@435 111 void do_full_collection(bool clear_all_soft_refs, int max_level);
duke@435 112
duke@435 113 // Does the "cause" of GC indicate that
duke@435 114 // we absolutely __must__ clear soft refs?
duke@435 115 bool must_clear_all_soft_refs();
duke@435 116
duke@435 117 public:
duke@435 118 GenCollectedHeap(GenCollectorPolicy *policy);
duke@435 119
duke@435 120 GCStats* gc_stats(int level) const;
duke@435 121
duke@435 122 // Returns JNI_OK on success
duke@435 123 virtual jint initialize();
duke@435 124 char* allocate(size_t alignment, PermanentGenerationSpec* perm_gen_spec,
duke@435 125 size_t* _total_reserved, int* _n_covered_regions,
duke@435 126 ReservedSpace* heap_rs);
duke@435 127
duke@435 128 // Does operations required after initialization has been done.
duke@435 129 void post_initialize();
duke@435 130
duke@435 131 // Initialize ("weak") refs processing support
duke@435 132 virtual void ref_processing_init();
duke@435 133
duke@435 134 virtual CollectedHeap::Name kind() const {
duke@435 135 return CollectedHeap::GenCollectedHeap;
duke@435 136 }
duke@435 137
duke@435 138 // The generational collector policy.
duke@435 139 GenCollectorPolicy* gen_policy() const { return _gen_policy; }
duke@435 140
duke@435 141 // Adaptive size policy
duke@435 142 virtual AdaptiveSizePolicy* size_policy() {
duke@435 143 return gen_policy()->size_policy();
duke@435 144 }
duke@435 145
duke@435 146 size_t capacity() const;
duke@435 147 size_t used() const;
duke@435 148
duke@435 149 // Save the "used_region" for generations level and lower,
duke@435 150 // and, if perm is true, for perm gen.
duke@435 151 void save_used_regions(int level, bool perm);
duke@435 152
duke@435 153 size_t max_capacity() const;
duke@435 154
duke@435 155 HeapWord* mem_allocate(size_t size,
duke@435 156 bool is_large_noref,
duke@435 157 bool is_tlab,
duke@435 158 bool* gc_overhead_limit_was_exceeded);
duke@435 159
duke@435 160 // We may support a shared contiguous allocation area, if the youngest
duke@435 161 // generation does.
duke@435 162 bool supports_inline_contig_alloc() const;
duke@435 163 HeapWord** top_addr() const;
duke@435 164 HeapWord** end_addr() const;
duke@435 165
duke@435 166 // Return an estimate of the maximum allocation that could be performed
duke@435 167 // without triggering any collection activity. In a generational
duke@435 168 // collector, for example, this is probably the largest allocation that
duke@435 169 // could be supported in the youngest generation. It is "unsafe" because
duke@435 170 // no locks are taken; the result should be treated as an approximation,
duke@435 171 // not a guarantee.
duke@435 172 size_t unsafe_max_alloc();
duke@435 173
duke@435 174 // Does this heap support heap inspection? (+PrintClassHistogram)
duke@435 175 virtual bool supports_heap_inspection() const { return true; }
duke@435 176
duke@435 177 // Perform a full collection of the heap; intended for use in implementing
duke@435 178 // "System.gc". This implies as full a collection as the CollectedHeap
duke@435 179 // supports. Caller does not hold the Heap_lock on entry.
duke@435 180 void collect(GCCause::Cause cause);
duke@435 181
duke@435 182 // This interface assumes that it's being called by the
duke@435 183 // vm thread. It collects the heap assuming that the
duke@435 184 // heap lock is already held and that we are executing in
duke@435 185 // the context of the vm thread.
duke@435 186 void collect_as_vm_thread(GCCause::Cause cause);
duke@435 187
duke@435 188 // The same as above but assume that the caller holds the Heap_lock.
duke@435 189 void collect_locked(GCCause::Cause cause);
duke@435 190
duke@435 191 // Perform a full collection of the first max_level+1 generations.
duke@435 192 // Mostly used for testing purposes. Caller does not hold the Heap_lock on entry.
duke@435 193 void collect(GCCause::Cause cause, int max_level);
duke@435 194
duke@435 195 // Returns "TRUE" iff "p" points into the allocated area of the heap.
duke@435 196 // The methods is_in(), is_in_closed_subset() and is_in_youngest() may
duke@435 197 // be expensive to compute in general, so, to prevent
duke@435 198 // their inadvertent use in product jvm's, we restrict their use to
duke@435 199 // assertion checking or verification only.
duke@435 200 bool is_in(const void* p) const;
duke@435 201
duke@435 202 // override
duke@435 203 bool is_in_closed_subset(const void* p) const {
duke@435 204 if (UseConcMarkSweepGC) {
duke@435 205 return is_in_reserved(p);
duke@435 206 } else {
duke@435 207 return is_in(p);
duke@435 208 }
duke@435 209 }
duke@435 210
duke@435 211 // Returns "TRUE" iff "p" points into the youngest generation.
duke@435 212 bool is_in_youngest(void* p);
duke@435 213
duke@435 214 // Iteration functions.
duke@435 215 void oop_iterate(OopClosure* cl);
duke@435 216 void oop_iterate(MemRegion mr, OopClosure* cl);
duke@435 217 void object_iterate(ObjectClosure* cl);
jmasa@952 218 void safe_object_iterate(ObjectClosure* cl);
duke@435 219 void object_iterate_since_last_GC(ObjectClosure* cl);
duke@435 220 Space* space_containing(const void* addr) const;
duke@435 221
duke@435 222 // A CollectedHeap is divided into a dense sequence of "blocks"; that is,
duke@435 223 // each address in the (reserved) heap is a member of exactly
duke@435 224 // one block. The defining characteristic of a block is that it is
duke@435 225 // possible to find its size, and thus to progress forward to the next
duke@435 226 // block. (Blocks may be of different sizes.) Thus, blocks may
duke@435 227 // represent Java objects, or they might be free blocks in a
duke@435 228 // free-list-based heap (or subheap), as long as the two kinds are
duke@435 229 // distinguishable and the size of each is determinable.
duke@435 230
duke@435 231 // Returns the address of the start of the "block" that contains the
duke@435 232 // address "addr". We say "blocks" instead of "object" since some heaps
duke@435 233 // may not pack objects densely; a chunk may either be an object or a
duke@435 234 // non-object.
duke@435 235 virtual HeapWord* block_start(const void* addr) const;
duke@435 236
duke@435 237 // Requires "addr" to be the start of a chunk, and returns its size.
duke@435 238 // "addr + size" is required to be the start of a new chunk, or the end
duke@435 239 // of the active area of the heap. Assumes (and verifies in non-product
duke@435 240 // builds) that addr is in the allocated part of the heap and is
duke@435 241 // the start of a chunk.
duke@435 242 virtual size_t block_size(const HeapWord* addr) const;
duke@435 243
duke@435 244 // Requires "addr" to be the start of a block, and returns "TRUE" iff
duke@435 245 // the block is an object. Assumes (and verifies in non-product
duke@435 246 // builds) that addr is in the allocated part of the heap and is
duke@435 247 // the start of a chunk.
duke@435 248 virtual bool block_is_obj(const HeapWord* addr) const;
duke@435 249
duke@435 250 // Section on TLAB's.
duke@435 251 virtual bool supports_tlab_allocation() const;
duke@435 252 virtual size_t tlab_capacity(Thread* thr) const;
duke@435 253 virtual size_t unsafe_max_tlab_alloc(Thread* thr) const;
duke@435 254 virtual HeapWord* allocate_new_tlab(size_t size);
duke@435 255
ysr@777 256 // Can a compiler initialize a new object without store barriers?
ysr@777 257 // This permission only extends from the creation of a new object
ysr@777 258 // via a TLAB up to the first subsequent safepoint.
ysr@777 259 virtual bool can_elide_tlab_store_barriers() const {
ysr@777 260 return true;
ysr@777 261 }
ysr@777 262
ysr@777 263 // Can a compiler elide a store barrier when it writes
ysr@777 264 // a permanent oop into the heap? Applies when the compiler
ysr@777 265 // is storing x to the heap, where x->is_perm() is true.
ysr@777 266 virtual bool can_elide_permanent_oop_store_barriers() const {
ysr@777 267 // CMS needs to see all, even intra-generational, ref updates.
ysr@777 268 return !UseConcMarkSweepGC;
ysr@777 269 }
ysr@777 270
duke@435 271 // The "requestor" generation is performing some garbage collection
duke@435 272 // action for which it would be useful to have scratch space. The
duke@435 273 // requestor promises to allocate no more than "max_alloc_words" in any
duke@435 274 // older generation (via promotion say.) Any blocks of space that can
duke@435 275 // be provided are returned as a list of ScratchBlocks, sorted by
duke@435 276 // decreasing size.
duke@435 277 ScratchBlock* gather_scratch(Generation* requestor, size_t max_alloc_words);
jmasa@698 278 // Allow each generation to reset any scratch space that it has
jmasa@698 279 // contributed as it needs.
jmasa@698 280 void release_scratch();
duke@435 281
duke@435 282 size_t large_typearray_limit();
duke@435 283
duke@435 284 // Ensure parsability: override
duke@435 285 virtual void ensure_parsability(bool retire_tlabs);
duke@435 286
duke@435 287 // Time in ms since the longest time a collector ran in
duke@435 288 // in any generation.
duke@435 289 virtual jlong millis_since_last_gc();
duke@435 290
duke@435 291 // Total number of full collections completed.
duke@435 292 unsigned int total_full_collections_completed() {
duke@435 293 assert(_full_collections_completed <= _total_full_collections,
duke@435 294 "Can't complete more collections than were started");
duke@435 295 return _full_collections_completed;
duke@435 296 }
duke@435 297
duke@435 298 // Update above counter, as appropriate, at the end of a stop-world GC cycle
duke@435 299 unsigned int update_full_collections_completed();
duke@435 300 // Update above counter, as appropriate, at the end of a concurrent GC cycle
duke@435 301 unsigned int update_full_collections_completed(unsigned int count);
duke@435 302
duke@435 303 // Update "time of last gc" for all constituent generations
duke@435 304 // to "now".
duke@435 305 void update_time_of_last_gc(jlong now) {
duke@435 306 for (int i = 0; i < _n_gens; i++) {
duke@435 307 _gens[i]->update_time_of_last_gc(now);
duke@435 308 }
duke@435 309 perm_gen()->update_time_of_last_gc(now);
duke@435 310 }
duke@435 311
duke@435 312 // Update the gc statistics for each generation.
duke@435 313 // "level" is the level of the lastest collection
duke@435 314 void update_gc_stats(int current_level, bool full) {
duke@435 315 for (int i = 0; i < _n_gens; i++) {
duke@435 316 _gens[i]->update_gc_stats(current_level, full);
duke@435 317 }
duke@435 318 perm_gen()->update_gc_stats(current_level, full);
duke@435 319 }
duke@435 320
duke@435 321 // Override.
duke@435 322 bool no_gc_in_progress() { return !is_gc_active(); }
duke@435 323
duke@435 324 // Override.
duke@435 325 void prepare_for_verify();
duke@435 326
duke@435 327 // Override.
duke@435 328 void verify(bool allow_dirty, bool silent);
duke@435 329
duke@435 330 // Override.
duke@435 331 void print() const;
duke@435 332 void print_on(outputStream* st) const;
duke@435 333 virtual void print_gc_threads_on(outputStream* st) const;
duke@435 334 virtual void gc_threads_do(ThreadClosure* tc) const;
duke@435 335 virtual void print_tracing_info() const;
duke@435 336
duke@435 337 // PrintGC, PrintGCDetails support
duke@435 338 void print_heap_change(size_t prev_used) const;
duke@435 339 void print_perm_heap_change(size_t perm_prev_used) const;
duke@435 340
duke@435 341 // The functions below are helper functions that a subclass of
duke@435 342 // "CollectedHeap" can use in the implementation of its virtual
duke@435 343 // functions.
duke@435 344
duke@435 345 class GenClosure : public StackObj {
duke@435 346 public:
duke@435 347 virtual void do_generation(Generation* gen) = 0;
duke@435 348 };
duke@435 349
duke@435 350 // Apply "cl.do_generation" to all generations in the heap (not including
duke@435 351 // the permanent generation). If "old_to_young" determines the order.
duke@435 352 void generation_iterate(GenClosure* cl, bool old_to_young);
duke@435 353
duke@435 354 void space_iterate(SpaceClosure* cl);
duke@435 355
duke@435 356 // Return "true" if all generations (but perm) have reached the
duke@435 357 // maximal committed limit that they can reach, without a garbage
duke@435 358 // collection.
duke@435 359 virtual bool is_maximal_no_gc() const;
duke@435 360
duke@435 361 // Return the generation before "gen", or else NULL.
duke@435 362 Generation* prev_gen(Generation* gen) const {
duke@435 363 int l = gen->level();
duke@435 364 if (l == 0) return NULL;
duke@435 365 else return _gens[l-1];
duke@435 366 }
duke@435 367
duke@435 368 // Return the generation after "gen", or else NULL.
duke@435 369 Generation* next_gen(Generation* gen) const {
duke@435 370 int l = gen->level() + 1;
duke@435 371 if (l == _n_gens) return NULL;
duke@435 372 else return _gens[l];
duke@435 373 }
duke@435 374
duke@435 375 Generation* get_gen(int i) const {
duke@435 376 if (i >= 0 && i < _n_gens)
duke@435 377 return _gens[i];
duke@435 378 else
duke@435 379 return NULL;
duke@435 380 }
duke@435 381
duke@435 382 int n_gens() const {
duke@435 383 assert(_n_gens == gen_policy()->number_of_generations(), "Sanity");
duke@435 384 return _n_gens;
duke@435 385 }
duke@435 386
duke@435 387 // Convenience function to be used in situations where the heap type can be
duke@435 388 // asserted to be this type.
duke@435 389 static GenCollectedHeap* heap();
duke@435 390
duke@435 391 void set_par_threads(int t);
duke@435 392
duke@435 393
duke@435 394 // Invoke the "do_oop" method of one of the closures "not_older_gens"
duke@435 395 // or "older_gens" on root locations for the generation at
duke@435 396 // "level". (The "older_gens" closure is used for scanning references
duke@435 397 // from older generations; "not_older_gens" is used everywhere else.)
duke@435 398 // If "younger_gens_as_roots" is false, younger generations are
duke@435 399 // not scanned as roots; in this case, the caller must be arranging to
duke@435 400 // scan the younger generations itself. (For example, a generation might
duke@435 401 // explicitly mark reachable objects in younger generations, to avoid
duke@435 402 // excess storage retention.) If "collecting_perm_gen" is false, then
duke@435 403 // roots that may only contain references to permGen objects are not
duke@435 404 // scanned. The "so" argument determines which of the roots
duke@435 405 // the closure is applied to:
duke@435 406 // "SO_None" does none;
duke@435 407 // "SO_AllClasses" applies the closure to all entries in the SystemDictionary;
duke@435 408 // "SO_SystemClasses" to all the "system" classes and loaders;
duke@435 409 // "SO_Symbols_and_Strings" applies the closure to all entries in
duke@435 410 // SymbolsTable and StringTable.
duke@435 411 void gen_process_strong_roots(int level, bool younger_gens_as_roots,
duke@435 412 bool collecting_perm_gen,
duke@435 413 SharedHeap::ScanningOption so,
duke@435 414 OopsInGenClosure* older_gens,
duke@435 415 OopsInGenClosure* not_older_gens);
duke@435 416
duke@435 417 // Apply "blk" to all the weak roots of the system. These include
duke@435 418 // JNI weak roots, the code cache, system dictionary, symbol table,
duke@435 419 // string table, and referents of reachable weak refs.
duke@435 420 void gen_process_weak_roots(OopClosure* root_closure,
duke@435 421 OopClosure* non_root_closure);
duke@435 422
duke@435 423 // Set the saved marks of generations, if that makes sense.
duke@435 424 // In particular, if any generation might iterate over the oops
duke@435 425 // in other generations, it should call this method.
duke@435 426 void save_marks();
duke@435 427
duke@435 428 // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects
duke@435 429 // allocated since the last call to save_marks in generations at or above
duke@435 430 // "level" (including the permanent generation.) The "cur" closure is
duke@435 431 // applied to references in the generation at "level", and the "older"
duke@435 432 // closure to older (and permanent) generations.
duke@435 433 #define GCH_SINCE_SAVE_MARKS_ITERATE_DECL(OopClosureType, nv_suffix) \
duke@435 434 void oop_since_save_marks_iterate(int level, \
duke@435 435 OopClosureType* cur, \
duke@435 436 OopClosureType* older);
duke@435 437
duke@435 438 ALL_SINCE_SAVE_MARKS_CLOSURES(GCH_SINCE_SAVE_MARKS_ITERATE_DECL)
duke@435 439
duke@435 440 #undef GCH_SINCE_SAVE_MARKS_ITERATE_DECL
duke@435 441
duke@435 442 // Returns "true" iff no allocations have occurred in any generation at
duke@435 443 // "level" or above (including the permanent generation) since the last
duke@435 444 // call to "save_marks".
duke@435 445 bool no_allocs_since_save_marks(int level);
duke@435 446
duke@435 447 // If a generation bails out of an incremental collection,
duke@435 448 // it sets this flag.
duke@435 449 bool incremental_collection_will_fail() {
duke@435 450 return _incremental_collection_will_fail;
duke@435 451 }
duke@435 452 void set_incremental_collection_will_fail() {
duke@435 453 _incremental_collection_will_fail = true;
duke@435 454 }
duke@435 455 void clear_incremental_collection_will_fail() {
duke@435 456 _incremental_collection_will_fail = false;
duke@435 457 }
duke@435 458
duke@435 459 bool last_incremental_collection_failed() const {
duke@435 460 return _last_incremental_collection_failed;
duke@435 461 }
duke@435 462 void set_last_incremental_collection_failed() {
duke@435 463 _last_incremental_collection_failed = true;
duke@435 464 }
duke@435 465 void clear_last_incremental_collection_failed() {
duke@435 466 _last_incremental_collection_failed = false;
duke@435 467 }
duke@435 468
duke@435 469 // Promotion of obj into gen failed. Try to promote obj to higher non-perm
duke@435 470 // gens in ascending order; return the new location of obj if successful.
duke@435 471 // Otherwise, try expand-and-allocate for obj in each generation starting at
duke@435 472 // gen; return the new location of obj if successful. Otherwise, return NULL.
duke@435 473 oop handle_failed_promotion(Generation* gen,
duke@435 474 oop obj,
coleenp@548 475 size_t obj_size);
duke@435 476
duke@435 477 private:
duke@435 478 // Accessor for memory state verification support
duke@435 479 NOT_PRODUCT(
duke@435 480 static size_t skip_header_HeapWords() { return _skip_header_HeapWords; }
duke@435 481 )
duke@435 482
duke@435 483 // Override
duke@435 484 void check_for_non_bad_heap_word_value(HeapWord* addr,
duke@435 485 size_t size) PRODUCT_RETURN;
duke@435 486
duke@435 487 // For use by mark-sweep. As implemented, mark-sweep-compact is global
duke@435 488 // in an essential way: compaction is performed across generations, by
duke@435 489 // iterating over spaces.
duke@435 490 void prepare_for_compaction();
duke@435 491
duke@435 492 // Perform a full collection of the first max_level+1 generations.
duke@435 493 // This is the low level interface used by the public versions of
duke@435 494 // collect() and collect_locked(). Caller holds the Heap_lock on entry.
duke@435 495 void collect_locked(GCCause::Cause cause, int max_level);
duke@435 496
duke@435 497 // Returns success or failure.
duke@435 498 bool create_cms_collector();
duke@435 499
duke@435 500 // In support of ExplicitGCInvokesConcurrent functionality
duke@435 501 bool should_do_concurrent_full_gc(GCCause::Cause cause);
duke@435 502 void collect_mostly_concurrent(GCCause::Cause cause);
duke@435 503
jmasa@698 504 // Save the tops of the spaces in all generations
jmasa@698 505 void record_gen_tops_before_GC() PRODUCT_RETURN;
jmasa@698 506
duke@435 507 protected:
duke@435 508 virtual void gc_prologue(bool full);
duke@435 509 virtual void gc_epilogue(bool full);
duke@435 510
duke@435 511 public:
duke@435 512 virtual void preload_and_dump(TRAPS) KERNEL_RETURN;
duke@435 513 };

mercurial