Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/memory/generation.hpp
32285 views
/*1* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_MEMORY_GENERATION_HPP25#define SHARE_VM_MEMORY_GENERATION_HPP2627#include "gc_implementation/shared/collectorCounters.hpp"28#include "memory/allocation.hpp"29#include "memory/memRegion.hpp"30#include "memory/referenceProcessor.hpp"31#include "memory/universe.hpp"32#include "memory/watermark.hpp"33#include "runtime/mutex.hpp"34#include "runtime/perfData.hpp"35#include "runtime/virtualspace.hpp"3637// A Generation models a heap area for similarly-aged objects.38// It will contain one ore more spaces holding the actual objects.39//40// The Generation class hierarchy:41//42// Generation - abstract base class43// - DefNewGeneration - allocation area (copy collected)44// - ParNewGeneration - a DefNewGeneration that is collected by45// several threads46// - CardGeneration - abstract class adding offset array behavior47// - OneContigSpaceCardGeneration - abstract class holding a single48// contiguous space with card marking49// - TenuredGeneration - tenured (old object) space (markSweepCompact)50// - ConcurrentMarkSweepGeneration - Mostly Concurrent Mark Sweep Generation51// (Detlefs-Printezis refinement of52// Boehm-Demers-Schenker)53//54// The system configurations currently allowed are:55//56// DefNewGeneration + TenuredGeneration57// DefNewGeneration + ConcurrentMarkSweepGeneration58//59// ParNewGeneration + TenuredGeneration60// ParNewGeneration + ConcurrentMarkSweepGeneration61//6263class DefNewGeneration;64class GenerationSpec;65class CompactibleSpace;66class ContiguousSpace;67class CompactPoint;68class OopsInGenClosure;69class OopClosure;70class ScanClosure;71class FastScanClosure;72class GenCollectedHeap;73class GenRemSet;74class GCStats;7576// A "ScratchBlock" represents a block of memory in one generation usable by77// another. It represents "num_words" free words, starting at and including78// the address of "this".79struct ScratchBlock {80ScratchBlock* next;81size_t num_words;82HeapWord scratch_space[1]; // Actually, of size "num_words-2" (assuming83// first two fields are word-sized.)84};858687class Generation: public CHeapObj<mtGC> {88friend class VMStructs;89private:90jlong _time_of_last_gc; // time when last gc on this generation happened (ms)91MemRegion _prev_used_region; // for collectors that want to "remember" a value for92// used region at some specific point during collection.9394protected:95// Minimum and maximum addresses for memory reserved (not necessarily96// committed) for generation.97// Used by card marking code. Must not overlap with address ranges of98// other generations.99MemRegion _reserved;100101// Memory area reserved for generation102VirtualSpace _virtual_space;103104// Level in the generation hierarchy.105int _level;106107// ("Weak") Reference processing support108ReferenceProcessor* _ref_processor;109110// Performance Counters111CollectorCounters* _gc_counters;112113// Statistics for garbage collection114GCStats* _gc_stats;115116// Returns the next generation in the configuration, or else NULL if this117// is the highest generation.118Generation* next_gen() const;119120// Initialize the generation.121Generation(ReservedSpace rs, size_t initial_byte_size, int level);122123// Apply "cl->do_oop" to (the address of) (exactly) all the ref fields in124// "sp" that point into younger generations.125// The iteration is only over objects allocated at the start of the126// iterations; objects allocated as a result of applying the closure are127// not included.128void younger_refs_in_space_iterate(Space* sp, OopsInGenClosure* cl);129130public:131// The set of possible generation kinds.132enum Name {133ASParNew,134ASConcurrentMarkSweep,135DefNew,136ParNew,137MarkSweepCompact,138ConcurrentMarkSweep,139Other140};141142enum SomePublicConstants {143// Generations are GenGrain-aligned and have size that are multiples of144// GenGrain.145// Note: on ARM we add 1 bit for card_table_base to be properly aligned146// (we expect its low byte to be zero - see implementation of post_barrier)147LogOfGenGrain = 16 ARM32_ONLY(+1),148GenGrain = 1 << LogOfGenGrain149};150151// allocate and initialize ("weak") refs processing support152virtual void ref_processor_init();153void set_ref_processor(ReferenceProcessor* rp) {154assert(_ref_processor == NULL, "clobbering existing _ref_processor");155_ref_processor = rp;156}157158virtual Generation::Name kind() { return Generation::Other; }159GenerationSpec* spec();160161// This properly belongs in the collector, but for now this162// will do.163virtual bool refs_discovery_is_atomic() const { return true; }164virtual bool refs_discovery_is_mt() const { return false; }165166// Space enquiries (results in bytes)167virtual size_t capacity() const = 0; // The maximum number of object bytes the168// generation can currently hold.169virtual size_t used() const = 0; // The number of used bytes in the gen.170virtual size_t used_stable() const; // The number of used bytes for memory monitoring tools.171virtual size_t free() const = 0; // The number of free bytes in the gen.172173// Support for java.lang.Runtime.maxMemory(); see CollectedHeap.174// Returns the total number of bytes available in a generation175// for the allocation of objects.176virtual size_t max_capacity() const;177178// If this is a young generation, the maximum number of bytes that can be179// allocated in this generation before a GC is triggered.180virtual size_t capacity_before_gc() const { return 0; }181182// The largest number of contiguous free bytes in the generation,183// including expansion (Assumes called at a safepoint.)184virtual size_t contiguous_available() const = 0;185// The largest number of contiguous free bytes in this or any higher generation.186virtual size_t max_contiguous_available() const;187188// Returns true if promotions of the specified amount are189// likely to succeed without a promotion failure.190// Promotion of the full amount is not guaranteed but191// might be attempted in the worst case.192virtual bool promotion_attempt_is_safe(size_t max_promotion_in_bytes) const;193194// For a non-young generation, this interface can be used to inform a195// generation that a promotion attempt into that generation failed.196// Typically used to enable diagnostic output for post-mortem analysis,197// but other uses of the interface are not ruled out.198virtual void promotion_failure_occurred() { /* does nothing */ }199200// Return an estimate of the maximum allocation that could be performed201// in the generation without triggering any collection or expansion202// activity. It is "unsafe" because no locks are taken; the result203// should be treated as an approximation, not a guarantee, for use in204// heuristic resizing decisions.205virtual size_t unsafe_max_alloc_nogc() const = 0;206207// Returns true if this generation cannot be expanded further208// without a GC. Override as appropriate.209virtual bool is_maximal_no_gc() const {210return _virtual_space.uncommitted_size() == 0;211}212213MemRegion reserved() const { return _reserved; }214215// Returns a region guaranteed to contain all the objects in the216// generation.217virtual MemRegion used_region() const { return _reserved; }218219MemRegion prev_used_region() const { return _prev_used_region; }220virtual void save_used_region() { _prev_used_region = used_region(); }221222// Returns "TRUE" iff "p" points into the committed areas in the generation.223// For some kinds of generations, this may be an expensive operation.224// To avoid performance problems stemming from its inadvertent use in225// product jvm's, we restrict its use to assertion checking or226// verification only.227virtual bool is_in(const void* p) const;228229/* Returns "TRUE" iff "p" points into the reserved area of the generation. */230bool is_in_reserved(const void* p) const {231return _reserved.contains(p);232}233234// Check that the generation kind is DefNewGeneration or a sub235// class of DefNewGeneration and return a DefNewGeneration*236DefNewGeneration* as_DefNewGeneration();237238// If some space in the generation contains the given "addr", return a239// pointer to that space, else return "NULL".240virtual Space* space_containing(const void* addr) const;241242// Iteration - do not use for time critical operations243virtual void space_iterate(SpaceClosure* blk, bool usedOnly = false) = 0;244245// Returns the first space, if any, in the generation that can participate246// in compaction, or else "NULL".247virtual CompactibleSpace* first_compaction_space() const = 0;248249// Returns "true" iff this generation should be used to allocate an250// object of the given size. Young generations might251// wish to exclude very large objects, for example, since, if allocated252// often, they would greatly increase the frequency of young-gen253// collection.254virtual bool should_allocate(size_t word_size, bool is_tlab) {255bool result = false;256size_t overflow_limit = (size_t)1 << (BitsPerSize_t - LogHeapWordSize);257if (!is_tlab || supports_tlab_allocation()) {258result = (word_size > 0) && (word_size < overflow_limit);259}260return result;261}262263// Allocate and returns a block of the requested size, or returns "NULL".264// Assumes the caller has done any necessary locking.265virtual HeapWord* allocate(size_t word_size, bool is_tlab) = 0;266267// Like "allocate", but performs any necessary locking internally.268virtual HeapWord* par_allocate(size_t word_size, bool is_tlab) = 0;269270// A 'younger' gen has reached an allocation limit, and uses this to notify271// the next older gen. The return value is a new limit, or NULL if none. The272// caller must do the necessary locking.273virtual HeapWord* allocation_limit_reached(Space* space, HeapWord* top,274size_t word_size) {275return NULL;276}277278// Some generation may offer a region for shared, contiguous allocation,279// via inlined code (by exporting the address of the top and end fields280// defining the extent of the contiguous allocation region.)281282// This function returns "true" iff the heap supports this kind of283// allocation. (More precisely, this means the style of allocation that284// increments *top_addr()" with a CAS.) (Default is "no".)285// A generation that supports this allocation style must use lock-free286// allocation for *all* allocation, since there are times when lock free287// allocation will be concurrent with plain "allocate" calls.288virtual bool supports_inline_contig_alloc() const { return false; }289290// These functions return the addresses of the fields that define the291// boundaries of the contiguous allocation area. (These fields should be292// physicall near to one another.)293virtual HeapWord** top_addr() const { return NULL; }294virtual HeapWord** end_addr() const { return NULL; }295296// Thread-local allocation buffers297virtual bool supports_tlab_allocation() const { return false; }298virtual size_t tlab_capacity() const {299guarantee(false, "Generation doesn't support thread local allocation buffers");300return 0;301}302virtual size_t tlab_used() const {303guarantee(false, "Generation doesn't support thread local allocation buffers");304return 0;305}306virtual size_t unsafe_max_tlab_alloc() const {307guarantee(false, "Generation doesn't support thread local allocation buffers");308return 0;309}310311// "obj" is the address of an object in a younger generation. Allocate space312// for "obj" in the current (or some higher) generation, and copy "obj" into313// the newly allocated space, if possible, returning the result (or NULL if314// the allocation failed).315//316// The "obj_size" argument is just obj->size(), passed along so the caller can317// avoid repeating the virtual call to retrieve it.318virtual oop promote(oop obj, size_t obj_size);319320// Thread "thread_num" (0 <= i < ParalleGCThreads) wants to promote321// object "obj", whose original mark word was "m", and whose size is322// "word_sz". If possible, allocate space for "obj", copy obj into it323// (taking care to copy "m" into the mark word when done, since the mark324// word of "obj" may have been overwritten with a forwarding pointer, and325// also taking care to copy the klass pointer *last*. Returns the new326// object if successful, or else NULL.327virtual oop par_promote(int thread_num,328oop obj, markOop m, size_t word_sz);329330// Undo, if possible, the most recent par_promote_alloc allocation by331// "thread_num" ("obj", of "word_sz").332virtual void par_promote_alloc_undo(int thread_num,333HeapWord* obj, size_t word_sz);334335// Informs the current generation that all par_promote_alloc's in the336// collection have been completed; any supporting data structures can be337// reset. Default is to do nothing.338virtual void par_promote_alloc_done(int thread_num) {}339340// Informs the current generation that all oop_since_save_marks_iterates341// performed by "thread_num" in the current collection, if any, have been342// completed; any supporting data structures can be reset. Default is to343// do nothing.344virtual void par_oop_since_save_marks_iterate_done(int thread_num) {}345346// This generation will collect all younger generations347// during a full collection.348virtual bool full_collects_younger_generations() const { return false; }349350// This generation does in-place marking, meaning that mark words351// are mutated during the marking phase and presumably reinitialized352// to a canonical value after the GC. This is currently used by the353// biased locking implementation to determine whether additional354// work is required during the GC prologue and epilogue.355virtual bool performs_in_place_marking() const { return true; }356357// Returns "true" iff collect() should subsequently be called on this358// this generation. See comment below.359// This is a generic implementation which can be overridden.360//361// Note: in the current (1.4) implementation, when genCollectedHeap's362// incremental_collection_will_fail flag is set, all allocations are363// slow path (the only fast-path place to allocate is DefNew, which364// will be full if the flag is set).365// Thus, older generations which collect younger generations should366// test this flag and collect if it is set.367virtual bool should_collect(bool full,368size_t word_size,369bool is_tlab) {370return (full || should_allocate(word_size, is_tlab));371}372373// Returns true if the collection is likely to be safely374// completed. Even if this method returns true, a collection375// may not be guaranteed to succeed, and the system should be376// able to safely unwind and recover from that failure, albeit377// at some additional cost.378virtual bool collection_attempt_is_safe() {379guarantee(false, "Are you sure you want to call this method?");380return true;381}382383// Perform a garbage collection.384// If full is true attempt a full garbage collection of this generation.385// Otherwise, attempting to (at least) free enough space to support an386// allocation of the given "word_size".387virtual void collect(bool full,388bool clear_all_soft_refs,389size_t word_size,390bool is_tlab) = 0;391392// Perform a heap collection, attempting to create (at least) enough393// space to support an allocation of the given "word_size". If394// successful, perform the allocation and return the resulting395// "oop" (initializing the allocated block). If the allocation is396// still unsuccessful, return "NULL".397virtual HeapWord* expand_and_allocate(size_t word_size,398bool is_tlab,399bool parallel = false) = 0;400401// Some generations may require some cleanup or preparation actions before402// allowing a collection. The default is to do nothing.403virtual void gc_prologue(bool full) {};404405// Some generations may require some cleanup actions after a collection.406// The default is to do nothing.407virtual void gc_epilogue(bool full) {};408409// Save the high water marks for the used space in a generation.410virtual void record_spaces_top() {};411412// Some generations may need to be "fixed-up" after some allocation413// activity to make them parsable again. The default is to do nothing.414virtual void ensure_parsability() {};415416// Time (in ms) when we were last collected or now if a collection is417// in progress.418virtual jlong time_of_last_gc(jlong now) {419// Both _time_of_last_gc and now are set using a time source420// that guarantees monotonically non-decreasing values provided421// the underlying platform provides such a source. So we still422// have to guard against non-monotonicity.423NOT_PRODUCT(424if (now < _time_of_last_gc) {425warning("time warp: " INT64_FORMAT " to " INT64_FORMAT, (int64_t) _time_of_last_gc, (int64_t) now);426}427)428return _time_of_last_gc;429}430431virtual void update_time_of_last_gc(jlong now) {432_time_of_last_gc = now;433}434435// Generations may keep statistics about collection. This436// method updates those statistics. current_level is437// the level of the collection that has most recently438// occurred. This allows the generation to decide what439// statistics are valid to collect. For example, the440// generation can decide to gather the amount of promoted data441// if the collection of the younger generations has completed.442GCStats* gc_stats() const { return _gc_stats; }443virtual void update_gc_stats(int current_level, bool full) {}444445// Mark sweep support phase2446virtual void prepare_for_compaction(CompactPoint* cp);447// Mark sweep support phase3448virtual void adjust_pointers();449// Mark sweep support phase4450virtual void compact();451virtual void post_compact() {ShouldNotReachHere();}452453// Support for CMS's rescan. In this general form we return a pointer454// to an abstract object that can be used, based on specific previously455// decided protocols, to exchange information between generations,456// information that may be useful for speeding up certain types of457// garbage collectors. A NULL value indicates to the client that458// no data recording is expected by the provider. The data-recorder is459// expected to be GC worker thread-local, with the worker index460// indicated by "thr_num".461virtual void* get_data_recorder(int thr_num) { return NULL; }462virtual void sample_eden_chunk() {}463464// Some generations may require some cleanup actions before allowing465// a verification.466virtual void prepare_for_verify() {};467468// Accessing "marks".469470// This function gives a generation a chance to note a point between471// collections. For example, a contiguous generation might note the472// beginning allocation point post-collection, which might allow some later473// operations to be optimized.474virtual void save_marks() {}475476// This function allows generations to initialize any "saved marks". That477// is, should only be called when the generation is empty.478virtual void reset_saved_marks() {}479480// This function is "true" iff any no allocations have occurred in the481// generation since the last call to "save_marks".482virtual bool no_allocs_since_save_marks() = 0;483484// Apply "cl->apply" to (the addresses of) all reference fields in objects485// allocated in the current generation since the last call to "save_marks".486// If more objects are allocated in this generation as a result of applying487// the closure, iterates over reference fields in those objects as well.488// Calls "save_marks" at the end of the iteration.489// General signature...490virtual void oop_since_save_marks_iterate_v(OopsInGenClosure* cl) = 0;491// ...and specializations for de-virtualization. (The general492// implemention of the _nv versions call the virtual version.493// Note that the _nv suffix is not really semantically necessary,494// but it avoids some not-so-useful warnings on Solaris.)495#define Generation_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \496virtual void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl) { \497oop_since_save_marks_iterate_v((OopsInGenClosure*)cl); \498}499SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(Generation_SINCE_SAVE_MARKS_DECL)500501#undef Generation_SINCE_SAVE_MARKS_DECL502503// The "requestor" generation is performing some garbage collection504// action for which it would be useful to have scratch space. If505// the target is not the requestor, no gc actions will be required506// of the target. The requestor promises to allocate no more than507// "max_alloc_words" in the target generation (via promotion say,508// if the requestor is a young generation and the target is older).509// If the target generation can provide any scratch space, it adds510// it to "list", leaving "list" pointing to the head of the511// augmented list. The default is to offer no space.512virtual void contribute_scratch(ScratchBlock*& list, Generation* requestor,513size_t max_alloc_words) {}514515// Give each generation an opportunity to do clean up for any516// contributed scratch.517virtual void reset_scratch() {};518519// When an older generation has been collected, and perhaps resized,520// this method will be invoked on all younger generations (from older to521// younger), allowing them to resize themselves as appropriate.522virtual void compute_new_size() = 0;523524// Printing525virtual const char* name() const = 0;526virtual const char* short_name() const = 0;527528int level() const { return _level; }529530// Attributes531532// True iff the given generation may only be the youngest generation.533virtual bool must_be_youngest() const = 0;534// True iff the given generation may only be the oldest generation.535virtual bool must_be_oldest() const = 0;536537// Reference Processing accessor538ReferenceProcessor* const ref_processor() { return _ref_processor; }539540// Iteration.541542// Iterate over all the ref-containing fields of all objects in the543// generation, calling "cl.do_oop" on each.544virtual void oop_iterate(ExtendedOopClosure* cl);545546// Iterate over all objects in the generation, calling "cl.do_object" on547// each.548virtual void object_iterate(ObjectClosure* cl);549550// Iterate over all safe objects in the generation, calling "cl.do_object" on551// each. An object is safe if its references point to other objects in552// the heap. This defaults to object_iterate() unless overridden.553virtual void safe_object_iterate(ObjectClosure* cl);554555// Apply "cl->do_oop" to (the address of) all and only all the ref fields556// in the current generation that contain pointers to objects in younger557// generations. Objects allocated since the last "save_marks" call are558// excluded.559virtual void younger_refs_iterate(OopsInGenClosure* cl) = 0;560561// Inform a generation that it longer contains references to objects562// in any younger generation. [e.g. Because younger gens are empty,563// clear the card table.]564virtual void clear_remembered_set() { }565566// Inform a generation that some of its objects have moved. [e.g. The567// generation's spaces were compacted, invalidating the card table.]568virtual void invalidate_remembered_set() { }569570// Block abstraction.571572// Returns the address of the start of the "block" that contains the573// address "addr". We say "blocks" instead of "object" since some heaps574// may not pack objects densely; a chunk may either be an object or a575// non-object.576virtual HeapWord* block_start(const void* addr) const;577578// Requires "addr" to be the start of a chunk, and returns its size.579// "addr + size" is required to be the start of a new chunk, or the end580// of the active area of the heap.581virtual size_t block_size(const HeapWord* addr) const ;582583// Requires "addr" to be the start of a block, and returns "TRUE" iff584// the block is an object.585virtual bool block_is_obj(const HeapWord* addr) const;586587588// PrintGC, PrintGCDetails support589void print_heap_change(size_t prev_used) const;590591// PrintHeapAtGC support592virtual void print() const;593virtual void print_on(outputStream* st) const;594595virtual void verify() = 0;596597struct StatRecord {598int invocations;599elapsedTimer accumulated_time;600StatRecord() :601invocations(0),602accumulated_time(elapsedTimer()) {}603};604private:605StatRecord _stat_record;606public:607StatRecord* stat_record() { return &_stat_record; }608609virtual void print_summary_info();610virtual void print_summary_info_on(outputStream* st);611612// Performance Counter support613virtual void update_counters() = 0;614virtual CollectorCounters* counters() { return _gc_counters; }615};616617// Class CardGeneration is a generation that is covered by a card table,618// and uses a card-size block-offset array to implement block_start.619620// class BlockOffsetArray;621// class BlockOffsetArrayContigSpace;622class BlockOffsetSharedArray;623624class CardGeneration: public Generation {625friend class VMStructs;626protected:627// This is shared with other generations.628GenRemSet* _rs;629// This is local to this generation.630BlockOffsetSharedArray* _bts;631632// current shrinking effect: this damps shrinking when the heap gets empty.633size_t _shrink_factor;634635size_t _min_heap_delta_bytes; // Minimum amount to expand.636637// Some statistics from before gc started.638// These are gathered in the gc_prologue (and should_collect)639// to control growing/shrinking policy in spite of promotions.640size_t _capacity_at_prologue;641size_t _used_at_prologue;642643CardGeneration(ReservedSpace rs, size_t initial_byte_size, int level,644GenRemSet* remset);645646public:647648// Attempt to expand the generation by "bytes". Expand by at a649// minimum "expand_bytes". Return true if some amount (not650// necessarily the full "bytes") was done.651virtual bool expand(size_t bytes, size_t expand_bytes);652653// Shrink generation with specified size (returns false if unable to shrink)654virtual void shrink(size_t bytes) = 0;655656virtual void compute_new_size();657658virtual void clear_remembered_set();659660virtual void invalidate_remembered_set();661662virtual void prepare_for_verify();663664// Grow generation with specified size (returns false if unable to grow)665virtual bool grow_by(size_t bytes) = 0;666// Grow generation to reserved size.667virtual bool grow_to_reserved() = 0;668};669670// OneContigSpaceCardGeneration models a heap of old objects contained in a single671// contiguous space.672//673// Garbage collection is performed using mark-compact.674675class OneContigSpaceCardGeneration: public CardGeneration {676friend class VMStructs;677// Abstractly, this is a subtype that gets access to protected fields.678friend class VM_PopulateDumpSharedSpace;679680protected:681ContiguousSpace* _the_space; // actual space holding objects682WaterMark _last_gc; // watermark between objects allocated before683// and after last GC.684685// Grow generation with specified size (returns false if unable to grow)686virtual bool grow_by(size_t bytes);687// Grow generation to reserved size.688virtual bool grow_to_reserved();689// Shrink generation with specified size (returns false if unable to shrink)690void shrink_by(size_t bytes);691692// Allocation failure693virtual bool expand(size_t bytes, size_t expand_bytes);694void shrink(size_t bytes);695696// Accessing spaces697ContiguousSpace* the_space() const { return _the_space; }698699public:700OneContigSpaceCardGeneration(ReservedSpace rs, size_t initial_byte_size,701int level, GenRemSet* remset,702ContiguousSpace* space) :703CardGeneration(rs, initial_byte_size, level, remset),704_the_space(space)705{}706707inline bool is_in(const void* p) const;708709// Space enquiries710size_t capacity() const;711size_t used() const;712size_t free() const;713714MemRegion used_region() const;715716size_t unsafe_max_alloc_nogc() const;717size_t contiguous_available() const;718719// Iteration720void object_iterate(ObjectClosure* blk);721void space_iterate(SpaceClosure* blk, bool usedOnly = false);722723void younger_refs_iterate(OopsInGenClosure* blk);724725inline CompactibleSpace* first_compaction_space() const;726727virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);728virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);729730// Accessing marks731inline WaterMark top_mark();732inline WaterMark bottom_mark();733734#define OneContig_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \735void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);736OneContig_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v)737SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(OneContig_SINCE_SAVE_MARKS_DECL)738739void save_marks();740void reset_saved_marks();741bool no_allocs_since_save_marks();742743inline size_t block_size(const HeapWord* addr) const;744745inline bool block_is_obj(const HeapWord* addr) const;746747virtual void collect(bool full,748bool clear_all_soft_refs,749size_t size,750bool is_tlab);751HeapWord* expand_and_allocate(size_t size,752bool is_tlab,753bool parallel = false);754755virtual void prepare_for_verify();756757virtual void gc_epilogue(bool full);758759virtual void record_spaces_top();760761virtual void verify();762virtual void print_on(outputStream* st) const;763};764765#endif // SHARE_VM_MEMORY_GENERATION_HPP766767768