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

Print this page
rev 4801 : imported patch code-movement
rev 4802 : imported patch optimize-nmethod-scanning

*** 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.
*** 42,51 **** --- 42,52 ---- // A "G1CollectedHeap" is an implementation of a java heap for HotSpot. // It uses the "Garbage First" heap organization and algorithm, which // may combine concurrent marking with parallel, incremental compaction of // heap subsets that will yield large amounts of garbage. + // Forward declarations class HeapRegion; class HRRSCleanupTask; class GenerationSpec; class OopsInHeapRegionClosure; class G1KlassScanClosure;
*** 60,69 **** --- 61,71 ---- class HeapRegionRemSetIterator; class ConcurrentMark; class ConcurrentMarkThread; class ConcurrentG1Refine; class GenerationCounters; + class nmethod; typedef OverflowTaskQueue<StarTask, mtGC> RefToScanQueue; typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet; typedef int RegionIdx_t; // needs to hold [ 0..max_regions() )
*** 154,175 **** public: MutatorAllocRegion() : G1AllocRegion("Mutator Alloc Region", false /* bot_updates */) { } }; - // 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); - }; - class SurvivorGCAllocRegion : public G1AllocRegion { protected: virtual HeapRegion* allocate_new_region(size_t word_size, bool force); virtual void retire_region(HeapRegion* alloc_region, size_t allocated_bytes); public: --- 156,165 ----
*** 184,193 **** --- 174,195 ---- public: OldGCAllocRegion() : G1AllocRegion("Old GC Alloc Region", true /* bot_updates */) { } }; + // 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); + }; + class RefineCardTableEntryClosure; class G1CollectedHeap : public SharedHeap { friend class VM_G1CollectForAllocation; friend class VM_G1CollectFull;
*** 1530,1575 **** // Print the maximum heap capacity. virtual size_t max_capacity() const; virtual jlong millis_since_last_gc(); - // Perform any cleanup actions necessary before allowing a verification. - virtual void prepare_for_verify(); - - // Perform verification. - - // vo == UsePrevMarking -> use "prev" marking information, - // vo == UseNextMarking -> use "next" marking information - // vo == UseMarkWord -> use the mark word in the object header - // - // NOTE: Only the "prev" marking information is guaranteed to be - // consistent most of the time, so most calls to this should use - // vo == UsePrevMarking. - // Currently, there is only one case where this is called with - // vo == UseNextMarking, which is to verify the "next" marking - // information at the end of remark. - // Currently there is only one place where this is called with - // vo == UseMarkWord, which is to verify the marking during a - // 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; - virtual void gc_threads_do(ThreadClosure* tc) const; - - // Override - void print_tracing_info() const; - - // The following two methods are helpful for debugging RSet issues. - void print_cset_rsets() PRODUCT_RETURN; - void print_all_rsets() PRODUCT_RETURN; - // Convenience function to be used in situations where the heap type can be // asserted to be this type. static G1CollectedHeap* heap(); void set_region_short_lived_locked(HeapRegion* hr); --- 1532,1541 ----
*** 1641,1657 **** else return true; } else return is_obj_ill(obj, hr); } // The methods below are here for convenience and dispatch the // appropriate method depending on value of the given VerifyOption ! // parameter. The options for that parameter are: ! // ! // vo == UsePrevMarking -> use "prev" marking information, ! // vo == UseNextMarking -> use "next" marking information, ! // vo == UseMarkWord -> use mark word from object header bool is_obj_dead_cond(const oop obj, const HeapRegion* hr, const VerifyOption vo) const { switch (vo) { --- 1607,1696 ---- else return true; } else return is_obj_ill(obj, hr); } + bool allocated_since_marking(oop obj, HeapRegion* hr, VerifyOption vo); + HeapWord* top_at_mark_start(HeapRegion* hr, VerifyOption vo); + bool is_marked(oop obj, VerifyOption vo); + const char* top_at_mark_start_str(VerifyOption vo); + + ConcurrentMark* concurrent_mark() const { return _cm; } + + // Refinement + + ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; } + + // The dirty cards region list is used to record a subset of regions + // whose cards need clearing. The list if populated during the + // remembered set scanning and drained during the card table + // cleanup. Although the methods are reentrant, population/draining + // phases must not overlap. For synchronization purposes the last + // element on the list points to itself. + HeapRegion* _dirty_cards_region_list; + void push_dirty_cards_region(HeapRegion* hr); + HeapRegion* pop_dirty_cards_region(); + + // Optimized nmethod scanning support routines + + // Register the given nmethod with the G1 heap + virtual void register_nmethod(nmethod* nm); + + // Unregister the given nmethod from the G1 heap + virtual void unregister_nmethod(nmethod* nm); + + // Migrate the nmethods in the code root lists of the regions + // in the collection set to regions in to-space. In the event + // of an evacuation failure, nmethods that reference objects + // that were not successfullly evacuated are not migrated. + void migrate_strong_code_roots(); + + // During an initial mark pause, mark all the code roots that + // point into regions *not* in the collection set. + void mark_strong_code_roots(uint worker_id); + + // Rebuild the stong code root lists for each region + // after a full GC + void rebuild_strong_code_roots(); + + // Verification + + // The following is just to alert the verification code + // that a full collection has occurred and that the + // remembered sets are no longer up to date. + bool _full_collection; + void set_full_collection() { _full_collection = true;} + void clear_full_collection() {_full_collection = false;} + bool full_collection() {return _full_collection;} + + // Perform any cleanup actions necessary before allowing a verification. + virtual void prepare_for_verify(); + + // Perform verification. + + // vo == UsePrevMarking -> use "prev" marking information, + // vo == UseNextMarking -> use "next" marking information + // vo == UseMarkWord -> use the mark word in the object header + // + // NOTE: Only the "prev" marking information is guaranteed to be + // consistent most of the time, so most calls to this should use + // vo == UsePrevMarking. + // Currently, there is only one case where this is called with + // vo == UseNextMarking, which is to verify the "next" marking + // information at the end of remark. + // Currently there is only one place where this is called with + // vo == UseMarkWord, which is to verify the marking during a + // full GC. + void verify(bool silent, VerifyOption vo); + + // Override; it uses the "prev" marking information + virtual void verify(bool silent); + // The methods below are here for convenience and dispatch the // appropriate method depending on value of the given VerifyOption ! // parameter. The values for that parameter, and their meanings, ! // are the same as those above. bool is_obj_dead_cond(const oop obj, const HeapRegion* hr, const VerifyOption vo) const { switch (vo) {
*** 1672,1706 **** default: ShouldNotReachHere(); } return false; // keep some compilers happy } ! bool allocated_since_marking(oop obj, HeapRegion* hr, VerifyOption vo); ! HeapWord* top_at_mark_start(HeapRegion* hr, VerifyOption vo); ! bool is_marked(oop obj, VerifyOption vo); ! const char* top_at_mark_start_str(VerifyOption vo); ! // The following is just to alert the verification code ! // that a full collection has occurred and that the ! // remembered sets are no longer up to date. ! bool _full_collection; ! void set_full_collection() { _full_collection = true;} ! void clear_full_collection() {_full_collection = false;} ! bool full_collection() {return _full_collection;} ! ConcurrentMark* concurrent_mark() const { return _cm; } ! ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; } ! // The dirty cards region list is used to record a subset of regions ! // whose cards need clearing. The list if populated during the ! // remembered set scanning and drained during the card table ! // cleanup. Although the methods are reentrant, population/draining ! // phases must not overlap. For synchronization purposes the last ! // element on the list points to itself. ! HeapRegion* _dirty_cards_region_list; ! void push_dirty_cards_region(HeapRegion* hr); ! HeapRegion* pop_dirty_cards_region(); public: void stop_conc_gc_threads(); size_t pending_card_num(); --- 1711,1735 ---- default: ShouldNotReachHere(); } return false; // keep some compilers happy } ! // Printing ! 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; ! virtual void gc_threads_do(ThreadClosure* tc) const; ! // Override ! void print_tracing_info() const; ! ! // The following two methods are helpful for debugging RSet issues. ! void print_cset_rsets() PRODUCT_RETURN; ! void print_all_rsets() PRODUCT_RETURN; public: void stop_conc_gc_threads(); size_t pending_card_num();