diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 50aaac4cd53..a7189b6e33e 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -114,21 +114,21 @@ class G1STWIsAliveClosure : public BoolObjectClosure { G1CollectedHeap* _g1h; public: G1STWIsAliveClosure(G1CollectedHeap* g1h) : _g1h(g1h) {} - bool do_object_b(oop p); + bool do_object_b(oop p) override; }; class G1STWSubjectToDiscoveryClosure : public BoolObjectClosure { G1CollectedHeap* _g1h; public: G1STWSubjectToDiscoveryClosure(G1CollectedHeap* g1h) : _g1h(g1h) {} - bool do_object_b(oop p); + bool do_object_b(oop p) override; }; class G1RegionMappingChangedListener : public G1MappingChangedListener { private: void reset_from_card_cache(uint start_idx, size_t num_regions); public: - virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled); + void on_commit(uint start_idx, size_t num_regions, bool zero_filled) override; }; class G1CollectedHeap : public CollectedHeap { @@ -246,7 +246,7 @@ class G1CollectedHeap : public CollectedHeap { // roots or the young generation. class HumongousReclaimCandidates : public G1BiasedMappedArray { protected: - bool default_value() const { return false; } + bool default_value() const override { return false; } public: void clear() { G1BiasedMappedArray::clear(); } void set_candidate(uint region, bool value) { @@ -311,7 +311,7 @@ class G1CollectedHeap : public CollectedHeap { size_t size, size_t translation_factor); - void trace_heap(GCWhen::Type when, const GCTracer* tracer); + void trace_heap(GCWhen::Type when, const GCTracer* tracer) override; // These are macros so that, if the assert fires, we get the correct // line number, file, etc. @@ -452,12 +452,12 @@ class G1CollectedHeap : public CollectedHeap { // humongous allocation requests should go to mem_allocate() which // will satisfy them with a special path. - virtual HeapWord* allocate_new_tlab(size_t min_size, - size_t requested_size, - size_t* actual_size); + HeapWord* allocate_new_tlab(size_t min_size, + size_t requested_size, + size_t* actual_size) override; - virtual HeapWord* mem_allocate(size_t word_size, - bool* gc_overhead_limit_was_exceeded); + HeapWord* mem_allocate(size_t word_size, + bool* gc_overhead_limit_was_exceeded) override; // First-level mutator allocation attempt: try to allocate out of // the mutator alloc region without taking the Heap_lock. This @@ -508,7 +508,7 @@ class G1CollectedHeap : public CollectedHeap { bool do_maximum_compaction); // Callback from VM_G1CollectFull operation, or collect_as_vm_thread. - virtual void do_full_collection(bool clear_all_soft_refs); + void do_full_collection(bool clear_all_soft_refs) override; // Helper to do a full collection that clears soft references. bool upgrade_to_full_collection(); @@ -1007,23 +1007,23 @@ class G1CollectedHeap : public CollectedHeap { // Initialize the G1CollectedHeap to have the initial and // maximum sizes and remembered and barrier sets // specified by the policy object. - jint initialize(); + jint initialize() override; - virtual void stop(); - virtual void safepoint_synchronize_begin(); - virtual void safepoint_synchronize_end(); + void stop() override; + void safepoint_synchronize_begin() override; + void safepoint_synchronize_end() override; // Does operations required after initialization has been done. - void post_initialize(); + void post_initialize() override; // Initialize weak reference processing. void ref_processing_init(); - virtual Name kind() const { + Name kind() const override { return CollectedHeap::G1; } - virtual const char* name() const { + const char* name() const override { return "G1"; } @@ -1040,12 +1040,12 @@ class G1CollectedHeap : public CollectedHeap { const G1CollectionSet* collection_set() const { return &_collection_set; } G1CollectionSet* collection_set() { return &_collection_set; } - virtual SoftRefPolicy* soft_ref_policy(); + SoftRefPolicy* soft_ref_policy() override; - virtual void initialize_serviceability(); - virtual MemoryUsage memory_usage(); - virtual GrowableArray memory_managers(); - virtual GrowableArray memory_pools(); + void initialize_serviceability() override; + MemoryUsage memory_usage() override; + GrowableArray memory_managers() override; + GrowableArray memory_pools() override; // Try to minimize the remembered set. void scrub_rem_set(); @@ -1068,8 +1068,8 @@ class G1CollectedHeap : public CollectedHeap { size_t unused_committed_regions_in_bytes() const; - virtual size_t capacity() const; - virtual size_t used() const; + size_t capacity() const override; + size_t used() const override; // This should be called when we're not holding the heap lock. The // result might be a bit inaccurate. size_t used_unlocked() const; @@ -1081,7 +1081,7 @@ class G1CollectedHeap : public CollectedHeap { // end fields defining the extent of the contiguous allocation region.) // But G1CollectedHeap doesn't yet support this. - virtual bool is_maximal_no_gc() const { + bool is_maximal_no_gc() const override { return _hrm.available() == 0; } @@ -1136,7 +1136,7 @@ class G1CollectedHeap : public CollectedHeap { // Perform a collection of the heap; intended for use in implementing // "System.gc". This probably implies as full a collection as the // "CollectedHeap" supports. - virtual void collect(GCCause::Cause cause); + void collect(GCCause::Cause cause) override; // Perform a collection of the heap with the given cause. // Returns whether this collection actually executed. @@ -1160,7 +1160,7 @@ class G1CollectedHeap : public CollectedHeap { void prepend_to_freelist(FreeRegionList* list); void decrement_summary_bytes(size_t bytes); - virtual bool is_in(const void* p) const; + bool is_in(const void* p) const override; // Return "TRUE" iff the given object address is within the collection // set. Assumes that the reference points into the heap. @@ -1200,12 +1200,12 @@ class G1CollectedHeap : public CollectedHeap { void object_iterate_parallel(ObjectClosure* cl, uint worker_id, HeapRegionClaimer* claimer); // Iterate over all objects, calling "cl.do_object" on each. - virtual void object_iterate(ObjectClosure* cl); + void object_iterate(ObjectClosure* cl) override; - virtual ParallelObjectIteratorImpl* parallel_object_iterator(uint thread_num); + ParallelObjectIteratorImpl* parallel_object_iterator(uint thread_num) override; // Keep alive an object that was loaded with AS_NO_KEEPALIVE. - virtual void keep_alive(oop obj); + void keep_alive(oop obj) override; // Iterate over heap regions, in address order, terminating the // iteration early if the "do_heap_region" method returns "true". @@ -1288,10 +1288,10 @@ class G1CollectedHeap : public CollectedHeap { // Section on thread-local allocation buffers (TLABs) // See CollectedHeap for semantics. - size_t tlab_capacity(Thread* ignored) const; - size_t tlab_used(Thread* ignored) const; - size_t max_tlab_size() const; - size_t unsafe_max_tlab_alloc(Thread* ignored) const; + size_t tlab_capacity(Thread* ignored) const override; + size_t tlab_used(Thread* ignored) const override; + size_t max_tlab_size() const override; + size_t unsafe_max_tlab_alloc(Thread* ignored) const override; inline bool is_in_young(const oop obj); @@ -1315,7 +1315,7 @@ class G1CollectedHeap : public CollectedHeap { static size_t humongous_obj_size_in_regions(size_t word_size); // Print the maximum heap capacity. - virtual size_t max_capacity() const; + size_t max_capacity() const override; Tickspan time_since_last_collection() const { return Ticks::now() - _collection_pause_end; } @@ -1385,16 +1385,16 @@ class G1CollectedHeap : public CollectedHeap { // Optimized nmethod scanning support routines // Register the given nmethod with the G1 heap. - virtual void register_nmethod(nmethod* nm); + void register_nmethod(nmethod* nm) override; // Unregister the given nmethod from the G1 heap. - virtual void unregister_nmethod(nmethod* nm); + void unregister_nmethod(nmethod* nm) override; // No nmethod flushing needed. - virtual void flush_nmethod(nmethod* nm) {} + void flush_nmethod(nmethod* nm) override {} // No nmethod verification implemented. - virtual void verify_nmethod(nmethod* nm) {} + void verify_nmethod(nmethod* nm) override {} // Recalculate amount of used memory after GC. Must be called after all allocation // has finished. @@ -1416,7 +1416,7 @@ class G1CollectedHeap : public CollectedHeap { // Verification // Perform any cleanup actions necessary before allowing a verification. - virtual void prepare_for_verify(); + void prepare_for_verify() override; // Perform verification. @@ -1433,14 +1433,14 @@ class G1CollectedHeap : public CollectedHeap { // Currently there is only one place where this is called with // vo == UseFullMarking, which is to verify the marking during a // full GC. - void verify(VerifyOption vo); + void verify(VerifyOption vo) override; // WhiteBox testing support. - virtual bool supports_concurrent_gc_breakpoints() const; + bool supports_concurrent_gc_breakpoints() const override; - virtual WorkGang* safepoint_workers() { return _workers; } + WorkGang* safepoint_workers() override { return _workers; } - virtual bool is_archived_object(oop object) const; + bool is_archived_object(oop object) const override; // The methods below are here for convenience and dispatch the // appropriate method depending on value of the given VerifyOption @@ -1463,22 +1463,21 @@ class G1CollectedHeap : public CollectedHeap { void print_regions_on(outputStream* st) const; public: + void print_on(outputStream* st) const override; + void print_extended_on(outputStream* st) const override; + void print_on_error(outputStream* st) const override; - 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 gc_threads_do(ThreadClosure* tc) const; + void gc_threads_do(ThreadClosure* tc) const override; // Override - void print_tracing_info() const; + void print_tracing_info() const override; // The following two methods are helpful for debugging RSet issues. void print_cset_rsets() PRODUCT_RETURN; void print_all_rsets() PRODUCT_RETURN; // Used to print information about locations in the hs_err file. - virtual bool print_location(outputStream* st, void* addr) const; + bool print_location(outputStream* st, void* addr) const override; }; // Scoped object that performs common pre- and post-gc heap printing operations.