0N/A/*
3157N/A * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_GC_INTERFACE_COLLECTEDHEAP_HPP
1879N/A#define SHARE_VM_GC_INTERFACE_COLLECTEDHEAP_HPP
1879N/A
1879N/A#include "gc_interface/gcCause.hpp"
4141N/A#include "gc_implementation/shared/gcWhen.hpp"
1879N/A#include "memory/allocation.hpp"
1879N/A#include "memory/barrierSet.hpp"
1879N/A#include "runtime/handles.hpp"
1879N/A#include "runtime/perfData.hpp"
1879N/A#include "runtime/safepoint.hpp"
3157N/A#include "utilities/events.hpp"
1879N/A
0N/A// A "CollectedHeap" is an implementation of a java heap for HotSpot. This
0N/A// is an abstract class: there may be many different kinds of heaps. This
0N/A// class defines the functions that a heap must implement, and contains
0N/A// infrastructure common to all heaps.
0N/A
4141N/Aclass AdaptiveSizePolicy;
0N/Aclass BarrierSet;
4141N/Aclass CollectorPolicy;
4141N/Aclass GCHeapSummary;
4141N/Aclass GCTimer;
4141N/Aclass GCTracer;
4141N/Aclass PermGenSummary;
4141N/Aclass Thread;
0N/Aclass ThreadClosure;
4141N/Aclass VirtualSpaceSummary;
0N/A
3157N/Aclass GCMessage : public FormatBuffer<1024> {
3157N/A public:
3157N/A bool is_before;
3157N/A
3157N/A public:
3157N/A GCMessage() {}
3157N/A};
3157N/A
3157N/Aclass GCHeapLog : public EventLogBase<GCMessage> {
3157N/A private:
3157N/A void log_heap(bool before);
3157N/A
3157N/A public:
3157N/A GCHeapLog() : EventLogBase<GCMessage>("GC Heap History") {}
3157N/A
3157N/A void log_heap_before() {
3157N/A log_heap(true);
3157N/A }
3157N/A void log_heap_after() {
3157N/A log_heap(false);
3157N/A }
3157N/A};
3157N/A
0N/A//
0N/A// CollectedHeap
0N/A// SharedHeap
0N/A// GenCollectedHeap
0N/A// G1CollectedHeap
0N/A// ParallelScavengeHeap
0N/A//
3863N/Aclass CollectedHeap : public CHeapObj<mtInternal> {
0N/A friend class VMStructs;
0N/A friend class IsGCActiveMark; // Block structured external access to _is_gc_active
542N/A friend class constantPoolCacheKlass; // allocate() method inserts is_conc_safe
0N/A
0N/A#ifdef ASSERT
0N/A static int _fire_out_of_memory_count;
0N/A#endif
0N/A
481N/A // Used for filler objects (static, but initialized in ctor).
481N/A static size_t _filler_array_max_size;
481N/A
4472N/A const static char* OverflowMessage;
4472N/A
3157N/A GCHeapLog* _gc_heap_log;
3157N/A
1166N/A // Used in support of ReduceInitialCardMarks; only consulted if COMPILER2 is being used
1166N/A bool _defer_initial_card_mark;
1166N/A
0N/A protected:
0N/A MemRegion _reserved;
0N/A BarrierSet* _barrier_set;
0N/A bool _is_gc_active;
3008N/A uint _n_par_threads;
1753N/A
0N/A unsigned int _total_collections; // ... started
0N/A unsigned int _total_full_collections; // ... started
0N/A NOT_PRODUCT(volatile size_t _promotion_failure_alot_count;)
0N/A NOT_PRODUCT(volatile size_t _promotion_failure_alot_gc_number;)
0N/A
0N/A // Reason for current garbage collection. Should be set to
0N/A // a value reflecting no collection between collections.
0N/A GCCause::Cause _gc_cause;
0N/A GCCause::Cause _gc_lastcause;
0N/A PerfStringVariable* _perf_gc_cause;
0N/A PerfStringVariable* _perf_gc_lastcause;
0N/A
0N/A // Constructor
0N/A CollectedHeap();
0N/A
1166N/A // Do common initializations that must follow instance construction,
1166N/A // for example, those needing virtual calls.
1166N/A // This code could perhaps be moved into initialize() but would
1166N/A // be slightly more awkward because we want the latter to be a
1166N/A // pure virtual.
1166N/A void pre_initialize();
1166N/A
2599N/A // Create a new tlab. All TLAB allocations must go through this.
0N/A virtual HeapWord* allocate_new_tlab(size_t size);
0N/A
0N/A // Accumulate statistics on all tlabs.
0N/A virtual void accumulate_statistics_all_tlabs();
0N/A
0N/A // Reinitialize tlabs before resuming mutators.
0N/A virtual void resize_all_tlabs();
0N/A
4472N/A // Returns the sum of total and size if the sum does not overflow;
4472N/A // Otherwise, call vm_exit_during_initialization().
4472N/A // The overflow check is performed by comparing the result of the sum against size, which is assumed to be non-zero.
4472N/A size_t add_and_check_overflow(size_t total, size_t size);
4472N/A
4472N/A // Round up total against size and return the value, if the result does not overflow;
4472N/A // Otherwise, call vm_exit_during_initialization().
4472N/A // The overflow check is performed by comparing the round-up result against size, which is assumed to be non-zero.
4472N/A size_t round_up_and_check_overflow(size_t total, size_t size);
4472N/A
0N/A // Allocate from the current thread's TLAB, with broken-out slow path.
4359N/A inline static HeapWord* allocate_from_tlab(KlassHandle klass, Thread* thread, size_t size);
4359N/A static HeapWord* allocate_from_tlab_slow(KlassHandle klass, Thread* thread, size_t size);
0N/A
0N/A // Allocate an uninitialized block of the given size, or returns NULL if
0N/A // this is impossible.
4359N/A inline static HeapWord* common_mem_allocate_noinit(KlassHandle klass, size_t size, TRAPS);
0N/A
0N/A // Like allocate_init, but the block returned by a successful allocation
0N/A // is guaranteed initialized to zeros.
4359N/A inline static HeapWord* common_mem_allocate_init(KlassHandle klass, size_t size, TRAPS);
0N/A
0N/A // Same as common_mem version, except memory is allocated in the permanent area
0N/A // If there is no permanent area, revert to common_mem_allocate_noinit
0N/A inline static HeapWord* common_permanent_mem_allocate_noinit(size_t size, TRAPS);
0N/A
0N/A // Same as common_mem version, except memory is allocated in the permanent area
0N/A // If there is no permanent area, revert to common_mem_allocate_init
0N/A inline static HeapWord* common_permanent_mem_allocate_init(size_t size, TRAPS);
0N/A
0N/A // Helper functions for (VM) allocation.
3643N/A inline static void post_allocation_setup_common(KlassHandle klass, HeapWord* obj);
0N/A inline static void post_allocation_setup_no_klass_install(KlassHandle klass,
3643N/A HeapWord* objPtr);
0N/A
3643N/A inline static void post_allocation_setup_obj(KlassHandle klass, HeapWord* obj);
0N/A
0N/A inline static void post_allocation_setup_array(KlassHandle klass,
3643N/A HeapWord* obj, int length);
0N/A
0N/A // Clears an allocated object.
0N/A inline static void init_obj(HeapWord* obj, size_t size);
0N/A
481N/A // Filler object utilities.
481N/A static inline size_t filler_array_hdr_size();
481N/A static inline size_t filler_array_min_size();
481N/A
481N/A DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);)
1165N/A DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words, bool zap = true);)
481N/A
481N/A // Fill with a single array; caller must ensure filler_array_min_size() <=
481N/A // words <= filler_array_max_size().
1165N/A static inline void fill_with_array(HeapWord* start, size_t words, bool zap = true);
481N/A
481N/A // Fill with a single object (either an int array or a java.lang.Object).
1165N/A static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
481N/A
4141N/A virtual void trace_heap(GCWhen::Type when, GCTracer* tracer);
4141N/A
0N/A // Verification functions
Error!

 

There was an error!

null

java.lang.NullPointerException