src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp

src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp

Print this page
rev 5732 : [mq]: comments2

*** 169,191 **** // Represents a marking stack used by the CMS collector. // Ideally this should be GrowableArray<> just like MSC's marking stack(s). class CMSMarkStack: public CHeapObj<mtGC> { // ! friend class CMSCollector; // to get at expasion stats further below // ! VirtualSpace _virtual_space; // space for the stack ! oop* _base; // bottom of stack ! size_t _index; // one more than last occupied index ! size_t _capacity; // max #elements ! Mutex _par_lock; // an advisory lock used in case of parallel access ! NOT_PRODUCT(size_t _max_depth;) // max depth plumbed during run protected: ! size_t _hit_limit; // we hit max stack size limit ! size_t _failed_double; // we failed expansion before hitting limit public: CMSMarkStack(): _par_lock(Mutex::event, "CMSMarkStack._par_lock", true), _hit_limit(0), --- 169,191 ---- // Represents a marking stack used by the CMS collector. // Ideally this should be GrowableArray<> just like MSC's marking stack(s). class CMSMarkStack: public CHeapObj<mtGC> { // ! friend class CMSCollector; // To get at expansion stats further below. // ! VirtualSpace _virtual_space; // Space for the stack ! oop* _base; // Bottom of stack ! size_t _index; // One more than last occupied index ! size_t _capacity; // Max #elements ! Mutex _par_lock; // An advisory lock used in case of parallel access ! NOT_PRODUCT(size_t _max_depth;) // Max depth plumbed during run protected: ! size_t _hit_limit; // We hit max stack size limit ! size_t _failed_double; // We failed expansion before hitting limit public: CMSMarkStack(): _par_lock(Mutex::event, "CMSMarkStack._par_lock", true), _hit_limit(0),
*** 236,246 **** // Forcibly reset the stack, losing all of its contents. void reset() { _index = 0; } ! // Expand the stack, typically in response to an overflow condition void expand(); // Compute the least valued stack element. oop least_value(HeapWord* low) { oop least = (oop)low; --- 236,246 ---- // Forcibly reset the stack, losing all of its contents. void reset() { _index = 0; } ! // Expand the stack, typically in response to an overflow condition. void expand(); // Compute the least valued stack element. oop least_value(HeapWord* low) { oop least = (oop)low;
*** 248,258 **** least = MIN2(least, _base[i]); } return least; } ! // Exposed here to allow stack expansion in || case Mutex* par_lock() { return &_par_lock; } }; class CardTableRS; class CMSParGCThreadState; --- 248,258 ---- least = MIN2(least, _base[i]); } return least; } ! // Exposed here to allow stack expansion in || case. Mutex* par_lock() { return &_par_lock; } }; class CardTableRS; class CMSParGCThreadState;
*** 555,565 **** // Overflow list of grey objects, threaded through mark-word // Manipulated with CAS in the parallel/multi-threaded case. oop _overflow_list; // The following array-pair keeps track of mark words ! // displaced for accomodating overflow list above. // This code will likely be revisited under RFE#4922830. Stack<oop, mtGC> _preserved_oop_stack; Stack<markOop, mtGC> _preserved_mark_stack; int* _hash_seed; --- 555,565 ---- // Overflow list of grey objects, threaded through mark-word // Manipulated with CAS in the parallel/multi-threaded case. oop _overflow_list; // The following array-pair keeps track of mark words ! // displaced for accommodating overflow list above. // This code will likely be revisited under RFE#4922830. Stack<oop, mtGC> _preserved_oop_stack; Stack<markOop, mtGC> _preserved_mark_stack; int* _hash_seed;
*** 597,607 **** // Verification support CMSBitMap _verification_mark_bm; void verify_after_remark_work_1(); void verify_after_remark_work_2(); ! // true if any verification flag is on. bool _verifying; bool verifying() const { return _verifying; } void set_verifying(bool v) { _verifying = v; } // Collector policy --- 597,607 ---- // Verification support CMSBitMap _verification_mark_bm; void verify_after_remark_work_1(); void verify_after_remark_work_2(); ! // True if any verification flag is on. bool _verifying; bool verifying() const { return _verifying; } void set_verifying(bool v) { _verifying = v; } // Collector policy
*** 609,621 **** ConcurrentMarkSweepPolicy* collector_policy() { return _collector_policy; } void set_did_compact(bool v); // XXX Move these to CMSStats ??? FIX ME !!! ! elapsedTimer _inter_sweep_timer; // time between sweeps ! elapsedTimer _intra_sweep_timer; // time _in_ sweeps ! // padded decaying average estimates of the above AdaptivePaddedAverage _inter_sweep_estimate; AdaptivePaddedAverage _intra_sweep_estimate; CMSTracer* _gc_tracer_cm; ConcurrentGCTimer* _gc_timer_cm; --- 609,621 ---- ConcurrentMarkSweepPolicy* collector_policy() { return _collector_policy; } void set_did_compact(bool v); // XXX Move these to CMSStats ??? FIX ME !!! ! elapsedTimer _inter_sweep_timer; // Time between sweeps ! elapsedTimer _intra_sweep_timer; // Time _in_ sweeps ! // Padded decaying average estimates of the above AdaptivePaddedAverage _inter_sweep_estimate; AdaptivePaddedAverage _intra_sweep_estimate; CMSTracer* _gc_tracer_cm; ConcurrentGCTimer* _gc_timer_cm;
*** 630,649 **** void register_gc_end(); void save_heap_summary(); void report_heap_summary(GCWhen::Type when); protected: ! ConcurrentMarkSweepGeneration* _cmsGen; // old gen (CMS) ! MemRegion _span; // span covering above two ! CardTableRS* _ct; // card table // CMS marking support structures CMSBitMap _markBitMap; CMSBitMap _modUnionTable; CMSMarkStack _markStack; ! HeapWord* _restart_addr; // in support of marking stack overflow void lower_restart_addr(HeapWord* low); // Counters in support of marking stack / work queue overflow handling: // a non-zero value indicates certain types of overflow events during // the current CMS cycle and could lead to stack resizing efforts at --- 630,649 ---- void register_gc_end(); void save_heap_summary(); void report_heap_summary(GCWhen::Type when); protected: ! ConcurrentMarkSweepGeneration* _cmsGen; // Old gen (CMS) ! MemRegion _span; // Span covering above two ! CardTableRS* _ct; // Card table // CMS marking support structures CMSBitMap _markBitMap; CMSBitMap _modUnionTable; CMSMarkStack _markStack; ! HeapWord* _restart_addr; // In support of marking stack overflow void lower_restart_addr(HeapWord* low); // Counters in support of marking stack / work queue overflow handling: // a non-zero value indicates certain types of overflow events during // the current CMS cycle and could lead to stack resizing efforts at
*** 654,669 **** size_t _ser_kac_preclean_ovflw; size_t _ser_kac_ovflw; size_t _par_kac_ovflw; NOT_PRODUCT(ssize_t _num_par_pushes;) ! // ("Weak") Reference processing support ReferenceProcessor* _ref_processor; CMSIsAliveClosure _is_alive_closure; ! // keep this textually after _markBitMap and _span; c'tor dependency ! ConcurrentMarkSweepThread* _cmsThread; // the thread doing the work ModUnionClosure _modUnionClosure; ModUnionClosurePar _modUnionClosurePar; // CMS abstract state machine // initial_state: Idling --- 654,669 ---- size_t _ser_kac_preclean_ovflw; size_t _ser_kac_ovflw; size_t _par_kac_ovflw; NOT_PRODUCT(ssize_t _num_par_pushes;) ! // ("Weak") Reference processing support. ReferenceProcessor* _ref_processor; CMSIsAliveClosure _is_alive_closure; ! // Keep this textually after _markBitMap and _span; c'tor dependency. ! ConcurrentMarkSweepThread* _cmsThread; // The thread doing the work ModUnionClosure _modUnionClosure; ModUnionClosurePar _modUnionClosurePar; // CMS abstract state machine // initial_state: Idling
*** 695,705 **** static CollectorState _collectorState; // State related to prologue/epilogue invocation for my generations bool _between_prologue_and_epilogue; ! // Signalling/State related to coordination between fore- and backgroud GC // Note: When the baton has been passed from background GC to foreground GC, // _foregroundGCIsActive is true and _foregroundGCShouldWait is false. static bool _foregroundGCIsActive; // true iff foreground collector is active or // wants to go active static bool _foregroundGCShouldWait; // true iff background GC is active and has not --- 695,705 ---- static CollectorState _collectorState; // State related to prologue/epilogue invocation for my generations bool _between_prologue_and_epilogue; ! // Signaling/State related to coordination between fore- and background GC // Note: When the baton has been passed from background GC to foreground GC, // _foregroundGCIsActive is true and _foregroundGCShouldWait is false. static bool _foregroundGCIsActive; // true iff foreground collector is active or // wants to go active static bool _foregroundGCShouldWait; // true iff background GC is active and has not
*** 710,726 **** bool _start_sampling; int _numYields; size_t _numDirtyCards; size_t _sweep_count; ! // number of full gc's since the last concurrent gc. uint _full_gcs_since_conc_gc; ! // occupancy used for bootstrapping stats double _bootstrap_occupancy; ! // timer elapsedTimer _timer; // Timing, allocation and promotion statistics, used for scheduling. CMSStats _stats; --- 710,726 ---- bool _start_sampling; int _numYields; size_t _numDirtyCards; size_t _sweep_count; ! // Number of full gc's since the last concurrent gc. uint _full_gcs_since_conc_gc; ! // Occupancy used for bootstrapping stats double _bootstrap_occupancy; ! // Timer elapsedTimer _timer; // Timing, allocation and promotion statistics, used for scheduling. CMSStats _stats;
*** 768,803 **** bool par_take_from_overflow_list(size_t num, OopTaskQueue* to_work_q, int no_of_gc_threads); void push_on_overflow_list(oop p); void par_push_on_overflow_list(oop p); ! // the following is, obviously, not, in general, "MT-stable" bool overflow_list_is_empty() const; void preserve_mark_if_necessary(oop p); void par_preserve_mark_if_necessary(oop p); void preserve_mark_work(oop p, markOop m); void restore_preserved_marks_if_any(); NOT_PRODUCT(bool no_preserved_marks() const;) ! // in support of testing overflow code NOT_PRODUCT(int _overflow_counter;) ! NOT_PRODUCT(bool simulate_overflow();) // sequential NOT_PRODUCT(bool par_simulate_overflow();) // MT version // CMS work methods ! void checkpointRootsInitialWork(bool asynch); // initial checkpoint work ! // a return value of false indicates failure due to stack overflow ! bool markFromRootsWork(bool asynch); // concurrent marking work public: // FIX ME!!! only for testing ! bool do_marking_st(bool asynch); // single-threaded marking ! bool do_marking_mt(bool asynch); // multi-threaded marking private: ! // concurrent precleaning work size_t preclean_mod_union_table(ConcurrentMarkSweepGeneration* gen, ScanMarkedObjectsAgainCarefullyClosure* cl); size_t preclean_card_table(ConcurrentMarkSweepGeneration* gen, ScanMarkedObjectsAgainCarefullyClosure* cl); // Does precleaning work, returning a quantity indicative of --- 768,803 ---- bool par_take_from_overflow_list(size_t num, OopTaskQueue* to_work_q, int no_of_gc_threads); void push_on_overflow_list(oop p); void par_push_on_overflow_list(oop p); ! // The following is, obviously, not, in general, "MT-stable" bool overflow_list_is_empty() const; void preserve_mark_if_necessary(oop p); void par_preserve_mark_if_necessary(oop p); void preserve_mark_work(oop p, markOop m); void restore_preserved_marks_if_any(); NOT_PRODUCT(bool no_preserved_marks() const;) ! // In support of testing overflow code NOT_PRODUCT(int _overflow_counter;) ! NOT_PRODUCT(bool simulate_overflow();) // Sequential NOT_PRODUCT(bool par_simulate_overflow();) // MT version // CMS work methods ! void checkpointRootsInitialWork(bool asynch); // Initial checkpoint work ! // A return value of false indicates failure due to stack overflow ! bool markFromRootsWork(bool asynch); // Concurrent marking work public: // FIX ME!!! only for testing ! bool do_marking_st(bool asynch); // Single-threaded marking ! bool do_marking_mt(bool asynch); // Multi-threaded marking private: ! // Concurrent precleaning work size_t preclean_mod_union_table(ConcurrentMarkSweepGeneration* gen, ScanMarkedObjectsAgainCarefullyClosure* cl); size_t preclean_card_table(ConcurrentMarkSweepGeneration* gen, ScanMarkedObjectsAgainCarefullyClosure* cl); // Does precleaning work, returning a quantity indicative of
*** 809,838 **** // Helper function for above; merge-sorts the per-thread plab samples void merge_survivor_plab_arrays(ContiguousSpace* surv, int no_of_gc_threads); // Resets (i.e. clears) the per-thread plab sample vectors void reset_survivor_plab_arrays(); ! // final (second) checkpoint work void checkpointRootsFinalWork(bool asynch, bool clear_all_soft_refs, bool init_mark_was_synchronous); ! // work routine for parallel version of remark void do_remark_parallel(); ! // work routine for non-parallel version of remark void do_remark_non_parallel(); ! // reference processing work routine (during second checkpoint) void refProcessingWork(bool asynch, bool clear_all_soft_refs); ! // concurrent sweeping work void sweepWork(ConcurrentMarkSweepGeneration* gen, bool asynch); ! // (concurrent) resetting of support data structures void reset(bool asynch); // Clear _expansion_cause fields of constituent generations void clear_expansion_cause(); ! // An auxilliary method used to record the ends of // used regions of each generation to limit the extent of sweep void save_sweep_limits(); // A work method used by foreground collection to determine // what type of collection (compacting or not, continuing or fresh) --- 809,838 ---- // Helper function for above; merge-sorts the per-thread plab samples void merge_survivor_plab_arrays(ContiguousSpace* surv, int no_of_gc_threads); // Resets (i.e. clears) the per-thread plab sample vectors void reset_survivor_plab_arrays(); ! // Final (second) checkpoint work void checkpointRootsFinalWork(bool asynch, bool clear_all_soft_refs, bool init_mark_was_synchronous); ! // Work routine for parallel version of remark void do_remark_parallel(); ! // Work routine for non-parallel version of remark void do_remark_non_parallel(); ! // Reference processing work routine (during second checkpoint) void refProcessingWork(bool asynch, bool clear_all_soft_refs); ! // Concurrent sweeping work void sweepWork(ConcurrentMarkSweepGeneration* gen, bool asynch); ! // (Concurrent) resetting of support data structures void reset(bool asynch); // Clear _expansion_cause fields of constituent generations void clear_expansion_cause(); ! // An auxiliary method used to record the ends of // used regions of each generation to limit the extent of sweep void save_sweep_limits(); // A work method used by foreground collection to determine // what type of collection (compacting or not, continuing or fresh)
*** 852,862 **** // Work methods for reporting concurrent mode interruption or failure bool is_external_interruption(); void report_concurrent_mode_interruption(); ! // If the backgrould GC is active, acquire control from the background // GC and do the collection. void acquire_control_and_collect(bool full, bool clear_all_soft_refs); // For synchronizing passing of control from background to foreground // GC. waitForForegroundGC() is called by the background --- 852,862 ---- // Work methods for reporting concurrent mode interruption or failure bool is_external_interruption(); void report_concurrent_mode_interruption(); ! // If the background GC is active, acquire control from the background // GC and do the collection. void acquire_control_and_collect(bool full, bool clear_all_soft_refs); // For synchronizing passing of control from background to foreground // GC. waitForForegroundGC() is called by the background
*** 891,901 **** size_t get_eden_used() const; size_t get_eden_capacity() const; ConcurrentMarkSweepGeneration* cmsGen() { return _cmsGen; } ! // locking checks NOT_PRODUCT(static bool have_cms_token();) // XXXPERM bool should_collect(bool full, size_t size, bool tlab); bool shouldConcurrentCollect(); --- 891,901 ---- size_t get_eden_used() const; size_t get_eden_capacity() const; ConcurrentMarkSweepGeneration* cmsGen() { return _cmsGen; } ! // Locking checks NOT_PRODUCT(static bool have_cms_token();) // XXXPERM bool should_collect(bool full, size_t size, bool tlab); bool shouldConcurrentCollect();
*** 956,966 **** void sample_eden_chunk(); CMSBitMap* markBitMap() { return &_markBitMap; } void directAllocated(HeapWord* start, size_t size); ! // main CMS steps and related support void checkpointRootsInitial(bool asynch); bool markFromRoots(bool asynch); // a return value of false indicates failure // due to stack overflow void preclean(); void checkpointRootsFinal(bool asynch, bool clear_all_soft_refs, --- 956,966 ---- void sample_eden_chunk(); CMSBitMap* markBitMap() { return &_markBitMap; } void directAllocated(HeapWord* start, size_t size); ! // Main CMS steps and related support void checkpointRootsInitial(bool asynch); bool markFromRoots(bool asynch); // a return value of false indicates failure // due to stack overflow void preclean(); void checkpointRootsFinal(bool asynch, bool clear_all_soft_refs,
*** 975,985 **** bool is_cms_reachable(HeapWord* addr); // Performance Counter Support CollectorCounters* counters() { return _gc_counters; } ! // timer stuff void startTimer() { assert(!_timer.is_active(), "Error"); _timer.start(); } void stopTimer() { assert( _timer.is_active(), "Error"); _timer.stop(); } void resetTimer() { assert(!_timer.is_active(), "Error"); _timer.reset(); } double timerValue() { assert(!_timer.is_active(), "Error"); return _timer.seconds(); } --- 975,985 ---- bool is_cms_reachable(HeapWord* addr); // Performance Counter Support CollectorCounters* counters() { return _gc_counters; } ! // Timer stuff void startTimer() { assert(!_timer.is_active(), "Error"); _timer.start(); } void stopTimer() { assert( _timer.is_active(), "Error"); _timer.stop(); } void resetTimer() { assert(!_timer.is_active(), "Error"); _timer.reset(); } double timerValue() { assert(!_timer.is_active(), "Error"); return _timer.seconds(); }
*** 1012,1033 **** CMSAdaptiveSizePolicy* size_policy(); CMSGCAdaptivePolicyCounters* gc_adaptive_policy_counters(); static void print_on_error(outputStream* st); ! // debugging void verify(); bool verify_after_remark(bool silent = VerifySilently); void verify_ok_to_terminate() const PRODUCT_RETURN; void verify_work_stacks_empty() const PRODUCT_RETURN; void verify_overflow_empty() const PRODUCT_RETURN; ! // convenience methods in support of debugging static const size_t skip_header_HeapWords() PRODUCT_RETURN0; HeapWord* block_start(const void* p) const PRODUCT_RETURN0; ! // accessors CMSMarkStack* verification_mark_stack() { return &_markStack; } CMSBitMap* verification_mark_bm() { return &_verification_mark_bm; } // Initialization errors bool completed_initialization() { return _completed_initialization; } --- 1012,1033 ---- CMSAdaptiveSizePolicy* size_policy(); CMSGCAdaptivePolicyCounters* gc_adaptive_policy_counters(); static void print_on_error(outputStream* st); ! // Debugging void verify(); bool verify_after_remark(bool silent = VerifySilently); void verify_ok_to_terminate() const PRODUCT_RETURN; void verify_work_stacks_empty() const PRODUCT_RETURN; void verify_overflow_empty() const PRODUCT_RETURN; ! // Convenience methods in support of debugging static const size_t skip_header_HeapWords() PRODUCT_RETURN0; HeapWord* block_start(const void* p) const PRODUCT_RETURN0; ! // Accessors CMSMarkStack* verification_mark_stack() { return &_markStack; } CMSBitMap* verification_mark_bm() { return &_verification_mark_bm; } // Initialization errors bool completed_initialization() { return _completed_initialization; }
*** 1107,1117 **** Unknown_collection_type = 3 }; CollectionTypes _debug_collection_type; ! // True if a compactiing collection was done. bool _did_compact; bool did_compact() { return _did_compact; } // Fraction of current occupancy at which to start a CMS collection which // will collect this generation (at least). --- 1107,1117 ---- Unknown_collection_type = 3 }; CollectionTypes _debug_collection_type; ! // True if a compacting collection was done. bool _did_compact; bool did_compact() { return _did_compact; } // Fraction of current occupancy at which to start a CMS collection which // will collect this generation (at least).
*** 1201,1211 **** void space_iterate(SpaceClosure* blk, bool usedOnly = false); // Support for compaction CompactibleSpace* first_compaction_space() const; ! // Adjust quantites in the generation affected by // the compaction. void reset_after_compaction(); // Allocation support HeapWord* allocate(size_t size, bool tlab); --- 1201,1211 ---- void space_iterate(SpaceClosure* blk, bool usedOnly = false); // Support for compaction CompactibleSpace* first_compaction_space() const; ! // Adjust quantities in the generation affected by // the compaction. void reset_after_compaction(); // Allocation support HeapWord* allocate(size_t size, bool tlab);
*** 1299,1309 **** // Smart allocation XXX -- move to CFLSpace? void setNearLargestChunk(); bool isNearLargestChunk(HeapWord* addr); ! // Get the chunk at the end of the space. Delagates to // the space. FreeChunk* find_chunk_at_end(); void post_compact(); --- 1299,1309 ---- // Smart allocation XXX -- move to CFLSpace? void setNearLargestChunk(); bool isNearLargestChunk(HeapWord* addr); ! // Get the chunk at the end of the space. Delegates to // the space. FreeChunk* find_chunk_at_end(); void post_compact();
*** 1420,1430 **** // This closure is used to do concurrent multi-threaded // marking from the roots following the first checkpoint. // XXX This should really be a subclass of The serial version // above, but i have not had the time to refactor things cleanly. - // That willbe done for Dolphin. class Par_MarkFromRootsClosure: public BitMapClosure { CMSCollector* _collector; MemRegion _whole_span; MemRegion _span; CMSBitMap* _bit_map; --- 1420,1429 ----
*** 1778,1788 **** void do_post_free_or_garbage_chunk(FreeChunk *fc, size_t chunkSize); // Process a free chunk during sweeping. void do_already_free_chunk(FreeChunk *fc); // Work method called when processing an already free or a // freshly garbage chunk to do a lookahead and possibly a ! // premptive flush if crossing over _limit. void lookahead_and_flush(FreeChunk* fc, size_t chunkSize); // Process a garbage chunk during sweeping. size_t do_garbage_chunk(FreeChunk *fc); // Process a live chunk during sweeping. size_t do_live_chunk(FreeChunk* fc); --- 1777,1787 ---- void do_post_free_or_garbage_chunk(FreeChunk *fc, size_t chunkSize); // Process a free chunk during sweeping. void do_already_free_chunk(FreeChunk *fc); // Work method called when processing an already free or a // freshly garbage chunk to do a lookahead and possibly a ! // preemptive flush if crossing over _limit. void lookahead_and_flush(FreeChunk* fc, size_t chunkSize); // Process a garbage chunk during sweeping. size_t do_garbage_chunk(FreeChunk *fc); // Process a live chunk during sweeping. size_t do_live_chunk(FreeChunk* fc);
*** 1877,1887 **** void trim_queue(uint max); void do_void(); }; // Allow yielding or short-circuiting of reference list ! // prelceaning work. class CMSPrecleanRefsYieldClosure: public YieldClosure { CMSCollector* _collector; void do_yield_work(); public: CMSPrecleanRefsYieldClosure(CMSCollector* collector): --- 1876,1886 ---- void trim_queue(uint max); void do_void(); }; // Allow yielding or short-circuiting of reference list ! // precleaning work. class CMSPrecleanRefsYieldClosure: public YieldClosure { CMSCollector* _collector; void do_yield_work(); public: CMSPrecleanRefsYieldClosure(CMSCollector* collector):
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File