< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.hpp

Print this page

        

*** 38,48 **** #include "gc/g1/g1EvacuationInfo.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1HeapTransition.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1HRPrinter.hpp" ! #include "gc/g1/g1HeapRegionAttr.hpp" #include "gc/g1/g1MonitoringSupport.hpp" #include "gc/g1/g1SurvivorRegions.hpp" #include "gc/g1/g1YCTypes.hpp" #include "gc/g1/heapRegionManager.hpp" #include "gc/g1/heapRegionSet.hpp" --- 38,48 ---- #include "gc/g1/g1EvacuationInfo.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1HeapTransition.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1HRPrinter.hpp" ! #include "gc/g1/g1InCSetState.hpp" #include "gc/g1/g1MonitoringSupport.hpp" #include "gc/g1/g1SurvivorRegions.hpp" #include "gc/g1/g1YCTypes.hpp" #include "gc/g1/heapRegionManager.hpp" #include "gc/g1/heapRegionSet.hpp"
*** 72,81 **** --- 72,82 ---- class ObjectClosure; class SpaceClosure; class CompactibleSpaceClosure; class Space; class G1CollectionSet; + class G1CollectorPolicy; class G1Policy; class G1HotCardCache; class G1RemSet; class G1YoungRemSetSamplingThread; class HeapRegionRemSetIterator;
*** 140,162 **** friend class G1HeapVerifier; // Closures used in implementation. friend class G1ParScanThreadState; friend class G1ParScanThreadStateSet; ! friend class G1EvacuateRegionsTask; friend class G1PLABAllocator; // Other related classes. friend class HeapRegionClaimer; // Testing classes. ! friend class G1CheckRegionAttrTableClosure; private: G1YoungRemSetSamplingThread* _young_gen_sampling_thread; WorkGang* _workers; G1CardTable* _card_table; SoftRefPolicy _soft_ref_policy; static size_t _humongous_object_threshold_in_words; --- 141,165 ---- friend class G1HeapVerifier; // Closures used in implementation. friend class G1ParScanThreadState; friend class G1ParScanThreadStateSet; ! friend class G1ParTask; friend class G1PLABAllocator; + friend class G1PrepareCompactClosure; // Other related classes. friend class HeapRegionClaimer; // Testing classes. ! friend class G1CheckCSetFastTableClosure; private: G1YoungRemSetSamplingThread* _young_gen_sampling_thread; WorkGang* _workers; + G1CollectorPolicy* _collector_policy; G1CardTable* _card_table; SoftRefPolicy _soft_ref_policy; static size_t _humongous_object_threshold_in_words;
*** 201,211 **** // Manages all heap verification. G1HeapVerifier* _verifier; // Outside of GC pauses, the number of bytes used in all regions other // than the current allocation region(s). ! volatile size_t _summary_bytes_used; void increase_used(size_t bytes); void decrease_used(size_t bytes); void set_used(size_t bytes); --- 204,214 ---- // Manages all heap verification. G1HeapVerifier* _verifier; // Outside of GC pauses, the number of bytes used in all regions other // than the current allocation region(s). ! size_t _summary_bytes_used; void increase_used(size_t bytes); void decrease_used(size_t bytes); void set_used(size_t bytes);
*** 352,370 **** assert_at_safepoint(); \ assert(Thread::current_or_null() != NULL, "no current thread"); \ assert(Thread::current()->is_VM_thread(), "current thread is not VM thread"); \ } while (0) - #define assert_used_and_recalculate_used_equal(g1h) \ - do { \ - size_t cur_used_bytes = g1h->used(); \ - size_t recal_used_bytes = g1h->recalculate_used(); \ - assert(cur_used_bytes == recal_used_bytes, "Used(" SIZE_FORMAT ") is not" \ - " same as recalculated used(" SIZE_FORMAT ").", \ - cur_used_bytes, recal_used_bytes); \ - } while (0) - const char* young_gc_name() const; // The young region list. G1EdenRegions _eden; G1SurvivorRegions _survivor; --- 355,364 ----
*** 462,475 **** HeapRegion* new_mutator_alloc_region(size_t word_size, bool force); void retire_mutator_alloc_region(HeapRegion* alloc_region, size_t allocated_bytes); // For GC alloc regions. ! bool has_more_regions(G1HeapRegionAttr dest); ! HeapRegion* new_gc_alloc_region(size_t word_size, G1HeapRegionAttr dest); void retire_gc_alloc_region(HeapRegion* alloc_region, ! size_t allocated_bytes, G1HeapRegionAttr dest); // - if explicit_gc is true, the GC is for a System.gc() etc, // otherwise it's for a failed allocation. // - if clear_all_soft_refs is true, all soft references should be // cleared during the GC. --- 456,469 ---- HeapRegion* new_mutator_alloc_region(size_t word_size, bool force); void retire_mutator_alloc_region(HeapRegion* alloc_region, size_t allocated_bytes); // For GC alloc regions. ! bool has_more_regions(InCSetState dest); ! HeapRegion* new_gc_alloc_region(size_t word_size, InCSetState dest); void retire_gc_alloc_region(HeapRegion* alloc_region, ! size_t allocated_bytes, InCSetState dest); // - if explicit_gc is true, the GC is for a System.gc() etc, // otherwise it's for a failed allocation. // - if clear_all_soft_refs is true, all soft references should be // cleared during the GC.
*** 523,536 **** public: G1YoungRemSetSamplingThread* sampling_thread() const { return _young_gen_sampling_thread; } WorkGang* workers() const { return _workers; } - // Runs the given AbstractGangTask with the current active workers, returning the - // total time taken. - Tickspan run_task(AbstractGangTask* task); - G1Allocator* allocator() { return _allocator; } G1HeapVerifier* verifier() { --- 517,526 ----
*** 549,562 **** // false otherwise. // (Rounds up to a HeapRegion boundary.) bool expand(size_t expand_bytes, WorkGang* pretouch_workers = NULL, double* expand_time_ms = NULL); // Returns the PLAB statistics for a given destination. ! inline G1EvacStats* alloc_buffer_stats(G1HeapRegionAttr dest); // Determines PLAB size for a given destination. ! inline size_t desired_plab_sz(G1HeapRegionAttr dest); // Do anything common to GC's. void gc_prologue(bool full); void gc_epilogue(bool full); --- 539,552 ---- // false otherwise. // (Rounds up to a HeapRegion boundary.) bool expand(size_t expand_bytes, WorkGang* pretouch_workers = NULL, double* expand_time_ms = NULL); // Returns the PLAB statistics for a given destination. ! inline G1EvacStats* alloc_buffer_stats(InCSetState dest); // Determines PLAB size for a given destination. ! inline size_t desired_plab_sz(InCSetState dest); // Do anything common to GC's. void gc_prologue(bool full); void gc_epilogue(bool full);
*** 571,598 **** // Remove from the reclaim candidate set. Also remove from the // collection set so that later encounters avoid the slow path. inline void set_humongous_is_live(oop obj); // Register the given region to be part of the collection set. ! inline void register_humongous_region_with_region_attr(uint index); ! // Update region attributes table with information about all regions. ! void register_regions_with_region_attr(); // We register a region with the fast "in collection set" test. We // simply set to true the array slot corresponding to this region. ! void register_young_region_with_region_attr(HeapRegion* r) { ! _region_attr.set_in_young(r->hrm_index()); } ! inline void register_region_with_region_attr(HeapRegion* r); ! inline void register_old_region_with_region_attr(HeapRegion* r); ! inline void register_optional_region_with_region_attr(HeapRegion* r); ! ! void clear_region_attr(const HeapRegion* hr) { ! _region_attr.clear(hr); } ! void clear_region_attr() { ! _region_attr.clear(); } bool is_user_requested_concurrent_full_gc(GCCause::Cause cause); // This is called at the start of either a concurrent cycle or a Full --- 561,591 ---- // Remove from the reclaim candidate set. Also remove from the // collection set so that later encounters avoid the slow path. inline void set_humongous_is_live(oop obj); // Register the given region to be part of the collection set. ! inline void register_humongous_region_with_cset(uint index); ! // Register regions with humongous objects (actually on the start region) in ! // the in_cset_fast_test table. ! void register_humongous_regions_with_cset(); // We register a region with the fast "in collection set" test. We // simply set to true the array slot corresponding to this region. ! void register_young_region_with_cset(HeapRegion* r) { ! _in_cset_fast_test.set_in_young(r->hrm_index()); } ! void register_old_region_with_cset(HeapRegion* r) { ! _in_cset_fast_test.set_in_old(r->hrm_index()); ! } ! void register_optional_region_with_cset(HeapRegion* r) { ! _in_cset_fast_test.set_optional(r->hrm_index()); ! } ! void clear_in_cset(const HeapRegion* hr) { ! _in_cset_fast_test.clear(hr); } ! void clear_cset_fast_test() { ! _in_cset_fast_test.clear(); } bool is_user_requested_concurrent_full_gc(GCCause::Cause cause); // This is called at the start of either a concurrent cycle or a Full
*** 743,760 **** void verify_before_young_collection(G1HeapVerifier::G1VerifyType type); void verify_after_young_collection(G1HeapVerifier::G1VerifyType type); void calculate_collection_set(G1EvacuationInfo& evacuation_info, double target_pause_time_ms); ! // Actually do the work of evacuating the parts of the collection set. ! void evacuate_initial_collection_set(G1ParScanThreadStateSet* per_thread_states); void evacuate_optional_collection_set(G1ParScanThreadStateSet* per_thread_states); ! private: ! // Evacuate the next set of optional regions. ! void evacuate_next_optional_regions(G1ParScanThreadStateSet* per_thread_states); - public: void pre_evacuate_collection_set(G1EvacuationInfo& evacuation_info); void post_evacuate_collection_set(G1EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* pss); void expand_heap_after_young_collection(); // Update object copying statistics. --- 736,750 ---- void verify_before_young_collection(G1HeapVerifier::G1VerifyType type); void verify_after_young_collection(G1HeapVerifier::G1VerifyType type); void calculate_collection_set(G1EvacuationInfo& evacuation_info, double target_pause_time_ms); ! // Actually do the work of evacuating the collection set. ! void evacuate_collection_set(G1ParScanThreadStateSet* per_thread_states); void evacuate_optional_collection_set(G1ParScanThreadStateSet* per_thread_states); ! void evacuate_optional_regions(G1ParScanThreadStateSet* per_thread_states, G1OptionalCSet* ocset); void pre_evacuate_collection_set(G1EvacuationInfo& evacuation_info); void post_evacuate_collection_set(G1EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* pss); void expand_heap_after_young_collection(); // Update object copying statistics.
*** 928,941 **** uint num_task_queues() const; // A set of cards where updates happened during the GC G1DirtyCardQueueSet& dirty_card_queue_set() { return _dirty_card_queue_set; } ! // Create a G1CollectedHeap. // Must call the initialize method afterwards. // May not return if something goes wrong. ! G1CollectedHeap(); private: jint initialize_concurrent_refinement(); jint initialize_young_gen_sampling_thread(); public: --- 918,931 ---- uint num_task_queues() const; // A set of cards where updates happened during the GC G1DirtyCardQueueSet& dirty_card_queue_set() { return _dirty_card_queue_set; } ! // Create a G1CollectedHeap with the specified policy. // Must call the initialize method afterwards. // May not return if something goes wrong. ! G1CollectedHeap(G1CollectorPolicy* policy); private: jint initialize_concurrent_refinement(); jint initialize_young_gen_sampling_thread(); public:
*** 946,955 **** --- 936,948 ---- virtual void stop(); virtual void safepoint_synchronize_begin(); virtual void safepoint_synchronize_end(); + // Return the (conservative) maximum heap alignment for any G1 heap + static size_t conservative_max_heap_alignment(); + // Does operations required after initialization has been done. void post_initialize(); // Initialize weak reference processing. void ref_processing_init();
*** 975,984 **** --- 968,979 ---- HeapRegionManager* hrm() const { return _hrm; } const G1CollectionSet* collection_set() const { return &_collection_set; } G1CollectionSet* collection_set() { return &_collection_set; } + virtual CollectorPolicy* collector_policy() const; + virtual SoftRefPolicy* soft_ref_policy(); virtual void initialize_serviceability(); virtual MemoryUsage memory_usage(); virtual GrowableArray<GCMemoryManager*> memory_managers();
*** 1005,1015 **** // The Concurrent Marking reference processor... ReferenceProcessor* ref_processor_cm() const { return _ref_processor_cm; } size_t unused_committed_regions_in_bytes() const; - virtual size_t capacity() const; virtual size_t used() const; // This should be called when we're not holding the heap lock. The // result might be a bit inaccurate. size_t used_unlocked() const; --- 1000,1009 ----
*** 1105,1119 **** private: // This array is used for a quick test on whether a reference points into // the collection set or not. Each of the array's elements denotes whether the // corresponding region is in the collection set or not. ! G1HeapRegionAttrBiasedMappedArray _region_attr; public: ! inline G1HeapRegionAttr region_attr(const void* obj); // Return "TRUE" iff the given object address is in the reserved // region of g1. bool is_in_g1_reserved(const void* p) const { return _hrm->reserved().contains(p); --- 1099,1113 ---- private: // This array is used for a quick test on whether a reference points into // the collection set or not. Each of the array's elements denotes whether the // corresponding region is in the collection set or not. ! G1InCSetStateFastTestBiasedMappedArray _in_cset_fast_test; public: ! inline InCSetState in_cset_state(const oop obj); // Return "TRUE" iff the given object address is in the reserved // region of g1. bool is_in_g1_reserved(const void* p) const { return _hrm->reserved().contains(p);
*** 1169,1186 **** uint worker_id) const; void heap_region_par_iterate_from_start(HeapRegionClosure* cl, HeapRegionClaimer* hrclaimer) const; ! // Iterate over all regions currently in the current collection set. ! void collection_set_iterate_all(HeapRegionClosure* blk); ! // Iterate over the regions in the current increment of the collection set. ! // Starts the iteration so that the start regions of a given worker id over the ! // set active_workers are evenly spread across the set of collection set regions ! // to be iterated. ! void collection_set_iterate_increment_from(HeapRegionClosure *blk, uint worker_id); // Returns the HeapRegion that contains addr. addr must not be NULL. template <class T> inline HeapRegion* heap_region_containing(const T addr) const; --- 1163,1180 ---- uint worker_id) const; void heap_region_par_iterate_from_start(HeapRegionClosure* cl, HeapRegionClaimer* hrclaimer) const; ! // Iterate over the regions (if any) in the current collection set. ! void collection_set_iterate(HeapRegionClosure* blk); ! // Iterate over the regions (if any) in the current collection set. Starts the ! // iteration over the entire collection set so that the start regions of a given ! // worker id over the set active_workers are evenly spread across the set of ! // collection set regions. ! void collection_set_iterate_from(HeapRegionClosure *blk, uint worker_id); // Returns the HeapRegion that contains addr. addr must not be NULL. template <class T> inline HeapRegion* heap_region_containing(const T addr) const;
*** 1256,1267 **** const G1SurvivorRegions* survivor() const { return &_survivor; } uint eden_regions_count() const { return _eden.length(); } uint survivor_regions_count() const { return _survivor.length(); } - size_t eden_regions_used_bytes() const { return _eden.used_bytes(); } - size_t survivor_regions_used_bytes() const { return _survivor.used_bytes(); } uint young_regions_count() const { return _eden.length() + _survivor.length(); } uint old_regions_count() const { return _old_set.length(); } uint archive_regions_count() const { return _archive_set.length(); } uint humongous_regions_count() const { return _humongous_set.length(); } --- 1250,1259 ----
*** 1426,1436 **** double _start_term; double _term_time; size_t _term_attempts; void start_term_time() { _term_attempts++; _start_term = os::elapsedTime(); } ! void end_term_time() { _term_time += (os::elapsedTime() - _start_term); } protected: G1CollectedHeap* _g1h; G1ParScanThreadState* _par_scan_state; RefToScanQueueSet* _queues; ParallelTaskTerminator* _terminator; --- 1418,1428 ---- double _start_term; double _term_time; size_t _term_attempts; void start_term_time() { _term_attempts++; _start_term = os::elapsedTime(); } ! void end_term_time() { _term_time += os::elapsedTime() - _start_term; } protected: G1CollectedHeap* _g1h; G1ParScanThreadState* _par_scan_state; RefToScanQueueSet* _queues; ParallelTaskTerminator* _terminator;
< prev index next >