src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp

Print this page
rev 4773 : 8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>

*** 1,7 **** /* ! * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 24,37 **** #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_HPP #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_HPP #include "gc_implementation/g1/concurrentMark.hpp" #include "gc_implementation/g1/g1AllocRegion.hpp" #include "gc_implementation/g1/g1HRPrinter.hpp" - #include "gc_implementation/g1/g1RemSet.hpp" #include "gc_implementation/g1/g1MonitoringSupport.hpp" #include "gc_implementation/g1/heapRegionSeq.hpp" #include "gc_implementation/g1/heapRegionSets.hpp" #include "gc_implementation/shared/hSpaceCounters.hpp" #include "gc_implementation/shared/parGCAllocBuffer.hpp" #include "memory/barrierSet.hpp" --- 24,39 ---- #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_HPP #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_HPP #include "gc_implementation/g1/concurrentMark.hpp" + #include "gc_implementation/g1/evacuationInfo.hpp" #include "gc_implementation/g1/g1AllocRegion.hpp" #include "gc_implementation/g1/g1HRPrinter.hpp" #include "gc_implementation/g1/g1MonitoringSupport.hpp" + #include "gc_implementation/g1/g1RemSet.hpp" + #include "gc_implementation/g1/g1YCTypes.hpp" #include "gc_implementation/g1/heapRegionSeq.hpp" #include "gc_implementation/g1/heapRegionSets.hpp" #include "gc_implementation/shared/hSpaceCounters.hpp" #include "gc_implementation/shared/parGCAllocBuffer.hpp" #include "memory/barrierSet.hpp"
*** 59,69 **** --- 61,76 ---- class G1RemSet; class HeapRegionRemSetIterator; class ConcurrentMark; class ConcurrentMarkThread; class ConcurrentG1Refine; + class ConcurrentGCTimer; class GenerationCounters; + class STWGCTimer; + class G1NewTracer; + class G1OldTracer; + class EvacuationFailedInfo; typedef OverflowTaskQueue<StarTask, mtGC> RefToScanQueue; typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet; typedef int RegionIdx_t; // needs to hold [ 0..max_regions() )
*** 158,168 **** // The G1 STW is alive closure. // An instance is embedded into the G1CH and used as the // (optional) _is_alive_non_header closure in the STW // reference processor. It is also extensively used during ! // refence processing during STW evacuation pauses. class G1STWIsAliveClosure: public BoolObjectClosure { G1CollectedHeap* _g1; public: G1STWIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) {} bool do_object_b(oop p); --- 165,175 ---- // The G1 STW is alive closure. // An instance is embedded into the G1CH and used as the // (optional) _is_alive_non_header closure in the STW // reference processor. It is also extensively used during ! // reference processing during STW evacuation pauses. class G1STWIsAliveClosure: public BoolObjectClosure { G1CollectedHeap* _g1; public: G1STWIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) {} bool do_object_b(oop p);
*** 321,334 **** // It releases the mutator alloc region. void release_mutator_alloc_region(); // It initializes the GC alloc regions at the start of a GC. ! void init_gc_alloc_regions(); // It releases the GC alloc regions at the end of a GC. ! void release_gc_alloc_regions(uint no_of_gc_workers); // It does any cleanup that needs to be done on the GC alloc regions // before a Full GC. void abandon_gc_alloc_regions(); --- 328,341 ---- // It releases the mutator alloc region. void release_mutator_alloc_region(); // It initializes the GC alloc regions at the start of a GC. ! void init_gc_alloc_regions(EvacuationInfo& evacuation_info); // It releases the GC alloc regions at the end of a GC. ! void release_gc_alloc_regions(uint no_of_gc_workers, EvacuationInfo& evacuation_info); // It does any cleanup that needs to be done on the GC alloc regions // before a Full GC. void abandon_gc_alloc_regions();
*** 387,396 **** --- 394,405 ---- // Keeps track of how many "old marking cycles" (i.e., Full GCs or // concurrent cycles) we have completed. volatile unsigned int _old_marking_cycles_completed; + bool _concurrent_cycle_started; + // This is a non-product method that is helpful for testing. It is // called at the end of a GC and artificially expands the heap by // allocating a number of dead regions. This way we can induce very // frequent marking cycles and stress the cleanup / concurrent // cleanup code more (as all the regions that will be allocated by
*** 737,746 **** --- 746,761 ---- unsigned int old_marking_cycles_completed() { return _old_marking_cycles_completed; } + void register_concurrent_cycle_start(jlong start_time); + void register_concurrent_cycle_end(); + void trace_heap_after_concurrent_cycle(); + + G1YCType yc_type(); + G1HRPrinter* hr_printer() { return &_hr_printer; } protected: // Shrink the garbage-first heap by at most the given size (in bytes!).
*** 772,782 **** // thread. It returns false if it is unable to do the collection due // to the GC locker being active, true otherwise bool do_collection_pause_at_safepoint(double target_pause_time_ms); // Actually do the work of evacuating the collection set. ! void evacuate_collection_set(); // The g1 remembered set of the heap. G1RemSet* _g1_rem_set; // And it's mod ref barrier set, used to track updates for the above. ModRefBarrierSet* _mr_bs; --- 787,797 ---- // thread. It returns false if it is unable to do the collection due // to the GC locker being active, true otherwise bool do_collection_pause_at_safepoint(double target_pause_time_ms); // Actually do the work of evacuating the collection set. ! void evacuate_collection_set(EvacuationInfo& evacuation_info); // The g1 remembered set of the heap. G1RemSet* _g1_rem_set; // And it's mod ref barrier set, used to track updates for the above. ModRefBarrierSet* _mr_bs;
*** 797,807 **** // set in the event of an evacuation failure. DirtyCardQueueSet _into_cset_dirty_card_queue_set; // After a collection pause, make the regions in the CS into free // regions. ! void free_collection_set(HeapRegion* cs_head); // Abandon the current collection set without recording policy // statistics or updating free lists. void abandon_collection_set(HeapRegion* cs_head); --- 812,822 ---- // set in the event of an evacuation failure. DirtyCardQueueSet _into_cset_dirty_card_queue_set; // After a collection pause, make the regions in the CS into free // regions. ! void free_collection_set(HeapRegion* cs_head, EvacuationInfo& evacuation_info); // Abandon the current collection set without recording policy // statistics or updating free lists. void abandon_collection_set(HeapRegion* cs_head);
*** 866,878 **** RefToScanQueueSet *_task_queues; // True iff a evacuation has failed in the current collection. bool _evacuation_failed; ! // Set the attribute indicating whether evacuation has failed in the ! // current collection. ! void set_evacuation_failed(bool b) { _evacuation_failed = b; } // Failed evacuations cause some logical from-space objects to have // forwarding pointers to themselves. Reset them. void remove_self_forwarding_pointers(); --- 881,891 ---- RefToScanQueueSet *_task_queues; // True iff a evacuation has failed in the current collection. bool _evacuation_failed; ! EvacuationFailedInfo* _evacuation_failed_info_array; // Failed evacuations cause some logical from-space objects to have // forwarding pointers to themselves. Reset them. void remove_self_forwarding_pointers();
*** 910,920 **** // Do any necessary cleanup for evacuation-failure handling data // structures. void finalize_for_evac_failure(); // An attempt to evacuate "obj" has failed; take necessary steps. ! oop handle_evacuation_failure_par(OopsInHeapRegionClosure* cl, oop obj); void handle_evacuation_failure_common(oop obj, markOop m); #ifndef PRODUCT // Support for forcing evacuation failures. Analogous to // PromotionFailureALot for the other collectors. --- 923,933 ---- // Do any necessary cleanup for evacuation-failure handling data // structures. void finalize_for_evac_failure(); // An attempt to evacuate "obj" has failed; take necessary steps. ! oop handle_evacuation_failure_par(G1ParScanThreadState* _par_scan_state, oop obj); void handle_evacuation_failure_common(oop obj, markOop m); #ifndef PRODUCT // Support for forcing evacuation failures. Analogous to // PromotionFailureALot for the other collectors.
*** 942,958 **** // Return true if it's time to cause an evacuation failure. inline bool evacuation_should_fail(); // Reset the G1EvacuationFailureALot counters. Should be called at ! // the end of an evacuation pause in which an evacuation failure ocurred. inline void reset_evacuation_should_fail(); #endif // !PRODUCT // ("Weak") Reference processing support. // ! // G1 has 2 instances of the referece processor class. One // (_ref_processor_cm) handles reference object discovery // and subsequent processing during concurrent marking cycles. // // The other (_ref_processor_stw) handles reference object // discovery and processing during full GCs and incremental --- 955,971 ---- // Return true if it's time to cause an evacuation failure. inline bool evacuation_should_fail(); // Reset the G1EvacuationFailureALot counters. Should be called at ! // the end of an evacuation pause in which an evacuation failure occurred. inline void reset_evacuation_should_fail(); #endif // !PRODUCT // ("Weak") Reference processing support. // ! // G1 has 2 instances of the reference processor class. One // (_ref_processor_cm) handles reference object discovery // and subsequent processing during concurrent marking cycles. // // The other (_ref_processor_stw) handles reference object // discovery and processing during full GCs and incremental
*** 998,1007 **** --- 1011,1026 ---- // lists (also checked as a precondition during initial marking). // The (stw) reference processor... ReferenceProcessor* _ref_processor_stw; + STWGCTimer* _gc_timer_stw; + ConcurrentGCTimer* _gc_timer_cm; + + G1OldTracer* _gc_tracer_cm; + G1NewTracer* _gc_tracer_stw; + // During reference object discovery, the _is_alive_non_header // closure (if non-null) is applied to the referent object to // determine whether the referent is live. If so then the // reference object does not need to be 'discovered' and can // be treated as a regular oop. This has the benefit of reducing
*** 1143,1155 **** // Reference Processing accessors // The STW reference processor.... ReferenceProcessor* ref_processor_stw() const { return _ref_processor_stw; } ! // The Concurent Marking reference processor... ReferenceProcessor* ref_processor_cm() const { return _ref_processor_cm; } 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; --- 1162,1177 ---- // Reference Processing accessors // The STW reference processor.... ReferenceProcessor* ref_processor_stw() const { return _ref_processor_stw; } ! // The Concurrent Marking reference processor... ReferenceProcessor* ref_processor_cm() const { return _ref_processor_cm; } + ConcurrentGCTimer* gc_timer_cm() const { return _gc_timer_cm; } + G1OldTracer* gc_tracer_cm() const { return _gc_tracer_cm; } + 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;
*** 1203,1213 **** // necessary (i.e., during heap verification). void verify_region_sets(); // verify_region_sets_optional() is planted in the code for // list verification in non-product builds (and it can be enabled in ! // product builds by definning HEAP_REGION_SET_FORCE_VERIFY to be 1). #if HEAP_REGION_SET_FORCE_VERIFY void verify_region_sets_optional() { verify_region_sets(); } #else // HEAP_REGION_SET_FORCE_VERIFY --- 1225,1235 ---- // necessary (i.e., during heap verification). void verify_region_sets(); // verify_region_sets_optional() is planted in the code for // list verification in non-product builds (and it can be enabled in ! // product builds by defining HEAP_REGION_SET_FORCE_VERIFY to be 1). #if HEAP_REGION_SET_FORCE_VERIFY void verify_region_sets_optional() { verify_region_sets(); } #else // HEAP_REGION_SET_FORCE_VERIFY
*** 1269,1279 **** virtual void collect(GCCause::Cause cause); // The same as above but assume that the caller holds the Heap_lock. void collect_locked(GCCause::Cause cause); ! // True iff a evacuation has failed in the most-recent collection. bool evacuation_failed() { return _evacuation_failed; } // It will free a region if it has allocated objects in it that are // all dead. It calls either free_region() or // free_humongous_region() depending on the type of the region that --- 1291,1301 ---- virtual void collect(GCCause::Cause cause); // The same as above but assume that the caller holds the Heap_lock. void collect_locked(GCCause::Cause cause); ! // True iff an evacuation has failed in the most-recent collection. bool evacuation_failed() { return _evacuation_failed; } // It will free a region if it has allocated objects in it that are // all dead. It calls either free_region() or // free_humongous_region() depending on the type of the region that
*** 1557,1566 **** --- 1579,1589 ---- // full GC. void verify(bool silent, VerifyOption vo); // Override; it uses the "prev" marking information virtual void verify(bool silent); + virtual void print_on(outputStream* st) const; virtual void print_extended_on(outputStream* st) const; virtual void print_on_error(outputStream* st) const; virtual void print_gc_threads_on(outputStream* st) const;
*** 1957,1966 **** } else { deal_with_reference((oop*)ref); } } - public: void trim_queue(); }; #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_HPP --- 1980,1988 ----